Skip to content

Commit

Permalink
build: refactoring to support full CRDs
Browse files Browse the repository at this point in the history
This was split off from
argoproj#5114 to make it easier
to review. This makes a few minor improvements to the build to support
the full CRD fixes:
1. Update devcontainer to install k3s 1.29.10, since that's what we use
   in CI: https://github.com/argoproj/argo-workflows/blob/ef41f83f801a6ff48c87f882a6b75d0e37529134/.github/workflows/ci-build.yaml#L263
   1.27 is EOL and doesn't support things like validation rules in CRDs.
2. Update `make install` to use [server-side
   apply](https://kubernetes.io/docs/reference/using-api/server-side-apply/),
   which is meant to replace client-side apply and isn't affected by
   size limitations for the CRDs. Since `kubectl apply --server-side`
   isn't compatible with `kubectl apply --prune`, I had to switch to
   [apply
   sets](https://kubernetes.io/docs/tasks/manage-kubernetes-objects/declarative-config/#alternative-kubectl-apply-f-directory-prune),
   which is intended to replace allow list pruning, and seems to work
   just as wlel.
3. Minor refactoring of the manifests under `manifests/` to use
   [Kustomize
   Components](https://kubectl.docs.kubernetes.io/guides/config_management/components/)
   so that we can share code with the the manifests under
   `test/e2e/manifests` without duplication. See argoproj#14001 for more details
   on this approach.

Signed-off-by: Mason Malone <[email protected]>
  • Loading branch information
MasonM committed Jan 3, 2025
1 parent 81993b5 commit 82eb102
Show file tree
Hide file tree
Showing 39 changed files with 58 additions and 61 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/pre-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@ set -eux

# install kubernetes
wget -q -O - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | bash
k3d cluster get k3s-default || k3d cluster create --image rancher/k3s:v1.27.3-k3s1 --wait
k3d cluster get k3s-default || k3d cluster create --image rancher/k3s:v1.29.10-k3s1 --wait
k3d kubeconfig merge --kubeconfig-merge-default

# install kubectl
curl -LO https://dl.k8s.io/release/v1.27.3/bin/linux/$(go env GOARCH)/kubectl
curl -LO https://dl.k8s.io/release/v1.29.10/bin/linux/$(go env GOARCH)/kubectl
chmod +x ./kubectl
sudo mv ./kubectl /usr/local/bin/kubectl
kubectl cluster-info
Expand Down
5 changes: 4 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -480,7 +480,10 @@ install: githooks
kubectl get ns $(KUBE_NAMESPACE) || kubectl create ns $(KUBE_NAMESPACE)
kubectl config set-context --current --namespace=$(KUBE_NAMESPACE)
@echo "installing PROFILE=$(PROFILE)"
kubectl kustomize --load-restrictor=LoadRestrictionsNone test/e2e/manifests/$(PROFILE) | sed 's|quay.io/argoproj/|$(IMAGE_NAMESPACE)/|' | sed 's/namespace: argo/namespace: $(KUBE_NAMESPACE)/' | kubectl -n $(KUBE_NAMESPACE) apply --prune -l app.kubernetes.io/part-of=argo -f -
kubectl kustomize --load-restrictor=LoadRestrictionsNone test/e2e/manifests/$(PROFILE) \
| sed 's|quay.io/argoproj/|$(IMAGE_NAMESPACE)/|' \
| sed 's/namespace: argo/namespace: $(KUBE_NAMESPACE)/' \
| KUBECTL_APPLYSET=true kubectl -n $(KUBE_NAMESPACE) apply --applyset=configmaps/install --server-side --prune -f -
ifeq ($(PROFILE),stress)
kubectl -n $(KUBE_NAMESPACE) apply -f test/stress/massive-workflow.yaml
endif
Expand Down
5 changes: 0 additions & 5 deletions manifests/base/crds/kustomization.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions manifests/base/kustomization.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion manifests/cluster-install/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base
- ../base/workflow-controller
- ../base/argo-server
- ./workflow-controller-rbac
- ./argo-server-rbac

Expand Down
10 changes: 10 additions & 0 deletions manifests/components/mysql/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- argo-mysql-config-secret.yaml
- mysql-deployment.yaml
- mysql-service.yaml

patches:
- path: overlays/workflow-controller-configmap.yaml
10 changes: 10 additions & 0 deletions manifests/components/postgres/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- argo-postgres-config-secret.yaml
- postgres-deployment.yaml
- postgres-service.yaml

patches:
- path: overlays/workflow-controller-configmap.yaml
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

labels:
- includeSelectors: true
pairs:
app.kubernetes.io/part-of: dex

resources:
- dex-cm.yaml
- dex-role.yaml
Expand Down
9 changes: 9 additions & 0 deletions manifests/components/sso/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- dex

patches:
- path: overlays/workflow-controller-configmap.yaml
- path: overlays/argo-server-sa.yaml
4 changes: 3 additions & 1 deletion manifests/namespace-install/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base
- ../base/crds/minimal
- ../base/workflow-controller
- ../base/argo-server
- ./argo-server-rbac
- ./workflow-controller-rbac

Expand Down
1 change: 1 addition & 0 deletions manifests/quick-start/minimal/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ kind: Kustomization

resources:
- ../base
- ../../base/crds/minimal

patches:
- path: overlays/workflow-controller-configmap.yaml
8 changes: 3 additions & 5 deletions manifests/quick-start/mysql/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ kind: Kustomization

resources:
- ../base
- argo-mysql-config-secret.yaml
- mysql-deployment.yaml
- mysql-service.yaml
- ../../base/crds/minimal

patches:
- path: overlays/workflow-controller-configmap.yaml
components:
- ../../components/mysql
8 changes: 3 additions & 5 deletions manifests/quick-start/postgres/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@ kind: Kustomization

resources:
- ../base
- argo-postgres-config-secret.yaml
- postgres-deployment.yaml
- postgres-service.yaml
- ../../base/crds/minimal

patches:
- path: overlays/workflow-controller-configmap.yaml
components:
- ../../components/postgres
7 changes: 3 additions & 4 deletions manifests/quick-start/sso/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ kind: Kustomization

resources:
- ../base
- dex
- ../../base/crds/minimal

patches:
- path: overlays/workflow-controller-configmap.yaml
- path: overlays/argo-server-sa.yaml
components:
- ../../components/sso
7 changes: 2 additions & 5 deletions test/e2e/manifests/components/base/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1alpha1
kind: Component

resources:
- ../../../../../manifests/base/crds/minimal
- ../../../../../manifests/quick-start/base
- argo-server.service-account-token-secret.yaml

patches:
Expand All @@ -10,8 +12,3 @@ patches:
- path: workflow-controller-deployment.yaml
- path: workflow-controller-cluster-workflow-template-rbac.yaml
- path: minio-deployment.yaml

labels:
- includeSelectors: true
pairs:
app.kubernetes.io/part-of: argo
5 changes: 2 additions & 3 deletions test/e2e/manifests/events/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/quick-start/minimal
- https://raw.githubusercontent.com/argoproj/argo-events/v1.2.0/manifests/install.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/v1.2.0/examples/eventbus/native.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/install.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/examples/eventbus/native.yaml

components:
- ../components/base
Expand Down
1 change: 0 additions & 1 deletion test/e2e/manifests/minimal/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/quick-start/minimal
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_eventbus.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_eventsources.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_sensors.yaml
Expand Down
2 changes: 1 addition & 1 deletion test/e2e/manifests/mysql/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/quick-start/mysql
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_eventbus.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_eventsources.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_sensors.yaml

components:
- ../components/base
- ../../../../manifests/components/mysql
- ../components/local-argo

namespace: argo
4 changes: 0 additions & 4 deletions test/e2e/manifests/plugins/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,4 @@ resources:
- hello-executor-plugin.service-account-token-secret.yaml
- hello-executor-plugin-configmap.yaml

labels:
- includeSelectors: true
pairs:
app.kubernetes.io/part-of: argo
namespace: argo
2 changes: 1 addition & 1 deletion test/e2e/manifests/postgres/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/quick-start/postgres
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_eventbus.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_eventsources.yaml
- https://raw.githubusercontent.com/argoproj/argo-events/stable/manifests/base/crds/argoproj.io_sensors.yaml

components:
- ../components/base
- ../../../../manifests/components/postgres
- ../components/local-argo

namespace: argo
1 change: 0 additions & 1 deletion test/e2e/manifests/prometheus/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/quick-start/minimal
- ../../../../manifests/quick-start/base/prometheus

components:
Expand Down
4 changes: 1 addition & 3 deletions test/e2e/manifests/sso/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../../manifests/quick-start/sso

components:
- ../components/base
- ../../../../manifests/components/sso
- ../components/local-argo

namespace: argo
7 changes: 1 addition & 6 deletions test/e2e/manifests/stress/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,4 @@ patches:
- path: workflow-controller-configmap.yaml
- path: workflow-controller-deployment.yaml
- path: argo-server-deployment.yaml
- path: minio-deployment.yaml

labels:
- includeSelectors: true
pairs:
app.kubernetes.io/part-of: argo
- path: minio-deployment.yaml

0 comments on commit 82eb102

Please sign in to comment.