-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add end-2-end test action
- Loading branch information
Showing
13 changed files
with
244 additions
and
46 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
name: e2e tests | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
pull_request: | ||
branches: | ||
- main | ||
|
||
jobs: | ||
e2e: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install kind with registry | ||
uses: bakito/kind-with-registry-action@main | ||
|
||
- name: Build image | ||
run: ./testdata/e2e/buildImage.sh | ||
|
||
- name: Install cert-manager | ||
run: ./testdata/e2e/installCertManager.sh | ||
|
||
- name: Install service certificate | ||
run: ./testdata/e2e/installCertificate.sh | ||
|
||
- name: Install helm chart | ||
run: | | ||
./testdata/e2e/installChart.sh | ||
kubectl create ns e2e-test | ||
- name: Setup Java | ||
uses: actions/setup-java@v3 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '17' | ||
|
||
- name: Test generated cacerts | ||
run: ./testdata/e2e/testConfigMaps.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
kind-config.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#!/bin/bash | ||
set -e | ||
docker build -f Dockerfile -t localhost:5001/java-truststore-injection-webhook:e2e . | ||
docker push localhost:5001/java-truststore-injection-webhook:e2e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
image: | ||
repository: localhost:5001/java-truststore-injection-webhook | ||
tag: e2e | ||
pullPolicy: Always | ||
|
||
securityContext: | ||
allowPrivilegeEscalation: false | ||
runAsNonRoot: true | ||
seccompProfile: | ||
type: RuntimeDefault | ||
capabilities: | ||
drop: [ "ALL" ] | ||
|
||
webhook: | ||
annotations: | ||
cert-manager.io/inject-ca-from: java-truststore-injection-webhook/java-truststore-injection-webhook-certs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
helm repo add jetstack https://charts.jetstack.io | ||
helm upgrade --install cert-manager --create-namespace --namespace cert-manager jetstack/cert-manager --atomic --set installCRDs=true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
kubectl create ns java-truststore-injection-webhook || true | ||
kubectl apply -n java-truststore-injection-webhook -f ./testdata/e2e/installCertificate.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
apiVersion: cert-manager.io/v1 | ||
kind: Issuer | ||
metadata: | ||
name: selfsigned-issuer | ||
spec: | ||
selfSigned: { } | ||
|
||
--- | ||
|
||
apiVersion: cert-manager.io/v1 | ||
kind: Certificate | ||
metadata: | ||
name: java-truststore-injection-webhook-certs | ||
spec: | ||
secretName: java-truststore-injection-webhook-certs | ||
dnsNames: | ||
- "*.java-truststore-injection-webhook.svc.cluster.local" | ||
- "*.java-truststore-injection-webhook.svc" | ||
- "*.java-truststore-injection-webhook" | ||
issuerRef: | ||
name: selfsigned-issuer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
helm upgrade --install java-truststore-injection-webhook charts/java-truststore-injection-webhook \ | ||
--namespace java-truststore-injection-webhook \ | ||
--create-namespace \ | ||
-f testdata/e2e/e2e-values.yaml \ | ||
--atomic | ||
kubectl get pods -n java-truststore-injection-webhook |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
kubectl apply -n java-truststore-injection-webhook -f testdata/e2e/testConfigMaps.yaml | ||
|
||
textConfigMap () { | ||
echo "Read ${2} from ${1}" | ||
CACERTS=$(kubectl get cm -n java-truststore-injection-webhook ${1} -o json | jq -r ".binaryData.\"${2}\"") | ||
echo "${CACERTS}" | base64 --decode > cacerts | ||
keytool -list -keystore cacerts -storepass ${3} | grep "Your keystore contains 1 entry" | ||
|
||
echo "Check last-injected-truststore-name" | ||
kubectl get cm -n java-truststore-injection-webhook ${1} -o json | jq -r '.metadata.annotations."jti.bakito.ch/last-injected-truststore-name"' | grep "${2}" | ||
} | ||
|
||
textConfigMap java-certs-simple cacerts changeit | ||
|
||
textConfigMap java-certs-extended my-certs my-precious |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
jti.bakito.ch/inject-truststore: "true" | ||
name: java-certs-simple | ||
data: | ||
my-cert.pem: | | ||
-----BEGIN CERTIFICATE----- | ||
MIIFmTCCA4GgAwIBAgIUKvSUzRiN3GyPAJk+x7zywVJIjL8wDQYJKoZIhvcNAQEL | ||
BQAwWzELMAkGA1UEBhMCWFgxDzANBgNVBAgMBmdpdGh1YjEPMA0GA1UEBwwGYmFr | ||
aXRvMSowKAYDVQQDDCFqYXZhLXRydXN0c3RvcmUtaW5qZWN0aW9uLXdlYmhvb2sw | ||
IBcNMjMwNTI3MTEyMDQ3WhgPMjEyMzA1MDMxMTIwNDdaMFsxCzAJBgNVBAYTAlhY | ||
MQ8wDQYDVQQIDAZnaXRodWIxDzANBgNVBAcMBmJha2l0bzEqMCgGA1UEAwwhamF2 | ||
YS10cnVzdHN0b3JlLWluamVjdGlvbi13ZWJob29rMIICIjANBgkqhkiG9w0BAQEF | ||
AAOCAg8AMIICCgKCAgEAq/7ZUh3aGkMTCzsoPbylqiBFsNNrPb/SBKpdljoKpejk | ||
Kuc/OSjtjgIPSZODUxnW9p+vwJ5Sv8nbqOpwfgkFHUwItEC771NqOOfObheiZZGz | ||
QxSqJUGActckTmGhgRC2TAWAFugzuusQK3EHAXOycBbDflTfC0IgEquUYExAQ2wB | ||
fmAoImJPsUXpoKtqVL7BnTemPcl0eUp07jmsxWmwmTd5STF36UsR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MdDdQQNBBwRmLmWJIwEKDpcW | ||
FSaj7mKUe5RnvFZTeHMLHDm/LgfaJHM0wrQo9YcYLaVQ4iYVNE94iPkI2zuhOgRq | ||
TYrDFyVqUA/jrgaAbguGiwP4mddfUmaWUiafLzdLxm+37V2bYT5b+Vn+PmPNpVom | ||
sFjsEiqNgPMsb+ARrzXdJzIO3gEW0TYLAx24ABgRttd0TXURZbuGkVwoEyDSQHer | ||
9tcIzkwuz9wxWrxygcKc5u3AlOSE5A2CBXEWEshgbegYc/8jhuYbtDgONvkO | ||
-----END CERTIFICATE----- | ||
--- | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
labels: | ||
jti.bakito.ch/inject-truststore: "true" | ||
jti.bakito.ch/truststore-name: my-certs | ||
annotations: | ||
jti.bakito.ch/truststore-password: my-precious | ||
name: java-certs-extended | ||
data: | ||
my-cert.pem: | | ||
-----BEGIN CERTIFICATE----- | ||
MIIFmTCCA4GgAwIBAgIUKvSUzRiN3GyPAJk+x7zywVJIjL8wDQYJKoZIhvcNAQEL | ||
BQAwWzELMAkGA1UEBhMCWFgxDzANBgNVBAgMBmdpdGh1YjEPMA0GA1UEBwwGYmFr | ||
aXRvMSowKAYDVQQDDCFqYXZhLXRydXN0c3RvcmUtaW5qZWN0aW9uLXdlYmhvb2sw | ||
IBcNMjMwNTI3MTEyMDQ3WhgPMjEyMzA1MDMxMTIwNDdaMFsxCzAJBgNVBAYTAlhY | ||
MQ8wDQYDVQQIDAZnaXRodWIxDzANBgNVBAcMBmJha2l0bzEqMCgGA1UEAwwhamF2 | ||
YS10cnVzdHN0b3JlLWluamVjdGlvbi13ZWJob29rMIICIjANBgkqhkiG9w0BAQEF | ||
AAOCAg8AMIICCgKCAgEAq/7ZUh3aGkMTCzsoPbylqiBFsNNrPb/SBKpdljoKpejk | ||
Kuc/OSjtjgIPSZODUxnW9p+vwJ5Sv8nbqOpwfgkFHUwItEC771NqOOfObheiZZGz | ||
QxSqJUGActckTmGhgRC2T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