{"id":13607725,"url":"https://github.com/datastax/cass-operator","last_synced_at":"2025-04-05T02:11:57.804Z","repository":{"id":41261721,"uuid":"247164126","full_name":"datastax/cass-operator","owner":"datastax","description":"The DataStax Kubernetes Operator for Apache Cassandra","archived":false,"fork":false,"pushed_at":"2023-12-18T21:46:37.000Z","size":2102,"stargazers_count":257,"open_issues_count":94,"forks_count":78,"subscribers_count":25,"default_branch":"master","last_synced_at":"2024-12-19T20:02:46.701Z","etag":null,"topics":["cassandra","kubernetes","operator"],"latest_commit_sha":null,"homepage":"https://docs.datastax.com/en/cass-operator/doc/cass-operator/cassOperatorGettingStarted.html","language":"Go","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/datastax.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null}},"created_at":"2020-03-13T21:25:20.000Z","updated_at":"2024-11-08T11:39:18.000Z","dependencies_parsed_at":"2024-02-10T09:40:35.025Z","dependency_job_id":"383b3a37-9195-499c-b82c-342ea57f5de3","html_url":"https://github.com/datastax/cass-operator","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datastax%2Fcass-operator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datastax%2Fcass-operator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datastax%2Fcass-operator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/datastax%2Fcass-operator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/datastax","download_url":"https://codeload.github.com/datastax/cass-operator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247276189,"owners_count":20912288,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cassandra","kubernetes","operator"],"created_at":"2024-08-01T19:01:21.005Z","updated_at":"2025-04-05T02:11:57.789Z","avatar_url":"https://github.com/datastax.png","language":"Go","funding_links":[],"categories":["Go","Repository is obsolete","General"],"sub_categories":["Awesome Operators in the Wild","Cassandra Deployment"],"readme":"# Cass Operator\n[![Gitter](https://badges.gitter.im/cass-operator/community.svg)](https://gitter.im/cass-operator/community?utm_source=badge\u0026utm_medium=badge\u0026utm_campaign=pr-badge)\n[![Go Report Card](https://goreportcard.com/badge/github.com/datastax/cass-operator)](https://goreportcard.com/report/github.com/datastax/cass-operator)\n[![License: Apache License 2.0](https://img.shields.io/github/license/datastax/cass-operator)](https://github.com/datastax/cass-operator/blob/master/LICENSE.txt)\n\nThe DataStax Kubernetes Operator for Apache Cassandra\u0026reg;\n\n:warning: *** [Ongoing development of cass-operator and future releases have been migrated to the K8ssandra project. Head over to the new repo for more information on using cass-operator!](https://github.com/k8ssandra/cass-operator) *** :warning:\n\n## Getting Started\n\nQuick start:\n```console\n# *** This is for GKE Regular Channel - k8s 1.16 -\u003e Adjust based on your cloud or storage options\nkubectl create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.6.0/docs/user/cass-operator-manifests-v1.16.yaml\nkubectl create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.6.0/operator/k8s-flavors/gke/storage.yaml\nkubectl -n cass-operator create -f https://raw.githubusercontent.com/datastax/cass-operator/v1.6.0/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml\n```\n\n### Loading the operator\n\nInstalling the Cass Operator itself is straightforward. We have provided manifests for each Kubernetes version from 1.15 through 1.19. Apply the relevant manifest to your cluster as follows:\n\n```console\nK8S_VER=v1.16\nkubectl apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.6.0/docs/user/cass-operator-manifests-$K8S_VER.yaml\n```\n\nNote that since the manifest will install a [Custom Resource Definition](https://kubernetes.io/docs/concepts/extend-kubernetes/api-extension/custom-resources/), the user running the above command will need cluster-admin privileges.\n\nThis will deploy the operator, along with any requisite resources such as Role, RoleBinding, etc., to the `cass-operator` namespace. You can check to see if the operator is ready as follows:\n\n```console\n$ kubectl -n cass-operator get pods --selector name=cass-operator\nNAME                             READY   STATUS    RESTARTS   AGE\ncass-operator-555577b9f8-zgx6j   1/1     Running   0          25h\n```\n\n### Creating a storage class\n\nYou will need to create an appropriate storage class which will define the type of storage to use for Cassandra nodes in a cluster. For example, here is a storage class for using SSDs in GKE, which you can also find at [operator/deploy/k8s-flavors/gke/storage.yaml](operator/k8s-flavors/gke/storage.yaml):\n\n```yaml\napiVersion: storage.k8s.io/v1\nkind: StorageClass\nmetadata:\n  name: server-storage\nprovisioner: kubernetes.io/gce-pd\nparameters:\n  type: pd-ssd\n  replication-type: none\nvolumeBindingMode: WaitForFirstConsumer\nreclaimPolicy: Delete\n```\n\nApply the above as follows:\n\n```\nkubectl apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.6.0/operator/k8s-flavors/gke/storage.yaml\n```\n\n### Creating a CassandraDatacenter\n\nThe following resource defines a Cassandra 3.11.7 datacenter with 3 nodes on one rack, which you can also find at [operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml](operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml):\n\n```yaml\napiVersion: cassandra.datastax.com/v1beta1\nkind: CassandraDatacenter\nmetadata:\n  name: dc1\nspec:\n  clusterName: cluster1\n  serverType: cassandra\n  serverVersion: 3.11.7\n  managementApiAuth:\n    insecure: {}\n  size: 3\n  storageConfig:\n    cassandraDataVolumeClaimSpec:\n      storageClassName: server-storage\n      accessModes:\n      - ReadWriteOnce\n      resources:\n        requests:\n          storage: 5Gi\n  config:\n    cassandra-yaml:\n      authenticator: org.apache.cassandra.auth.PasswordAuthenticator\n      authorizer: org.apache.cassandra.auth.CassandraAuthorizer\n      role_manager: org.apache.cassandra.auth.CassandraRoleManager\n    jvm-options:\n      initial_heap_size: 800M\n      max_heap_size: 800M\n```\n\nApply the above as follows:\n\n```console\nkubectl -n cass-operator apply -f https://raw.githubusercontent.com/datastax/cass-operator/v1.6.0/operator/example-cassdc-yaml/cassandra-3.11.x/example-cassdc-minimal.yaml\n```\n\nYou can check the status of pods in the Cassandra cluster as follows:\n\n```console\n$ kubectl -n cass-operator get pods --selector cassandra.datastax.com/cluster=cluster1\nNAME                         READY   STATUS    RESTARTS   AGE\ncluster1-dc1-default-sts-0   2/2     Running   0          26h\ncluster1-dc1-default-sts-1   2/2     Running   0          26h\ncluster1-dc1-default-sts-2   2/2     Running   0          26h\n```\n\nYou can check to see the current progress of bringing the Cassandra datacenter online by checking the `cassandraOperatorProgress` field of the `CassandraDatacenter`'s `status` sub-resource as follows:\n\n```console\n$ kubectl -n cass-operator get cassdc/dc1 -o \"jsonpath={.status.cassandraOperatorProgress}\"\nReady\n```\n\n(`cassdc` and `cassdcs` are supported short forms of `CassandraDatacenter`.)\n\nA value of \"Ready\", as above, means the operator has finished setting up the Cassandra datacenter.\n\nYou can also check the Cassandra cluster status using `nodetool` by invoking it on one of the pods in the Cluster as follows:\n\n```console\n$ kubectl -n cass-operator exec -it -c cassandra cluster1-dc1-default-sts-0 -- nodetool status\nDatacenter: dc1\n===============\nStatus=Up/Down\n|/ State=Normal/Leaving/Joining/Moving/Stopped\n--  Address         Load       Tokens       Owns (effective)  Host ID                               Rack\nUN  10.233.105.125  224.82 KiB  1            65.4%             5e29b4c9-aa69-4d53-97f9-a3e26115e625  r1\nUN  10.233.92.96    186.48 KiB  1            61.6%             b119eae5-2ff4-4b06-b20b-c492474e59a6  r1\nUN  10.233.90.54    205.1 KiB   1            73.1%             0a96e814-dcf6-48b9-a2ca-663686c8a495  r1\n```\n\nThe operator creates a secure Cassandra cluster by default, with a new superuser (not the traditional `cassandra` user) and a random password. You can get those out of a Kubernetes secret and use them to log into your Cassandra cluster for the first time. For example:\n\n```console\n$ # get CASS_USER and CASS_PASS variables into the current shell\n$ CASS_USER=$(kubectl -n cass-operator get secret cluster1-superuser -o json | jq -r '.data.username' | base64 --decode)\n$ CASS_PASS=$(kubectl -n cass-operator get secret cluster1-superuser -o json | jq -r '.data.password' | base64 --decode)\n$ kubectl -n cass-operator exec -ti cluster1-dc1-default-sts-0 -c cassandra -- sh -c \"cqlsh -u '$CASS_USER' -p '$CASS_PASS'\"\n\nConnected to cluster1 at 127.0.0.1:9042.\n[cqlsh 5.0.1 | Cassandra 3.11.6 | CQL spec 3.4.4 | Native protocol v4]\nUse HELP for help.\n\ncluster1-superuser@cqlsh\u003e select * from system.peers;\n\n peer      | data_center | host_id                              | preferred_ip | rack    | release_version | rpc_address | schema_version                       | tokens\n-----------+-------------+--------------------------------------+--------------+---------+-----------------+-------------+--------------------------------------+--------------------------\n 10.28.0.4 |         dc1 | 4bf5e110-6c19-440e-9d97-c013948f007c |         null | default |          3.11.6 |   10.28.0.4 | e84b6a60-24cf-30ca-9b58-452d92911703 | {'-7957039572378599263'}\n 10.28.5.5 |         dc1 | 3e84b0f1-9c1e-4deb-b6f8-043731eaead4 |         null | default |          3.11.6 |   10.28.5.5 | e84b6a60-24cf-30ca-9b58-452d92911703 | {'-3984092431318102676'}\n\n(2 rows)\n```\n\n### (Optional) Loading the operator via Helm\n\nHelm may be used to install the operator. Consider installing it from our Helm Charts repo\n\n```console\nhelm repo add datastax https://datastax.github.io/charts\nhelm repo update\n\n# Helm 2\nhelm install datastax/cass-operator\n\n# Helm 3\nhelm install cass-operator datastax/cass-operator\n```\n\n_or via a local checkout_\n\n```console\nkubectl create namespace cass-operator-system\nhelm install --namespace=cass-operator-system cass-operator ./charts/cass-operator-chart\n```\n\nThe following Helm default values may be overridden:\n\n```yaml\nclusterWideInstall: false\nserviceAccountName: cass-operator\nclusterRoleName: cass-operator-cr\nclusterRoleBindingName: cass-operator-crb\nroleName: cass-operator\nroleBindingName: cass-operator\nwebhookClusterRoleName: cass-operator-webhook\nwebhookClusterRoleBindingName: cass-operator-webhook\ndeploymentName: cass-operator\ndeploymentReplicas: 1\ndefaultImage: \"datastax/cass-operator:1.6.0\"\nimagePullPolicy: IfNotPresent\nimagePullSecret: \"\"\n```\n\nNOTE: roleName and roleBindingName will be used for a clusterRole and clusterRoleBinding if clusterWideInstall is set to true.\n\nNOTE: Helm does not install a storage-class for the cassandra pods.\n\nIf clusterWideInstall is set to true, then the operator will be able to administer `CassandraDatacenter`s in all namespaces of the kubernetes cluster.  A namespace must still be provided because some of the kubernetes resources for the operator require one.\n\nExample:\n\n```console\nkubectl create namespace cass-operator-system\nhelm install --set clusterWideInstall=true --namespace=cass-operator-system cass-operator ./charts/cass-operator-chart\n```\n\n#### Using a custom Docker registry with the Helm Chart\n\nA custom Docker registry may be used as the source of the operator Docker image.  Before \"helm install\" is run, a Secret of type \"docker-registry\" should be created with the proper credentials.\n\nThen the \"imagePullSecret\" helm value may be set to the name of the ImagePullSecret to cause the custom Docker registry to be used.\n\n##### Custom Docker registry example: Github packages\n\nGithub Packages may be used as a custom Docker registry.\n\nFirst, a Github personal access token must be created.\n\nSee:\n\nhttps://docs.github.com/en/github/authenticating-to-github/creating-a-personal-access-token\n\nSecond, the access token will be used to create the Secret:\n\n```console\nkubectl create secret docker-registry github-docker-registry --docker-username=USERNAME --docker-password=ACCESSTOKEN --docker-server docker.pkg.github.com\n```\n\nReplace USERNAME with the github username and ACCESSTOKEN with the personal access token.\n\nNow we can run \"helm install\" with the override value for imagePullSecret.  This is often used with an override value for image so that a specific tag can be chosen.  Note that the image value should include the full path to the custom registry.\n\n```console\nhelm install --set image=docker.pkg.github.com/datastax/cass-operator/operator:latest-ubi --set imagePullSecrets=github-docker-registry cass-operator ./charts/cass-operator-chart\n```\n\n## Features\n\n- Proper token ring initialization, with only one node bootstrapping at a time\n- Seed node management - one per rack, or three per datacenter, whichever is more\n- Server configuration integrated into the CassandraDatacenter CRD\n- Rolling reboot nodes by changing the CRD\n- Store data in a rack-safe way - one replica per cloud AZ\n- Scale up racks evenly with new nodes\n- Scale down racks evenly by decommissioning existing nodes\n- Replace dead/unrecoverable nodes\n- Multi DC clusters (limited to one Kubernetes namespace)\n\nAll features are documented in the [User Documentation](docs/user/README.md).\n\n### Containers\n\nThe operator is comprised of the following container images working in concert:\n* The operator, built from sources in the [operator](operator/) directory.\n* The config builder init container, built from sources in [datastax/cass-config-builder](https://github.com/datastax/cass-config-builder).\n* Cassandra, built from\n  [datastax/management-api-for-apache-cassandra](https://github.com/datastax/management-api-for-apache-cassandra),\n  with Cassandra 3.11.7 support, and experimental support for Cassandra\n  4.0-beta1.\n* ... or DSE, built from [datastax/docker-images](https://github.com/datastax/docker-images).\n\n### Overriding properties of cass-operator created Containers\n\nIf the CassandraDatacenter specifies a podTemplateSpec field, then containers with specific names can be used to override default settings in containers that will be created by cass-operator.\n\nCurrently cass-operator will create an InitContainer with the name of \"server-config-init\". Normal Containers that will be created have the names \"cassandra\", \"server-system-logger\", and optionally \"reaper\". \n\nIn general, the values specified in this way by the user will override anything generated by cass-operator.\n\nOf special note is that user-specified environment variables, ports, and volumes in the corresponding containers will be added to the values that cass-operator automatically generates for those containers.\n\n```yaml\napiVersion: cassandra.datastax.com/v1beta1\nkind: CassandraDatacenter\nmetadata:\n  name: dc1\nspec:\n  clusterName: cluster1\n  serverType: cassandra\n  serverVersion: 3.11.7\n  managementApiAuth:\n    insecure: {}\n  size: 3\n  podTemplateSpec:\n    spec:\n      initContainers:\n        - name: \"server-config-init\"\n          env:\n          - name: \"EXTRA_PARAM\"\n            value: \"123\"\n      containers:\n        - name: \"cassandra\"\n          terminationMessagePath: \"/dev/other-termination-log\"\n          terminationMessagePolicy: \"File\"\n  storageConfig:\n    cassandraDataVolumeClaimSpec:\n      storageClassName: server-storage\n      accessModes:\n      - ReadWriteOnce\n      resources:\n        requests:\n          storage: 5Gi\n  config:\n    cassandra-yaml:\n      authenticator: org.apache.cassandra.auth.PasswordAuthenticator\n      authorizer: org.apache.cassandra.auth.CassandraAuthorizer\n      role_manager: org.apache.cassandra.auth.CassandraRoleManager\n    jvm-options:\n      initial_heap_size: 800M\n      max_heap_size: 800M\n```\n\n## Requirements\n\n- Kubernetes cluster, 1.15 or newer.\n\n## Contributing\n\nAs of version 1.0, Cass Operator is maintained by a team at DataStax and it is\npart of what powers [DataStax\nAstra](https://www.datastax.com/cloud/datastax-astra). We would love for open\nsource users to contribute bug reports, documentation updates, tests, and\nfeatures.\n\n### Developer setup\n\nAlmost every build, test, or development task requires the following\npre-requisites...\n\n* Golang 1.14\n* Docker, either the docker.io packages on Ubuntu, Docker Desktop for Mac,\n  or your preferred docker distribution.\n* [mage](https://magefile.org/): There are some tips for using mage in\n  [docs/developer/mage.md](docs/developer/mage.md)\n\n### Building\n\nThe operator uses [mage](https://magefile.org/) for its build process.\n\n#### Build the Operator Container Image\nThis build task will create the operator container image, building or rebuilding\nthe binary from golang sources if necessary:\n\n``` bash\nmage operator:buildDocker\n```\n\n#### Build the Operator Binary\nIf you wish to perform ONLY to the golang build or rebuild, without creating\na container image:\n\n``` bash\nmage operator:buildGo\n```\n\n### Testing\n\n``` bash\nmage operator:testGo\n```\n\n#### End-to-end Automated Testing\n\nRun fully automated end-to-end tests...\n\n```bash\nmage integ:run\n```\n\nDocs about testing are [here](tests/README.md). These work against any k8s\ncluster with six or more worker nodes.\n\n#### Manual Local Testing\nThere are a number of ways to run the operator, see the following docs for\nmore information:\n* [k8s targets](docs/developer/k8s_targets.md): A set of mage targets for\n  automating a variety of tasks for several different supported k8s flavors.\n  At the moment, we support KIND, k3d, and gke. These targets can setup and\n  manage a local cluster in either KIND or k3d, and also a remote cluster\n  in gke. Both KIND and k3d can simulate a k8s cluster with multiple worker \n  nodes on a single physical machine, though it's necessary to dial down \n  the database memory requests.\n\nThe [user documentation](docs/user/README.md) also contains information on\nspinning up your first operator instance that is useful regardless of what\nKubernetes distribution you're using to do so.\n\n\n## Not (Yet) Supported Features\n\n- Cassandra:\n  - Integrated data repair solution\n  - Integrated backup and restore solution\n- DSE:\n  - Advanced Workloads, like Search / Graph / Analytics\n\n## Uninstall\n\n*This will destroy all of your data!*\n\nDelete your CassandraDatacenters first, otherwise Kubernetes will block deletion because we use a finalizer.\n```\nkubectl delete cassdcs --all-namespaces --all\n```\n\nRemove the operator Deployment, CRD, etc.\n```\nkubectl delete -f https://raw.githubusercontent.com/datastax/cass-operator/v1.6.0/docs/user/cass-operator-manifests-v1.16.yaml\n```\n\n## Contacts\n\nFor development questions, please reach out on [Gitter](https://gitter.im/cass-operator/community), or by opening an issue on GitHub.\n\nFor usage questions, please visit our Community Forums: https://community.datastax.com\n\n## License\n\nCopyright DataStax, Inc.\n\nLicensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in compliance with the License. You may obtain a copy of the License at\n\nhttp://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatastax%2Fcass-operator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdatastax%2Fcass-operator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdatastax%2Fcass-operator/lists"}