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

Allow control of managed-by label through use of environment variable #1471

Merged
merged 1 commit into from
Feb 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

- Skip Helm test hook resources by default (https://github.com/pulumi/pulumi-kubernetes/pull/1467)
- Ensure no panic when a kubernetes provider is used with an incompatible resource type (https://github.com/pulumi/pulumi-kubernetes/pull/1469)
- Allow users to set `PULUMI_KUBERNETES_MANAGED_BY_LABEL` environment variable to control `app.kubernetes.io/managed-by` label (https://github.com/pulumi/pulumi-kubernetes/pull/1471)

## 2.8.0 (February 3, 2021)

Expand Down
8 changes: 7 additions & 1 deletion provider/pkg/metadata/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ package metadata

import (
"fmt"
"os"
"reflect"

"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
Expand Down Expand Up @@ -90,7 +91,12 @@ func GetLabel(obj *unstructured.Unstructured, key string) interface{} {
// (e.g.) the underlying object is mistyped. In particular, TrySetLabel will fail if the underlying
// object has a Pulumi computed value.
func TrySetManagedByLabel(obj *unstructured.Unstructured) (bool, error) {
return TrySetLabel(obj, managedByLabel, "pulumi")
managedBy := "pulumi"
labelVal, exists := os.LookupEnv("PULUMI_KUBERNETES_MANAGED_BY_LABEL")
if exists {
managedBy = labelVal
}
return TrySetLabel(obj, managedByLabel, managedBy)
}

// HasManagedByLabel returns true if the object has the `app.kubernetes.io/managed-by` label set to `pulumi`,
Expand Down