Skip to content

Commit 5c8f630

Browse files
author
Tommy McNeely
authored
Merge pull request #5 from TJM/chore/build-changes
chore: split lint and test
2 parents a38a0b6 + c23124c commit 5c8f630

21 files changed

+443
-226
lines changed

.github/workflows/lint-test.yaml

Lines changed: 0 additions & 155 deletions
This file was deleted.

.github/workflows/lint.yaml

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Lint Chart and Dockerfile
2+
3+
on: pull_request
4+
5+
jobs:
6+
lint:
7+
runs-on: ubuntu-latest
8+
env:
9+
CT_TARGET_BRANCH: main
10+
11+
steps:
12+
- name: Checkout
13+
uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
17+
- name: Set up Helm
18+
uses: azure/setup-helm@v1
19+
with:
20+
version: v3.4.0
21+
22+
- uses: actions/setup-python@v2
23+
with:
24+
python-version: 3.7
25+
26+
- name: Set up chart-testing
27+
uses: helm/[email protected]
28+
29+
- name: Run chart-testing (list-changed)
30+
id: list-changed
31+
run: |
32+
changed=$(ct list-changed)
33+
if [[ -n "$changed" ]]; then
34+
echo "::set-output name=changed::true"
35+
fi
36+
37+
- name: Run chart-testing (lint)
38+
run: ct lint
39+
40+
- name: Docker Lint
41+
uses: luke142367/[email protected]
42+
with:
43+
target: Dockerfile
44+
env:
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/test.yaml

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Test Container and Helm Chart
2+
3+
on: pull_request
4+
5+
jobs:
6+
test:
7+
runs-on: ubuntu-latest
8+
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
auth:
13+
- kubernetes
14+
- approle
15+
secretType:
16+
- docker
17+
- generic
18+
19+
env:
20+
VAULT_ADDR: http://127.0.0.1:8200
21+
VAULT_AUTH_NAMESPACE: kube-system
22+
TARGET_NAMESPACE: gcp-secrets
23+
AUTH_METHOD: ${{ matrix.auth }}
24+
SECRET_TYPE: ${{ matrix.secretType }}
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v2
29+
with:
30+
fetch-depth: 0
31+
32+
- name: Set up Helm
33+
uses: azure/setup-helm@v1
34+
with:
35+
version: v3.4.0
36+
37+
- name: Setup Vault
38+
run: |
39+
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
40+
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
41+
sudo apt-get update && sudo apt-get install vault
42+
43+
- name: Create KIND cluster with Registry
44+
# uses: helm/[email protected]
45+
uses: container-tools/kind-action@v1
46+
47+
- name: Create Kubernetes namespace
48+
id: kube-target-namespace
49+
run: kubectl create namespace $TARGET_NAMESPACE
50+
51+
- name: Build Docker Image for local testing
52+
run: |
53+
docker build -t $KIND_REGISTRY/vault-gcr-secrets:test .
54+
docker push $KIND_REGISTRY/vault-gcr-secrets:test
55+
56+
- name: Install Vault Service
57+
run: ./test/scripts/vault-install.sh
58+
59+
- name: Configure ${{ matrix.auth }} Vault authentication
60+
run: ./test/scripts/vault-auth-${{ matrix.auth }}.sh
61+
62+
- name: Configure Vault ${{ matrix.auth }} Role
63+
run: ./test/scripts/vault-role-${{ matrix.auth }}.sh
64+
65+
- name: Setup GCP secrets engine
66+
id: gcp-secrets
67+
env:
68+
GCP_CREDENTIALS: ${{ secrets.GCP_TEST_ACCOUNT }}
69+
run: ./test/scripts/vault-gcp-secrets.sh
70+
71+
- name: Install vault-gcr-secrets
72+
run: ./test/scripts/install-chart.sh
73+
74+
- name: Verify Secret
75+
env:
76+
SERVICE_ACCOUNT_EMAIL: ${{ steps.gcp-secrets.outputs.service_account_email }}
77+
run: ./test/scripts/verify-secret.sh
78+
79+
- name: Show Pod Status and Logs
80+
if: ${{ always() }}
81+
run: ./test/scripts/end-collect-data.sh
82+
83+
- name: Cleanup GCP Roleset (service accounts)
84+
if: ${{ always() }}
85+
run: ./test/scripts/end-cleanup.sh

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ ARG KUBECTL_VERSION="stable"
33

