Skip to content

Commit

Permalink
config: use centrally configured k8s namespace
Browse files Browse the repository at this point in the history
* Use the Helm release namespace as the namespace where
  REANA will be running. Passes this configuration down to
  REANA-Workflow-Controller which till take care of all
  runtime pods running on the desired namespace
  (closes #274).
  • Loading branch information
Diego Rodriguez committed Jun 9, 2020
1 parent c65f9c9 commit adf0b25
Show file tree
Hide file tree
Showing 20 changed files with 36 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ deploy: # Deploy/redeploy previously built REANA cluster.
source ${HOME}/.virtualenvs/${INSTANCE_NAME}/bin/activate && \
minikube docker-env --profile ${INSTANCE_NAME} > /dev/null && eval $$(minikube docker-env --profile ${INSTANCE_NAME}) && \
helm dep update helm/reana && (helm ls | grep -q ${TRUNC_INSTANCE_NAME} && helm uninstall ${TRUNC_INSTANCE_NAME}) && \
kubectl get secrets -o custom-columns=":metadata.name" | grep ${TRUNC_INSTANCE_NAME} | xargs kubectl delete secret || \
kubectl delete namespace ${INSTANCE_NAME} || \
waited=0 && while true; do \
waited=$$(($$waited+${TIMECHECK})); \
if [ $$waited -gt ${TIMEOUT} ];then \
Expand All @@ -194,7 +194,7 @@ deploy: # Deploy/redeploy previously built REANA cluster.
if [ $$(docker images | grep -c '<none>') -gt 0 ]; then \
docker images | grep '<none>' | awk '{print $$3;}' | xargs docker rmi; \
fi && \
helm install ${TRUNC_INSTANCE_NAME} helm/reana $(addprefix --set , ${CLUSTER_FLAGS}) $(addprefix -f , ${VALUES_YAML_PATH}) --wait && \
helm install ${TRUNC_INSTANCE_NAME} helm/reana $(addprefix --set , ${CLUSTER_FLAGS}) $(addprefix -f , ${VALUES_YAML_PATH}) --wait --namespace ${INSTANCE_NAME} --create-namespace && \
waited=0 && while true; do \
waited=$$(($$waited+${TIMECHECK})); \
if [ $$waited -gt ${TIMEOUT} ];then \
Expand Down
1 change: 0 additions & 1 deletion helm/reana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ This Helm automatically prefixes all names using the release name to avoid colli
| `secrets.reana.REANA_SECRET_KEY` | **[Do not use in production, use secrets instead]** REANA encryption secret key | None |
| `serviceAccount.create` | Create a service account for the REANA system user | true |
| `serviceAccount.name` | Service account name | reana |
| `serviceAccount.namespace` | Service account namespace | default |
| `shared_storage.access_modes` | Shared volume access mode | ReadWriteMany |
| `shared_storage.backend` | Shared volume storage backend | hostpath |
| `shared_storage.cephfs.availability_zone` | **[CERN only]** OpenStack Availability zone | nova |
Expand Down
1 change: 1 addition & 0 deletions helm/reana/templates/announcement-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: announcement-config
namespace: {{ .Release.Namespace }}
data:
announcement: ""
1 change: 1 addition & 0 deletions helm/reana/templates/cronjobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: batch/v1beta1
kind: CronJob
metadata:
name: {{ include "reana.prefix" . }}-system-status
namespace: {{ .Release.Namespace }}
spec:
schedule: "{{ .Values.notifications.system_status }}"
jobTemplate:
Expand Down
1 change: 1 addition & 0 deletions helm/reana/templates/ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ apiVersion: extensions/v1beta1
kind: Ingress
metadata:
name: {{ include "reana.prefix" . }}-ingress
namespace: {{ .Release.Namespace }}
{{- with .Values.ingress.annotations }}
annotations:
{{- toYaml . | nindent 4 }}
Expand Down
1 change: 1 addition & 0 deletions helm/reana/templates/kerberos-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: {{ include "reana.prefix" . }}-krb5-conf
namespace: {{ .Release.Namespace }}
data:
krb5.conf: |
[libdefaults]
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-cache.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-cache
namespace: {{ .Release.Namespace }}
spec:
type: NodePort
selector:
Expand All @@ -16,6 +17,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-cache
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-db.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-db
namespace: {{ .Release.Namespace }}
spec:
type: NodePort
selector:
Expand All @@ -17,6 +18,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-db
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-mail.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-mail
namespace: {{ .Release.Namespace }}
spec:
type: "NodePort"
ports:
Expand All @@ -24,6 +25,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-mail
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-message-broker.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-message-broker
namespace: {{ .Release.Namespace }}
spec:
ports:
- port: 5672
Expand All @@ -20,6 +21,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-message-broker
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-server.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-server
namespace: {{ .Release.Namespace }}
spec:
type: "NodePort"
ports:
Expand All @@ -17,6 +18,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-server
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-shared-persistent-volume.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: {{ include "reana.prefix" . }}-shared-persistent-volume
namespace: {{ .Release.Namespace }}
spec:
accessModes:
- {{ .Values.shared_storage.access_modes }}
Expand All @@ -18,6 +19,7 @@ apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ include "reana.prefix" . }}-shared-volume-storage-class
namespace: {{ .Release.Namespace }}
provisioner: {{ .Values.shared_storage.cephfs.provisioner }}
parameters:
type: {{ .Values.shared_storage.cephfs.type }}
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-ui.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-ui
namespace: {{ .Release.Namespace }}
spec:
type: "NodePort"
ports:
Expand All @@ -18,6 +19,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-ui
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down
2 changes: 2 additions & 0 deletions helm/reana/templates/reana-wdb.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-wdb
namespace: {{ .Release.Namespace }}
spec:
type: "NodePort"
ports:
Expand All @@ -23,6 +24,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-wdb
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down
4 changes: 4 additions & 0 deletions helm/reana/templates/reana-workflow-controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Service
metadata:
name: {{ include "reana.prefix" . }}-workflow-controller
namespace: {{ .Release.Namespace }}
spec:
type: "NodePort"
ports:
Expand All @@ -17,6 +18,7 @@ apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "reana.prefix" . }}-workflow-controller
namespace: {{ .Release.Namespace }}
spec:
replicas: 1
selector:
Expand Down Expand Up @@ -51,6 +53,8 @@ spec:
env:
- name: REANA_COMPONENT_PREFIX
value: {{ include "reana.prefix" . }}
- name: REANA_KUBERNETES_NAMESPACE
value: {{ .Release.Namespace }}
{{- if .Values.naming_scheme }}
- name: REANA_COMPONENT_NAMING_SCHEME
value: {{ .Values.naming_scheme }}
Expand Down
5 changes: 3 additions & 2 deletions helm/reana/templates/roles.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
kind: ClusterRole
apiVersion: rbac.authorization.k8s.io/v1
metadata:
namespace: default
name: {{ include "reana.prefix" . }}-deployment-manager
namespace: {{ .Release.Namespace }}
rules:
- apiGroups: [""] # "" indicates the core API group
resources: ["nodes", "nodes/status", "pods", "pods/log", "secrets", "persistentvolumeclaims", "configmaps"]
Expand All @@ -23,11 +23,12 @@ apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: {{ include "reana.prefix" . }}-manage-deployments
namespace: {{ .Release.Namespace }}
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: {{ include "reana.prefix" . }}-deployment-manager
subjects:
- kind: ServiceAccount
name: {{ include "reana.prefixed_svaccount_name" . }}
namespace: default
namespace: {{ .Release.Namespace }}
5 changes: 5 additions & 0 deletions helm/reana/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "reana.prefix" . }}-db-secrets
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
Expand All @@ -14,6 +15,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "reana.prefix" . }}-cern-sso-secrets
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
Expand All @@ -25,6 +27,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "reana.prefix" . }}-cern-gitlab-secrets
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
Expand All @@ -37,6 +40,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "reana.prefix" . }}-secrets
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
Expand All @@ -48,6 +52,7 @@ apiVersion: v1
kind: Secret
metadata:
name: {{ include "reana.prefix" . }}-mail-notification-sender-password
namespace: {{ .Release.Namespace }}
annotations:
"helm.sh/resource-policy": keep
type: Opaque
Expand Down
2 changes: 1 addition & 1 deletion helm/reana/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ include "reana.prefixed_svaccount_name" . }}
namespace: {{ .Values.serviceAccount.namespace }}
namespace: {{ .Release.Namespace }}
1 change: 1 addition & 0 deletions helm/reana/templates/uwsgi-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ apiVersion: v1
kind: ConfigMap
metadata:
name: uwsgi-config
namespace: {{ .Release.Namespace }}
data:
uwsgi.ini: |
[uwsgi]
Expand Down
5 changes: 0 additions & 5 deletions helm/reana/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@ ingress:
serviceAccount:
create: true
name: reana
namespace: default

# Traefik's chart values.yaml
traefik:
Expand All @@ -105,10 +104,6 @@ traefik:
enabled: true
dashboard:
enabled: true
kubernetes:
namespaces:
- default
- kube-system
serviceType: NodePort
service:
nodePorts:
Expand Down

0 comments on commit adf0b25

Please sign in to comment.