Skip to content

Commit 0538ec3

Browse files
authored
fix: Use Kustomize v2 for manifest generation to support kubectl apply -k (#62)
* fix: Use Kustomize v2 for manifest generation to support kubectl apply -k * Adapt GH workflow to check for manifest changes * Fix curl flag * Download curl to appropriate location * Use bash shell for manifest generation
1 parent ae81a7a commit 0538ec3

File tree

4 files changed

+29
-10
lines changed

4 files changed

+29
-10
lines changed

.github/workflows/ci-tests.yaml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,28 @@ jobs:
2626
run: |
2727
go mod tidy
2828
git diff --exit-code -- .
29+
codegen:
30+
name: Run codegen
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: Checkout code
34+
uses: actions/checkout@v2
35+
- name: Install Kustomize v2
36+
run: |
37+
set -xo pipefail
38+
KUSTOMIZE_VERSION=2.0.2
39+
URL="https://github.com/kubernetes-sigs/kustomize/releases/download/v${KUSTOMIZE_VERSION}/kustomize_${KUSTOMIZE_VERSION}_linux_amd64"
40+
BINNAME=kustomize2
41+
curl -sLf --retry 3 -o /tmp/kustomize2 "$URL"
42+
sudo mv /tmp/kustomize2 /usr/local/bin/kustomize2
43+
chmod +x /usr/local/bin/kustomize2
44+
- name: Run make manifests
45+
run: |
46+
make manifests
47+
- name: Check nothing has changed
48+
run: |
49+
set -xo pipefail
50+
git diff --exit-code -- . ':!go.sum' ':!go.mod' ':!assets/swagger.json' | tee codegen.patch
2951
lint:
3052
name: Ensure code is correctly linted
3153
runs-on: ubuntu-latest

hack/generate-manifests.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
#!/bin/sh
1+
#!/usr/bin/env bash
22

33
set -eo pipefail
44
set -x
55

66
SRCROOT="$( CDPATH='' cd -- "$(dirname "$0")/.." && pwd -P )"
7-
KUSTOMIZE="kustomize"
7+
# Make sure that KUSTOMIZE points to a v2 - we need that to support the kubectl
8+
# integration.
9+
KUSTOMIZE=${KUSTOMIZE:-kustomize2}
810
TEMPFILE=$(mktemp /tmp/aic-manifests.XXXXXX)
911

1012
IMAGE_NAMESPACE="${IMAGE_NAMESPACE:-argoprojlabs}"
@@ -23,7 +25,7 @@ if [ "$IMAGE_TAG" = "" ]; then
2325
IMAGE_TAG=latest
2426
fi
2527

26-
cd ${SRCROOT}/manifests/base && kustomize edit set image argoprojlabs/argocd-image-updater=${IMAGE_NAMESPACE}/argocd-image-updater:${IMAGE_TAG}
28+
cd ${SRCROOT}/manifests/base && ${KUSTOMIZE} edit set image ${IMAGE_NAMESPACE}/argocd-image-updater:${IMAGE_TAG}
2729
cd ${SRCROOT}/manifests/base && ${KUSTOMIZE} build . > ${TEMPFILE}
2830

2931
mv ${TEMPFILE} ${SRCROOT}/manifests/install.yaml

manifests/base/deployment/argocd-image-updater-deployment.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ spec:
1919
- command:
2020
- /usr/local/bin/argocd-image-updater
2121
- run
22-
image: argoproj-labs/argocd-image-updater:latest
22+
image: argoprojlabs/argocd-image-updater:latest
2323
imagePullPolicy: Always
2424
env:
2525
- name: ARGOCD_GRPC_WEB

manifests/base/kustomization.yaml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,11 @@
11
apiVersion: kustomize.config.k8s.io/v1beta1
22
kind: Kustomization
33

4-
54
images:
6-
- name: argoproj-labs/argocd-image-updater
7-
newName: argoprojlabs/argocd-image-updater
8-
newTag: latest
95
- name: argoprojlabs/argocd-image-updater
10-
newName: argoprojlabs/argocd-image-updater
116
newTag: latest
127

13-
resources:
8+
bases:
149
- ./config
1510
- ./deployment
1611
- ./rbac

0 commit comments

Comments
 (0)