Skip to content

Commit 66fcc71

Browse files
endzymeanishakj
andauthored
Adjust behavior for pod labels (#521)
Pod labels from the Spec.Pod.Labels were previously not propagated to the StatefulSet.Template. This change notes the differences between the two Label locations in the ZookeeperCluster CRD and denotes priority ordering. Signed-off-by: Nick Huanca <[email protected]> Signed-off-by: Nick Huanca <[email protected]> Co-authored-by: anishakj <[email protected]>
1 parent 8076745 commit 66fcc71

File tree

4 files changed

+16
-10
lines changed

4 files changed

+16
-10
lines changed

api/v1beta1/zookeepercluster_types.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,9 @@ type ZookeeperClusterSpec struct {
8282
// Image is the container image. default is zookeeper:0.2.10
8383
Image ContainerImage `json:"image,omitempty"`
8484

85-
// Labels specifies the labels to attach to pods the operator creates for
86-
// the zookeeper cluster.
85+
// Labels specifies the labels to attach to all resources the operator
86+
// creates for the zookeeper cluster, including StatefulSet, Pod,
87+
// PersistentVolumeClaim, Service, ConfigMap, et al.
8788
Labels map[string]string `json:"labels,omitempty"`
8889

8990
// Replicas is the expected size of the zookeeper cluster.
@@ -433,8 +434,8 @@ func (c *ContainerImage) ToString() string {
433434
// PodPolicy defines the common pod configuration for Pods, including when used
434435
// in deployments, stateful-sets, etc.
435436
type PodPolicy struct {
436-
// Labels specifies the labels to attach to pods the operator creates for
437-
// the zookeeper cluster.
437+
// Labels specifies the labels to attach to pods the operator creates for the
438+
// zookeeper cluster. Overrides any values specified in Spec.Labels.
438439
Labels map[string]string `json:"labels,omitempty"`
439440

440441
// NodeSelector specifies a map of key-value pairs. For the pod to be

charts/zookeeper-operator/templates/zookeeper.pravega.io_zookeeperclusters_crd.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2684,8 +2684,9 @@ spec:
26842684
labels:
26852685
additionalProperties:
26862686
type: string
2687-
description: Labels specifies the labels to attach to pods the operator
2688-
creates for the zookeeper cluster.
2687+
description: Labels specifies the labels to attach to all resources
2688+
the operator creates for the zookeeper cluster, including StatefulSet,
2689+
Pod, PersistentVolumeClaim, Service, ConfigMap, et al.
26892690
type: object
26902691
maxUnavailableReplicas:
26912692
description: MaxUnavailableReplicas defines the MaxUnavailable Replicas
@@ -3875,7 +3876,8 @@ spec:
38753876
additionalProperties:
38763877
type: string
38773878
description: Labels specifies the labels to attach to pods the
3878-
operator creates for the zookeeper cluster.
3879+
operator creates for the zookeeper cluster. Overrides any values
3880+
specified in Spec.Labels.
38793881
type: object
38803882
nodeSelector:
38813883
additionalProperties:

config/crd/bases/zookeeper.pravega.io_zookeeperclusters.yaml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2683,8 +2683,9 @@ spec:
26832683
labels:
26842684
additionalProperties:
26852685
type: string
2686-
description: Labels specifies the labels to attach to pods the operator
2687-
creates for the zookeeper cluster.
2686+
description: Labels specifies the labels to attach to all resources
2687+
the operator creates for the zookeeper cluster, including StatefulSet,
2688+
Pod, PersistentVolumeClaim, Service, ConfigMap, et al.
26882689
type: object
26892690
maxUnavailableReplicas:
26902691
description: MaxUnavailableReplicas defines the MaxUnavailable Replicas
@@ -3874,7 +3875,8 @@ spec:
38743875
additionalProperties:
38753876
type: string
38763877
description: Labels specifies the labels to attach to pods the
3877-
operator creates for the zookeeper cluster.
3878+
operator creates for the zookeeper cluster. Overrides any values
3879+
specified in Spec.Labels.
38783880
type: object
38793881
nodeSelector:
38803882
additionalProperties:

pkg/zk/generators.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ func MakeStatefulSet(z *v1beta1.ZookeeperCluster) *appsv1.StatefulSet {
9292
GenerateName: z.GetName(),
9393
Labels: mergeLabels(
9494
z.Spec.Labels,
95+
z.Spec.Pod.Labels,
9596
map[string]string{
9697
"app": z.GetName(),
9798
"kind": "ZookeeperMember",

0 commit comments

Comments
 (0)