-
Notifications
You must be signed in to change notification settings - Fork 56
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rfc(template): remove custom Jinja templating #358
Comments
Hi @shikanime, thanks for willingness to contribute! We created We have also been looking at Kustomize which comes for free with Note that @BenGalewsky already started to create REANA charts some moths ago: Perhaps we could join the efforts and make the change happen? |
Hi @tiborsimko! Speaking of Helm's Tiller, there have been several attempts in the community like the Operator Framework Helm Operator or bitnamy's Helm CRD. Well, fortunately the next major version 3 of Helm has definitely got rid of it. With that the security model for Helm is radically simplified. Of course I'm up for it. |
Indeed Helm's current model require special care when used on a Kubernetes cluster with Role-based access control (RBAC) enabled, which is the case for example on Google's managed clusters (GKE). If you are interested, I can submit the configuration required for Helm to deploy Reana in a RBAC-enabled cluster. |
I had a lot to do since then, I'm working on it right now 😇 |
After some experimentation, Helm turns out not to be a suitable tool. It makes the YAML less readable, less easy to maintain, hard to extend, difficult to share template configuration between sub-charts and have security concerns. Helm is may be more useful if we want to publish a chart with abstracted complexe cluster deployment configuration but for the My current really WIP implementation for the moment: https://github.com/Shikanime/reana-cluster/tree/refactor/kustomize. |
Hello @shikanime! Great to see progress and a nice analysis of the tools 🙂. Since there are more people interested in this change in the community (for example @BenGalewsky, @lukasheinrich, @khurtado, and @reanahub/developers in general), it would be great if you could share some more examples of the specific hiccups you found while using Helm for the Also, in order to help to clarify, I see in your branch that you have nice history, using Helm and now Kustomize, maybe splitting the history into two branches (Helm and Kustomize) and having a short usage scenario for each would also help to make a decision? P.S. We should also take a closer look at @BenGalewsky first attempt with Helm which I believe can be found here https://github.com/BenGalewsky/reana-cluster/tree/helm_chart and maybe getting some more feedback? |
While I think there are legitimate concerns with helm, it is I *very*
broadly deployed compared to kustomize. I would vote for preparing a helm
chart.
…On Tue, Oct 22, 2019 at 1:45 PM Diego ***@***.***> wrote:
Hello @shikanime <https://github.com/Shikanime>!
Great to see progress and a nice analysis of the tools 🙂.
Since there are more people interested in this change in the community
(for example @BenGalewsky <https://github.com/BenGalewsky>, @lukasheinrich
<https://github.com/lukasheinrich>, @khurtado
<https://github.com/khurtado>, and @reanahub/developers
<https://github.com/orgs/reanahub/teams/developers> in general), it would
be great if you could share some more examples of the specific hiccups you
found while using Helm for the reana-cluster use case, so we can all
better understand which decision to take and more importantly, why we take
it :)
Also, in order to help to clarify, I see in your branch
<https://github.com/Shikanime/reana-cluster/commits/refactor/kustomize>
that you have nice history, using Helm and now Kustomize, maybe splitting
the history into two branches (Helm and Kustomize) and having a short usage
scenario for each would also help to make a decision?
P.S. We should also take a closer look at @BenGalewsky
<https://github.com/BenGalewsky> first attempt with Helm which I believe
can be found here
https://github.com/BenGalewsky/reana-cluster/tree/helm_chart and maybe
getting some more feedback?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<https://github.com/reanahub/reana-cluster/issues/219?email_source=notifications&email_token=AARV6AZ5PUPSAVUXGOZWBT3QP3RUPA5CNFSM4IK67FBKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEB5N3BI#issuecomment-544923013>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AARV6A3PAFBBNU2Z364ZJS3QP3RUPANCNFSM4IK67FBA>
.
|
Hello @everyone Of course, to start with, I started the project using Helm since it is the tool I used the most. Since September, I have moved all my work to Kustomize. I will objectively state below the reason and how Kustomize solved my problems and why i now exclusively use Kustomize. Helm is one of the first package managers for Kubernetes and is an industry standard for the moment after the vanilla Kubernetes YAML manifest. Like Ksonnet, Helm uses a programmatic model instead of a declarative model to produce Kubernetes manifests. On the other hand, Kustomize is template-free and declarative to extend the manifests and is natively supported by Kubernetes. OrganizationHelm 2Helm uses the
And it allows you to conditionally import nested subcharts and third-party charts. ./requirements.yaml: dependencies:
- name: postgreql
version: 6.3.9
repository: https://kubernetes-charts.storage.googleapis.com/
- name: rabbitmq
version: 6.7.4
repository: https://kubernetes-charts.storage.googleapis.com/
- name: reana-ui
version: 0.1.0
condition: reanaui.enabled
repository: file://subcharts/reanaui KustomizeA Kustomize project structure is more minimalist and is unopinionated, using Environment oriented structure :
Overlays:
Kustomize in constrast is more declarative,
./base/kustomization.yaml: apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app.kubernetes.io/part-of: reana
app.kubernetes.io/managed-by: kustomize
bases:
- postgresql
- redis
- rabbitmq
- reana-server
- reana-ui
- reana-wdb
- reana-workflow-controller
# ... ./base/postgresql/kustomization.yaml apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
app.kubernetes.io/name: postgresql
app.kubernetes.io/version: "11.5.0"
app.kubernetes.io/component: database
resources:
- headless-svc.yaml
- statefulset.yaml
- svc.yaml
secretGenerator:
- literals:
- postgresql-password=reana
name: postgresql
# ... ConfigurationHelmOne of the main restrictions of templating is that it's not extensible by default. Historically, templating is good for ahead known configuration but in case of infrastructure deployment that's not the case, sometime we need to pass certain environment variable or volume based on various variables. Which lead to template a configuration to be configured on the Chart level. ./charts/reanaserver/templates/deployment.yaml # ...
env:
{{- with .Values.hostName }}
- name: REANA_URL
value: {{ . }}
{{- end }}
{{ include "reanaserver.env" . | indent 12 }}
{{- if .Values.extraEnv }}
{{ tpl (toYaml .Values.extraEnv) $ | indent 12 }}
{{- end }}
ports:
- name: rest-api
containerPort: 5000
- name: scheduler
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
imagePullPolicy: {{ .Values.image.pullPolicy }}
command: ["flask", "start-scheduler"]
resources:
{{- toYaml .Values.scheduler.resources | indent 12 }}
{{- if .Values.securityContext.enabled }}
securityContext:
runAsUser: {{ .Values.securityContext.runAsUser }}
{{- end }}
env:
{{ include "reanaserver.env" . | indent 12 }}
{{- if .Values.extraEnv }}
{{ tpl (toYaml .Values.extraEnv) $ | indent 12 }}
{{- end }}
# ... ./values.yaml reanaserver:
extraVolumeMounts:
- name: reana-shared-volume
mountPath: "/var/reana"
extraVolumes:
- name: reana-shared-volume
persistentVolumeClaim:
claimName: manila-cephfs-pvc
readOnly: false
extraEnv:
- name: SHARED_VOLUME_PATH
value: reana-shared-volume
- name: REANA_STORAGE_BACKEND
value: "cephfs" KustomizeThis is where Kustomize shine, it use template-free Kubernetes manifest and extend it by applying the superposition. ./base/postgresql/deploy.yaml apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: reana-server
spec:
selector:
matchLabels: &containerLabels
app: reana-server
template:
metadata:
labels: *containerLabels
spec:
containers:
- env:
- name: REANA_DEPLOYMENT_TYPE
value: development
- name: SHARED_VOLUME_PATH
value: /var/reana
- name: REANA_DB_HOST
value: $(POSTGRESQL_NAME)
- name: REANA_DB_PORT
value: "5432"
# ...
name: server
volumeMounts:
- mountPath: /var/reana
name: reana-shared-volume
# ... ./prod/cern/postgresql/deploy-patch.yaml apiVersion: extensions/v1beta1
kind: Deployment
metadata:
name: reana-server
spec:
template:
spec:
containers:
- name: server
env:
- name: REANA_DEPLOYMENT_TYPE
value: production
- name: REANA_STORAGE_BACKEND
value: "cephfs"
- name: reana-shared-volume
mountPath: "/var/reana"
volumes:
- name: reana-shared-volume
persistentVolumeClaim:
claimName: manila-cephfs-pvc
readOnly: false Deployment and securityHelmFirstly Helm 2 manages its releases via the tiller, which is a security issue by itself in the same way as the RBAC security issues of the Kubenetes dashboard. Partially solved in the Helm 3 by using an opaque configmap instead of Tiller.
KustomizeIn contrast, Kustomize is natively supported by Kubernetes and is easier to deploy by simply using the following command on a directory that contains a file
Apply and prune all deleted resources:
ConclutionAt each step Kustomize feels more Kubernetes. With or without Kustomize, all the manifests written are valid vanilla Kubernetes manifest and are extensible by default without requiring to fork or create a pull request. Helm is harsh and feels magical where Kustomize is declarative following the Kubernetes philosophy. |
As Reana uses Helm to install Traefik, I was thinking why not use Helm for back-end kubernetes instead of using custom templates with jinja. Since Helm is an industry standard for reusable Kubernetes packages, it can open up opportunities for independent deployment without a
reana-cluster
and allow the use of packages such asstable/postgresql
.I look forward to contributing more 🥰
The text was updated successfully, but these errors were encountered: