Skip to content

Commit

Permalink
Fix cluster-wide cache, modify Makefile to not fetch kustomize on git…
Browse files Browse the repository at this point in the history
…hub actions
  • Loading branch information
burmanm committed Mar 5, 2024
1 parent 1c401af commit ea54b3e
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 17 deletions.
11 changes: 8 additions & 3 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.27.x
ENVTEST_K8S_VERSION = 1.28.x

# Logger image
LOG_IMG_BASE ?= $(ORG)/system-logger
Expand Down Expand Up @@ -242,8 +242,8 @@ OPM ?= $(LOCALBIN)/opm
CERT_MANAGER_VERSION ?= v1.14.3
KUSTOMIZE_VERSION ?= v5.3.0
CONTROLLER_TOOLS_VERSION ?= v0.14.0
OPERATOR_SDK_VERSION ?= 1.33.0
HELM_VERSION ?= 3.14.0
OPERATOR_SDK_VERSION ?= 1.34.0
HELM_VERSION ?= 3.14.2
OPM_VERSION ?= 1.36.0
GOLINT_VERSION ?= 1.55.2

Expand All @@ -257,11 +257,16 @@ KUSTOMIZE_INSTALL_SCRIPT ?= "https://raw.githubusercontent.com/kubernetes-sigs/k
.PHONY: kustomize
kustomize: $(KUSTOMIZE) ## Download kustomize locally if necessary. If wrong version is installed, it will be removed before downloading.
$(KUSTOMIZE): $(LOCALBIN)
ifeq ($(GITHUB_ACTIONS), true)
@echo "Running in GitHub Actions, using the kustomize version provided by the runner."
ln -s $(shell which kustomize) $(LOCALBIN)/kustomize
else
@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); }
endif

.PHONY: controller-gen
controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
Expand Down
11 changes: 3 additions & 8 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,14 +108,9 @@ func main() {
for _, namespace := range namespaces {
options.Cache.DefaultNamespaces[namespace] = cache.Config{}
}
} else {
if ns != "" {
setupLog.Info("watch namespace configured", "namespace", ns)
options.Cache.DefaultNamespaces[ns] = cache.Config{}
} else {
setupLog.Info("manager set up to watch and manage resources in all namespaces")
options.Cache.DefaultNamespaces[cache.AllNamespaces] = cache.Config{}
}
} else if ns != "" {
setupLog.Info("watch namespace configured", "namespace", ns)
options.Cache.DefaultNamespaces[ns] = cache.Config{}
}

mgr, err := ctrl.NewManager(ctrl.GetConfigOrDie(), options)
Expand Down
2 changes: 1 addition & 1 deletion hack/cluster.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ if [ "${running}" != 'true' ]; then
fi

# create a cluster with the local registry enabled in containerd
cat <<EOF | kind create cluster --image kindest/node:v1.28.0 --config=-
cat <<EOF | kind create cluster --image kindest/node:v1.28.7 --config=-
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
containerdConfigPatches:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (
"k8s.io/apimachinery/pkg/api/resource"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer" //nolint:staticcheck
"k8s.io/utils/ptr" //nolint:staticcheck
"sigs.k8s.io/controller-runtime/pkg/client"

cassdcapi "github.com/k8ssandra/cass-operator/apis/cassandra/v1beta1"
Expand Down Expand Up @@ -74,7 +74,7 @@ var _ = Describe("CassandraDatacenter tests", func() {
Name: testNamespaceName,
},
}
Expect(k8sClient.Create(context.Background(), testNamespace)).Should(Succeed())
Expect(k8sClient.Create(ctx, testNamespace)).Should(Succeed())
})

AfterEach(func() {
Expand All @@ -83,7 +83,7 @@ var _ = Describe("CassandraDatacenter tests", func() {
Name: testNamespaceName,
},
}
Expect(k8sClient.Delete(context.TODO(), testNamespaceDel)).To(Succeed())
Expect(k8sClient.Delete(ctx, testNamespaceDel)).To(Succeed())
})
When("There is a single rack and a single node", func() {
It("should end up in a Ready state", func(ctx SpecContext) {
Expand Down Expand Up @@ -237,11 +237,11 @@ func createStubCassDc(dcName string, nodeCount int32) cassdcapi.CassandraDatacen
},
ClusterName: clusterName(),
ServerType: "cassandra",
ServerVersion: "4.0.7",
ServerVersion: "4.1.4",
Size: nodeCount,
StorageConfig: cassdcapi.StorageConfig{
CassandraDataVolumeClaimSpec: &corev1.PersistentVolumeClaimSpec{
StorageClassName: pointer.String("default"),
StorageClassName: ptr.To[string]("default"),
AccessModes: []corev1.PersistentVolumeAccessMode{"ReadWriteOnce"},
Resources: corev1.VolumeResourceRequirements{
Requests: map[corev1.ResourceName]resource.Quantity{"storage": resource.MustParse("1Gi")},
Expand Down

0 comments on commit ea54b3e

Please sign in to comment.