Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updating controller-runtime and dependencies #740

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
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
24 changes: 12 additions & 12 deletions .github/workflows/kindIntegTest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
strategy:
matrix:
version:
- "4.0.14"
- "4.0.15"
integration_test:
- cdc_successful # OSS only
- config_fql
Expand Down Expand Up @@ -117,12 +117,12 @@ jobs:
strategy:
matrix:
version:
- "6.8.51"
- "6.8.52"
integration_test:
- cdc_successful
include:
- version: 6.8.51
serverImage: datastax/dse-mgmtapi-6_8:6.8.51-ubi8 # DSE 6.8.51
- version: 6.8.52
serverImage: datastax/dse-mgmtapi-6_8:6.8.52-ubi8 # DSE 6.8.51
serverType: dse
integration_test: "cdc_successful"
fail-fast: true
Expand Down Expand Up @@ -155,7 +155,7 @@ jobs:
strategy:
matrix:
version:
- "5.0.1"
- "5.0.2"
integration_test:
# Single worker tests:
- additional_serviceoptions
Expand Down Expand Up @@ -233,19 +233,19 @@ jobs:
version:
- "4.0.14"
- "4.1.7"
- "5.0.1"
- "6.8.51"
- "6.9.2"
- "5.0.2"
- "6.8.52"
- "6.9.5"
- "1.0.0"
integration_test:
- test_all_the_things
- smoke_test_read_only_fs
include:
- version: 6.8.51
serverImage: datastax/dse-mgmtapi-6_8:6.8.51-ubi8 # DSE 6.8.51
serverImage: datastax/dse-mgmtapi-6_8:6.8.52-ubi8 # DSE 6.8.52
serverType: dse
- version: 6.9.2
serverImage: datastax/dse-mgmtapi-6_8:6.9.2-ubi # DSE 6.9.2
serverImage: datastax/dse-mgmtapi-6_8:6.9.5-ubi # DSE 6.9.5
serverType: dse
- version: 1.0.0
serverImage: datastax/hcd:1.0.0-ubi # HCD 1.0.0
Expand Down Expand Up @@ -283,7 +283,7 @@ jobs:
strategy:
matrix:
version:
- "5.0.1"
- "5.0.2"
integration_test:
- pvc_expansion
fail-fast: true
Expand All @@ -306,7 +306,7 @@ jobs:
with:
repository: topolvm/topolvm
path: topolvm
ref: topolvm-chart-v15.2.0
ref: topolvm-chart-v15.5.0
- name: Create LVM from TopoLVM's example setup
run: |
cd topolvm/example
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/operatorBuildAndDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ on:
push:
branches:
- master
- 1.10.x
pull_request:
branches: [ master ]
jobs:
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Build the manager binary
FROM golang:1.22 AS builder
FROM golang:1.23 AS builder
ARG TARGETOS
ARG TARGETARCH

Expand All @@ -21,7 +21,7 @@ COPY internal/ internal/
RUN CGO_ENABLED=0 GOOS=${TARGETOS:-linux} GOARCH=${TARGETARCH} go build -a -o manager cmd/main.go

# Build the UBI image
FROM redhat/ubi8-micro:latest
FROM redhat/ubi9-micro:latest

ARG VERSION

Expand Down
32 changes: 21 additions & 11 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ IMG ?= $(IMAGE_TAG_BASE):v$(VERSION)
# Produce CRDs that work back to Kubernetes 1.11 (no version conversion)
CRD_OPTIONS ?= "crd:generateEmbeddedObjectMeta=true"
# ENVTEST_K8S_VERSION refers to the version of kubebuilder assets to be downloaded by envtest binary.
ENVTEST_K8S_VERSION = 1.30.x
ENVTEST_K8S_VERSION = 1.31.x

# Logger image
LOG_IMG_BASE ?= $(ORG)/system-logger
Expand Down Expand Up @@ -130,12 +130,16 @@ vet: ## Run go vet against code.
lint: golangci-lint ## Run golangci-lint against code.
$(GOLANGCI_LINT) run ./...

