Pārlūkot izejas kodu

HUE-8744 [k8s] Big clean-up and restructure of the config files

Romain 6 gadi atpakaļ
vecāks
revīzija
ca84b660a2

+ 3 - 5
tools/kubernetes/README.md

@@ -18,13 +18,11 @@ Assuming you have a Kubernetes cluster configured with Helm installed and images
 * [Container Images](/tools/docker)
    * [Hue](/tools/docker/hue)
 
-## Hue
+## Quick Start
 
-Update the Hue pods:
+    cd tools/kubernetes/helm/hue
 
-```
-kubectl delete pods `kubectl get pods | grep hue | grep -v postgres | cut -d" " -f1`
-```
+    helm install hue -n hue
 
 ## K8s Cluster
 

+ 0 - 8
tools/kubernetes/helm/config.yaml

@@ -1,8 +0,0 @@
-registry: "gethue/hue"
-tag: "latest"
-impala:
-  server_host: "localhost"
-aws:
-  accessKeyId: ""
-  secretAccessKey: ""
-  region: "us-east-1"

+ 5 - 12
tools/kubernetes/helm/hue/README.md

@@ -1,33 +1,26 @@
 # Hue Chart
 
-This is a MVP to get an Helm chart for Hue.
+This is an Helm chart to easily start a Hue service.
 
 
 ## Install
 
     cd tools/kubernetes/helm/hue
 
-If needed, copy [values.yaml](values.yaml) and edit and run:
+View the configuration [hue/values.yaml](hue/values.yaml), edit if needed and run:
 
-    cp config.yaml values.yaml
-    helm install hue -f values.yaml -n hue
+    helm install hue -n hue
 
 
-And follow-up the instructions printed on the screen.
+And follow-up the instructions printed on the screen for conneting to Hue.
 
-Not that by default Hue comes with a temporary DB and ingress load balancer:
+By default you should see these running containers:
 
     kubectl get pods
     NAME                                          READY   STATUS    RESTARTS   AGE
     hue-4n2ck                                     1/1       Running   0          3h
     hue-postgres-5jg77                            1/1       Running   0          12d
-    traefik-ingress-controller-6fbd76695d-nkxnz   1/1       Running   0          12d
 
 ## Un-install
 
     helm delete hue --purge
-
-## Follow-ups
-
-* Parameterize the Database
-* Productionize DB persistence

+ 1 - 1
tools/kubernetes/helm/hue/templates/NOTES.txt

@@ -13,7 +13,7 @@ Then opening-up:
 
   http://localhost:8888
 
-Or directly typing:
+Or directly running below to get the URL:
 
   export WEB_HOST=$(kubectl get node -o jsonpath="{.items[0].metadata.name}")
   export WEB_PORT=$(kubectl get service hue -o jsonpath="{.spec.ports[*].nodePort}" --namespace {{ .Release.Namespace }})

+ 2 - 0
tools/kubernetes/helm/hue/templates/hue-postgres.yaml → tools/kubernetes/helm/hue/templates/database-postgres.yaml

@@ -1,3 +1,4 @@
+{{- if .Values.hue.database.create -}}
 apiVersion: v1
 kind: Service
 metadata:
@@ -41,3 +42,4 @@ spec:
       volumes:
         - name: pg-data
           emptyDir: {}
+{{- end -}}

+ 12 - 19
tools/kubernetes/helm/hue/templates/hue.yaml

@@ -6,25 +6,12 @@ data:
   hue-ini: |
     [desktop]
     [[database]]
-    engine=postgresql_psycopg2
-    host=hue-postgres
-    port=5432
-    user=hue
-    password=hue
-    name=hue
-
-    [impala]
-    server_host={{ .Values.impala.server_host }}
-
-    [notebook]
-    [[interpreters]]
-    [[[impala]]]
-      name=Impala
-      interface=hiveserver2
-    [[[postgresql]]]
-      name = postgresql
-      interface=sqlalchemy
-      options='{"url": "postgresql://hue:hue@hue-database:5432/hue"}'
+    engine={{ .Values.hue.database.engine }}
+    host={{ .Values.hue.database.host }}
+    port={{ .Values.hue.database.port }}
+    user={{ .Values.hue.database.user }}
+    password={{ .Values.hue.database.password }}
+    name={{ .Values.hue.database.name }}
 
     [aws]
     [[aws_accounts]]
@@ -32,6 +19,10 @@ data:
     access_key_id={{ .Values.aws.awsAccessKeyId }}
     secret_access_key={{ .Values.aws.awsSecretAccessKey }}
     region={{ .Values.aws.awsRegion }}
+
+    [notebook]
+    [[interpreters]]
+    {{ .Values.hue.interpreters | indent 4 }}
 ---
 apiVersion: v1
 kind: ReplicationController
@@ -71,6 +62,7 @@ spec:
     port: 8888
   type: NodePort
 ---
+{{- if .Values.ingress.create -}}
 apiVersion: extensions/v1beta1
 kind: Ingress
 metadata:
@@ -86,3 +78,4 @@ spec:
         backend:
           serviceName: hue
           servicePort: hue
+{{- end -}}

+ 5 - 3
tools/kubernetes/helm/hue/templates/traefik.yaml → tools/kubernetes/helm/hue/templates/ingress-traefik.yaml

@@ -1,3 +1,4 @@
+{{- if .Values.ingress.create -}}
 ---
 apiVersion: v1
 kind: ServiceAccount
@@ -86,7 +87,7 @@ spec:
     - name: admin
       port: 8080
   type: LoadBalancer
-  #loadBalancerIp: {{ .Values.loadBalancerIp }} 
+  #loadBalancerIp: {{ .Values.loadBalancerIp }}
 ---
 apiVersion: extensions/v1beta1
 kind: Ingress
@@ -96,10 +97,11 @@ metadata:
     kubernetes.io/ingress.class: traefik
 spec:
   rules:
-  - host: traefik.{{ .Values.domain }}
+  - host: traefik.{{ .Values.ingress.domain }}
     http:
       paths:
       - path: /
         backend:
           serviceName: traefik-ingress-service
-          servicePort: admin
+          servicePort: admin
+{{- end -}}

+ 24 - 10
tools/kubernetes/helm/hue/values.yaml

@@ -1,11 +1,25 @@
-registry: "gethue"
-loadBalancerIp: "127.0.0.1"
-domain: "127.0.0.1.nip.io"
+registry: "gethue/hue"
+tag: "latest"
 hue:
-  replicas: 1
-  awsAccessKeyId: ""
-  awsSecretAccessKey: ""
-  awsRegion: "us-east-1"
-  prometheusHost: "prometheus-server.prometheus"
-impala:
-  server_host: "impala-coordinator.com"
+  database:
+    create: true
+    engine: "postgresql_psycopg2"
+    host: "hue-postgres"
+    port: 5432
+    user: "hue"
+    password: "hue"
+    name: "hue"
+  interpreters: |
+    [[[postgresql]]]
+      name = postgresql
+      interface=sqlalchemy
+      options='{"url": "postgresql://hue:hue@hue-database:5432/hue"}'
+aws:
+  accessKeyId: ""
+  secretAccessKey: ""
+  region: "us-east-1"
+ingress:
+  create: false
+  type: "traefik"
+  loadBalancerIp: "127.0.0.1"
+  domain: "127.0.0.1.nip.io"