Skip to content

Commit 072db14

Browse files
Merge pull request #258 from swghosh/nits
Improves local operator development
2 parents 6937ffd + 7041844 commit 072db14

File tree

3 files changed

+30
-26
lines changed

3 files changed

+30
-26
lines changed

Makefile

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
# - use the BUNDLE_VERSION as arg of the bundle target (e.g make bundle BUNDLE_VERSION=0.0.2)
66
# - use environment variables to overwrite this value (e.g export BUNDLE_VERSION=0.0.2)
77
BUNDLE_VERSION ?= 1.15.1
8+
CERT_MANAGER_VERSION ?= "v1.15.5"
9+
ISTIO_CSR_VERSION ?= "v0.14.0"
810

911
# CHANNELS define the bundle channels used in the bundle.
1012
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "candidate,fast,stable")
@@ -82,7 +84,7 @@ BIN_DIR=$(shell pwd)/bin
8284
SHELL = /usr/bin/env bash -o pipefail
8385
.SHELLFLAGS = -ec
8486

85-
CONTAINER_ENGINE ?= docker
87+
CONTAINER_ENGINE ?= podman
8688
CONTAINER_PUSH_ARGS ?= $(if $(filter ${CONTAINER_ENGINE}, docker), , --tls-verify=${TLS_VERIFY})
8789
TLS_VERIFY ?= true
8890
CONTAINER_IMAGE_NAME ?= registry.ci.openshift.org/ocp/builder:rhel-9-golang-1.22-openshift-4.17
@@ -108,8 +110,7 @@ E2E_TIMEOUT ?= 1h
108110
# https://onsi.github.io/ginkgo/#spec-labels. The default is to run tests on the AWS platform.
109111
E2E_GINKGO_LABEL_FILTER ?= "Platform: isSubsetOf {AWS}"
110112

111-
MANIFEST_SOURCE = https://github.com/cert-manager/cert-manager/releases/download/v1.15.5/cert-manager.yaml
112-
ISTIO_CSR_VERSION = "v0.14.0"
113+
MANIFEST_SOURCE = https://github.com/cert-manager/cert-manager/releases/download/$(CERT_MANAGER_VERSION)/cert-manager.yaml
113114

114115
##@ Development
115116

@@ -178,9 +179,21 @@ verify-deps:
178179
hack/verify-deps.sh
179180

180181
local-run: build
181-
OPERATOR_NAME=cert-manager-operator OPERAND_IMAGE_VERSION=$(BUNDLE_VERSION) OPERATOR_IMAGE_VERSION=$(BUNDLE_VERSION) ./cert-manager-operator start --config=./hack/local-run-config.yaml --kubeconfig=$${KUBECONFIG:-$$HOME/.kube/config} --namespace=cert-manager-operator
182+
RELATED_IMAGE_CERT_MANAGER_WEBHOOK=quay.io/jetstack/cert-manager-webhook:$(CERT_MANAGER_VERSION) \
183+
RELATED_IMAGE_CERT_MANAGER_CA_INJECTOR=quay.io/jetstack/cert-manager-cainjector:$(CERT_MANAGER_VERSION) \
184+
RELATED_IMAGE_CERT_MANAGER_CONTROLLER=quay.io/jetstack/cert-manager-controller:$(CERT_MANAGER_VERSION) \
185+
RELATED_IMAGE_CERT_MANAGER_ACMESOLVER=quay.io/jetstack/cert-manager-acmesolver:$(CERT_MANAGER_VERSION) \
186+
RELATED_IMAGE_CERT_MANAGER_ISTIOCSR=quay.io/jetstack/cert-manager-istio-csr:$(ISTIO_CSR_VERSION) \
187+
OPERATOR_NAME=cert-manager-operator \
188+
OPERAND_IMAGE_VERSION=$(BUNDLE_VERSION) \
189+
OPERATOR_IMAGE_VERSION=$(BUNDLE_VERSION) \
190+
./cert-manager-operator start \
191+
--config=./hack/local-run-config.yaml \
192+
--kubeconfig=$${KUBECONFIG:-$$HOME/.kube/config} \
193+
--namespace=cert-manager-operator
182194
.PHONY: local-run
183195

196+
184197
##@ Build
185198
GO=GO111MODULE=on CGO_ENABLED=1 go
186199

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ The Operator automatically deploys a cluster-scoped `CertManager` object named `
3737

3838
Connect to your OpenShift cluster and run the following command:
3939

40-
make local-run
40+
```sh
41+
make deploy
42+
oc scale --replicas=0 deploy --all -n cert-manager-operator
43+
make local-run
44+
```
4145

4246
This command will install all the necessary Operator manifests as well as all necessary CRDs. After this part is complete, it will run the Operator locally.
4347

hack/operator-sdk.sh

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,47 +5,34 @@ set -e
55
VERSION="1.25.1"
66

77
OUTPUT_PATH=${1:-./bin/operator-sdk}
8-
VERIFY=${2:-yes}
98

109
GOOS=$(go env GOOS)
1110
GOARCH=$(go env GOARCH)
1211
BIN="operator-sdk"
1312
BIN_ARCH="${BIN}_${GOOS}_${GOARCH}"
1413
OPERATOR_SDK_DL_URL="https://github.com/operator-framework/operator-sdk/releases/download/v${VERSION}"
1514

16-
case ${GOOS} in
17-
linux)
18-
CHECKSUM="9596b2894b4b1d7f1c3b54cb1ec317b86494dbc00718b48561dfbcb232477c26"
19-
;;
20-
darwin)
21-
CHECKSUM="bb54842b92efee4ea1071373f7482b62a8130cc3dc4d45a5be50041ae7c81e7c"
22-
;;
23-
*)
24-
echo "Unsupported OS $GOOS"
25-
exit 1
26-
;;
27-
esac
28-
29-
if [ "$GOARCH" != "amd64" ]; then
15+
if [[ "$GOOS" != "linux" && "$GOOS" != "darwin" ]]; then
16+
echo "Unsupported OS $GOOS"
17+
exit 1
18+
fi
19+
20+
if [[ "$GOARCH" != "amd64" && "$GOARCH" != "arm64" && "$GOARCH" != "ppc64le" && "$GOARCH" != "s390x" ]]; then
3021
echo "Unsupported architecture $GOARCH"
3122
exit 1
3223
fi
3324

3425
command -v curl &> /dev/null || { echo "can't find curl command" && exit 1; }
35-
command -v sha256sum &> /dev/null || { echo "can't find sha256sum command" && exit 1; }
3626

3727
TEMPDIR=$(mktemp -d)
3828
BIN_PATH="${TEMPDIR}/${BIN_ARCH}"
3929

4030
echo "> downloading binary"
4131
curl --silent --location -o "${BIN_PATH}" "${OPERATOR_SDK_DL_URL}/operator-sdk_${GOOS}_${GOARCH}"
4232

43-
if [ "${VERIFY}" == "yes" ]; then
44-
echo "> verifying binary"
45-
echo "${CHECKSUM} ${BIN_PATH}" | sha256sum -c --quiet
46-
fi
47-
4833
echo "> installing binary"
4934
mv "${BIN_PATH}" "${OUTPUT_PATH}"
5035
chmod +x "${OUTPUT_PATH}"
5136
rm -rf "${TEMPDIR}"
37+
38+
echo "> operator-sdk binary available at ${OUTPUT_PATH}"

0 commit comments

Comments
 (0)