.PHONY: lint-fix
lint-fix: golangci-lint ## Run golangci-lint linter and perform fixes
$(GOLANGCI_LINT) run --fix

.PHONY: test
test: manifests generate fmt vet lint envtest ## Run tests.
# Old unit tests first - these use mocked client / fakeclient
go test ./pkg/... -coverprofile cover-pkg.out
# Then the envtest ones
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./apis/... ./internal/controllers/... -coverprofile cover.out
KUBEBUILDER_ASSETS="$(shell $(ENVTEST) use $(ENVTEST_K8S_VERSION) --bin-dir $(LOCALBIN) -p path)" go test -v ./apis/... ./internal/... -coverprofile cover.out

.PHONY: integ-test
integ-test: kustomize cert-manager helm ## Run integration tests from directory M_INTEG_DIR or set M_INTEG_DIR=all to run all the integration tests.
Expand Down Expand Up @@ -184,6 +188,12 @@ docker-logger-push: ## Push system-logger-image
docker-logger-kind: docker-logger-build ## Build system-logger image and load to kind cluster
kind load docker-image ${LOG_IMG}

.PHONY: build-installer
build-installer: manifests generate kustomize ## Generate a consolidated YAML with CRDs and deployment.
mkdir -p dist
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/deployments/cluster > dist/install.yaml

##@ Deployment

ifndef ignore-not-found
Expand All @@ -202,11 +212,11 @@ uninstall: manifests ## Uninstall CRDs from the K8s cluster specified in ~/.kube
deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
LOG_IMG=${LOG_IMG} yq eval -i '.images.system-logger = env(LOG_IMG)' config/manager/image_config.yaml
kubectl apply --force-conflicts --server-side -k config/deployments/default
kubectl apply --force-conflicts --server-side -k config/deployments/cluster

.PHONY: undeploy
undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
kubectl delete --ignore-not-found=$(ignore-not-found) -k config/deployments/default
kubectl delete --ignore-not-found=$(ignore-not-found) -k config/deployments/cluster

.PHONY: deploy-test
deploy-test: kustomize
Expand Down Expand Up @@ -241,13 +251,13 @@ HELM ?= $(LOCALBIN)/helm
OPM ?= $(LOCALBIN)/opm

## Tool Versions
CERT_MANAGER_VERSION ?= v1.14.7
KUSTOMIZE_VERSION ?= v5.4.2
CONTROLLER_TOOLS_VERSION ?= v0.15.0
OPERATOR_SDK_VERSION ?= 1.35.0
HELM_VERSION ?= 3.14.2
OPM_VERSION ?= 1.38.0
GOLINT_VERSION ?= 1.60.3
CERT_MANAGER_VERSION ?= v1.16.2
KUSTOMIZE_VERSION ?= v5.5.0
CONTROLLER_TOOLS_VERSION ?= v0.16.4
OPERATOR_SDK_VERSION ?= 1.38.0
HELM_VERSION ?= 3.17.0
OPM_VERSION ?= 1.48.0
GOLINT_VERSION ?= 1.62.2

.PHONY: cert-manager
cert-manager: ## Install cert-manager to the cluster
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ ignore the feature (components enabled in the default installation are marked wi
| namespace | Create namespace before installation* |
| webhook | Enable validation webhooks in cass-operator (requires cert-manager) * |
| clusterscope | Install cass-operator in a cluster scope, monitoring all the namespaces |
| auth-proxy | Protect Prometheus /metrics endpoint with api-server authentication |

And following resource. Apply ``github.com/k8ssandra/cass-operator/config/`` before resource name if using remote installation:

Expand Down
108 changes: 0 additions & 108 deletions apis/cassandra/v1beta1/cassandradatacenter_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@ import (
"strconv"
"strings"

"github.com/Jeffail/gabs/v2"
"github.com/k8ssandra/cass-operator/pkg/serverconfig"
"github.com/pkg/errors"
"golang.org/x/mod/semver"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -721,80 +718,6 @@ func (dc *CassandraDatacenter) GetSuperuserSecretNamespacedName() types.Namespac
}
}

// GetConfigAsJSON gets a JSON-encoded string suitable for passing to configBuilder
func (dc *CassandraDatacenter) GetConfigAsJSON(config []byte) (string, error) {

// We use the cluster seed-service name here for the seed list as it will
// resolve to the seed nodes. This obviates the need to update the
// cassandra.yaml whenever the seed nodes change.
seeds := []string{dc.GetSeedServiceName(), dc.GetAdditionalSeedsServiceName()}

graphEnabled := 0
solrEnabled := 0
sparkEnabled := 0

if dc.Spec.ServerType == "dse" && dc.Spec.DseWorkloads != nil {
if dc.Spec.DseWorkloads.AnalyticsEnabled {
sparkEnabled = 1
}
if dc.Spec.DseWorkloads.GraphEnabled {
graphEnabled = 1
}
if dc.Spec.DseWorkloads.SearchEnabled {
solrEnabled = 1
}
}

native := 0
nativeSSL := 0
internode := 0
internodeSSL := 0
if dc.IsNodePortEnabled() {
native = dc.Spec.Networking.NodePort.Native
nativeSSL = dc.Spec.Networking.NodePort.NativeSSL
internode = dc.Spec.Networking.NodePort.Internode
internodeSSL = dc.Spec.Networking.NodePort.InternodeSSL
}

modelValues := serverconfig.GetModelValues(
seeds,
dc.Spec.ClusterName,
dc.DatacenterName(),
graphEnabled,
solrEnabled,
sparkEnabled,
native,
nativeSSL,
internode,
internodeSSL)

var modelBytes []byte

modelBytes, err := json.Marshal(modelValues)
if err != nil {
return "", err
}

// Combine the model values with the user-specified values
modelParsed, err := gabs.ParseJSON(modelBytes)
if err != nil {
return "", errors.Wrap(err, "Model information for CassandraDatacenter resource was not properly configured")
}

if config != nil {
configParsed, err := gabs.ParseJSON(config)
if err != nil {
return "", errors.Wrap(err, "Error parsing Spec.Config for CassandraDatacenter resource")
}

if err := modelParsed.Merge(configParsed); err != nil {
return "", errors.Wrap(err, "Error merging Spec.Config for CassandraDatacenter resource")
}
}

return modelParsed.String(), nil
}

// GetNodePortNativePort
// Gets the defined CQL port for NodePort.
// 0 will be returned if NodePort is not configured.
Expand Down Expand Up @@ -951,37 +874,6 @@ func (dc *CassandraDatacenter) DeploymentSupportsFQL() bool {
return true
}

func (dc *CassandraDatacenter) LegacyInternodeEnabled() bool {
config, err := gabs.ParseJSON(dc.Spec.Config)
if err != nil {
return false
}

hasOldKeyStore := func(gobContainer map[string]*gabs.Container) bool {
if gobContainer == nil {
return false
}

if keystorePath, found := gobContainer["keystore"]; found {
if strings.TrimSpace(keystorePath.Data().(string)) == "/etc/encryption/node-keystore.jks" {
return true
}
}
return false
}

if config.Exists("cassandra-yaml", "client_encryption_options") || config.Exists("cassandra-yaml", "server_encryption_options") {
serverContainer := config.Path("cassandra-yaml.server_encryption_options").ChildrenMap()
clientContainer := config.Path("cassandra-yaml.client_encryption_options").ChildrenMap()

if hasOldKeyStore(clientContainer) || hasOldKeyStore(serverContainer) {
return true
}
}

return false
}

func SplitRacks(nodeCount, rackCount int) []int {
nodesPerRack, extraNodes := nodeCount/rackCount, nodeCount%rackCount

Expand Down
Loading
Loading