Skip to content

Commit

Permalink
Merge branch 'main' into docs/docs-refresh
Browse files Browse the repository at this point in the history
  • Loading branch information
Miles-Garnsey authored Nov 9, 2023
2 parents 6ae401e + 895d27a commit 1779fb0
Show file tree
Hide file tree
Showing 89 changed files with 1,333 additions and 574 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/kind_e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ jobs:
- CreateSingleDatacenterCluster
- CreateStargateAndDatacenter
- CreateSingleReaper
- CreateSingleReaperWStargateAndHTTP
- CreateReaperAndDatacenter
- CreateSingleMedusaJob
- CreateSingleDseMedusaJob
Expand Down Expand Up @@ -130,10 +131,6 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
with:
Expand Down
4 changes: 0 additions & 4 deletions .github/workflows/kind_multicluster_e2e_tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,6 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
with:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,6 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
- name: Install kubectl
run: |
curl -LO "https://dl.k8s.io/release/$(curl -L -s https://dl.k8s.io/release/stable.txt)/bin/linux/amd64/kubectl"
sudo install -o root -g root -m 0755 kubectl /usr/local/bin/kubectl
- name: Install kustomize
uses: imranismail/setup-kustomize@v2
with:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
tags:
- 'docs-v*.*.*'
- 'docs-v*.*.*-*'
- 'v*.*.*'
- 'v*.*.0'

jobs:
build_and_publish:
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/test_and_build_image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,16 @@ jobs:
with:
go-version-file: 'go.mod'
cache: true
- name: Create temporary directory for yq install
run: |
mkdir ${{ runner.temp }}/yq
- name: Install yq
working-directory: ${{ runner.temp }}/yq
run: |
sudo rm /bin/yq
wget https://github.com/mikefarah/yq/releases/download/v4.11.2/yq_linux_amd64.tar.gz
tar -xzf yq_linux_amd64.tar.gz
sudo mv ./yq_linux_amd64 /usr/bin/yq
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
version: latest
# GHA requires longer timeout
args: --timeout=10m
# Optional: show only new issues if it's a pull request. The default value is `false`.
only-new-issues: ${{ github.event_name == 'pull_request' }}
skip-pkg-cache: true
skip-build-cache: true
- name: Run unit and integration tests
run: |
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
Expand Down
20 changes: 19 additions & 1 deletion CHANGELOG/CHANGELOG-1.10.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,22 @@ When cutting a new release, update the `unreleased` heading to the tag being gen

## unreleased

