Skip to content
Open
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 @@ -5950,44 +5950,6 @@ spec:
- name
type: object
type: array
reaper:
properties:
enabled:
type: boolean
image:
type: string
imagePullPolicy:
description: PullPolicy describes a policy for if/when to pull a
container image
type: string
resources:
description: Kubernetes resource requests and limits per reaper
container.
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
type: object
replaceNodes:
description: A list of pod names that need to be replaced.
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5962,44 +5962,6 @@ spec:
- name
type: object
type: array
reaper:
properties:
enabled:
type: boolean
image:
type: string
imagePullPolicy:
description: PullPolicy describes a policy for if/when to pull a
container image
type: string
resources:
description: Kubernetes resource requests and limits per reaper
container.
properties:
limits:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Limits describes the maximum amount of compute
resources allowed. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
requests:
additionalProperties:
anyOf:
- type: integer
- type: string
pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$
x-kubernetes-int-or-string: true
description: 'Requests describes the minimum amount of compute
resources required. If Requests is omitted for a container,
it defaults to Limits if that is explicitly specified, otherwise
to an implementation-defined value. More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/'
type: object
type: object
type: object
replaceNodes:
description: A list of pod names that need to be replaced.
items:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,8 +174,6 @@ type CassandraDatacenterSpec struct {

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

Reaper *ReaperConfig `json:"reaper,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what happens if I had this and I was using 1.5.0, then I upgrade and we rip it out?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's a good question. I will test and report back my findings.


// Configuration for disabling the simple log tailing sidecar container. Our default is to have it enabled.
DisableSystemLoggerSidecar bool `json:"disableSystemLoggerSidecar,omitempty"`

Expand Down Expand Up @@ -359,17 +357,6 @@ type ManagementApiAuthConfig struct {
// other strategy configs (e.g. Cert Manager) go here
}

type ReaperConfig struct {
Enabled bool `json:"enabled,omitempty"`

Image string `json:"image,omitempty"`

ImagePullPolicy corev1.PullPolicy `json:"imagePullPolicy,omitempty"`

// Kubernetes resource requests and limits per reaper container.
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// CassandraDatacenterList contains a list of CassandraDatacenter
Expand Down Expand Up @@ -424,13 +411,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
22 changes: 0 additions & 22 deletions operator/pkg/apis/cassandra/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 0 additions & 17 deletions operator/pkg/reconciliation/construct_podtemplatespec.go
Original file line number Diff line number Diff line change
Expand Up @@ -289,21 +289,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 @@ -422,12 +417,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 @@ -441,12 +430,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
74 changes: 2 additions & 72 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,11 +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 +242,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 +266,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/datastax/cass-operator/operator/pkg/oplabels"
"github.com/datastax/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),
},
},
},
},
},
},
},
}
}
8 changes: 0 additions & 8 deletions operator/pkg/reconciliation/reconcile_racks.go
Original file line number Diff line number Diff line change
Expand Up @@ -2318,14 +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