mirror of
https://github.com/tailscale/tailscale.git
synced 2025-04-02 14:32:26 +00:00
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:
parent
d0492fdee5
commit
50b52dbd7d
@ -411,6 +411,9 @@ func (a *tailscaleSTSReconciler) reconcileSTS(ctx context.Context, logger *zap.S
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
mak.Set(&ss.Spec.Template.Labels, "app", sts.ParentResourceUID)
|
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.
|
// Generic containerboot configuration options.
|
||||||
container.Env = append(container.Env,
|
container.Env = append(container.Env,
|
||||||
|
@ -147,7 +147,13 @@ func expectedSTS(opts configOpts) *appsv1.StatefulSet {
|
|||||||
ObjectMeta: metav1.ObjectMeta{
|
ObjectMeta: metav1.ObjectMeta{
|
||||||
Annotations: annots,
|
Annotations: annots,
|
||||||
DeletionGracePeriodSeconds: ptr.To[int64](10),
|
DeletionGracePeriodSeconds: ptr.To[int64](10),
|
||||||
Labels: map[string]string{"app": "1234-UID"},
|
Labels: map[string]string{
|
||||||
|
"tailscale.com/managed": "true",
|
||||||
|
"tailscale.com/parent-resource": "test",
|
||||||
|
"tailscale.com/parent-resource-ns": opts.namespace,
|
||||||
|
"tailscale.com/parent-resource-type": opts.parentType,
|
||||||
|
"app": "1234-UID",
|
||||||
|
},
|
||||||
},
|
},
|
||||||
Spec: corev1.PodSpec{
|
Spec: corev1.PodSpec{
|
||||||
ServiceAccountName: "proxies",
|
ServiceAccountName: "proxies",
|
||||||
|
Loading…
x
Reference in New Issue
Block a user