* [BUGFIX] [#1061](https://github.com/k8ssandra/k8ssandra-operator/issues/1061) Point to cass-config-builder 1.0.7 for arm64 compatibility
## v1.10.2 - 2023-10-30

* [BUGFIX] Fix manager kustomization to use the correct coordinates for the operator image

## v1.10.1 - 2023-10-27

* [BUGFIX] [#1109](https://github.com/k8ssandra/k8ssandra-operator/issues/1109) Correctly configure the cr.k8ssandra.io registry

## v1.10.0 - 2023-10-26

* [CHANGE] [#1072](https://github.com/k8ssandra/k8ssandra-operator/issues/1072) Add settings to configure reaper HTTP management interface
* [CHANGE] Upgrade Reaper to v3.4.0
* [CHANGE] [#1088](https://github.com/k8ssandra/k8ssandra-operator/issues/1088) Use the Scarf proxy for image coordinates
* [CHANGE] Update to cass-operator v1.18.1
* [ENHANCEMENT] [#1073](https://github.com/k8ssandra/k8ssandra-operator/issues/1073) Add a namespace label to the Cassandra metrics
* [BUGFIX] [#1060](https://github.com/k8ssandra/k8ssandra-operator/issues/1060) Fix restore mapping shuffling nodes when restoring in place
* [BUGFIX] [#1061](https://github.com/k8ssandra/k8ssandra-operator/issues/1061) Point to cass-config-builder 1.0.7 for arm64 compatibility
* [ENHANCEMENT] [#956](https://github.com/k8ssandra/k8ssandra-operator/issues/956) Enable linting in the project
* [BUGFIX] [#1102](https://github.com/k8ssandra/k8ssandra-operator/issues/1102) Update gRPC maximum receive size to 512MB. Note, the operator might need more max memory than the default to take advantage of this.
16 changes: 16 additions & 0 deletions CHANGELOG/CHANGELOG-1.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Changelog

Changelog for the K8ssandra Operator, new PRs should update the `unreleased` section below with entries describing the changes like:

```markdown
* [CHANGE]
* [FEATURE]
* [ENHANCEMENT]
* [BUGFIX]
* [DOCS]
* [TESTING]
```

When cutting a new release, update the `unreleased` heading to the tag being generated and date, like `## vX.Y.Z - YYYY-MM-DD` and create a new placeholder section for `unreleased` entries.

## unreleased
8 changes: 8 additions & 0 deletions CHANGELOG/CHANGELOG-1.9.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,16 @@ When cutting a new release, update the `unreleased` heading to the tag being gen

## unreleased


## v1.9.2 - 2023-10-19

* [CHANGE] Upgrade to cass-operator v1.17.2 to fix issues with Medusa modifying initContainers when used with Cassandra 4.1

## v1.9.1 - 2023-10-06

* [CHANGE] Upgrade to Reaper v3.3.4 for arm64 support
* [BUGFIX] Upgrade to Medusa v0.16.2 to fix issues with listing backups

## v1.9.0 - 2023-09-20

* [CHANGE] [#1037](https://github.com/k8ssandra/k8ssandra-operator/issues/1037) Upgrade Medusa to v0.16.1
Expand Down
41 changes: 32 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,28 @@ help: ## Display this help.

##@ Development

.PHONY: manifests
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=k8ssandra-operator webhook paths="./..." output:crd:artifacts:config=config/crd/bases

.PHONY: generate
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...

.PHONY: vet
vet: ## Run go vet against code.
go vet ./...

.PHONY: lint
lint: golangci-lint ## Run golangci-lint against code.
$(GOLANGCI_LINT) run ./...

ENVTEST_ASSETS_DIR=$(shell pwd)/testbin
test: manifests generate fmt vet envtest ## Run tests.
test: manifests generate fmt vet lint envtest ## Run tests.
ifdef TEST
@echo Running test $(TEST)
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test $(GO_FLAGS) ./apis/... ./pkg/... ./test/yq/... ./controllers/... -run="$(TEST)" -covermode=atomic -coverprofile coverage.out
Expand Down Expand Up @@ -273,7 +281,8 @@ create-kind-multicluster:
scripts/setup-kind-multicluster.sh --clusters $(NUM_CLUSTERS) --kind-node-version $(KIND_NODE_VERSION) --kind-worker-nodes $(NUM_WORKER_NODES) --output-file $(KIND_KUBECONFIG)

kind-load-image:
kind load docker-image --name $(KIND_CLUSTER) ${IMG}
docker tag ${IMG} cr.k8ssandra.io/${IMG}
kind load docker-image --name $(KIND_CLUSTER) cr.k8ssandra.io/${IMG}

kind-load-image-multi:
for ((i = 0; i < $(NUM_CLUSTERS); ++i)); do \
Expand Down Expand Up @@ -310,11 +319,13 @@ $(LOCALBIN):
KUSTOMIZE ?= $(LOCALBIN)/kustomize
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
ENVTEST ?= $(LOCALBIN)/setup-envtest
GOLANGCI_LINT ?= $(LOCALBIN)/golangci-lint # TODO Add linting to the GHA also

## Tool Versions
CERT_MANAGER_VERSION ?= v1.9.1
KUSTOMIZE_VERSION ?= v4.5.7
CONTROLLER_TOOLS_VERSION ?= v0.11.4
CERT_MANAGER_VERSION ?= v1.12.2
KUSTOMIZE_VERSION ?= v5.0.3
CONTROLLER_TOOLS_VERSION ?= v0.12.0
GOLINT_VERSION ?= 1.55.0

cert-manager: ## Install cert-manager to the cluster
kubectl apply -f https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MANAGER_VERSION)/cert-manager.yaml
Expand Down Expand Up @@ -370,17 +381,29 @@ create-clientconfig:
--dest-context kind-k8ssandra-0; \
done


KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh"
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary.
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
$(KUSTOMIZE): $(LOCALBIN)
@if test -x $(LOCALBIN)/kustomize && ! $(LOCALBIN)/kustomize version | grep -q $(KUSTOMIZE_VERSION); then \
echo "$(LOCALBIN)/kustomize version is not expected $(KUSTOMIZE_VERSION). Removing it before installing."; \
rm -rf $(LOCALBIN)/kustomize; \
fi
test -s $(LOCALBIN)/kustomize || { curl -s $(KUSTOMIZE_INSTALL_SCRIPT) | bash -s -- $(subst v,,$(KUSTOMIZE_VERSION)) $(LOCALBIN); }

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary.
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen || GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

.PHONY: golangci-lint
golangci-lint:
@if test -x $(LOCALBIN)/golangci-lint && ! $(LOCALBIN)/golangci-lint version | grep -q $(GOLINT_VERSION); then \
echo "$(LOCALBIN)/golangci-lint version is not expected $(GOLINT_VERSION). Removing it before installing."; \
rm -rf $(LOCALBIN)/golangci-lint; \
fi
test -s $(LOCALBIN)/golangci-lint || curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s v$(GOLINT_VERSION)

.PHONY: envtest
envtest: $(ENVTEST) ## Download envtest-setup locally if necessary.
Expand Down
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# K8ssandra Operator


This is the Kubernetes operator for K8ssandra.

**[Documentation site](https://docs.k8ssandra.io/)**

k8ssandra-operator is a turnkey solution to manage [Apache Cassandra](https://cassandra.apache.org/_/index.html) and [DSE](https://www.datastax.com/products/datastax-enterprise) on Kubernetes. Apache Cassandra is the premiere wide column NoSQL data store, offering low latency, geo-replication, and the capacity to store petabytes of data. Apache Cassandra is in use in 90% of the Fortune 500 in some capacity.
Expand Down
35 changes: 18 additions & 17 deletions apis/control/v1alpha1/k8ssandratask_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,13 @@ func (t *K8ssandraTask) RefreshGlobalStatus(expectedDcCount int) {
totalActive += dcStatus.Active
totalSucceeded += dcStatus.Succeeded
totalFailed += dcStatus.Failed
if getConditionStatus(dcStatus, cassapi.JobRunning) == corev1.ConditionTrue {
if getConditionStatus(dcStatus, cassapi.JobRunning) == metav1.ConditionTrue {
anyRunning = true
}
if getConditionStatus(dcStatus, cassapi.JobFailed) == corev1.ConditionTrue {
if getConditionStatus(dcStatus, cassapi.JobFailed) == metav1.ConditionTrue {
anyFailed = true
}
if getConditionStatus(dcStatus, cassapi.JobComplete) != corev1.ConditionTrue {
if getConditionStatus(dcStatus, cassapi.JobComplete) != metav1.ConditionTrue {
allComplete = false
}
}
Expand All @@ -137,15 +137,15 @@ func (t *K8ssandraTask) RefreshGlobalStatus(expectedDcCount int) {
t.SetCondition(cassapi.JobFailed, toConditionStatus(anyFailed))
if allComplete && len(t.Status.Datacenters) == expectedDcCount {
t.Status.CompletionTime = lastCompletionTime
t.SetCondition(cassapi.JobComplete, corev1.ConditionTrue)
t.SetCondition(cassapi.JobComplete, metav1.ConditionTrue)
}
}

func (t *K8ssandraTask) SetCondition(condition cassapi.JobConditionType, status corev1.ConditionStatus) bool {
func (t *K8ssandraTask) SetCondition(condition cassapi.JobConditionType, status metav1.ConditionStatus) bool {
existing := false
for i := 0; i < len(t.Status.Conditions); i++ {
cond := t.Status.Conditions[i]
if cond.Type == condition {
if cond.Type == string(condition) {
if cond.Status == status {
// Already correct status
return false
Expand All @@ -159,8 +159,9 @@ func (t *K8ssandraTask) SetCondition(condition cassapi.JobConditionType, status
}

if !existing {
cond := cassapi.JobCondition{
Type: condition,
cond := metav1.Condition{
Type: string(condition),
Reason: string(condition),
Status: status,
LastTransitionTime: metav1.Now(),
}
Expand All @@ -170,32 +171,32 @@ func (t *K8ssandraTask) SetCondition(condition cassapi.JobConditionType, status
return true
}

func (t *K8ssandraTask) GetConditionStatus(conditionType cassapi.JobConditionType) corev1.ConditionStatus {
func (t *K8ssandraTask) GetConditionStatus(conditionType cassapi.JobConditionType) metav1.ConditionStatus {
for _, condition := range t.Status.Conditions {
if condition.Type == conditionType {
if condition.Type == string(conditionType) {
return condition.Status
}
}
return corev1.ConditionUnknown
return metav1.ConditionUnknown
}

func getConditionStatus(s cassapi.CassandraTaskStatus, conditionType cassapi.JobConditionType) corev1.ConditionStatus {
func getConditionStatus(s cassapi.CassandraTaskStatus, conditionType cassapi.JobConditionType) metav1.ConditionStatus {
for _, condition := range s.Conditions {
if condition.Type == conditionType {
if condition.Type == string(conditionType) {
return condition.Status
}
}
return corev1.ConditionUnknown
return metav1.ConditionUnknown
}

func init() {
SchemeBuilder.Register(&K8ssandraTask{}, &K8ssandraTaskList{})
}

// toConditionStatus converts a primitive boolean into a k8s ConditionStatus
func toConditionStatus(condition bool) corev1.ConditionStatus {
func toConditionStatus(condition bool) metav1.ConditionStatus {
if condition {
return corev1.ConditionTrue
return metav1.ConditionTrue
}
return corev1.ConditionFalse
return metav1.ConditionFalse
}
Loading

0 comments on commit 1779fb0

Please sign in to comment.