Skip to content
Snippets Groups Projects
Commit 4538096b73b2 authored by Alexander Trost's avatar Alexander Trost
Browse files

Added manifests for GitLab CI RBAC config

parent e236deb0a7c1
No related branches found
No related tags found
No related merge requests found
...@@ -84,9 +84,7 @@ ...@@ -84,9 +84,7 @@
- sed -i "s/__CI_ENVIRONMENT_SLUG__/${CI_ENVIRONMENT_SLUG}/" deployment.yaml ingress.yaml service.yaml - sed -i "s/__CI_ENVIRONMENT_SLUG__/${CI_ENVIRONMENT_SLUG}/" deployment.yaml ingress.yaml service.yaml
- sed -i "s/__VERSION__/${CI_COMMIT_REF_NAME}/" deployment.yaml ingress.yaml service.yaml - sed -i "s/__VERSION__/${CI_COMMIT_REF_NAME}/" deployment.yaml ingress.yaml service.yaml
- kubectl get deployments -l app=${CI_ENVIRONMENT_SLUG} - kubectl get deployments -l app=${CI_ENVIRONMENT_SLUG}
- | - if [[ $(kubectl apply -f deployment.yaml) == *"unchanged"* ]]; then kubectl patch deployment ${CI_ENVIRONMENT_SLUG} -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"ci-last-updated\":\"$(date +'%s')\"}}}}}"; fi
test $(kubectl apply -f manifests/deployment.yml -n ${NAMESPACE}) == *"unchanged"* && \
kubectl patch deployment ${CI_ENVIRONMENT_SLUG} -p "{\"spec\":{\"template\":{\"metadata\":{\"annotations\":{\"ci-last-updated\":\"$(date +'%s')\"}}}}}"
- kubectl apply -f service.yaml || true - kubectl apply -f service.yaml || true
- kubectl apply -f ingress.yaml - kubectl apply -f ingress.yaml
......
This directory contains a Namespace and RBAC ServiceAccount, Role and RoleBinding to be used for GitLab Kubernetes integration.
apiVersion: v1
kind: Namespace
metadata:
name: presentation-gitlab-k8s
apiVersion: v1
kind: ServiceAccount
metadata:
name: gitlab-ci
namespace: presentation-gitlab-k8s
---
apiVersion: rbac.authorization.k8s.io/v1beta1
kind: RoleBinding
metadata:
name: gitlab-ci
namespace: presentation-gitlab-k8s
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: cluster-admin
subjects:
- kind: ServiceAccount
name: gitlab-ci
namespace: presentation-gitlab-k8s
apiVersion: v1
kind: Namespace
metadata:
name: presentation-gitlab-k8s
spec: {}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment