cmd/k8s-operator: sync StatefulSet labels to their Pods (#10861)

So that users have predictable label values to use when configuring network policies.

Updates tailscale/tailscale#10854

Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
Irbe Krumina
2024-01-16 12:51:10 +00:00
committed by GitHub
parent d0492fdee5
commit 50b52dbd7d
2 changed files with 10 additions and 1 deletions

View File

@@ -411,6 +411,9 @@ func (a *tailscaleSTSReconciler) reconcileSTS(ctx context.Context, logger *zap.S
},
}
mak.Set(&ss.Spec.Template.Labels, "app", sts.ParentResourceUID)
for key, val := range sts.ChildResourceLabels {
ss.Spec.Template.Labels[key] = val // sync StatefulSet labels to Pod to make it easier for users to select the Pod
}
// Generic containerboot configuration options.
container.Env = append(container.Env,