diff --git a/.github/workflows/test-action-kustomize.yml b/.github/workflows/test-action-kustomize.yml new file mode 100644 index 0000000..c51ca1a --- /dev/null +++ b/.github/workflows/test-action-kustomize.yml @@ -0,0 +1,64 @@ +name: Action CI (Kustomize) + +on: [push] + +jobs: + test-action-kustomize-job-win32: + runs-on: windows-latest + name: kube-score kustomize (Win32) + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: azure/setup-kubectl@v3 + id: install + - name: Make temporal output directory + run: mkdir -p out/kustomize + - name: kustomize build to standard template + run: kubectl kustomize sample-manifests\kustomize\overlays\production > ./out/kustomize/sample-kustomize.yaml + - name: kube-score action step + uses: ./ # Uses an action in the root directory + id: ksga + with: + manifests-folders: './out/kustomize/*.yaml' + ignore-exit-code: 'true' + kube-score-version: '1.14.0' + + test-action-kustomize-job-linux: + runs-on: ubuntu-latest + name: kube-score kustomize (Linux) + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: azure/setup-kubectl@v3 + id: install + - name: Make temporal output directory + run: mkdir -p out/kustomize + - name: kustomize build to standard template + run: kubectl kustomize sample-manifests/kustomize/overlays/production > ./out/kustomize/sample-kustomize.yaml + - name: kube-score action step + uses: ./ # Uses an action in the root directory + id: ksga + with: + manifests-folders: './out/kustomize/*.yaml' + ignore-exit-code: 'true' + kube-score-version: '1.14.0' + + test-action-kustomize-job-macos: + runs-on: macos-latest + name: kube-score kustomize (MacOS) + steps: + - name: Checkout + uses: actions/checkout@v2 + - uses: azure/setup-kubectl@v3 + id: install + - name: Make temporal output directory + run: mkdir -p out/kustomize + - name: kustomize build to standard template + run: kubectl kustomize sample-manifests/kustomize/overlays/production > ./out/kustomize/sample-kustomize.yaml + - name: kube-score action step + uses: ./ # Uses an action in the root directory + id: ksga + with: + manifests-folders: './out/kustomize/*.yaml' + ignore-exit-code: 'true' + kube-score-version: '1.14.0' diff --git a/sample-manifests/kustomize/base/deployment.yaml b/sample-manifests/kustomize/base/deployment.yaml new file mode 100644 index 0000000..77faefc --- /dev/null +++ b/sample-manifests/kustomize/base/deployment.yaml @@ -0,0 +1,21 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment + labels: + app: nginx +spec: + replicas: 3 + selector: + matchLabels: + app: nginx + template: + metadata: + labels: + app: nginx + spec: + containers: + - name: nginx + image: nginx:1.7.9 + ports: + - containerPort: 80 \ No newline at end of file diff --git a/sample-manifests/kustomize/base/kustomization.yaml b/sample-manifests/kustomize/base/kustomization.yaml new file mode 100644 index 0000000..d4abebb --- /dev/null +++ b/sample-manifests/kustomize/base/kustomization.yaml @@ -0,0 +1,4 @@ +commonLabels: + app: hello +resources: +- deployment.yaml \ No newline at end of file diff --git a/sample-manifests/kustomize/overlays/production/kustomization.yaml b/sample-manifests/kustomize/overlays/production/kustomization.yaml new file mode 100644 index 0000000..0c17158 --- /dev/null +++ b/sample-manifests/kustomize/overlays/production/kustomization.yaml @@ -0,0 +1,6 @@ +commonLabels: + env: production +bases: +- ../../base +patches: +- replica_count.yaml diff --git a/sample-manifests/kustomize/overlays/production/replica_count.yaml b/sample-manifests/kustomize/overlays/production/replica_count.yaml new file mode 100644 index 0000000..612b301 --- /dev/null +++ b/sample-manifests/kustomize/overlays/production/replica_count.yaml @@ -0,0 +1,6 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: nginx-deployment +spec: + replicas: 100 \ No newline at end of file