44
# Add more dependencies
55
RUN apk add --no-cache jq bash curl openssl \
6-
&& [[ $KUBECTL_VERSION = "stable" ]] && KUBECTL_VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) \
6+
&& [ "${KUBECTL_VERSION}" = "stable" ] && KUBECTL_VERSION=$(curl -s https://storage.googleapis.com/kubernetes-release/release/stable.txt) \
77
&& curl -LO "https://storage.googleapis.com/kubernetes-release/release/${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
88
&& chmod +x ./kubectl \
99
&& mv ./kubectl /usr/local/bin/kubectl

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ NOTE: This is alpha quality, use it at your own risk.
99
## Prerequisites
1010

1111
* Google Cloud Platform (GCP) Account setup with Vault
12-
* AppRole, Token or Kubernetes authentication to Vault
12+
* AppRole or Kubernetes authentication to Vault
1313

1414
## Installation
1515

charts/vault-gcr-secrets/Chart.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,5 +5,5 @@ home: https://github.com/TJM/vault-gcr-secrets
55
# icon: https://raw.githubusercontent.com/TJM/vault-gcr-secrets/master/assets/logo.png
66
maintainers:
77
- name: TJM # Tommy McNeely
8-
version: 0.3.0
9-
appVersion: 0.3.0
8+
version: 0.3.1
9+
appVersion: 0.3.1

charts/vault-gcr-secrets/README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,9 @@ NOTE: This is alpha quality, use it at your own risk.
1717
| `imagePullSecrets` | Secrets which can be used to pull the Docker image. | `[]` |
1818
| `nameOverride` | Expand the name of the chart. | `""` |
1919
| `fullnameOverride` | Override the name of the app. | `""` |
20-
| `environmentVars` | Pass environment variables from a secret to the containers. This must be used if you use the Token auth method of Vault. | `[]` |
20+
| `environmentVars` | Pass environment variables from a secret to the containers. | `[]` |
2121
| `vault.address` | The address where Vault listen on (e.g. `http://vault.example.com`). | `"http://vault:8200"` |
22-
| `vault.authMethod` | The authentication method, which should be used by the operator. Can by `token` ([Token auth method](https://www.vaultproject.io/docs/auth/token.html)), `kubernetes` ([Kubernetes auth method](https://www.vaultproject.io/docs/auth/kubernetes.html)), or `approle` ([AppRole auth method](https://www.vaultproject.io/docs/auth/approle)). | `token` |
23-
| `vault.tokenPath` | Path to file with the Vault token if the used auth method is `token`. Can be used to read the token from a file and not from the `VAULT_TOKEN` environment variable. | `""` |
22+
| `vault.authMethod` | The authentication method, which should be used by the operator. Can be `kubernetes` ([Kubernetes auth method](https://www.vaultproject.io/docs/auth/kubernetes.html)), or `approle` ([AppRole auth method](https://www.vaultproject.io/docs/auth/approle)). | `kubernetes` |
2423
| `vault.kubernetesPath` | If the Kubernetes auth method is used, this is the path where the Kubernetes auth method is enabled. | `auth/kubernetes` |
2524
| `vault.kubernetesRole` | The name of the role which is configured for the Kubernetes auth method. | `vault-gcr-secrets` |
2625
| `vault.appRolePath` | If the AppRole auth method is used, this is the path where the AppRole auth method is enabled. | `auth/approle` |

charts/vault-gcr-secrets/templates/configmap.yaml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,6 @@ data:
7272
--dry-run=client -o yaml | kubectl replace -f -
7373
{{- else }}
7474
kubectl create secret generic "{{ .Values.secret.name }}" \
75-
--from-file={{ .Values.secret.key }}=/dev/shm/key.json \
76-
--dry-run=client -o yaml | kubectl replace -f -
75+
--from-file={{ .Values.secret.key }}=/dev/shm/key.json \
76+
--dry-run=client -o yaml | kubectl replace -f -
7777
{{- end }}

charts/vault-gcr-secrets/templates/deployment.yaml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,6 @@ spec:
4949
- -config
5050
- /srv/vault-agent/agent.hcl
5151
env:
52-
{{- if .Values.vault.address }}
53-
- name: VAULT_ADDRESS
54-
value: {{ .Values.vault.address | quote }}
55-
{{- end }}
56-
{{- if .Values.vault.tokenPath }}
57-
- name: VAULT_TOKEN_PATH
58-
value: {{ .Values.vault.tokenPath | quote }}
59-
{{- end }}
6052
{{- with .Values.environmentVars }}
6153
{{- toYaml . | nindent 12 }}
6254
{{- end }}

0 commit comments

Comments
 (0)