-
Notifications
You must be signed in to change notification settings - Fork 59
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
Move to operator sdk version 1.24.0 #729
Changes from all commits
9cc8304
e4428a1
1cb4ac5
9734f1c
570e7b9
38a0d37
becd1a8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -38,7 +38,7 @@ IMAGE_NAME ?= ramen | |
IMAGE_TAG ?= latest | ||
PLATFORM ?= k8s | ||
IMAGE_TAG_BASE = $(IMAGE_REGISTRY)/$(IMAGE_REPOSITORY)/$(IMAGE_NAME) | ||
RBAC_PROXY_IMG ?= "gcr.io/kubebuilder/kube-rbac-proxy:v0.8.0" | ||
RBAC_PROXY_IMG ?= "gcr.io/kubebuilder/kube-rbac-proxy:v0.13.0" | ||
OPERATOR_SUGGESTED_NAMESPACE ?= ramen-system | ||
AUTO_CONFIGURE_DR_CLUSTER ?= true | ||
KUBE_OBJECT_PROTECTION_DISABLED ?= false | ||
|
@@ -136,11 +136,14 @@ lint: golangci-bin ## Run configured golangci-lint and pre-commit.sh linters aga | |
testbin/golangci-lint run ./... --config=./.golangci.yaml | ||
hack/pre-commit.sh | ||
|
||
ENVTEST_K8S_VERSION = 1.25.0 | ||
ENVTEST_ASSETS_DIR=$(shell pwd)/testbin | ||
setup-envtest: | ||
mkdir -p ${ENVTEST_ASSETS_DIR} | ||
test -f ${ENVTEST_ASSETS_DIR}/setup-envtest.sh || curl -sSLo ${ENVTEST_ASSETS_DIR}/setup-envtest.sh https://raw.githubusercontent.com/kubernetes-sigs/controller-runtime/v0.8.3/hack/setup-envtest.sh | ||
source ${ENVTEST_ASSETS_DIR}/setup-envtest.sh; fetch_envtest_tools $(ENVTEST_ASSETS_DIR); setup_envtest_env $(ENVTEST_ASSETS_DIR) | ||
nirs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
envtest: | ||
mkdir -p $(ENVTEST_ASSETS_DIR) | ||
test -s $(ENVTEST_ASSETS_DIR)/setup-envtest || GOBIN=$(ENVTEST_ASSETS_DIR) go install sigs.k8s.io/controller-runtime/tools/setup-envtest@latest | ||
|
||
setup-envtest: envtest | ||
KUBEBUILDER_ASSETS="$(shell $(ENVTEST_ASSETS_DIR)/setup-envtest use $(ENVTEST_K8S_VERSION) --bin-dir $(ENVTEST_ASSETS_DIR) -p path)" | ||
nirs marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
test: generate manifests setup-envtest ## Run tests. | ||
go test ./... -coverprofile cover.out $(GO_TEST_GINKGO_ARGS) | ||
|
@@ -232,7 +235,7 @@ undeploy-dr-cluster: kustomize ## Undeploy dr-cluster controller from the K8s cl | |
##@ Tools | ||
|
||
CONTROLLER_GEN = $(shell pwd)/bin/controller-gen | ||
controller_gen_version=v0.9.0 | ||
controller_gen_version=v0.9.2 | ||
controller-gen: ## Download controller-gen locally if necessary. | ||
@test '$(shell $(CONTROLLER_GEN) --version)' = 'Version: $(controller_gen_version)' ||\ | ||
$(call go-get-tool,sigs.k8s.io/controller-tools/cmd/controller-gen@$(controller_gen_version)) | ||
|
@@ -267,7 +270,7 @@ ifeq (,$(shell which operator-sdk 2>/dev/null)) | |
set -e ;\ | ||
mkdir -p $(dir $(OSDK)) ;\ | ||
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \ | ||
curl -sSLo $(OSDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.11.0/operator-sdk_$${OS}_$${ARCH} ;\ | ||
curl -sSLo $(OSDK) https://github.com/operator-framework/operator-sdk/releases/download/v1.24.0/operator-sdk_$${OS}_$${ARCH} ;\ | ||
chmod +x $(OSDK) ;\ | ||
} | ||
else | ||
|
@@ -338,7 +341,7 @@ ifeq (,$(shell which opm 2>/dev/null)) | |
set -e ;\ | ||
mkdir -p $(dir $(OPM)) ;\ | ||
OS=$(shell go env GOOS) && ARCH=$(shell go env GOARCH) && \ | ||
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.15.1/$${OS}-$${ARCH}-opm ;\ | ||
curl -sSLo $(OPM) https://github.com/operator-framework/operator-registry/releases/download/v1.23.2/$${OS}-$${ARCH}-opm ;\ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Would be nicer to extract the tag to a separate variable later. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. True, this and other version strings within various tool downloads/use in the Makefile. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we can do this later, maybe open an isue for this? this looks like a good first change. |
||
chmod +x $(OPM) ;\ | ||
} | ||
else | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.9.0 | ||
controller-gen.kubebuilder.io/version: v0.9.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? the commit message explains only about using There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks like I did 2 things in one commit, this updates controller-gen version as per this, causing the CRD changes that are auto generated when running make generate. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ok, would be nice to mention this in the commit message. |
||
creationTimestamp: null | ||
name: drclusters.ramendr.openshift.io | ||
spec: | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1 | |
kind: CustomResourceDefinition | ||
metadata: | ||
annotations: | ||
controller-gen.kubebuilder.io/version: v0.9.0 | ||
controller-gen.kubebuilder.io/version: v0.9.2 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I hope we can eliminate the duplication by seting this tag in the makefile and updating There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. These files are auto generated during There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It the files are auto generated, maybe they should not be part of git, and generated |
||
creationTimestamp: null | ||
name: drplacementcontrols.ramendr.openshift.io | ||
spec: | ||
|
@@ -113,6 +113,7 @@ spec: | |
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' | ||
type: string | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why is this needed? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
failoverCluster: | ||
description: FailoverCluster is the cluster name that the user wants | ||
to failover the application to. If not sepcified, then the DRPC | ||
|
@@ -181,6 +182,7 @@ spec: | |
description: 'UID of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#uids' | ||
type: string | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
preferredCluster: | ||
description: PreferredCluster is the cluster name that the user preferred | ||
to run the application on | ||
|
@@ -232,6 +234,7 @@ spec: | |
are ANDed. | ||
type: object | ||
type: object | ||
x-kubernetes-map-type: atomic | ||
required: | ||
- drPolicyRef | ||
- placementRef | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,4 +19,10 @@ spec: | |
ports: | ||
- containerPort: 9289 | ||
name: https | ||
|
||
resources: | ||
limits: | ||
cpu: 500m | ||
memory: 128Mi | ||
requests: | ||
cpu: 5m | ||
memory: 64Mi | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do we need this change? the link does not give any reason and it points to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It is good to have resource limits on the containers, so that they do not run wild and get capped. I would assume it is added by the SDK as a good practice, hence the (suggested) updates. |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,8 @@ spec: | |
metadata: | ||
labels: | ||
control-plane: controller-manager | ||
annotations: | ||
kubectl.kubernetes.io/default-container: manager | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Again not clear why this is needed, and the link points to another uhelpful link. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This adds a notion of a default container, which is useful when certain commands are run that need a container to be specified to omit the same (for example There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure it makes sense, just not explained in the commit message. |
||
spec: | ||
securityContext: | ||
runAsNonRoot: true | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this really work? we have kustomization replacing the version to 0.13.0 later,
which is not upadted if you use antoher RBAC_PROXY_IMG value at build time.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This setting and changing things in the kustomize is to keep changed to committed sources to a minimum when deploying (which is where this image is used). IOW, this allows someone to use a different image, and when deployed would change that is in the deployment manifest via kustomize, if not changed then those manifests remain as is and not report any diffs when doing
git diff
etc.Or, I am missing the question
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So if you change this in the makefile, some autogenerated files are updated automatically
or you need to do the same change in multiple files (like we see in this commit)?