Skip to content

Commit

Permalink
Adjust behavior for pod labels (#521)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
endzyme and anishakj authored Jan 13, 2023
1 parent 8076745 commit 66fcc71
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
9 changes: 5 additions & 4 deletions api/v1beta1/zookeepercluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,9 @@ type ZookeeperClusterSpec struct {
// Image is the container image. default is zookeeper:0.2.10
Image ContainerImage `json:"image,omitempty"`

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

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

// NodeSelector specifies a map of key-value pairs. For the pod to be
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2684,8 +2684,9 @@ spec:
labels:
additionalProperties:
type: string
description: Labels specifies the labels to attach to pods the operator
creates for the zookeeper cluster.
description: Labels specifies the labels to attach to all resources
the operator creates for the zookeeper cluster, including StatefulSet,
Pod, PersistentVolumeClaim, Service, ConfigMap, et al.
type: object
maxUnavailableReplicas:
description: MaxUnavailableReplicas defines the MaxUnavailable Replicas
Expand Down Expand Up @@ -3875,7 +3876,8 @@ spec:
additionalProperties:
type: string
description: Labels specifies the labels to attach to pods the
operator creates for the zookeeper cluster.
operator creates for the zookeeper cluster. Overrides any values
specified in Spec.Labels.
type: object
nodeSelector:
additionalProperties:
Expand Down
8 changes: 5 additions & 3 deletions config/crd/bases/zookeeper.pravega.io_zookeeperclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2683,8 +2683,9 @@ spec:
labels:
additionalProperties:
type: string
description: Labels specifies the labels to attach to pods the operator
creates for the zookeeper cluster.
description: Labels specifies the labels to attach to all resources
the operator creates for the zookeeper cluster, including StatefulSet,
Pod, PersistentVolumeClaim, Service, ConfigMap, et al.
type: object
maxUnavailableReplicas:
description: MaxUnavailableReplicas defines the MaxUnavailable Replicas
Expand Down Expand Up @@ -3874,7 +3875,8 @@ spec:
additionalProperties:
type: string
description: Labels specifies the labels to attach to pods the
operator creates for the zookeeper cluster.
operator creates for the zookeeper cluster. Overrides any values
specified in Spec.Labels.
type: object
nodeSelector:
additionalProperties:
Expand Down
1 change: 1 addition & 0 deletions pkg/zk/generators.go
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,7 @@ func MakeStatefulSet(z *v1beta1.ZookeeperCluster) *appsv1.StatefulSet {
GenerateName: z.GetName(),
Labels: mergeLabels(
z.Spec.Labels,
z.Spec.Pod.Labels,
map[string]string{
"app": z.GetName(),
"kind": "ZookeeperMember",
Expand Down

0 comments on commit 66fcc71

Please sign in to comment.