Skip to content

Commit

Permalink
Merge branch 'main' into cloud-881
Browse files Browse the repository at this point in the history
  • Loading branch information
jvpasinatto authored Jan 21, 2025
2 parents 32e3bb0 + 1bd7c70 commit 715c8f6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 7 deletions.
1 change: 1 addition & 0 deletions e2e-tests/functions
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ compare_kubectl() {
del(.. | select(has("percona.com/env-secret-config-hash"))."percona.com/env-secret-config-hash") |
del(.. | select(has("percona.com/ssl-hash"))."percona.com/ssl-hash") |
del(.. | select(has("percona.com/ssl-internal-hash"))."percona.com/ssl-internal-hash") |
del(.. | select(has("kubectl.kubernetes.io/default-container"))."kubectl.kubernetes.io/default-container") |
del(.spec.volumeClaimTemplates[].spec.volumeMode | select(. == "Filesystem")) |
del(.. | select(has("healthCheckNodePort")).healthCheckNodePort) |
del(.. | select(has("nodePort")).nodePort) |
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ require (
github.com/onsi/ginkgo/v2 v2.22.2
github.com/onsi/gomega v1.36.2
github.com/pkg/errors v0.9.1
github.com/prometheus/client_golang v1.20.4
github.com/prometheus/client_golang v1.20.5
github.com/robfig/cron/v3 v3.0.1
go.uber.org/zap v1.27.0
golang.org/x/sync v0.10.0
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINE
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 h1:Jamvg5psRIccs7FGNTlIRMkT8wgtp5eCXdBlqhYGL6U=
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/prometheus/client_golang v1.20.4 h1:Tgh3Yr67PaOv/uTqloMsCEdeuFTatm5zIq5+qNN23vI=
github.com/prometheus/client_golang v1.20.4/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_golang v1.20.5 h1:cxppBPuYhUnsO6yo/aoRol4L7q7UFfdm+bR9r+8l63Y=
github.com/prometheus/client_golang v1.20.5/go.mod h1:PIEt8X02hGcP8JWbeHyeZ53Y/jReSnHgO035n//V5WE=
github.com/prometheus/client_model v0.6.1 h1:ZKSh/rekM+n3CeS952MLRAdFwIKqeY8b62p8ais2e9E=
github.com/prometheus/client_model v0.6.1/go.mod h1:OrxVMOVHjw3lKMa8+x6HeMGkHMQyHDk9E3jmP2AmGiY=
github.com/prometheus/common v0.55.0 h1:KEi6DK7lXW/m7Ig5i47x0vRzuBsHuvJdi5ee6Y3G1dc=
Expand Down
15 changes: 11 additions & 4 deletions pkg/pxc/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,8 @@ func StatefulSet(ctx context.Context, cl client.Client, sfs api.StatefulApp, pod
TerminationGracePeriodSeconds: podSpec.TerminationGracePeriodSeconds,
RuntimeClassName: podSpec.RuntimeClassName,
}
if cr.CompareVersionWith("1.5.0") >= 0 {
pod.ServiceAccountName = podSpec.ServiceAccountName
}

pod.ServiceAccountName = podSpec.ServiceAccountName
secrets := secret.Name
pod.Affinity = PodAffinity(podSpec.Affinity, sfs)
pod.TopologySpreadConstraints = PodTopologySpreadConstraints(podSpec.TopologySpreadConstraints, sfs.Labels())
Expand Down Expand Up @@ -120,6 +119,14 @@ func StatefulSet(ctx context.Context, cl client.Client, sfs api.StatefulApp, pod
}
}

customAnnotations := podSpec.Annotations
if cr.CompareVersionWith("1.17.0") >= 0 {
if customAnnotations == nil {
customAnnotations = make(map[string]string)
}
customAnnotations["kubectl.kubernetes.io/default-container"] = sfs.Labels()[naming.LabelAppKubernetesComponent]
}

obj := sfs.StatefulSet()
obj.Spec = appsv1.StatefulSetSpec{
Replicas: &podSpec.Size,
Expand All @@ -130,7 +137,7 @@ func StatefulSet(ctx context.Context, cl client.Client, sfs api.StatefulApp, pod
Template: corev1.PodTemplateSpec{
ObjectMeta: metav1.ObjectMeta{
Labels: customLabels,
Annotations: podSpec.Annotations,
Annotations: customAnnotations,
},
Spec: pod,
},
Expand Down

0 comments on commit 715c8f6

Please sign in to comment.