Skip to content

Conversation

@jsanda
Copy link
Collaborator

@jsanda jsanda commented Oct 31, 2020

Cass Operator has the ability to deploy Reaper in sidecar mode. Due to #211 it is not very usable. This PR introduces new and improved integration where Reaper is run as a separate deployment. Cass Operator does not deploy Reaper. This is handled by reaper-operator.

A CassandraDatacenter only needs to specify a couple things as illustrated in this example:

apiVersion: cassandra.datastax.com/v1beta1
kind: CassandraDatacenter
metadata:
  name: dc1
spec:
  clusterName: reaper-test
  serverType: cassandra
  serverVersion: 3.11.7
  managementApiAuth:
    insecure: {}
  size: 3
  allowMultipleNodesPerWorker: false
  config:
    jvm-options:
      initial_heap_size: "800m"
      max_heap_size: "800m"
  resources:
    requests:
      cpu: 2
      memory: 2Gi
    limits:
      cpu: 2
      memory: 2Gi
  reaper:
    enabled: true
    # This is optional. cass-operator will generate a secret if this
    # is not set.
    jmxSecretName: reaper-jmx
    name: reaper-cassdc
  storageConfig:
    cassandraDataVolumeClaimSpec:
      storageClassName: server-storage
      accessModes:
      - ReadWriteOnce
      resources:
        requests:
          storage: 5Gi

When Reaper is deployed on its own, it requires remote JMX for running repairs. This PR introduces changes to configure the cluster with remote JMX when .spec.reaper.enabled is true.

.spec.reaper.name specifies the name of a Reaper object. A namespace can also be specified if the Reaper object lives in a different namespace.

Here is what a Reaper manifest looks like:

apiVersion: reaper.cassandra-reaper.io/v1alpha1
kind: Reaper
metadata:
  name: reaper-cassdc
spec:
  serverConfig:
    storageType: cassandra
    jmxUserSecretName: reaper-test-reaper-jmx
    cassandraBackend:
      clusterName: reaper-test
      replication:
        networkTopologyStrategy:
          dc1: 3
      cassandraService: reaper-test-dc1-service

In this example the Reaper object is configured to also use the Cassandra cluster as its backend; however, this is not required.

When Reaper is run in sidecar mode, it will auto register the cluster to which it is attached. This PR includes changes to automatically register the C* cluster with Reaper. It also includes checks to ensure it remains registered.

There are probably more changes needed with this PR, but it is ready for review.

@bradfordcp
Copy link
Member

If the operator isn't doing anything with this reaper information would it make more sense to use an annotation instead of fields in the spec?

@jsanda
Copy link
Collaborator Author

jsanda commented Oct 31, 2020 via email

@bradfordcp
Copy link
Member

Gotcha, I did not pick up on that from the text. I'll dig into this in a bit.

@jsanda
Copy link
Collaborator Author

jsanda commented Oct 31, 2020 via email

@jsanda
Copy link
Collaborator Author

jsanda commented Oct 31, 2020

If the operator isn't doing anything with this reaper information would it make more sense to use an annotation instead of fields in the spec?

I thought some more about this. The CassandraDatacenter would need to specify two annotations:

  • one with the name of the Reaper instance
  • one with the name of the JMX credentials secret

I could then have a controller in reaper-operator that watches CassandraDatacenters and takes action if those annotations are present. In particular, the controller would make the REST call to Reaper to register the Cassandra cluster.

We would still need cass-operator to set up remote JMX though which it is doing based on .spec.reaper.enabled being true. Other than that cass-operator would not have to do anything Reaper specific as it is doing in this PR. I think that would be a plus.

@bradfordcp / @jimdickinson wdyt?

DatacenterResuming DatacenterConditionType = "Resuming"
DatacenterRollingRestart DatacenterConditionType = "RollingRestart"
DatacenterValid DatacenterConditionType = "Valid"
DatacenterReaperManage DatacenterConditionType = "Reaper"
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit - did you mean Manage? or Manager or Managed?

}

type ReaperConfig struct {
// Other properties in ReaperConfig are ignores unless this is set to true. When set to
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
// Other properties in ReaperConfig are ignores unless this is set to true. When set to
// Other properties in ReaperConfig are ignored unless this is set to true. When set to

type ReaperConfig struct {
// Other properties in ReaperConfig are ignores unless this is set to true. When set to
// true, the operator will enable remote JMX in the Cassandra cluster since Reaper
// manages repairs via JMX. Note that setting this to true after the Cassandra cluster
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit - is this more clear about the expected behavior?

Suggested change
// manages repairs via JMX. Note that setting this to true after the Cassandra cluster
// manages repairs via JMX. Note that toggling this to true after the Cassandra cluster

@jsanda
Copy link
Collaborator Author

jsanda commented Nov 1, 2020

I prototyped a new controller in reaper-operator that watches CassandraDatacenters. The code lives here https://github.com/jsanda/reaper-operator/blob/cassdc-controller/controllers/cassandradatacenter_controller.go. I am going to move forward with this approach.

For this PR that means I only need the changes for setting up remote JMX. I am going to update the PR accordingly. I am still going to remove the Reaper sidecar stuff since it was broken.

In summary, setting .spec.reaper.enabled to true will result only result in cass-operator enabling and configuring remote JMX.

@jsanda
Copy link
Collaborator Author

jsanda commented Nov 1, 2020

@jimdickinson I removed Reaper specific code since that will be handled in reaper-operator. We can probably remove enable_reaper_test_suite.go as well.

I think it would make more sense to add something like:

type RemoteJmxConfig struct  {
        Enabled bool

        JmxSecretName string
}

Remote JMX is not specific to Reaper. As a user who wants to use some remote management tool (other than Reaper) with my cluster, .spec.remoteJmx.enabled would be more obvious and clear than .spec.reaper.enabled. If we add something like this, I would still leave the existing ReaperConfig struct as is for deprecation.

@bradfordcp
Copy link
Member

Rerunning checks

}
//if recResult := rc.CheckReaperSchemaInitialized(); recResult.Completed() {
// return recResult.Output()
//}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just delete these lines if not needed?

We want the server config init container to run first so other initContainers
can access the server config files.
@jsanda
Copy link
Collaborator Author

jsanda commented Dec 17, 2020

I am closing this out. See #335 for details.

@jsanda jsanda closed this Dec 17, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants