Skip to content

Commit

Permalink
feat: Add conversion webhook for ArgoCD v1alpha1 to v1beta1 migration (
Browse files Browse the repository at this point in the history
…#964)

* Add ArgoCD v1beta1 & deprecate v1alpha1

- Add new ArgoCD v1beta1 api
- Mark ArgoCD v1alpha1 as deprecated & add back the removed sso fields
- Use server side validation for "kubectl apply" as client side results into
  failure due to exceeding annotation size limit.

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add funcs for ArgoCD alpha to beta conversion

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add conversion webhook

- Create webhook & setup webhook server on 9443
- Disable operator namespaced install via OLM so that OLM can handle certs for webhook server
- For manual install, user needs to explicitly configure cert manager to inject certs and enable
  webhook server in operator by setting env ENABLE_CONVERSION_WEBHOOK="true"

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Resolve local build issues

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Tweak webhook configs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Update operator installation docs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add e2e tests

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Minor updates

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Fix go-lint ci failure

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Update docs

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Remove webhook from 0.7.0 bundle

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

Add spaces in bundle

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

* update 0.8.0 bundle

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>

---------

Signed-off-by: Siddhesh Ghadi <sghadi1203@gmail.com>
  • Loading branch information
svghadi authored Aug 21, 2023
1 parent 11299b7 commit b25858d
Show file tree
Hide file tree
Showing 57 changed files with 25,496 additions and 79 deletions.
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ COPY version/ version/

# Build
ARG LD_FLAGS
RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="$LD_FLAGS" -a -o manager main.go
RUN CGO_ENABLED=0 GOOS=linux go build -ldflags="$LD_FLAGS" -a -o manager main.go

# Use distroless as minimal base image to package the manager binary
# Refer to https://github.com/GoogleContainerTools/distroless for more details
Expand Down
11 changes: 7 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,14 +107,17 @@ docker-push: ## Push docker image with the manager.
##@ Deployment

install: manifests kustomize ## Install CRDs into the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl apply -f -
## TODO: Remove sed usage after all v1alpha1 references are updated to v1beta1 in codebase.
## For local testing, conversion webhook defined in crd makes call to webhook for each v1alpha1 reference
## causing failures as we don't set up the webhook for local testing.
$(KUSTOMIZE) build config/crd | sed '/conversion:/,/- v1beta1/d' |kubectl apply --server-side=true -f -

uninstall: manifests kustomize ## Uninstall CRDs from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/crd | kubectl delete -f -

deploy: manifests kustomize ## Deploy controller to the K8s cluster specified in ~/.kube/config.
cd config/manager && $(KUSTOMIZE) edit set image controller=${IMG}
$(KUSTOMIZE) build config/default | kubectl apply -f -
$(KUSTOMIZE) build config/default | kubectl apply --server-side=true -f -

undeploy: ## Undeploy controller from the K8s cluster specified in ~/.kube/config.
$(KUSTOMIZE) build config/default | kubectl delete -f -
Expand All @@ -137,7 +140,7 @@ kustomize: ## Download kustomize locally if necessary.
ENVTEST = $(shell pwd)/bin/setup-envtest
envtest: ## Download envtest-setup locally if necessary.
$(call go-install-tool,$(ENVTEST),sigs.k8s.io/controller-runtime/tools/setup-envtest@latest)
$(ENVTEST) use 1.21
$(ENVTEST) use 1.26

# go-install-tool will 'go install' any package $2 and install it to $1.
PROJECT_DIR := $(shell dirname $(abspath $(lastword $(MAKEFILE_LIST))))
Expand Down Expand Up @@ -210,7 +213,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.20.0/$${OS}-$${ARCH}-opm ;\
chmod +x $(OPM) ;\
}
else
Expand Down
10 changes: 10 additions & 0 deletions PROJECT
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,14 @@ resources:
kind: ArgoCDExport
path: github.com/argoproj-labs/argocd-operator/api/v1alpha1
version: v1alpha1
- api:
crdVersion: v1
namespaced: true
group: argoproj.io
kind: ArgoCD
path: github.com/argoproj-labs/argocd-operator/api/v1beta1
version: v1beta1
webhooks:
conversion: true
webhookVersion: v1
version: "3"
Loading

0 comments on commit b25858d

Please sign in to comment.