-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Charles-Edouard Brétéché <charles.edouard@nirmata.com>
- Loading branch information
1 parent
7a5d788
commit 1d490ad
Showing
13 changed files
with
264 additions
and
0 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
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,35 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
|
||
wget -O /usr/local/bin/yq "https://github.com/mikefarah/yq/releases/download/v4.35.1/yq_linux_amd64" | ||
chmod +x /usr/local/bin/yq | ||
|
||
if [ -z "$CI_SHA1" ]; then | ||
echo "CI_SHA1 not set. Something is wrong" | ||
exit 1 | ||
else | ||
echo "CI_SHA1: $CI_SHA1" | ||
fi | ||
|
||
printf "\n\n" | ||
echo "********************************************************************" | ||
echo "** LOADING IMAGES TO DOCKER AND KIND **" | ||
echo "********************************************************************" | ||
printf "\n\n" | ||
docker load --input /tmp/workspace/docker_save/rbac-manager_${CI_SHA1}-amd64.tar | ||
export PATH=$(pwd)/bin-kind:$PATH | ||
kind load docker-image --name e2e quay.io/reactiveops/rbac-manager:${CI_SHA1}-amd64 | ||
printf "\n\n" | ||
echo "********************************************************************" | ||
echo "** END LOADING IMAGE **" | ||
echo "********************************************************************" | ||
printf "\n\n" | ||
|
||
export newImage=quay.io/reactiveops/rbac-manager:${CI_SHA1}-amd64 | ||
yq -i '.spec.template.spec.containers[0].image = env(newImage)' deploy/3_deployment.yaml | ||
yq -i '.spec.template.spec.containers[0].imagePullPolicy = "IfNotPresent"' deploy/3_deployment.yaml | ||
cat deploy/3_deployment.yaml | ||
|
||
docker cp deploy e2e-command-runner:/ | ||
docker cp e2e/chainsaw e2e-command-runner:/ |
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,40 @@ | ||
#!/bin/bash | ||
|
||
BASE_DIR=$(dirname $BASH_SOURCE) | ||
|
||
printf "\n\n" | ||
echo "**************************" | ||
echo "** Begin E2E Test Setup **" | ||
echo "**************************" | ||
printf "\n\n" | ||
|
||
set -e | ||
|
||
|
||
printf "\n\n" | ||
echo "********************************************************************" | ||
echo "** Install rbac-manager at $CI_SHA1 **" | ||
echo "********************************************************************" | ||
printf "\n\n" | ||
|
||
kubectl apply -f deploy/ | ||
kubectl -n rbac-manager wait deployment/rbac-manager --timeout=120s --for condition=available | ||
|
||
printf "\n\n" | ||
echo "********************************************************************" | ||
echo "** Install and run Chainsaw **" | ||
echo "********************************************************************" | ||
printf "\n\n" | ||
|
||
cd "$BASE_DIR/chainsaw" | ||
|
||
curl -sL https://github.com/kyverno/chainsaw/releases/download/v0.0.9/chainsaw_linux_amd64.tar.gz -o linux_amd64.tar.gz | ||
tar -xvf linux_amd64.tar.gz chainsaw | ||
rm linux_amd64.tar.gz | ||
chmod +x chainsaw | ||
|
||
./chainsaw test | ||
|
||
if [ $? -ne 0 ]; then | ||
exit 1 | ||
fi |
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,10 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/configuration-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Configuration | ||
metadata: | ||
name: congiguration | ||
spec: | ||
parallel: 1 | ||
fullName: true | ||
failFast: false | ||
delayBeforeCleanup: 3s |
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,12 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: clusterrolebindings | ||
spec: | ||
steps: | ||
- try: | ||
- apply: | ||
file: resources.yaml | ||
- assert: | ||
file: expected.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,17 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
rbac-manager: reactiveops | ||
ownerReferences: | ||
- apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
name: rbac-manager-definition | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: test-rbac-manager | ||
subjects: | ||
- kind: ServiceAccount | ||
name: test-rbac-manager | ||
namespace: rbac-manager |
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,12 @@ | ||
apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
metadata: | ||
name: rbac-manager-definition | ||
rbacBindings: | ||
- name: admins | ||
subjects: | ||
- kind: ServiceAccount | ||
name: test-rbac-manager | ||
namespace: rbac-manager | ||
clusterRoleBindings: | ||
- clusterRole: test-rbac-manager |
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,22 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: clusterrolebindings | ||
spec: | ||
steps: | ||
- description: setup rbac definition, make sure expected resources are created | ||
try: | ||
- apply: | ||
file: resources.yaml | ||
- assert: | ||
file: expected.yaml | ||
- description: delete rbac definition, make sure previously created resources are deleted | ||
try: | ||
- delete: | ||
ref: | ||
apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
name: rbac-manager-definition | ||
- error: | ||
file: expected.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,17 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
rbac-manager: reactiveops | ||
ownerReferences: | ||
- apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
name: rbac-manager-definition | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: test-rbac-manager | ||
subjects: | ||
- kind: ServiceAccount | ||
name: test-rbac-manager | ||
namespace: rbac-manager |
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,12 @@ | ||
apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
metadata: | ||
name: rbac-manager-definition | ||
rbacBindings: | ||
- name: admins | ||
subjects: | ||
- kind: ServiceAccount | ||
name: test-rbac-manager | ||
namespace: rbac-manager | ||
clusterRoleBindings: | ||
- clusterRole: test-rbac-manager |
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,12 @@ | ||
# yaml-language-server: $schema=https://raw.githubusercontent.com/kyverno/chainsaw/main/.schemas/json/test-chainsaw-v1alpha1.json | ||
apiVersion: chainsaw.kyverno.io/v1alpha1 | ||
kind: Test | ||
metadata: | ||
name: clusterrolebindings | ||
spec: | ||
steps: | ||
- try: | ||
- apply: | ||
file: resources.yaml | ||
- assert: | ||
file: expected.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,33 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
labels: | ||
rbac-manager: reactiveops | ||
ownerReferences: | ||
- apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
name: rbac-manager-definition-1 | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: test-rbac-manager | ||
subjects: | ||
- kind: ServiceAccount | ||
name: test-rbac-manager | ||
namespace: rbac-manager | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
imagePullSecrets: | ||
- name: robot-secret | ||
metadata: | ||
annotations: | ||
rbacmanager.reactiveops.io/managed-pull-secrets: robot-secret | ||
labels: | ||
rbac-manager: reactiveops | ||
name: test-rbac-manager | ||
namespace: rbac-manager | ||
ownerReferences: | ||
- apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
name: rbac-manager-definition-1 |
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,14 @@ | ||
apiVersion: rbacmanager.reactiveops.io/v1beta1 | ||
kind: RBACDefinition | ||
metadata: | ||
name: rbac-manager-definition-1 | ||
rbacBindings: | ||
- name: admins | ||
subjects: | ||
- kind: ServiceAccount | ||
name: test-rbac-manager | ||
namespace: rbac-manager | ||
imagePullSecrets: | ||
- robot-secret | ||
clusterRoleBindings: | ||
- clusterRole: test-rbac-manager |