Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

calico also annotates pods automatically, triggering a diff #741

Closed
wants to merge 1 commit into from
Closed

calico also annotates pods automatically, triggering a diff #741

wants to merge 1 commit into from

Conversation

hughobrien
Copy link

  # kubernetes_pod.nginx will be updated in-place
  ~ resource "kubernetes_pod" "nginx" {
        id = "hugh/nginx-example"

      ~ metadata {
          ~ annotations      = {
              - "cni.projectcalico.org/podIP" = "10.1.10.200/32" -> null
            }

@ghost ghost added the size/XS label Jan 20, 2020
@hughobrien hughobrien requested a review from radeksimko January 20, 2020 22:08
@jrhouston
Copy link
Collaborator

jrhouston commented Jan 21, 2020

Something you could do here instead is use the ignore_changes lifecycle feature to ignore the annotation. A caveat of this feature is that you have to create a placeholder for the annotation for which you are ignoring non-terraform changes:

resource "kubernetes_pod" "test_pod" {
    metadata {
        name = "test-pod"

        annotations = {
            "cni.projectcalico.org/podIP" = ""
        }
    }

    spec {
        container {
            name = "test-container"
            image = "nginx"
        }
    }

    lifecycle {
        ignore_changes = [metadata.0.annotations["cni.projectcalico.org/podIP"]]
    }
}

@hughobrien
Copy link
Author

That looks ideal actually, thank you for the quick feedback. Should I close the PR? An optional provider level ignore list might be the more general solution anyway.

@jrhouston
Copy link
Collaborator

You can close this PR. You could open an issue to discuss an optional provider level ignore list and what that might look like.

@hughobrien hughobrien closed this Jan 23, 2020
@hughobrien hughobrien deleted the ignore-calico-annotations branch January 23, 2020 11:58
@ghost ghost locked and limited conversation to collaborators Apr 21, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants