Skip to content

Commit

Permalink
Merge branch 'main' into K8OP-295
Browse files Browse the repository at this point in the history
  • Loading branch information
rzvoncek authored Jan 3, 2025
2 parents 1bc7889 + d00a94b commit 176d33c
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 22 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG/CHANGELOG-1.21.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ When cutting a new release, update the `unreleased` heading to the tag being gen
## unreleased

* [CHANGE] [#1441](https://github.com/k8ssandra/k8ssandra-operator/issues/1441) Use k8ssandra-client instead of k8ssandra-tools for CRD upgrades
* [BUGFIX] [#1383](https://github.com/k8ssandra/k8ssandra-operator/issues/1383) Do not create MedusaBackup if MadusaBakupJob did not fully succeed
* [BUGFIX] [#1383](https://github.com/k8ssandra/k8ssandra-operator/issues/1383) Do not create MedusaBackup if MedusaBakupJob did not fully succeed
* [ENHANCEMENT] [#1667](https://github.com/k8ssahttps://github.com/k8ssandra/k8ssandra/issues/1667) Add `skipSchemaMigration` option to `K8ssandraCluster.spec.reaper`
* [FEATURE] [#1034](https://github.com/k8ssandra/k8ssandra-operator/issues/1034) Add support for priorityClassName
* [ENHANCEMENT] [#1455](https://github.com/k8ssandra/k8ssandra-operator/issues/1455) Expose configuration of Medusa's gRPC server port
4 changes: 4 additions & 0 deletions apis/k8ssandra/v1alpha1/k8ssandracluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,10 @@ type DatacenterOptions struct {
// +optional
PodSecurityContext *corev1.PodSecurityContext `json:"podSecurityContext,omitempty"`

// PodPriorityClassName defines the priority class name for the Cassandra pods.
// +optional
PodPriorityClassName string `json:"podPriorityClassName,omitempty"`

// ManagementApiAuth defines the authentication settings for the management API in the Cassandra pods.
// +optional
ManagementApiAuth *cassdcapi.ManagementApiAuthConfig `json:"managementApiAuth,omitempty"`
Expand Down
4 changes: 2 additions & 2 deletions apis/reaper/v1alpha1/reaper_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,10 +85,10 @@ type ReaperTemplate struct {
SecretsProvider string `json:"secretsProvider,omitempty"`

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

// Deprecated: The main container image will be used for the init container as well.
Expand Down
16 changes: 12 additions & 4 deletions charts/k8ssandra-operator/crds/k8ssandra-operator-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9556,6 +9556,10 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
podPriorityClassName:
description: PodPriorityClassName defines the priority class
name for the Cassandra pods.
type: string
podSecurityContext:
description: PodSecurityContext defines the security context
for the Cassandra pods.
Expand Down Expand Up @@ -22018,6 +22022,10 @@ spec:
configuration. This is only useful when PerNodeConfigMapRef is set.
The default is "mikefarah/yq:4".
type: string
podPriorityClassName:
description: PodPriorityClassName defines the priority class name
for the Cassandra pods.
type: string
podSecurityContext:
description: PodSecurityContext defines the security context for
the Cassandra pods.
Expand Down Expand Up @@ -27571,10 +27579,10 @@ spec:
default:
name: cassandra-reaper
repository: thelastpickle
tag: 3.6.1
tag: 3.7.0
description: |-
The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.
properties:
name:
Expand Down Expand Up @@ -33699,10 +33707,10 @@ spec:
default:
name: cassandra-reaper
repository: thelastpickle
tag: 3.6.1
tag: 3.7.0
description: |-
The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.
properties:
name:
Expand Down
12 changes: 10 additions & 2 deletions config/crd/bases/k8ssandra.io_k8ssandraclusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9494,6 +9494,10 @@ spec:
type: string
type: object
x-kubernetes-map-type: atomic
podPriorityClassName:
description: PodPriorityClassName defines the priority class
name for the Cassandra pods.
type: string
podSecurityContext:
description: PodSecurityContext defines the security context
for the Cassandra pods.
Expand Down Expand Up @@ -21956,6 +21960,10 @@ spec:
configuration. This is only useful when PerNodeConfigMapRef is set.
The default is "mikefarah/yq:4".
type: string
podPriorityClassName:
description: PodPriorityClassName defines the priority class name
for the Cassandra pods.
type: string
podSecurityContext:
description: PodSecurityContext defines the security context for
the Cassandra pods.
Expand Down Expand Up @@ -27509,10 +27517,10 @@ spec:
default:
name: cassandra-reaper
repository: thelastpickle
tag: 3.6.1
tag: 3.7.0
description: |-
The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.
properties:
name:
Expand Down
4 changes: 2 additions & 2 deletions config/crd/bases/reaper.k8ssandra.io_reapers.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1110,10 +1110,10 @@ spec:
default:
name: cassandra-reaper
repository: thelastpickle
tag: 3.6.1
tag: 3.7.0
description: |-
The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.
properties:
name:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54718,10 +54718,10 @@ and must contain two keys: "username" and "password".<br/>
<td>object</td>
<td>
The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.<br/>
<br/>
<i>Default</i>: map[name:cassandra-reaper repository:thelastpickle tag:3.6.1]<br/>
<i>Default</i>: map[name:cassandra-reaper repository:thelastpickle tag:3.7.0]<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down Expand Up @@ -56694,7 +56694,7 @@ TODO: Add other useful fields. apiVersion, kind, uid?<br/>


The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.

<table>
Expand Down Expand Up @@ -84691,10 +84691,10 @@ and must contain two keys: "username" and "password".<br/>
<td>object</td>
<td>
The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.<br/>
<br/>
<i>Default</i>: map[name:cassandra-reaper repository:thelastpickle tag:3.6.1]<br/>
<i>Default</i>: map[name:cassandra-reaper repository:thelastpickle tag:3.7.0]<br/>
</td>
<td>false</td>
</tr><tr>
Expand Down Expand Up @@ -86876,7 +86876,7 @@ TODO: Add other useful fields. apiVersion, kind, uid?<br/>


The image to use for the Reaper pod main container.
The default is "thelastpickle/cassandra-reaper:3.6.1".
The default is "thelastpickle/cassandra-reaper:3.7.0".
TODO: update with real release version.

<table>
Expand Down
1 change: 1 addition & 0 deletions pkg/cassandra/datacenter.go
Original file line number Diff line number Diff line change
Expand Up @@ -374,6 +374,7 @@ func Coalesce(clusterName string, clusterTemplate *api.CassandraClusterTemplate,
dcConfig.DseWorkloads = mergedOptions.DseWorkloads
dcConfig.ManagementApiAuth = mergedOptions.ManagementApiAuth
dcConfig.PodTemplateSpec.Spec.SecurityContext = mergedOptions.PodSecurityContext
dcConfig.PodTemplateSpec.Spec.PriorityClassName = mergedOptions.PodPriorityClassName
dcConfig.PerNodeInitContainerImage = mergedOptions.PerNodeConfigInitContainerImage
dcConfig.ServiceAccount = mergedOptions.ServiceAccount
dcConfig.ReadOnlyRootFilesystem = mergedOptions.ReadOnlyRootFilesystem
Expand Down
51 changes: 51 additions & 0 deletions pkg/cassandra/datacenter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -1281,6 +1281,46 @@ func TestCoalesce(t *testing.T) {
},
},
},
{
name: "Set priority class name at cluster level",
clusterTemplate: &api.CassandraClusterTemplate{
DatacenterOptions: api.DatacenterOptions{
PodPriorityClassName: "mock-priority",
},
},
dcTemplate: &api.CassandraDatacenterTemplate{},
want: &DatacenterConfig{
McacEnabled: true,
PodTemplateSpec: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: "cassandra"}},
PriorityClassName: "mock-priority",
},
},
},
},
{
name: "Override priority class name",
clusterTemplate: &api.CassandraClusterTemplate{
DatacenterOptions: api.DatacenterOptions{
PodPriorityClassName: "ignored-priority",
},
},
dcTemplate: &api.CassandraDatacenterTemplate{
DatacenterOptions: api.DatacenterOptions{
PodPriorityClassName: "mock-priority",
},
},
want: &DatacenterConfig{
McacEnabled: true,
PodTemplateSpec: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{{Name: "cassandra"}},
PriorityClassName: "mock-priority",
},
},
},
},
}

for _, tc := range tests {
Expand Down Expand Up @@ -1376,6 +1416,17 @@ func TestNewDatacenter_ServiceAccount(t *testing.T) {
assert.Equal(t, template.ServiceAccount, dc.Spec.ServiceAccountName)
}

func TestNewDatacenter_PodPriorityClassName(t *testing.T) {
template := GetDatacenterConfig()
template.PodTemplateSpec.Spec.PriorityClassName = "mock-priority"
dc, err := NewDatacenter(
types.NamespacedName{Name: "testdc", Namespace: "test-namespace"},
&template,
)
assert.NoError(t, err)
assert.Equal(t, "mock-priority", dc.Spec.PodTemplateSpec.Spec.PriorityClassName)
}

// TestValidateCoalesced_Fail_NoStorageConfig tests that NewDatacenter fails when no storage config is provided.
func TestValidateDatacenterConfig_Fail_NoStorageConfig(t *testing.T) {
template := GetDatacenterConfig()
Expand Down
2 changes: 1 addition & 1 deletion pkg/reaper/deployment.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
const (
DefaultImageRepository = "thelastpickle"
DefaultImageName = "cassandra-reaper"
DefaultVersion = "3.6.1"
DefaultVersion = "3.7.0"
// When changing the default version above, please also change the kubebuilder markers in
// apis/reaper/v1alpha1/reaper_types.go accordingly.

Expand Down
8 changes: 4 additions & 4 deletions pkg/reaper/deployment_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -410,8 +410,8 @@ func TestImages(t *testing.T) {
reaper.Spec.ContainerImage = nil
logger := testlogr.NewTestLogger(t)
deployment := NewDeployment(reaper, newTestDatacenter(), nil, nil, logger)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.6.1", deployment.Spec.Template.Spec.InitContainers[0].Image)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.6.1", deployment.Spec.Template.Spec.Containers[0].Image)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.7.0", deployment.Spec.Template.Spec.InitContainers[0].Image)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.7.0", deployment.Spec.Template.Spec.Containers[0].Image)
assert.Equal(t, corev1.PullIfNotPresent, deployment.Spec.Template.Spec.InitContainers[0].ImagePullPolicy)
assert.Equal(t, corev1.PullIfNotPresent, deployment.Spec.Template.Spec.Containers[0].ImagePullPolicy)
assert.Empty(t, deployment.Spec.Template.Spec.ImagePullSecrets)
Expand All @@ -421,8 +421,8 @@ func TestImages(t *testing.T) {
reaper.Spec.ContainerImage = nil
logger := testlogr.NewTestLogger(t)
deployment := NewDeployment(reaper, newTestDatacenter(), nil, nil, logger)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.6.1", deployment.Spec.Template.Spec.InitContainers[0].Image)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.6.1", deployment.Spec.Template.Spec.Containers[0].Image)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.7.0", deployment.Spec.Template.Spec.InitContainers[0].Image)
assert.Equal(t, "docker.io/thelastpickle/cassandra-reaper:3.7.0", deployment.Spec.Template.Spec.Containers[0].Image)
assert.Equal(t, corev1.PullIfNotPresent, deployment.Spec.Template.Spec.InitContainers[0].ImagePullPolicy)
assert.Equal(t, corev1.PullIfNotPresent, deployment.Spec.Template.Spec.Containers[0].ImagePullPolicy)
assert.Empty(t, deployment.Spec.Template.Spec.ImagePullSecrets)
Expand Down

0 comments on commit 176d33c

Please sign in to comment.