Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6024,6 +6024,12 @@ spec:
type: object
type: array
reaper:
description: 'Deprecated: Reaper''s sidecar mode has too many problems
in Kubernetes for it to usable. In order for it to work reliably,
changes in Reaper would be needed. See https://github.com/thelastpickle/cassandra-reaper/issues/956
for details. Because those changes were not implemented in Reaper
and because Reaper support was instead added through k8ssandra, this
field will be removed in the 1.8.0 release.'
properties:
enabled:
type: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6036,6 +6036,12 @@ spec:
type: object
type: array
reaper:
description: 'Deprecated: Reaper''s sidecar mode has too many problems
in Kubernetes for it to usable. In order for it to work reliably,
changes in Reaper would be needed. See https://github.com/thelastpickle/cassandra-reaper/issues/956
for details. Because those changes were not implemented in Reaper
and because Reaper support was instead added through k8ssandra, this
field will be removed in the 1.8.0 release.'
properties:
enabled:
type: boolean
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ type CassandraDatacenterSpec struct {

AdditionalSeeds []string `json:"additionalSeeds,omitempty"`

// Deprecated: Reaper's sidecar mode has too many problems in Kubernetes for it to
// usable. In order for it to work reliably, changes in Reaper would be needed. See
// https://github.com/thelastpickle/cassandra-reaper/issues/956 for details. Because
// those changes were not implemented in Reaper and because Reaper support was instead
// added through k8ssandra, this field will be removed in the 1.8.0 release.
Reaper *ReaperConfig `json:"reaper,omitempty"`

// Configuration for disabling the simple log tailing sidecar container. Our default is to have it enabled.
Expand Down Expand Up @@ -457,13 +462,6 @@ func (dc *CassandraDatacenter) GetRackLabels(rackName string) map[string]string
return labels
}

func (dc *CassandraDatacenter) IsReaperEnabled() bool {
if dc.Spec.Reaper != nil && dc.Spec.Reaper.Enabled && dc.Spec.ServerType == "cassandra" {
return true
}
return false
}

