Bläddra i källkod

HUE-9030 [k8s] Preparing helm chart for the website

Romain 6 år sedan
förälder
incheckning
66a3cc1372

+ 1 - 0
tools/kubernetes/helm/website/.helmignore

@@ -0,0 +1 @@
+.DS_Store

+ 19 - 0
tools/kubernetes/helm/website/Chart.yaml

@@ -0,0 +1,19 @@
+apiVersion: v1
+description: Website for Hue, the SQL Cloud Editor for Datwarehouses and Databases.
+name: hue-website
+version: 1.0.0
+appVersion: 1.0
+keywords:
+- Hue
+- SQL
+- Editor
+- Catalog
+- Visualization
+home: http://gethue.com/
+sources:
+- https://github.com/cloudera/hue
+- https://hub.docker.com/u/gethue
+maintainers:
+- name: romainr
+  email: romain.rigaux@gmail.com
+icon: https://raw.githubusercontent.com/cloudera/hue/master/docs/images/hue_logo.png

+ 20 - 0
tools/kubernetes/helm/website/README.md

@@ -0,0 +1,20 @@
+# Hue Website Chart
+
+This is an Helm chart to easily manage the Hue websites, gethue, docs, cdn, forum.
+
+## Install
+
+    cd tools/kubernetes/helm/website
+
+View the configuration [values.yaml](values.yaml), edit if needed and run:
+
+    helm install hue-website -n hue-website
+
+[values.yaml](values.yaml) contains the most important parameters in the `hue` section with for example which database to use. The `ini`
+section let you add any extra [regular parameter](https://docs.gethue.com/latest/administrator/configuration/server/).
+
+Then follow-up the instructions printed on the screen for getting the URL to connect to the sites.
+
+## Uninstall
+
+    helm delete hue-website --purge

+ 27 - 0
tools/kubernetes/helm/website/templates/NOTES.txt

@@ -0,0 +1,27 @@
+Congratulations, you've launched the website of Hue!
+
+To check the status of your installation run:
+
+  helm list {{ .Release.Name }}
+
+Run below commands to get the recommended URLs:
+{{ if true }}
+  export WEB_HOST=$(kubectl get node -o jsonpath="{.items[0].metadata.name}")
+{{- end -}}
+
+{{ if and .Values.ingress.create (eq .Values.ingress.type "nginx") }}
+
+  echo http://$WEB_HOST
+
+{{ else if and .Values.ingress.create (eq .Values.ingress.type "nginx-ssl") }}
+
+  echo https://{{ .Values.docs.domain }}
+
+{{ else }}
+
+  export WEB_PORT=$(kubectl get service gethue-docs -o jsonpath="{.spec.ports[*].nodePort}" --namespace {{ .Release.Namespace }})
+
+  echo http://$WEB_HOST:$WEB_PORT
+
+{{ end }}
+Happy Querying!

+ 17 - 0
tools/kubernetes/helm/website/templates/clusterissuer-letsencrypt-prod.yaml

@@ -0,0 +1,17 @@
+{{- if and .Values.ingress.create (eq .Values.ingress.type "nginx-ssl") -}}
+apiVersion: certmanager.k8s.io/v1alpha1
+kind: ClusterIssuer
+metadata:
+  name: letsencrypt-website-prod
+spec:
+  acme:
+    # The ACME server URL
+    server: https://acme-v02.api.letsencrypt.org/directory
+    # Email address used for ACME registration
+    email: {{ .Values.ingress.email }}
+    # Name of a secret used to store the ACME account private key
+    privateKeySecretRef:
+      name: letsencrypt-prod
+    # Enable the HTTP-01 challenge provider
+    http01: {}
+{{- end -}}

+ 29 - 0
tools/kubernetes/helm/website/templates/deployment-docs.gethue.yaml

@@ -0,0 +1,29 @@
+apiVersion: apps/v1
+kind: Deployment
+metadata:
+  name: gethue-docs
+  labels:
+    deployment: gethue-docs
+spec:
+  selector:
+    matchLabels:
+      pod: gethue-docs
+  replicas: 1
+  template:
+    metadata:
+      labels:
+        pod: gethue-docs
+    spec:
+      containers:
+      - name: gethue-docs
+        image: {{ .Values.image.registry }}/documentation:{{ .Values.image.tag }}
+        imagePullPolicy: {{ .Values.image.pullPolicy }}
+        ports:
+          - containerPort: 80
+        readinessProbe:
+          httpGet:
+            path: /
+            port: 80
+          initialDelaySeconds: 3
+          periodSeconds: 60
+          failureThreshold: 30

+ 21 - 0
tools/kubernetes/helm/website/templates/ingress-http.yaml

@@ -0,0 +1,21 @@
+{{- if and .Values.ingress.create (eq .Values.ingress.type "nginx") -}}
+apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  name: hue-ingress
+  annotations:
+    kubernetes.io/ingress.class: nginx
+    nginx.ingress.kubernetes.io/affinity: "cookie"
+    nginx.ingress.kubernetes.io/session-cookie-name: "hue-website-ingress"
+    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
+    nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
+spec:
+  rules:
+  - host: {{ .Values.ingress.domain }}
+    http:
+      paths:
+      - backend:
+          serviceName: gethue-docs
+          servicePort: 80
+        path: /
+{{- end -}}

+ 28 - 0
tools/kubernetes/helm/website/templates/ingress-https.yaml

@@ -0,0 +1,28 @@
+{{- if and .Values.ingress.create (eq .Values.ingress.type "nginx-ssl") -}}
+apiVersion: networking.k8s.io/v1beta1
+kind: Ingress
+metadata:
+  name: hue-ingress
+  annotations:
+    kubernetes.io/ingress.class: nginx
+    certmanager.k8s.io/cluster-issuer: letsencrypt-website-prod
+    certmanager.k8s.io/acme-challenge-type: http01
+    nginx.ingress.kubernetes.io/ssl-redirect: "true"
+    nginx.ingress.kubernetes.io/affinity: "cookie"
+    nginx.ingress.kubernetes.io/session-cookie-name: "hue-website-ingress"
+    nginx.ingress.kubernetes.io/session-cookie-expires: "172800"
+    nginx.ingress.kubernetes.io/session-cookie-max-age: "172800"
+spec:
+  rules:
+  - host: {{ .Values.docs.domain }}
+    http:
+      paths:
+      - backend:
+          serviceName: gethue-docs
+          servicePort: 80
+        path: /
+  tls:
+  - hosts:
+    - {{ .Values.docs.domain }}
+    secretName: letsencrypt-pro
+{{- end -}}

+ 13 - 0
tools/kubernetes/helm/website/templates/service-docs.gethue.yaml

@@ -0,0 +1,13 @@
+apiVersion: v1
+kind: Service
+metadata:
+  name: gethue-docs
+  labels:
+    pod: gethue-docs
+spec:
+  selector:
+    pod: gethue-docs
+  ports:
+  - name: gethue-docs
+    port: 80
+  type: ClusterIP

+ 19 - 0
tools/kubernetes/helm/website/templates/servicemonitor-hue.yaml

@@ -0,0 +1,19 @@
+{{- if .Values.monitoring.enabled -}}
+apiVersion: monitoring.coreos.com/v1
+kind: ServiceMonitor
+metadata:
+  labels:
+    k8s-app: hue
+  name: hue
+  namespace: monitoring
+spec:
+  endpoints:
+  - interval: 30s
+    port: hue
+  namespaceSelector:
+    matchNames:
+    - default
+  selector:
+    matchLabels:
+      app: hue
+{{- end -}}

+ 18 - 0
tools/kubernetes/helm/website/values.yaml

@@ -0,0 +1,18 @@
+image:
+   registry: "localhost:32000"
+   tag: "registry"
+   pullPolicy: "Always"
+   # registry: "gethue"
+   # tag: "latest"
+   # pullPolicy: "IfNotPresent"
+docs:
+  enabled: true
+  replicas: 1
+  domain: "docs.gethue.com"
+monitoring:
+  enabled: false
+ingress:
+  create: false
+  type: "nginx"
+  # type: "nginx-ssl"
+  email: "team@gethue.com"