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

kubernetes.io annotations are not available as attributes on GCP #874

Closed
haard opened this issue Jun 4, 2020 · 5 comments
Closed

kubernetes.io annotations are not available as attributes on GCP #874

haard opened this issue Jun 4, 2020 · 5 comments
Labels

Comments

@haard
Copy link

haard commented Jun 4, 2020

Terraform Version and Provider Version

Terraform v0.12.25

  • provider.google v3.22.0
  • provider.google-beta v3.22.0
  • provider.kubernetes v1.11.3

Affected Resource(s)

  • kubernetes_ingress
  • other kubernetes_ resources

Terraform Configuration Files

resource "kubernetes_ingress" "app" {
  provider = kubernetes.gke_app
  metadata {
    name = "app-ingress"
  }
  spec {
    backend {
      service_name = "app"
      service_port = 8080
    }
  }
}

Debug Output

Panic Output

Expected Behavior

What should have happened?
terraform state show kubernetes_ingress.app should show kubernetes.io/GCP annotations.

Actual Behavior

Output of terraform state show data.kubernetes_ingress.app

# data.kubernetes_ingress.app:
data "kubernetes_ingress" "app" {
    id                    = "default/app-ingress"
    load_balancer_ingress = [
        {
            hostname = ""
            ip       = "NN.NN.NN.NN"
        },
    ]
    spec                  = [
        {
            backend = [
                {
                    service_name = "app"
                    service_port = "8080"
                },
            ]
            rule    = []
            tls     = []
        },
    ]

    metadata {
        annotations      = {}
        generation       = 1
        labels           = {}
        name             = "app-ingress"
        namespace        = "default"
        resource_version = "90910"
        self_link        = "/apis/extensions/v1beta1/namespaces/default/ingresses/app-ingress"
        uid              = "aad8e98b-a654-11ea-b841-42010aa200d5"
    }
}

output of kubectl get ingress app-ingress -o yaml

apiVersion: extensions/v1beta1
kind: Ingress
metadata:
  annotations:
    ingress.kubernetes.io/backends: '{"k8s-be-nnnnn--a2d6fsdfs4cf724d":"HEALTHY"}'
    ingress.kubernetes.io/forwarding-rule: k8s-fw-default-app-ingress--a2d6fsdfs4cf724d
    ingress.kubernetes.io/target-proxy: k8s-tp-default-app-ingress--a2d6fsdfs4cf724d
    ingress.kubernetes.io/url-map: k8s-um-default-app-ingress--a2d6fsdfs4cf724d
  creationTimestamp: "2020-06-04T11:15:16Z"
  generation: 1
  name: app-ingress
  namespace: default
  resourceVersion: "90901"
  selfLink: /apis/extensions/v1beta1/namespaces/default/ingresses/app-ingress
  uid: aad8e98b-a654-11ea-b841-42010aa200d5
spec:
  backend:
    serviceName: app
    servicePort: 8080
status:
  loadBalancer:
    ingress:
    - ip: nn.nn.nn.nn

Steps to Reproduce

Create a kubernetes_ingress on GCP (using the guide from the Terraform docs to layer the providers).
Show state of the ingress.

Important Factoids

References

May be related to #60

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment
@haard haard added the bug label Jun 4, 2020
@stellirin
Copy link

Also facing this:

Terraform v0.12.28
+ provider.google v3.30.0

Specifically we're setting the "kubernetes.io/ingress.class" = "gce-multi-cluster" annotation on a kubernetes_ingress resource, which will trigger GCP to add the ingress.gcp.kubernetes.io/instance-groups annotation with data about the instance groups.

We then want to read back this annotation using a kubernetes_ingress data resource to configure a multi-cluster load balancer.

Our current work-around is to manually copy the JSON from the annotation into a local Terraform variable then continue processing from there (fortunately this annotation does not regularly change).

@aareet
Copy link
Contributor

aareet commented Jul 20, 2020

Relates to #722

@pdecat
Copy link
Contributor

pdecat commented Jan 13, 2021

Hi, when using a kubernetes_ingress datasource to retrieve annotations, the work-around that I shared on #709 (comment) should also apply here, e.g.:

data "kubernetes_ingress" "myapp" {
  metadata {
    namespace = "mynamespace"
    name      = "myapp"
    annotations = {
      # Internal annotations are removed if not defined in configuration
      "ingress.gcp.kubernetes.io/instance-groups" = ""
    }
  }
}

@dak1n1
Copy link
Contributor

dak1n1 commented Mar 17, 2021

We're looking into adding a provider-level annotation ignore/allow list, which should fix the issue described here. Let's track this over here: #746

@dak1n1 dak1n1 closed this as completed Mar 17, 2021
@ghost
Copy link

ghost commented Apr 17, 2021

I'm going to lock this issue because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.

If you feel this issue should be reopened, we encourage creating a new issue linking back to this one for added context. If you feel I made an error 🤖 🙉 , please reach out to my human friends 👉 [email protected]. Thanks!

@ghost ghost locked as resolved and limited conversation to collaborators Apr 17, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

5 participants