func (status *CassandraDatacenterStatus) GetConditionStatus(conditionType DatacenterConditionType) corev1.ConditionStatus {
for _, condition := range status.Conditions {
if condition.Type == conditionType {
Expand Down
6 changes: 0 additions & 6 deletions operator/pkg/images/images.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,6 @@ const (
UBIConfigBuilder

BusyBox
Reaper
BaseImageOS
SystemLoggerImage

Expand Down Expand Up @@ -104,7 +103,6 @@ var imageLookupMap map[Image]string = map[Image]string{
UBIConfigBuilder: "datastax/cass-config-builder:1.0.3-ubi7",

BusyBox: "busybox:1.32.0-uclibc",
Reaper: "thelastpickle/cassandra-reaper:2.0.5",
SystemLoggerImage: "k8ssandra/system-logger:latest",
}

Expand Down Expand Up @@ -271,10 +269,6 @@ func GetConfigBuilderImage() string {
}
}

func GetReaperImage() string {
return GetImage(Reaper)
}

func GetSystemLoggerImage() string {
return GetImage(SystemLoggerImage)
}
Expand Down
17 changes: 0 additions & 17 deletions operator/pkg/reconciliation/construct_podtemplatespec.go
Original file line number Diff line number Diff line change
Expand Up @@ -328,21 +328,16 @@ func buildContainers(dc *api.CassandraDatacenter, baseTemplate *corev1.PodTempla

cassContainer := &corev1.Container{}
loggerContainer := &corev1.Container{}
reaperContainer := &corev1.Container{}

foundCass := false
foundLogger := false
foundReaper := false
for i, c := range baseTemplate.Spec.Containers {
if c.Name == CassandraContainerName {
foundCass = true
cassContainer = &baseTemplate.Spec.Containers[i]
} else if c.Name == SystemLoggerContainerName {
foundLogger = true
loggerContainer = &baseTemplate.Spec.Containers[i]
} else if c.Name == ReaperContainerName {
foundReaper = true
reaperContainer = &baseTemplate.Spec.Containers[i]
}
}

Expand Down Expand Up @@ -462,12 +457,6 @@ func buildContainers(dc *api.CassandraDatacenter, baseTemplate *corev1.PodTempla

loggerContainer.Resources = *getResourcesOrDefault(&dc.Spec.SystemLoggerResources, &DefaultsLoggerContainer)

// Reaper Container

if dc.IsReaperEnabled() {
buildReaperContainer(dc, reaperContainer)
}

// Note that append() can make copies of each element,
// so we call it after modifying any existing elements.

Expand All @@ -481,12 +470,6 @@ func buildContainers(dc *api.CassandraDatacenter, baseTemplate *corev1.PodTempla
}
}

if dc.IsReaperEnabled() {
if !foundReaper {
baseTemplate.Spec.Containers = append(baseTemplate.Spec.Containers, *reaperContainer)
}
}

return nil
}

Expand Down
73 changes: 2 additions & 71 deletions operator/pkg/reconciliation/construct_podtemplatespec_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -203,72 +203,12 @@ func TestCassandraDatacenter_buildContainers_systemlogger_resources_set_when_not
}
}

func TestCassandraDatacenter_buildContainers_reaper_resources(t *testing.T) {
dc := &api.CassandraDatacenter{
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.7",
Reaper: &api.ReaperConfig{
Enabled: true,
Resources: corev1.ResourceRequirements{
Limits: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
Requests: corev1.ResourceList{
"cpu": *resource.NewMilliQuantity(1, resource.DecimalSI),
"memory": *resource.NewScaledQuantity(1, resource.Giga),
},
},
},
},
}

podTemplateSpec := &corev1.PodTemplateSpec{}
err := buildContainers(dc, podTemplateSpec)
containers := podTemplateSpec.Spec.Containers
assert.NotNil(t, containers, "Unexpected containers containers received")
assert.Nil(t, err, "Unexpected error encountered")

assert.Len(t, containers, 3, "Unexpected number of containers containers returned")
assert.Equal(t, containers[2].Resources, dc.Spec.Reaper.Resources,
"reaper container resources have unexpected values.")
}

func TestCassandraDatacenter_buildContainers_reaper_resources_set_when_not_specified(t *testing.T) {
dc := &api.CassandraDatacenter{
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.7",
Reaper: &api.ReaperConfig{
Enabled: true,
},
},
}

podTemplateSpec := &corev1.PodTemplateSpec{}
err := buildContainers(dc, podTemplateSpec)
containers := podTemplateSpec.Spec.Containers
assert.NotNil(t, containers, "Unexpected containers containers received")
assert.Nil(t, err, "Unexpected error encountered")

assert.Len(t, containers, 3, "Unexpected number of containers containers returned")
if !reflect.DeepEqual(containers[2].Resources, DefaultsReaperContainer) {
t.Error("reaper container resources are not set to the default values.")
}
}

