Skip to content

Commit 6ecd312

Browse files
authored
Replace use of CRD image defaults and configuration with global configuration (#1606)
* Replace the use of pkg/images.Image in internal handling, use cass-operators similar struct. Set up ImageRegistry to controllers and use the information from ImageRegistry to set the correct images. * Modify perNodeConfig to use k8ssandra-client by default * Remove unused code * Add scripts to update Kustomize builds based on the changes from cass-operator * Add CHANGELOG * Add Helm charts changes (pointing to non-existant cass-operator chart version), go dependency updates * Restrict ImageConfig loading to the operator namespace * Update to cass-operator v1.27.0 * Remove flaky nil pointer causing assertion * Make generate-imageconfig.sh work with MacOS sed also * Replace cat with yq in the script for more consistent output, modify Helm charts indentation, update patch-image-config * More Kustomize fixes, add missing component * Fix medusa image coordinates * Add new reconcile checkers (generation) for K8ssandraCluster and CassandraDatacenter to the test code, update to Kubernetes 1.33.5 * Fix unit tests, downgrade testify to 1.10.0 to prevent a deadlock * Kubernetes 1.33.5 and Go 1.24.7 * Update to cass-operator v1.27.1 * Add Release Notes
1 parent 8f7d1ad commit 6ecd312

49 files changed

Lines changed: 798 additions & 612 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

CHANGELOG/CHANGELOG-1.27.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ When cutting a new release, update the `unreleased` heading to the tag being gen
1515

1616
## unreleased
1717

18+
* [FEATURE] [#1605](https://github.com/k8ssandra/k8ssandra-operator/issues/1605) Container images, tags, repositories, registry and pullsecrets and now centrally managed in a ConfigMap with label `k8ssandra.io/config: image`. This is shared with the cass-operator and allows to configure everything from a single place. perNodeConfig is using k8ssandra-client as the image name.
1819
* [ENHANCEMENT] [#1591](https://github.com/k8ssandra/k8ssandra-operator/issues/1591) Remove the old medusa purge cronjob in favor of scheduled tasks
1920
* [ENHANCEMENT] [#1245](https://github.com/k8ssandra/k8ssandra-operator/issues/1245) Ensure ReplicatedSecret targets are cleaned up correctly
2021
* [BUGFIX] [#1603](https://github.com/k8ssandra/k8ssandra-operator/issues/1603) Fix the crd-upgrader to update cass-operator CRDs also as part of the Helm upgrade

CHANGELOG/RELEASE-NOTES.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
11
# k8ssandra-operator - Release Notes
22

3+
## v1.27.0
4+
5+
### Modifications to the configuration of images
6+
7+
Starting from 1.27.0, the k8ssandra-operator will use the same ImageConfig structure as cass-operator. In the Helm charts, the configuration happens through the global.imageConfig property. It's divided to three sections, with the most important part usually being the `defaults` where we define the properties that are used by all the containers unless otherwise overridden:
8+
9+
```
10+
defaults:
11+
registry: "docker.io"
12+
pullPolicy: IfNotPresent
13+
# -- pullSecrets allow configuring the secret to use for pulling images from private registries.
14+
# pullSecrets:
15+
# - my-secret-pull-registry
16+
```
17+
18+
Changing any setting will apply to all images. For example, setting ``--set global.imageConfig.defaults.registry=privateregistry.local`` would pull all the images from `privateregistry.local` instead of `docker.io`. Setting a `pullSecret` would similarly allow pulling all images using that secret instead of having to define it separately for all container types.
19+
20+
For more information, see the comments in the [Helm chart of cass-operator](https://github.com/k8ssandra/k8ssandra/blob/main/charts/cass-operator/values.yaml#L17).
21+
22+
This also means deprecation of multiple fields in the CRD that were required to modify the image to be used such as `PerNodeConfigInitContainerImage`. To modify the image used by `perNodeConfigInitContainerImage`, modify the `k8ssandra-client` image. For Kustomize installations, the `imageConfig` is available in the `config/cass-operator/imageconfig` directory.
23+
324
## v1.15.0
425

526
### Deprecation of non-namespace-local MedusaConfigRef

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,10 +129,13 @@ help: ## Display this help.
129129

130130
##@ Development
131131

132+
CASS_OPERATOR_TAG ?= v1.27.1
133+
132134
.PHONY: manifests
133135
manifests: controller-gen kustomize ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
134136
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=k8ssandra-operator webhook paths="./..." output:crd:artifacts:config=config/crd/bases
135137
KUSTOMIZE=$(KUSTOMIZE) ./scripts/prepare-helm-release.sh
138+
KUSTOMIZE=$(KUSTOMIZE) CASS_OPERATOR_REF=$(CASS_OPERATOR_TAG) ./scripts/generate-imageconfig.sh
136139

137140
.PHONY: generate
138141
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.

apis/k8ssandra/v1alpha1/k8ssandracluster_types.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -436,9 +436,8 @@ type DatacenterOptions struct {
436436

437437
// The image to use in each Cassandra pod for the (short-lived) init container that merges global and perNodeConfig
438438
// configuration. This is only useful when PerNodeConfigMapRef is set.
439-
// The default is "k8ssandra/k8ssandra-client:v0.8.1".
440439
// +optional
441-
// +kubebuilder:default="k8ssandra/k8ssandra-client:v0.8.1"
440+
// DEPRECATED: use ImageConfig's k8ssandra-client instead
442441
PerNodeConfigInitContainerImage string `json:"perNodeConfigInitContainerImage,omitempty"`
443442

444443
// The k8s service account to use for the Cassandra pods

apis/reaper/v1alpha1/reaper_types.go

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,10 +85,7 @@ type ReaperTemplate struct {
8585
SecretsProvider string `json:"secretsProvider,omitempty"`
8686

8787
// The image to use for the Reaper pod main container.
88-
// The default is "thelastpickle/cassandra-reaper:4.0.0-rc1".
8988
// +optional
90-
// TODO: update with real release version.
91-
// +kubebuilder:default={repository:"thelastpickle",name:"cassandra-reaper",tag:"4.0.0-rc1"}
9289
ContainerImage *images.Image `json:"containerImage,omitempty"`
9390

9491
// Deprecated: The main container image will be used for the init container as well.

charts/k8ssandra-operator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies:
99
version: 0.29.2
1010
repository: https://helm.k8ssandra.io
1111
- name: cass-operator
12-
version: 0.60.0
12+
version: 0.61.1
1313
repository: https://helm.k8ssandra.io
1414
home: https://github.com/k8ssandra/k8ssandra-operator
1515
sources:

charts/k8ssandra-operator/crds/k8ssandra-operator-crds.yaml

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -10004,11 +10004,10 @@ spec:
1000410004
type: object
1000510005
type: object
1000610006
perNodeConfigInitContainerImage:
10007-
default: k8ssandra/k8ssandra-client:v0.8.1
1000810007
description: |-
1000910008
The image to use in each Cassandra pod for the (short-lived) init container that merges global and perNodeConfig
1001010009
configuration. This is only useful when PerNodeConfigMapRef is set.
10011-
The default is "k8ssandra/k8ssandra-client:v0.8.1".
10010+
DEPRECATED: use ImageConfig's k8ssandra-client instead
1001210011
type: string
1001310012
perNodeConfigMapRef:
1001410013
description: |-
@@ -23080,11 +23079,10 @@ spec:
2308023079
type: object
2308123080
type: object
2308223081
perNodeConfigInitContainerImage:
23083-
default: k8ssandra/k8ssandra-client:v0.8.1
2308423082
description: |-
2308523083
The image to use in each Cassandra pod for the (short-lived) init container that merges global and perNodeConfig
2308623084
configuration. This is only useful when PerNodeConfigMapRef is set.
23087-
The default is "k8ssandra/k8ssandra-client:v0.8.1".
23085+
DEPRECATED: use ImageConfig's k8ssandra-client instead
2308823086
type: string
2308923087
podPriorityClassName:
2309023088
description: PodPriorityClassName defines the priority class name
@@ -29140,13 +29138,7 @@ spec:
2914029138
type: object
2914129139
x-kubernetes-map-type: atomic
2914229140
containerImage:
29143-
default:
29144-
name: cassandra-reaper
29145-
repository: thelastpickle
29146-
tag: 4.0.0-rc1
29147-
description: |-
29148-
The image to use for the Reaper pod main container.
29149-
The default is "thelastpickle/cassandra-reaper:4.0.0-rc1".
29141+
description: The image to use for the Reaper pod main container.
2915029142
properties:
2915129143
name:
2915229144
description: The image name to use.
@@ -35575,13 +35567,7 @@ spec:
3557535567
- truststoreSecretRef
3557635568
type: object
3557735569
containerImage:
35578-
default:
35579-
name: cassandra-reaper
35580-
repository: thelastpickle
35581-
tag: 4.0.0-rc1
35582-
description: |-
35583-
The image to use for the Reaper pod main container.
35584-
The default is "thelastpickle/cassandra-reaper:4.0.0-rc1".
35570+
description: The image to use for the Reaper pod main container.
3558535571
properties:
3558635572
name:
3558735573
description: The image name to use.

charts/k8ssandra-operator/values.yaml

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,18 @@ global:
1212
# watchNamespaces: []
1313
# -- If true, the helm chart will generate ClusterRoles and ClusterRoleBindings.
1414
clusterScopedResources: true
15-
15+
# -- imageConfig modifications to the default settings provided by the cass-operator. One can override all the
16+
# settings here. See https://github.com/k8ssandra/k8ssandra/blob/main/charts/cass-operator/values.yaml#L17 for more details.
17+
imageConfig:
18+
images:
19+
reaper:
20+
repository: "thelastpickle"
21+
name: "cassandra-reaper"
22+
tag: "4.0.0-rc1"
23+
medusa:
24+
repository: "k8ssandra"
25+
name: "medusa"
26+
tag: "0.25.0"
1627
# -- A name in place of the chart name which is used in the metadata.name of
1728
# objects created by this chart.
1829
nameOverride: ''
@@ -74,8 +85,8 @@ nodeSelector: {}
7485
## Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
7586
##
7687
tolerations: []
77-
# -- k8ssandra-client provides CLI utilities, but also certain functions such as
78-
# upgradecrds that allow modifying the running instances
88+
# -- This client configuration is used for the CRD upgrader job only. Otherwise, modify
89+
# the global.imageConfig values to change k8ssandra-client
7990
client:
8091
# -- Uncomment to specify the name of the service account to use for the
8192
# client tools image. Defaults to <release-name>-crd-upgrader-k8ssandra.
@@ -86,13 +97,13 @@ client:
8697
# -- Image repository for the client
8798
repository: k8ssandra/k8ssandra-client
8899
# -- Tag of the client image to pull from
89-
tag: v0.8.1
100+
tag: v0.8.3
90101
# -- Pull policy for the client container
91102
pullPolicy: IfNotPresent
92103
# -- HTTPS proxy address to use for communication to helm.k8ssandra.io
93104
#proxy:
94105
# -- Allows managing CRD upgrades externally and fully disable the CRD upgrader job hook
95106
disableCrdUpgraderJob: false
107+
# cass-operator:
96108
# -- Allows disabling the check for the presence of cert-manager.
97-
cass-operator:
98-
disableCertManagerCheck: false
109+
# disableCertManagerCheck: false

config/cass-operator/cluster-scoped/kustomization.yaml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,10 @@ apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

44
resources:
5-
- github.com/k8ssandra/cass-operator/config/deployments/cluster?ref=v1.26.0
5+
- github.com/k8ssandra/cass-operator/config/deployments/cluster?ref=v1.27.1
6+
7+
components:
8+
- ../imageconfig
69

710
patchesStrategicMerge:
811
- |-
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
images:
2+
medusa:
3+
repository: "k8ssandra"
4+
name: "medusa"
5+
tag: "0.25.0"

0 commit comments

Comments
 (0)