Skip to content

Commit

Permalink
fix unwanted labels
Browse files Browse the repository at this point in the history
  • Loading branch information
navid.shariaty committed Oct 28, 2023
1 parent 8accd60 commit 04d6bd5
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
2 changes: 1 addition & 1 deletion config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ spec:
resources:
limits:
cpu: 3
memory: 1Gi
memory: 4Gi
requests:
cpu: 1
memory: 1Gi
Expand Down
10 changes: 9 additions & 1 deletion k8sutils/agesecret.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ var (
unwantedAnnotations = []string{
"kubectl.kubernetes.io/last-applied-configuration",
}
unwantedLabels = []string{
"app.kubernetes.io/instance",
}
)

func finalizeAgeSecret(ageSecret *v1alpha1.AgeSecret, k8sclient client.Client) error {
Expand Down Expand Up @@ -66,6 +69,7 @@ func CreateOrUpdateSecretObj(ageSecret *v1alpha1.AgeSecret, secret *corev1.Secre
err := k8sclient.Get(context.Background(), types.NamespacedName{Namespace: secret.Namespace, Name: secret.Name}, secretToLoad)
if err != nil {
if errors.IsNotFound(err) {
logger.Info("secret not found, creating...", "namespace", secret.Namespace, "secretName", secret.Name)
errCreateChildSecret := k8sclient.Create(context.Background(), secret)
if errCreateChildSecret != nil {
ageSecret.Status.Health = lang.AgeSecretStatusUnhealthy
Expand Down Expand Up @@ -140,7 +144,11 @@ func CheckAgeKeyReference(ageSecret *v1alpha1.AgeSecret, k8sclient client.Client
}

func cloneLabels(labels map[string]string) map[string]string {
return cloneMap(labels)
tmpLabels := cloneMap(labels)
for _, label := range unwantedLabels {
delete(tmpLabels, label)
}
return tmpLabels
}

func cloneAnnotations(annotations map[string]string) map[string]string {
Expand Down

0 comments on commit 04d6bd5

Please sign in to comment.