func TestCassandraDatacenter_buildContainers_use_cassandra_settings(t *testing.T) {
dc := &api.CassandraDatacenter{
Spec: api.CassandraDatacenterSpec{
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.7",
Reaper: &api.ReaperConfig{
Enabled: true,
},
},
}

Expand All @@ -290,10 +230,7 @@ func TestCassandraDatacenter_buildContainers_use_cassandra_settings(t *testing.T
assert.NotNil(t, containers, "Unexpected containers containers received")
assert.Nil(t, err, "Unexpected error encountered")

assert.Len(t, containers, 3, "Unexpected number of containers containers returned")
if !reflect.DeepEqual(containers[2].Resources, DefaultsReaperContainer) {
t.Error("reaper container resources are not set to the default values.")
}
assert.Len(t, containers, 2, "Unexpected number of containers containers returned")

if !reflect.DeepEqual(containers[0].Env[0].Name, "k1") {
t.Errorf("Unexpected env vars allocated for the cassandra container: %v", containers[0].Env)
Expand All @@ -306,9 +243,6 @@ func TestCassandraDatacenter_buildContainers_override_other_containers(t *testin
ClusterName: "bob",
ServerType: "cassandra",
ServerVersion: "3.11.7",
Reaper: &api.ReaperConfig{
Enabled: true,
},
},
}

Expand All @@ -333,10 +267,7 @@ func TestCassandraDatacenter_buildContainers_override_other_containers(t *testin
assert.NotNil(t, containers, "Unexpected containers containers received")
assert.Nil(t, err, "Unexpected error encountered")

assert.Len(t, containers, 3, "Unexpected number of containers containers returned")
if !reflect.DeepEqual(containers[2].Resources, DefaultsReaperContainer) {
t.Error("reaper container resources are not set to the default values.")
}
assert.Len(t, containers, 2, "Unexpected number of containers containers returned")

if !reflect.DeepEqual(containers[0].VolumeMounts,
[]corev1.VolumeMount{
Expand Down
44 changes: 0 additions & 44 deletions operator/pkg/reconciliation/constructor.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ import (
"github.com/k8ssandra/cass-operator/operator/pkg/oplabels"
"github.com/k8ssandra/cass-operator/operator/pkg/utils"

batchv1 "k8s.io/api/batch/v1"
corev1 "k8s.io/api/core/v1"
policyv1beta1 "k8s.io/api/policy/v1beta1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
Expand Down Expand Up @@ -65,45 +63,3 @@ func setOperatorProgressStatus(rc *ReconciliationContext, newState api.ProgressS

return nil
}

func buildInitReaperSchemaJob(dc *api.CassandraDatacenter) *batchv1.Job {
return &batchv1.Job{
TypeMeta: metav1.TypeMeta{
Kind: "Job",
APIVersion: "batch/v1",
},
ObjectMeta: metav1.ObjectMeta{
Namespace: dc.Namespace,
Name: getReaperSchemaInitJobName(dc),
Labels: dc.GetDatacenterLabels(),
},
Spec: batchv1.JobSpec{
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
RestartPolicy: corev1.RestartPolicyOnFailure,
Containers: []corev1.Container{
{
Name: getReaperSchemaInitJobName(dc),
Image: ReaperSchemaInitJobImage,
ImagePullPolicy: corev1.PullIfNotPresent,
Env: []corev1.EnvVar{
{
Name: "KEYSPACE",
Value: ReaperKeyspace,
},
{
Name: "CONTACT_POINTS",
Value: dc.GetSeedServiceName(),
},
{
Name: "REPLICATION",
Value: getReaperReplication(dc),
},
},
},
},
},
},
},
}
}
9 changes: 1 addition & 8 deletions operator/pkg/reconciliation/reconcile_racks.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ import (
"github.com/k8ssandra/cass-operator/operator/pkg/events"
"github.com/k8ssandra/cass-operator/operator/pkg/httphelper"
"github.com/k8ssandra/cass-operator/operator/pkg/oplabels"
"github.com/k8ssandra/cass-operator/operator/pkg/utils"
"github.com/k8ssandra/cass-operator/operator/pkg/psp"
"github.com/k8ssandra/cass-operator/operator/pkg/utils"
)

var (
Expand Down Expand Up @@ -2318,13 +2318,6 @@ func (rc *ReconciliationContext) ReconcileAllRacks() (reconcile.Result, error) {
return recResult.Output()
}

if recResult := rc.CheckReaperService(); recResult.Completed() {
return recResult.Output()
}

if recResult := rc.CheckReaperSchemaInitialized(); recResult.Completed() {
return recResult.Output()
}

if recResult := rc.CheckRollingRestart(); recResult.Completed() {
return recResult.Output()
Expand Down
Loading