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

Enhancement Request: Be able to control the app.kubernetes.io/managed-by label #1357

Closed
MitchellGerdisch opened this issue Oct 20, 2020 · 4 comments · Fixed by #1508
Closed
Assignees
Labels
resolution/fixed This issue was fixed
Milestone

Comments

@MitchellGerdisch
Copy link

Problem description

As a provider, I sometimes need to deploy infrastructure into a customer's environment.
In those cases, I would like to control the app.kuberenetes.io.managed-by:pulumi label that is applied by the Pulumi K8s provider to use my company or project name.

image

Errors & Logs

N/A

Affected product version(s)

2.6.3

Reproducing the issue

  • Deploy a namespace via Pulumi K8s provider
  • See labels in K8s dashboard.

Suggestions for a fix

At a minimum provide a mechanism to overwrite the label after the initial deployment.
But, optimally, provide a mechanism to inject the preferred label value as part of the deployment.

@hausdorff
Copy link
Contributor

This is a good idea. Kubernetes generally recommends a managed-by label, a lot of tools have standardized on it, and it would be cheap to add in implementation cost.

@stack72 stack72 self-assigned this Feb 11, 2021
@stack72 stack72 added this to the 0.52 milestone Feb 11, 2021
stack72 added a commit that referenced this issue Feb 12, 2021
Related: #1357

This allows the label to be controlled in a simple way for now

```
▶ PULUMI_KUBERNETES_MANAGED_BY_LABEL=mycompany pulumi up
Previewing update (dev)
     Type                             Name                      Plan
 +   pulumi:pulumi:Stack              testing-new-workflow-dev  create
 +   └─ kubernetes:core/v1:Namespace  nginx                     create
Resources:
    + 2 to create
Do you want to perform this update? details
+ pulumi:pulumi:Stack: (create)
    [urn=urn:pulumi:dev::testing-new-workflow::pulumi:pulumi:Stack::testing-new-workflow-dev]
    + kubernetes:core/v1:Namespace: (create)
        [urn=urn:pulumi:dev::testing-new-workflow::kubernetes:core/v1:Namespace::nginx]
        [provider=urn:pulumi:dev::testing-new-workflow::pulumi:providers:kubernetes::default_2_8_0::04da6b54-80e4-46f7-96ec-b56ff0331ba9]
        apiVersion: "v1"
        kind      : "Namespace"
        metadata  : {
            labels: {
                app.kubernetes.io/managed-by: "mycompany"
            }
            name  : "testing"
        }
```
@stack72 stack72 removed their assignment Feb 12, 2021
@stack72 stack72 removed this from the 0.52 milestone Feb 17, 2021
@leezen leezen added this to the 0.52 milestone Feb 19, 2021
@infin8x
Copy link

infin8x commented Feb 19, 2021

@stack72 confirming: this seems to have been done and merged, right? Please reopen if not.

@infin8x infin8x closed this as completed Feb 19, 2021
@stack72
Copy link
Contributor

stack72 commented Feb 22, 2021

@infin8x yes we delivered something in this area - any further work here can be scheduled as appropriatly

@MitchellGerdisch
Copy link
Author

MitchellGerdisch commented Mar 22, 2021

Issues are being seen when using PULUMI_KUBERNETES_MANAGED_BY_LABEL env variable.
Here's the scenario:

  1. Run PULUMI_KUBERNETES_MANAGED_BY_LABEL=mycompany pulumi up and deploy the stack.
    As expected, pulumi has changed the app.kubernetes.io/managed-by: "mycompany".
  2. If some iterative deployments using the same command PULUMI_KUBERNETES_MANAGED_BY_LABEL=mycompany pulumi up are run, we see state diff showing app.kubernetes.io/managed-by: company as deleted.
    It doesn't matter how many times we try the same command above, pulumi is not able to recognize the env variable and hence it's not updating the managed by label.

@stack72

@infin8x infin8x reopened this Mar 22, 2021
stack72 added a commit that referenced this issue Mar 29, 2021
Fixes: #1357

Before:

```
▶ PULUMI_KUBERNETES_MANAGED_BY_LABEL=mycompany pulumi up
Previewing update (dev)

View Live: https://app.pulumi.com/stack72/test-kubernetes-go/dev/previews/9f709e63-1719-4493-8ed5-515882fcc70b

     Type                              Name                    Plan       Info
     pulumi:pulumi:Stack               test-kubernetes-go-dev
 ~   └─ kubernetes:apps/v1:Deployment  app-dep                 update     [diff: ~metadata]

Resources:
    ~ 1 to update
    1 unchanged

Do you want to perform this update? no
confirmation declined, not proceeding with the update
```

After:

```
▶ PULUMI_KUBERNETES_MANAGED_BY_LABEL=mycompany pulumi up
Previewing update (dev)

View Live: https://app.pulumi.com/stack72/test-kubernetes-go/dev/previews/91ef271f-3000-472f-b41e-b5470d4cca25

     Type                 Name                    Plan
     pulumi:pulumi:Stack  test-kubernetes-go-dev

Resources:
    2 unchanged
```
lblackstone pushed a commit that referenced this issue Mar 29, 2021
…tes (#1508)

Fixes: #1357

Before:

```
▶ PULUMI_KUBERNETES_MANAGED_BY_LABEL=mycompany pulumi up
Previewing update (dev)

View Live: https://app.pulumi.com/stack72/test-kubernetes-go/dev/previews/9f709e63-1719-4493-8ed5-515882fcc70b

     Type                              Name                    Plan       Info
     pulumi:pulumi:Stack               test-kubernetes-go-dev
 ~   └─ kubernetes:apps/v1:Deployment  app-dep                 update     [diff: ~metadata]

Resources:
    ~ 1 to update
    1 unchanged

Do you want to perform this update? no
confirmation declined, not proceeding with the update
```

After:

```
▶ PULUMI_KUBERNETES_MANAGED_BY_LABEL=mycompany pulumi up
Previewing update (dev)

View Live: https://app.pulumi.com/stack72/test-kubernetes-go/dev/previews/91ef271f-3000-472f-b41e-b5470d4cca25

     Type                 Name                    Plan
     pulumi:pulumi:Stack  test-kubernetes-go-dev

Resources:
    2 unchanged
```
@pulumi-bot pulumi-bot added the resolution/fixed This issue was fixed label Mar 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
resolution/fixed This issue was fixed
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants