Skip to content

Commit

Permalink
Merge branch 'main' into change/local-only-medusaconfig
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey authored Apr 15, 2024
2 parents c862e0c + 9577b31 commit f552dad
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 5 deletions.
8 changes: 7 additions & 1 deletion CHANGELOG/CHANGELOG-1.14.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,17 @@ When cutting a new release, update the `unreleased` heading to the tag being gen
* [BUGFIX] [#1217](https://github.com/k8ssandra/k8ssandra-operator/issues/1217) Medusa storage secrets now use a ReplicatedSecret for synchronization, fixing an issue where changes to the secrets were not propagating. Additionally, fix a number of issues with local testing on ARM Macs.
* [BUGFIX] [#1253](https://github.com/k8ssandra/k8ssandra-operator/issues/1253) Medusa storage secrets are now labelled with a unique label.
* [FEATURE] [#1260](https://github.com/k8ssandra/k8ssandra-operator/issues/1260) Update controller-gen to version 0.14.0.
* [BUGFIX] [#1240](https://github.com/k8ssandra/k8ssandra-operator/issues/1240) The PullSecretRef for medusa is ignored in the standalone deployment of medusa



## v1.14.0 - 2024-04-02

* [FEATURE] [#1242](https://github.com/k8ssandra/k8ssandra-operator/issues/1242) Allow for creation of replicated secrets with a prefix, so that we can distinguish between multiple secrets with the same origin but targeting different clusters.
* [BUGFIX] [#1226](https://github.com/k8ssandra/k8ssandra-operator/issues/1226) Medusa purge cronjob should be created in the operator namespace
* [BUGFIX] [#1141](https://github.com/k8ssandra/k8ssandra-operator/issues/1141) Use DC name override when naming secondary resources
* [BUGFIX] [#1138](https://github.com/k8ssandra/k8ssandra-operator/issues/1138) Use cluster name override for metrics agent ConfigMap
* [BUGFIX] [#1252](https://github.com/k8ssandra/k8ssandra-operator/issues/1252) Sanitize DC name in pods selector
* [CHANGE] Update Medusa to v0.20.1
* [BUGFIX] [#1235](https://github.com/k8ssandra/k8ssandra-operator/issues/1235) Prevent operator from modifying the spec when superUserRef is not set. Also, remove the injection to mount secrets to cassandra container.
* [BUGFIX] [#1239](https://github.com/k8ssandra/k8ssandra-operator/issues/1239) Use `concurrent_transfers` setting from MedusaConfiguration object if it is actually set.
* [BUGFIX] [#1239](https://github.com/k8ssandra/k8ssandra-operator/issues/1239) Use `concurrent_transfers` setting from MedusaConfiguration object if it is actually set.
2 changes: 1 addition & 1 deletion controllers/k8ssandra/medusa_reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ func (r *K8ssandraClusterReconciler) reconcileMedusa(
}

// Create the Medusa standalone pod
desiredMedusaStandalone := medusa.StandaloneMedusaDeployment(*medusaContainer, kc.SanitizedName(), dcConfig.SanitizedName(), dcNamespace, logger)
desiredMedusaStandalone := medusa.StandaloneMedusaDeployment(*medusaContainer, kc.SanitizedName(), dcConfig.SanitizedName(), namespace, logger, kc.Spec.Medusa.ContainerImage)

Check failure on line 89 in controllers/k8ssandra/medusa_reconciler.go

View workflow job for this annotation

GitHub Actions / Run unit/integration tests

undefined: namespace

// Add the volumes previously computed to the Medusa standalone pod
for _, volume := range volumes {
Expand Down
7 changes: 4 additions & 3 deletions pkg/medusa/reconcile.go
Original file line number Diff line number Diff line change
Expand Up @@ -505,7 +505,7 @@ func MedusaPurgeCronJobName(clusterName string, dcName string) string {
return fmt.Sprintf("%s-%s-medusa-purge", clusterName, dcName)
}

func StandaloneMedusaDeployment(medusaContainer corev1.Container, clusterName, dcName, namespace string, logger logr.Logger) *appsv1.Deployment {
func StandaloneMedusaDeployment(medusaContainer corev1.Container, clusterName, dcName, namespace string, logger logr.Logger, medusaImage *images.Image) *appsv1.Deployment {
// The standalone medusa pod won't be able to resolve its own IP address using DNS entries
medusaContainer.Env = append(medusaContainer.Env, corev1.EnvVar{Name: "MEDUSA_RESOLVE_IP_ADDRESSES", Value: "False"})
medusaDeployment := &appsv1.Deployment{
Expand All @@ -530,8 +530,9 @@ func StandaloneMedusaDeployment(medusaContainer corev1.Container, clusterName, d
Containers: []corev1.Container{
medusaContainer,
},
Volumes: []corev1.Volume{},
Hostname: MedusaStandaloneDeploymentName(clusterName, dcName),
ImagePullSecrets: images.CollectPullSecrets(medusaImage.ApplyDefaults(defaultMedusaImage)),
Volumes: []corev1.Volume{},
Hostname: MedusaStandaloneDeploymentName(clusterName, dcName),
},
},
},
Expand Down
36 changes: 36 additions & 0 deletions pkg/medusa/reconcile_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
api "github.com/k8ssandra/k8ssandra-operator/apis/k8ssandra/v1alpha1"
medusaapi "github.com/k8ssandra/k8ssandra-operator/apis/medusa/v1alpha1"
"github.com/k8ssandra/k8ssandra-operator/pkg/cassandra"
"github.com/k8ssandra/k8ssandra-operator/pkg/images"
"github.com/stretchr/testify/assert"
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"
Expand Down Expand Up @@ -595,6 +596,41 @@ func TestInitContainerCustomResources(t *testing.T) {

}

func TestStandaloneMedusaDeploymentImageSettings(t *testing.T) {
medusaSpec := &medusaapi.MedusaClusterTemplate{
StorageProperties: medusaapi.Storage{
StorageProvider: "s3",
StorageSecretRef: corev1.LocalObjectReference{
Name: "secret",
},
BucketName: "bucket",
},
ContainerImage: &images.Image{
Registry: "reg1",
Name: "img1",
Repository: "repo1",
Tag: "tag1",
PullPolicy: "Always",
PullSecretRef: &corev1.LocalObjectReference{Name: "main-secret"},
},
}

dcConfig := cassandra.DatacenterConfig{}

logger := logr.New(logr.Discard().GetSink())

medusaContainer, err := CreateMedusaMainContainer(&dcConfig, medusaSpec, false, "test", logger)
assert.NoError(t, err)
UpdateMedusaInitContainer(&dcConfig, medusaSpec, false, "test", logger)
UpdateMedusaMainContainer(&dcConfig, medusaContainer)

desiredMedusaStandalone := StandaloneMedusaDeployment(*medusaContainer, "dc1", dcConfig.SanitizedName(), "test", logger, medusaSpec.ContainerImage)

assert.Equal(t, "main-secret", desiredMedusaStandalone.Spec.Template.Spec.ImagePullSecrets[0].Name, "expected standalone container image pull secret to be set")
assert.Equal(t, "reg1/repo1/img1:tag1", desiredMedusaStandalone.Spec.Template.Spec.Containers[0].Image, "expected standalone container image to be set to reg1/repo1/img1:tag1")
assert.Equal(t, corev1.PullAlways, desiredMedusaStandalone.Spec.Template.Spec.Containers[0].ImagePullPolicy, "expected standalone pull policy to be set to Always")
}

func TestExternalSecretsFlag(t *testing.T) {
medusaSpec := &medusaapi.MedusaClusterTemplate{
StorageProperties: medusaapi.Storage{
Expand Down

0 comments on commit f552dad

Please sign in to comment.