From 434fe079886c01bcca21ed2324e6ef4b19eefc11 Mon Sep 17 00:00:00 2001 From: verchol Date: Sun, 3 Dec 2017 23:42:54 +0200 Subject: [PATCH 01/38] add demochat chart --- deploy/.helmignore | 21 ++++ deploy/Chart.yaml | 4 + deploy/all.yaml | 110 ------------------ deploy/charts/demoservice2/.helmignore | 21 ++++ deploy/charts/demoservice2/Chart.yaml | 4 + .../charts/demoservice2/templates/NOTES.txt | 19 +++ .../demoservice2/templates/_helpers.tpl | 16 +++ .../demoservice2/templates/configmap.yaml | 0 .../demoservice2/templates/deployment.yaml | 45 +++++++ .../demoservice2/templates/ingress.yaml | 32 +++++ .../demoservice2/templates/service.yaml | 19 +++ .../demoservice2/templates/test/sanity.yaml | 16 +++ deploy/charts/demoservice2/values.yaml | 38 ++++++ deploy/charts/mongodb/.helmignore | 1 + deploy/charts/mongodb/Chart.yaml | 16 +++ deploy/charts/mongodb/README.md | 84 +++++++++++++ deploy/charts/mongodb/templates/NOTES.txt | 7 ++ deploy/charts/mongodb/templates/_helpers.tpl | 16 +++ .../charts/mongodb/templates/deployment.yaml | 66 +++++++++++ deploy/charts/mongodb/templates/pvc.yaml | 19 +++ deploy/charts/mongodb/templates/secrets.yaml | 13 +++ deploy/charts/mongodb/templates/svc.yaml | 17 +++ deploy/charts/mongodb/values.yaml | 49 ++++++++ deploy/demochatChart/.helmignore | 21 ++++ deploy/demochatChart/Chart.yaml | 4 + .../charts/demoservice2/.helmignore | 21 ++++ .../charts/demoservice2/Chart.yaml | 4 + .../charts/demoservice2/templates/NOTES.txt | 19 +++ .../demoservice2/templates/_helpers.tpl | 16 +++ .../demoservice2/templates/configmap.yaml | 0 .../demoservice2/templates/deployment.yaml | 45 +++++++ .../demoservice2/templates/ingress.yaml | 32 +++++ .../demoservice2/templates/service.yaml | 19 +++ .../demoservice2/templates/test/sanity.yaml | 16 +++ .../charts/demoservice2/values.yaml | 38 ++++++ .../demochatChart/charts/mongodb/.helmignore | 1 + .../demochatChart/charts/mongodb/Chart.yaml | 16 +++ deploy/demochatChart/charts/mongodb/README.md | 84 +++++++++++++ .../charts/mongodb/templates/NOTES.txt | 7 ++ .../charts/mongodb/templates/_helpers.tpl | 16 +++ .../charts/mongodb/templates/deployment.yaml | 66 +++++++++++ .../charts/mongodb/templates/pvc.yaml | 19 +++ .../charts/mongodb/templates/secrets.yaml | 13 +++ .../charts/mongodb/templates/svc.yaml | 17 +++ .../demochatChart/charts/mongodb/values.yaml | 49 ++++++++ deploy/demochatChart/requirements.yaml | 4 + deploy/demochatChart/templates/NOTES.txt | 19 +++ deploy/demochatChart/templates/_helpers.tpl | 16 +++ deploy/demochatChart/templates/configMap.yaml | 9 ++ .../demochatChart/templates/deployment.yaml | 35 ++++++ deploy/demochatChart/templates/ingress.yaml | 32 +++++ deploy/demochatChart/templates/secrets.yaml | 0 deploy/demochatChart/templates/service.yaml | 19 +++ .../templates/test/e2e.spec.yaml | 17 +++ deploy/demochatChart/values.yaml | 47 ++++++++ deploy/requirements.yaml | 6 + deploy/templates/NOTES.txt | 19 +++ deploy/templates/_helpers.tpl | 16 +++ deploy/templates/configMap.yaml | 9 ++ deploy/templates/deployment.yaml | 53 +++++++++ deploy/templates/ingress.yaml | 32 +++++ deploy/templates/secrets.yaml | 0 deploy/templates/service.yaml | 19 +++ deploy/templates/test/e2e.spec.yaml | 17 +++ deploy/values.yaml | 47 ++++++++ 65 files changed, 1462 insertions(+), 110 deletions(-) create mode 100644 deploy/.helmignore create mode 100644 deploy/Chart.yaml delete mode 100644 deploy/all.yaml create mode 100644 deploy/charts/demoservice2/.helmignore create mode 100644 deploy/charts/demoservice2/Chart.yaml create mode 100644 deploy/charts/demoservice2/templates/NOTES.txt create mode 100644 deploy/charts/demoservice2/templates/_helpers.tpl create mode 100644 deploy/charts/demoservice2/templates/configmap.yaml create mode 100644 deploy/charts/demoservice2/templates/deployment.yaml create mode 100644 deploy/charts/demoservice2/templates/ingress.yaml create mode 100644 deploy/charts/demoservice2/templates/service.yaml create mode 100644 deploy/charts/demoservice2/templates/test/sanity.yaml create mode 100644 deploy/charts/demoservice2/values.yaml create mode 100644 deploy/charts/mongodb/.helmignore create mode 100644 deploy/charts/mongodb/Chart.yaml create mode 100644 deploy/charts/mongodb/README.md create mode 100644 deploy/charts/mongodb/templates/NOTES.txt create mode 100644 deploy/charts/mongodb/templates/_helpers.tpl create mode 100644 deploy/charts/mongodb/templates/deployment.yaml create mode 100644 deploy/charts/mongodb/templates/pvc.yaml create mode 100644 deploy/charts/mongodb/templates/secrets.yaml create mode 100644 deploy/charts/mongodb/templates/svc.yaml create mode 100644 deploy/charts/mongodb/values.yaml create mode 100644 deploy/demochatChart/.helmignore create mode 100644 deploy/demochatChart/Chart.yaml create mode 100644 deploy/demochatChart/charts/demoservice2/.helmignore create mode 100644 deploy/demochatChart/charts/demoservice2/Chart.yaml create mode 100644 deploy/demochatChart/charts/demoservice2/templates/NOTES.txt create mode 100644 deploy/demochatChart/charts/demoservice2/templates/_helpers.tpl create mode 100644 deploy/demochatChart/charts/demoservice2/templates/configmap.yaml create mode 100644 deploy/demochatChart/charts/demoservice2/templates/deployment.yaml create mode 100644 deploy/demochatChart/charts/demoservice2/templates/ingress.yaml create mode 100644 deploy/demochatChart/charts/demoservice2/templates/service.yaml create mode 100644 deploy/demochatChart/charts/demoservice2/templates/test/sanity.yaml create mode 100644 deploy/demochatChart/charts/demoservice2/values.yaml create mode 100644 deploy/demochatChart/charts/mongodb/.helmignore create mode 100644 deploy/demochatChart/charts/mongodb/Chart.yaml create mode 100644 deploy/demochatChart/charts/mongodb/README.md create mode 100644 deploy/demochatChart/charts/mongodb/templates/NOTES.txt create mode 100644 deploy/demochatChart/charts/mongodb/templates/_helpers.tpl create mode 100644 deploy/demochatChart/charts/mongodb/templates/deployment.yaml create mode 100644 deploy/demochatChart/charts/mongodb/templates/pvc.yaml create mode 100644 deploy/demochatChart/charts/mongodb/templates/secrets.yaml create mode 100644 deploy/demochatChart/charts/mongodb/templates/svc.yaml create mode 100644 deploy/demochatChart/charts/mongodb/values.yaml create mode 100644 deploy/demochatChart/requirements.yaml create mode 100644 deploy/demochatChart/templates/NOTES.txt create mode 100644 deploy/demochatChart/templates/_helpers.tpl create mode 100644 deploy/demochatChart/templates/configMap.yaml create mode 100644 deploy/demochatChart/templates/deployment.yaml create mode 100644 deploy/demochatChart/templates/ingress.yaml create mode 100644 deploy/demochatChart/templates/secrets.yaml create mode 100644 deploy/demochatChart/templates/service.yaml create mode 100644 deploy/demochatChart/templates/test/e2e.spec.yaml create mode 100644 deploy/demochatChart/values.yaml create mode 100644 deploy/requirements.yaml create mode 100644 deploy/templates/NOTES.txt create mode 100644 deploy/templates/_helpers.tpl create mode 100644 deploy/templates/configMap.yaml create mode 100644 deploy/templates/deployment.yaml create mode 100644 deploy/templates/ingress.yaml create mode 100644 deploy/templates/secrets.yaml create mode 100644 deploy/templates/service.yaml create mode 100644 deploy/templates/test/e2e.spec.yaml create mode 100644 deploy/values.yaml diff --git a/deploy/.helmignore b/deploy/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/deploy/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/deploy/Chart.yaml b/deploy/Chart.yaml new file mode 100644 index 000000000..ce7e5b376 --- /dev/null +++ b/deploy/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: demochat +name: demochat +version: 0.0.1 diff --git a/deploy/all.yaml b/deploy/all.yaml deleted file mode 100644 index bf9a1f1ae..000000000 --- a/deploy/all.yaml +++ /dev/null @@ -1,110 +0,0 @@ - -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - name: demo-chat - labels: - deploy: test1 - service: demo-chat - app: demo-chat -spec: - replicas: 2 - template: - metadata: - labels: - deploy: test1 - service: demo-chat - spec: - imagePullSecrets: - - name: cfcr - containers: - - image: containers101/demochat:master - name: app - imagePullPolicy: Always - ports: - - containerPort: 5000 - protocol: TCP ---- - apiVersion: extensions/v1beta1 - kind: Ingress - metadata: - labels: - deploy: test1 - name: demochat-ingress - spec: - backend: - serviceName: demochat-board - servicePort: 80 ---- - apiVersion: v1 - kind: Service - metadata: - labels: - deploy: test1 - name: demochat-master - spec: - type: NodePort - selector: - app: demo-chat - ports: - - name: "http" - port: 80 - protocol: TCP - targetPort: 5000 - selector: - service: demochat-board ---- -apiVersion: v1 -kind: Service -metadata: - labels: - app: mongo - name: mongo -spec: - type: NodePort - ports: - - name: "http" - port: 27017 - protocol: TCP - targetPort: 27017 - selector: - service: mongo ---- -apiVersion: extensions/v1beta1 -kind: Ingress -metadata: - name: mongo -spec: - backend: - serviceName: mongo - servicePort: 27017 ---- -apiVersion: extensions/v1beta1 -kind: Deployment -metadata: - annotations: - io.codefresh.owner: codefresh - name: mongo -spec: - replicas: 1 - template: - metadata: - labels: - service: mongo - spec: - containers: - - args: - - mongod - - --smallfiles - image: mongo:latest - name: mongo - ports: - - containerPort: 27017 - protocol: TCP - volumeMounts: - - mountPath: /data/db - name: mongo-data - restartPolicy: Always - volumes: - - name: mongo-data - emptyDir: {} diff --git a/deploy/charts/demoservice2/.helmignore b/deploy/charts/demoservice2/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/deploy/charts/demoservice2/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/deploy/charts/demoservice2/Chart.yaml b/deploy/charts/demoservice2/Chart.yaml new file mode 100644 index 000000000..d19170c79 --- /dev/null +++ b/deploy/charts/demoservice2/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: A Helm chart for Kubernetes +name: demoservice2 +version: 0.1.1 diff --git a/deploy/charts/demoservice2/templates/NOTES.txt b/deploy/charts/demoservice2/templates/NOTES.txt new file mode 100644 index 000000000..ccfecb7ea --- /dev/null +++ b/deploy/charts/demoservice2/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} +{{- end }} diff --git a/deploy/charts/demoservice2/templates/_helpers.tpl b/deploy/charts/demoservice2/templates/_helpers.tpl new file mode 100644 index 000000000..f0d83d2ed --- /dev/null +++ b/deploy/charts/demoservice2/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deploy/charts/demoservice2/templates/configmap.yaml b/deploy/charts/demoservice2/templates/configmap.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/deploy/charts/demoservice2/templates/deployment.yaml b/deploy/charts/demoservice2/templates/deployment.yaml new file mode 100644 index 000000000..ac14a0bf8 --- /dev/null +++ b/deploy/charts/demoservice2/templates/deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "name" . }} + appversion: "{{.Values.appversion}}" + release: {{ .Release.Name }} + test : "works" + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + env: + - name: appversion + value : "2" + # - name: service + + # value : "{{.Values.service.name}}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: / + port: {{ .Values.service.internalPort }} + readinessProbe: + httpGet: + path: /mongo + port: {{ .Values.service.internalPort }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/deploy/charts/demoservice2/templates/ingress.yaml b/deploy/charts/demoservice2/templates/ingress.yaml new file mode 100644 index 000000000..b09eb9075 --- /dev/null +++ b/deploy/charts/demoservice2/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "fullname" . -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/deploy/charts/demoservice2/templates/service.yaml b/deploy/charts/demoservice2/templates/service.yaml new file mode 100644 index 000000000..f311d10a0 --- /dev/null +++ b/deploy/charts/demoservice2/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/deploy/charts/demoservice2/templates/test/sanity.yaml b/deploy/charts/demoservice2/templates/test/sanity.yaml new file mode 100644 index 000000000..896bde12b --- /dev/null +++ b/deploy/charts/demoservice2/templates/test/sanity.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "release-sanity-test" + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: release-sanity-test + image: alpine:latest + env: + - name: TEST + value: works + command: ["wget"] + args: ["{{ template "fullname" . }}"] + restartPolicy: Never diff --git a/deploy/charts/demoservice2/values.yaml b/deploy/charts/demoservice2/values.yaml new file mode 100644 index 000000000..ceffb3288 --- /dev/null +++ b/deploy/charts/demoservice2/values.yaml @@ -0,0 +1,38 @@ +# Default values for demoservice2. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +appversion: "1" +image: + repository: verchol/demo-service1 + tag: v5 + pullPolicy: IfNotPresent +service: + name: demo-service2 + type: LoadBalancer + externalPort: 80 + internalPort: 3000 +ingress: + enabled: true + # Used to create an Ingress record. + hosts: + - demoservice2 + annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + tls: + # Secrets must be manually created in the namespace. + # - secretName: chart-example-tls + # hosts: + # - chart-example.local +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi diff --git a/deploy/charts/mongodb/.helmignore b/deploy/charts/mongodb/.helmignore new file mode 100644 index 000000000..6b8710a71 --- /dev/null +++ b/deploy/charts/mongodb/.helmignore @@ -0,0 +1 @@ +.git diff --git a/deploy/charts/mongodb/Chart.yaml b/deploy/charts/mongodb/Chart.yaml new file mode 100644 index 000000000..c0d9e96ab --- /dev/null +++ b/deploy/charts/mongodb/Chart.yaml @@ -0,0 +1,16 @@ +name: mongodb +version: 0.4.18 +appVersion: 3.4.10 +description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications. +keywords: +- mongodb +- database +- nosql +home: https://mongodb.org +icon: https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png +sources: +- https://github.com/bitnami/bitnami-docker-mongodb +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl diff --git a/deploy/charts/mongodb/README.md b/deploy/charts/mongodb/README.md new file mode 100644 index 000000000..bac5168a3 --- /dev/null +++ b/deploy/charts/mongodb/README.md @@ -0,0 +1,84 @@ +# MongoDB + +[MongoDB](https://www.mongodb.com/) is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas, making the integration of data in certain types of applications easier and faster. + +## TL;DR; + +```bash +$ helm install stable/mongodb +``` + +## Introduction + +This chart bootstraps a [MongoDB](https://github.com/bitnami/bitnami-docker-mongodb) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.4+ with Beta APIs enabled +- PV provisioner support in the underlying infrastructure + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release stable/mongodb +``` + +The command deploys MongoDB on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the MongoDB chart and their default values. + +| Parameter | Description | Default | +|----------------------------|-------------------------------------|----------------------------------------------------------| +| `image` | MongoDB image | `bitnami/mongodb:{VERSION}` | +| `imagePullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent`. | +| `mongodbRootPassword` | MongoDB admin password | `nil` | +| `mongodbUsername` | MongoDB custom user | `nil` | +| `mongodbPassword` | MongoDB custom user password | `nil` | +| `mongodbDatabase` | Database to create | `nil` | +| `serviceType` | Kubernetes Service type | `ClusterIP` | +| `persistence.enabled` | Use a PVC to persist data | `true` | +| `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) | +| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` | +| `persistence.size` | Size of data volume | `8Gi` | + +The above parameters map to the env variables defined in [bitnami/mongodb](http://github.com/bitnami/bitnami-docker-mongodb). For more information please refer to the [bitnami/mongodb](http://github.com/bitnami/bitnami-docker-mongodb) image documentation. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set mongodbRootPassword=secretpassword,mongodbUsername=my-user,mongodbPassword=my-password,mongodbDatabase=my-database \ + stable/mongodb +``` + +The above command sets the MongoDB `root` account password to `secretpassword`. Additionally it creates a standard database user named `my-user`, with the password `my-password`, who has access to a database named `my-database`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml stable/mongodb +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Bitnami MongoDB](https://github.com/bitnami/bitnami-docker-mongodb) image stores the MongoDB data and configurations at the `/bitnami/mongodb` path of the container. + +The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning. diff --git a/deploy/charts/mongodb/templates/NOTES.txt b/deploy/charts/mongodb/templates/NOTES.txt new file mode 100644 index 000000000..24c5d200b --- /dev/null +++ b/deploy/charts/mongodb/templates/NOTES.txt @@ -0,0 +1,7 @@ +MongoDB can be accessed via port 27017 on the following DNS name from within your cluster: +{{ template "mongodb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local + +To connect to your database run the following command: + + kubectl run {{ template "mongodb.fullname" . }}-client --rm --tty -i --image bitnami/mongodb --command -- mongo --host {{ template "mongodb.fullname" . }} {{- if .Values.mongodbRootPassword }} -p {{ .Values.mongodbRootPassword }}{{- end -}} + diff --git a/deploy/charts/mongodb/templates/_helpers.tpl b/deploy/charts/mongodb/templates/_helpers.tpl new file mode 100644 index 000000000..ad4a3f5ef --- /dev/null +++ b/deploy/charts/mongodb/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "mongodb.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "mongodb.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deploy/charts/mongodb/templates/deployment.yaml b/deploy/charts/mongodb/templates/deployment.yaml new file mode 100644 index 000000000..55901ecd7 --- /dev/null +++ b/deploy/charts/mongodb/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "mongodb.fullname" . }} + labels: + app: {{ template "mongodb.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + template: + metadata: + labels: + app: {{ template "mongodb.fullname" . }} + spec: + containers: + - name: {{ template "mongodb.fullname" . }} + image: "{{ .Values.image }}" + imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + env: + - name: MONGODB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mongodb.fullname" . }} + key: mongodb-root-password + - name: MONGODB_USERNAME + value: {{ default "" .Values.mongodbUsername | quote }} + - name: MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mongodb.fullname" . }} + key: mongodb-password + - name: MONGODB_DATABASE + value: {{ default "" .Values.mongodbDatabase | quote }} + ports: + - name: mongodb + containerPort: 27017 + livenessProbe: + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 30 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 5 + timeoutSeconds: 1 + volumeMounts: + - name: data + mountPath: /bitnami/mongodb + resources: +{{ toYaml .Values.resources | indent 10 }} + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "mongodb.fullname" . }} + {{- else }} + emptyDir: {} + {{- end -}} diff --git a/deploy/charts/mongodb/templates/pvc.yaml b/deploy/charts/mongodb/templates/pvc.yaml new file mode 100644 index 000000000..f53516f90 --- /dev/null +++ b/deploy/charts/mongodb/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "mongodb.fullname" . }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/deploy/charts/mongodb/templates/secrets.yaml b/deploy/charts/mongodb/templates/secrets.yaml new file mode 100644 index 000000000..d95e7a451 --- /dev/null +++ b/deploy/charts/mongodb/templates/secrets.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "mongodb.fullname" . }} + labels: + app: {{ template "mongodb.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + mongodb-root-password: {{ default "" .Values.mongodbRootPassword | b64enc | quote }} + mongodb-password: {{ default "" .Values.mongodbPassword | b64enc | quote }} diff --git a/deploy/charts/mongodb/templates/svc.yaml b/deploy/charts/mongodb/templates/svc.yaml new file mode 100644 index 000000000..6c58b54c5 --- /dev/null +++ b/deploy/charts/mongodb/templates/svc.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "mongodb.fullname" . }} + labels: + app: {{ template "mongodb.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + type: {{ .Values.serviceType }} + ports: + - name: mongodb + port: 27017 + targetPort: mongodb + selector: + app: {{ template "mongodb.fullname" . }} diff --git a/deploy/charts/mongodb/values.yaml b/deploy/charts/mongodb/values.yaml new file mode 100644 index 000000000..294a3efce --- /dev/null +++ b/deploy/charts/mongodb/values.yaml @@ -0,0 +1,49 @@ +## Bitnami MongoDB image version +## ref: https://hub.docker.com/r/bitnami/mongodb/tags/ +## +image: bitnami/mongodb:3.4.10-r0 + +## Specify a imagePullPolicy +## 'Always' if imageTag is 'latest', else set to 'IfNotPresent' +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +# imagePullPolicy: + +## MongoDB admin password +## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#setting-the-root-password-on-first-run +## +# mongodbRootPassword: + +## MongoDB custom user and database +## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#creating-a-user-and-database-on-first-run +## +# mongodbUsername: +# mongodbPassword: +# mongodbDatabase: + +## Kubernetes service type +serviceType: ClusterIP + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + ## mongodb data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteOnce + size: 8Gi + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + requests: + memory: 256Mi + cpu: 100m diff --git a/deploy/demochatChart/.helmignore b/deploy/demochatChart/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/deploy/demochatChart/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/deploy/demochatChart/Chart.yaml b/deploy/demochatChart/Chart.yaml new file mode 100644 index 000000000..ce7e5b376 --- /dev/null +++ b/deploy/demochatChart/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: demochat +name: demochat +version: 0.0.1 diff --git a/deploy/demochatChart/charts/demoservice2/.helmignore b/deploy/demochatChart/charts/demoservice2/.helmignore new file mode 100644 index 000000000..f0c131944 --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/.helmignore @@ -0,0 +1,21 @@ +# Patterns to ignore when building packages. +# This supports shell glob matching, relative path matching, and +# negation (prefixed with !). Only one pattern per line. +.DS_Store +# Common VCS dirs +.git/ +.gitignore +.bzr/ +.bzrignore +.hg/ +.hgignore +.svn/ +# Common backup files +*.swp +*.bak +*.tmp +*~ +# Various IDEs +.project +.idea/ +*.tmproj diff --git a/deploy/demochatChart/charts/demoservice2/Chart.yaml b/deploy/demochatChart/charts/demoservice2/Chart.yaml new file mode 100644 index 000000000..d19170c79 --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/Chart.yaml @@ -0,0 +1,4 @@ +apiVersion: v1 +description: A Helm chart for Kubernetes +name: demoservice2 +version: 0.1.1 diff --git a/deploy/demochatChart/charts/demoservice2/templates/NOTES.txt b/deploy/demochatChart/charts/demoservice2/templates/NOTES.txt new file mode 100644 index 000000000..ccfecb7ea --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} +{{- end }} diff --git a/deploy/demochatChart/charts/demoservice2/templates/_helpers.tpl b/deploy/demochatChart/charts/demoservice2/templates/_helpers.tpl new file mode 100644 index 000000000..f0d83d2ed --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deploy/demochatChart/charts/demoservice2/templates/configmap.yaml b/deploy/demochatChart/charts/demoservice2/templates/configmap.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/deploy/demochatChart/charts/demoservice2/templates/deployment.yaml b/deploy/demochatChart/charts/demoservice2/templates/deployment.yaml new file mode 100644 index 000000000..ac14a0bf8 --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/templates/deployment.yaml @@ -0,0 +1,45 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "name" . }} + appversion: "{{.Values.appversion}}" + release: {{ .Release.Name }} + test : "works" + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + env: + - name: appversion + value : "2" + # - name: service + + # value : "{{.Values.service.name}}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: / + port: {{ .Values.service.internalPort }} + readinessProbe: + httpGet: + path: /mongo + port: {{ .Values.service.internalPort }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/deploy/demochatChart/charts/demoservice2/templates/ingress.yaml b/deploy/demochatChart/charts/demoservice2/templates/ingress.yaml new file mode 100644 index 000000000..b09eb9075 --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "fullname" . -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/deploy/demochatChart/charts/demoservice2/templates/service.yaml b/deploy/demochatChart/charts/demoservice2/templates/service.yaml new file mode 100644 index 000000000..f311d10a0 --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/deploy/demochatChart/charts/demoservice2/templates/test/sanity.yaml b/deploy/demochatChart/charts/demoservice2/templates/test/sanity.yaml new file mode 100644 index 000000000..896bde12b --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/templates/test/sanity.yaml @@ -0,0 +1,16 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "release-sanity-test" + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: release-sanity-test + image: alpine:latest + env: + - name: TEST + value: works + command: ["wget"] + args: ["{{ template "fullname" . }}"] + restartPolicy: Never diff --git a/deploy/demochatChart/charts/demoservice2/values.yaml b/deploy/demochatChart/charts/demoservice2/values.yaml new file mode 100644 index 000000000..ceffb3288 --- /dev/null +++ b/deploy/demochatChart/charts/demoservice2/values.yaml @@ -0,0 +1,38 @@ +# Default values for demoservice2. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +appversion: "1" +image: + repository: verchol/demo-service1 + tag: v5 + pullPolicy: IfNotPresent +service: + name: demo-service2 + type: LoadBalancer + externalPort: 80 + internalPort: 3000 +ingress: + enabled: true + # Used to create an Ingress record. + hosts: + - demoservice2 + annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + tls: + # Secrets must be manually created in the namespace. + # - secretName: chart-example-tls + # hosts: + # - chart-example.local +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi diff --git a/deploy/demochatChart/charts/mongodb/.helmignore b/deploy/demochatChart/charts/mongodb/.helmignore new file mode 100644 index 000000000..6b8710a71 --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/.helmignore @@ -0,0 +1 @@ +.git diff --git a/deploy/demochatChart/charts/mongodb/Chart.yaml b/deploy/demochatChart/charts/mongodb/Chart.yaml new file mode 100644 index 000000000..c0d9e96ab --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/Chart.yaml @@ -0,0 +1,16 @@ +name: mongodb +version: 0.4.18 +appVersion: 3.4.10 +description: NoSQL document-oriented database that stores JSON-like documents with dynamic schemas, simplifying the integration of data in content-driven applications. +keywords: +- mongodb +- database +- nosql +home: https://mongodb.org +icon: https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png +sources: +- https://github.com/bitnami/bitnami-docker-mongodb +maintainers: +- name: Bitnami + email: containers@bitnami.com +engine: gotpl diff --git a/deploy/demochatChart/charts/mongodb/README.md b/deploy/demochatChart/charts/mongodb/README.md new file mode 100644 index 000000000..bac5168a3 --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/README.md @@ -0,0 +1,84 @@ +# MongoDB + +[MongoDB](https://www.mongodb.com/) is a cross-platform document-oriented database. Classified as a NoSQL database, MongoDB eschews the traditional table-based relational database structure in favor of JSON-like documents with dynamic schemas, making the integration of data in certain types of applications easier and faster. + +## TL;DR; + +```bash +$ helm install stable/mongodb +``` + +## Introduction + +This chart bootstraps a [MongoDB](https://github.com/bitnami/bitnami-docker-mongodb) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.4+ with Beta APIs enabled +- PV provisioner support in the underlying infrastructure + +## Installing the Chart + +To install the chart with the release name `my-release`: + +```bash +$ helm install --name my-release stable/mongodb +``` + +The command deploys MongoDB on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release` deployment: + +```bash +$ helm delete my-release +``` + +The command removes all the Kubernetes components associated with the chart and deletes the release. + +## Configuration + +The following tables lists the configurable parameters of the MongoDB chart and their default values. + +| Parameter | Description | Default | +|----------------------------|-------------------------------------|----------------------------------------------------------| +| `image` | MongoDB image | `bitnami/mongodb:{VERSION}` | +| `imagePullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent`. | +| `mongodbRootPassword` | MongoDB admin password | `nil` | +| `mongodbUsername` | MongoDB custom user | `nil` | +| `mongodbPassword` | MongoDB custom user password | `nil` | +| `mongodbDatabase` | Database to create | `nil` | +| `serviceType` | Kubernetes Service type | `ClusterIP` | +| `persistence.enabled` | Use a PVC to persist data | `true` | +| `persistence.storageClass` | Storage class of backing PVC | `nil` (uses alpha storage class annotation) | +| `persistence.accessMode` | Use volume as ReadOnly or ReadWrite | `ReadWriteOnce` | +| `persistence.size` | Size of data volume | `8Gi` | + +The above parameters map to the env variables defined in [bitnami/mongodb](http://github.com/bitnami/bitnami-docker-mongodb). For more information please refer to the [bitnami/mongodb](http://github.com/bitnami/bitnami-docker-mongodb) image documentation. + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, + +```bash +$ helm install --name my-release \ + --set mongodbRootPassword=secretpassword,mongodbUsername=my-user,mongodbPassword=my-password,mongodbDatabase=my-database \ + stable/mongodb +``` + +The above command sets the MongoDB `root` account password to `secretpassword`. Additionally it creates a standard database user named `my-user`, with the password `my-password`, who has access to a database named `my-database`. + +Alternatively, a YAML file that specifies the values for the parameters can be provided while installing the chart. For example, + +```bash +$ helm install --name my-release -f values.yaml stable/mongodb +``` + +> **Tip**: You can use the default [values.yaml](values.yaml) + +## Persistence + +The [Bitnami MongoDB](https://github.com/bitnami/bitnami-docker-mongodb) image stores the MongoDB data and configurations at the `/bitnami/mongodb` path of the container. + +The chart mounts a [Persistent Volume](http://kubernetes.io/docs/user-guide/persistent-volumes/) volume at this location. The volume is created using dynamic volume provisioning. diff --git a/deploy/demochatChart/charts/mongodb/templates/NOTES.txt b/deploy/demochatChart/charts/mongodb/templates/NOTES.txt new file mode 100644 index 000000000..24c5d200b --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/templates/NOTES.txt @@ -0,0 +1,7 @@ +MongoDB can be accessed via port 27017 on the following DNS name from within your cluster: +{{ template "mongodb.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local + +To connect to your database run the following command: + + kubectl run {{ template "mongodb.fullname" . }}-client --rm --tty -i --image bitnami/mongodb --command -- mongo --host {{ template "mongodb.fullname" . }} {{- if .Values.mongodbRootPassword }} -p {{ .Values.mongodbRootPassword }}{{- end -}} + diff --git a/deploy/demochatChart/charts/mongodb/templates/_helpers.tpl b/deploy/demochatChart/charts/mongodb/templates/_helpers.tpl new file mode 100644 index 000000000..ad4a3f5ef --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "mongodb.name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "mongodb.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deploy/demochatChart/charts/mongodb/templates/deployment.yaml b/deploy/demochatChart/charts/mongodb/templates/deployment.yaml new file mode 100644 index 000000000..55901ecd7 --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/templates/deployment.yaml @@ -0,0 +1,66 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "mongodb.fullname" . }} + labels: + app: {{ template "mongodb.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + template: + metadata: + labels: + app: {{ template "mongodb.fullname" . }} + spec: + containers: + - name: {{ template "mongodb.fullname" . }} + image: "{{ .Values.image }}" + imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + env: + - name: MONGODB_ROOT_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mongodb.fullname" . }} + key: mongodb-root-password + - name: MONGODB_USERNAME + value: {{ default "" .Values.mongodbUsername | quote }} + - name: MONGODB_PASSWORD + valueFrom: + secretKeyRef: + name: {{ template "mongodb.fullname" . }} + key: mongodb-password + - name: MONGODB_DATABASE + value: {{ default "" .Values.mongodbDatabase | quote }} + ports: + - name: mongodb + containerPort: 27017 + livenessProbe: + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 30 + timeoutSeconds: 5 + readinessProbe: + exec: + command: + - mongo + - --eval + - "db.adminCommand('ping')" + initialDelaySeconds: 5 + timeoutSeconds: 1 + volumeMounts: + - name: data + mountPath: /bitnami/mongodb + resources: +{{ toYaml .Values.resources | indent 10 }} + volumes: + - name: data + {{- if .Values.persistence.enabled }} + persistentVolumeClaim: + claimName: {{ template "mongodb.fullname" . }} + {{- else }} + emptyDir: {} + {{- end -}} diff --git a/deploy/demochatChart/charts/mongodb/templates/pvc.yaml b/deploy/demochatChart/charts/mongodb/templates/pvc.yaml new file mode 100644 index 000000000..f53516f90 --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/templates/pvc.yaml @@ -0,0 +1,19 @@ +{{- if .Values.persistence.enabled }} +kind: PersistentVolumeClaim +apiVersion: v1 +metadata: + name: {{ template "mongodb.fullname" . }} +spec: + accessModes: + - {{ .Values.persistence.accessMode | quote }} + resources: + requests: + storage: {{ .Values.persistence.size | quote }} +{{- if .Values.persistence.storageClass }} +{{- if (eq "-" .Values.persistence.storageClass) }} + storageClassName: "" +{{- else }} + storageClassName: "{{ .Values.persistence.storageClass }}" +{{- end }} +{{- end }} +{{- end }} diff --git a/deploy/demochatChart/charts/mongodb/templates/secrets.yaml b/deploy/demochatChart/charts/mongodb/templates/secrets.yaml new file mode 100644 index 000000000..d95e7a451 --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/templates/secrets.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "mongodb.fullname" . }} + labels: + app: {{ template "mongodb.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +type: Opaque +data: + mongodb-root-password: {{ default "" .Values.mongodbRootPassword | b64enc | quote }} + mongodb-password: {{ default "" .Values.mongodbPassword | b64enc | quote }} diff --git a/deploy/demochatChart/charts/mongodb/templates/svc.yaml b/deploy/demochatChart/charts/mongodb/templates/svc.yaml new file mode 100644 index 000000000..6c58b54c5 --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/templates/svc.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "mongodb.fullname" . }} + labels: + app: {{ template "mongodb.fullname" . }} + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + type: {{ .Values.serviceType }} + ports: + - name: mongodb + port: 27017 + targetPort: mongodb + selector: + app: {{ template "mongodb.fullname" . }} diff --git a/deploy/demochatChart/charts/mongodb/values.yaml b/deploy/demochatChart/charts/mongodb/values.yaml new file mode 100644 index 000000000..294a3efce --- /dev/null +++ b/deploy/demochatChart/charts/mongodb/values.yaml @@ -0,0 +1,49 @@ +## Bitnami MongoDB image version +## ref: https://hub.docker.com/r/bitnami/mongodb/tags/ +## +image: bitnami/mongodb:3.4.10-r0 + +## Specify a imagePullPolicy +## 'Always' if imageTag is 'latest', else set to 'IfNotPresent' +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +# imagePullPolicy: + +## MongoDB admin password +## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#setting-the-root-password-on-first-run +## +# mongodbRootPassword: + +## MongoDB custom user and database +## ref: https://github.com/bitnami/bitnami-docker-mongodb/blob/master/README.md#creating-a-user-and-database-on-first-run +## +# mongodbUsername: +# mongodbPassword: +# mongodbDatabase: + +## Kubernetes service type +serviceType: ClusterIP + +## Enable persistence using Persistent Volume Claims +## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ +## +persistence: + enabled: true + ## mongodb data Persistent Volume Storage Class + ## If defined, storageClassName: + ## If set to "-", storageClassName: "", which disables dynamic provisioning + ## If undefined (the default) or set to null, no storageClassName spec is + ## set, choosing the default provisioner. (gp2 on AWS, standard on + ## GKE, AWS & OpenStack) + ## + # storageClass: "-" + accessMode: ReadWriteOnce + size: 8Gi + +## Configure resource requests and limits +## ref: http://kubernetes.io/docs/user-guide/compute-resources/ +## +resources: + requests: + memory: 256Mi + cpu: 100m diff --git a/deploy/demochatChart/requirements.yaml b/deploy/demochatChart/requirements.yaml new file mode 100644 index 000000000..32855b0cd --- /dev/null +++ b/deploy/demochatChart/requirements.yaml @@ -0,0 +1,4 @@ +dependencies: + - name: mongodb + version: 0.4.18 + repository: mongodb diff --git a/deploy/demochatChart/templates/NOTES.txt b/deploy/demochatChart/templates/NOTES.txt new file mode 100644 index 000000000..ccfecb7ea --- /dev/null +++ b/deploy/demochatChart/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} +{{- end }} diff --git a/deploy/demochatChart/templates/_helpers.tpl b/deploy/demochatChart/templates/_helpers.tpl new file mode 100644 index 000000000..f0d83d2ed --- /dev/null +++ b/deploy/demochatChart/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deploy/demochatChart/templates/configMap.yaml b/deploy/demochatChart/templates/configMap.yaml new file mode 100644 index 000000000..4e4c4a965 --- /dev/null +++ b/deploy/demochatChart/templates/configMap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "name" . }}-config + namespace: default +data: + sha: "{{ .Values.commit.sha }}" + branch: "{{ .Values.commit.branch }}" + repo: "{{ .Values.commit.repo }}" diff --git a/deploy/demochatChart/templates/deployment.yaml b/deploy/demochatChart/templates/deployment.yaml new file mode 100644 index 000000000..00f153adb --- /dev/null +++ b/deploy/demochatChart/templates/deployment.yaml @@ -0,0 +1,35 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + # appversion: "{{.Values.appversion}}" +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + # imageinfo : {{.Values.test.key}} + appversion: "{{.Values.appversion}}" + spec: + containers: + - image: containers101/demochat:master + name: app + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name : MONGO_HELM + value: {{.Release.Name }}-mongodb + ports: + - containerPort: {{ .Values.service.internalPort }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/deploy/demochatChart/templates/ingress.yaml b/deploy/demochatChart/templates/ingress.yaml new file mode 100644 index 000000000..b09eb9075 --- /dev/null +++ b/deploy/demochatChart/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "fullname" . -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/deploy/demochatChart/templates/secrets.yaml b/deploy/demochatChart/templates/secrets.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/deploy/demochatChart/templates/service.yaml b/deploy/demochatChart/templates/service.yaml new file mode 100644 index 000000000..f311d10a0 --- /dev/null +++ b/deploy/demochatChart/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/deploy/demochatChart/templates/test/e2e.spec.yaml b/deploy/demochatChart/templates/test/e2e.spec.yaml new file mode 100644 index 000000000..209b131e3 --- /dev/null +++ b/deploy/demochatChart/templates/test/e2e.spec.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-e2e-test" + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: {{ .Release.Name }}-e2e-test + image: {{ .Values.test.image}} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: serviceName + value: {{ .Values.service.name }} + command: ["npm", "test"] + #W["sh", "-c", "curl $serviceNAme:80&&echo workded"] + restartPolicy: Never diff --git a/deploy/demochatChart/values.yaml b/deploy/demochatChart/values.yaml new file mode 100644 index 000000000..35ad0d137 --- /dev/null +++ b/deploy/demochatChart/values.yaml @@ -0,0 +1,47 @@ +# Default values for demoservice1. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +appversion: 9 +build : "1" +test: + key: "value2" +image: + repository: verchol/demo-service1 + tag: v8 + pullPolicy: IfNotPresent +test: + image: verchol/demo-service1:v2 +service: + name: demochat + type: LoadBalancer + externalPort: 80 + internalPort: 5000 +commit: + sha: "1234" + branch: "master" + repo : "verchol/demochat" +ingress: + enabled: false + # Used to create an Ingress record. + hosts: + - chart-example.local + annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + tls: + # Secrets must be manually created in the namespace. + # - secretName: chart-example-tls + # hosts: + # - chart-example.local +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi diff --git a/deploy/requirements.yaml b/deploy/requirements.yaml new file mode 100644 index 000000000..74b61b104 --- /dev/null +++ b/deploy/requirements.yaml @@ -0,0 +1,6 @@ +dependencies: + - name: mongodb + version: 0.4.18 + repository: mongodb + - name: demoservice2 + version: 0.1.0 diff --git a/deploy/templates/NOTES.txt b/deploy/templates/NOTES.txt new file mode 100644 index 000000000..ccfecb7ea --- /dev/null +++ b/deploy/templates/NOTES.txt @@ -0,0 +1,19 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range .Values.ingress.hosts }} + http://{{ . }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "fullname" . }}) + export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + echo http://$NODE_IP:$NODE_PORT +{{- else if contains "LoadBalancer" .Values.service.type }} + NOTE: It may take a few minutes for the LoadBalancer IP to be available. + You can watch the status of by running 'kubectl get svc -w {{ template "fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.externalPort }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + echo "Visit http://127.0.0.1:8080 to use your application" + kubectl port-forward $POD_NAME 8080:{{ .Values.service.externalPort }} +{{- end }} diff --git a/deploy/templates/_helpers.tpl b/deploy/templates/_helpers.tpl new file mode 100644 index 000000000..f0d83d2ed --- /dev/null +++ b/deploy/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "name" -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} +{{- end -}} + +{{/* +Create a default fully qualified app name. +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +*/}} +{{- define "fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/deploy/templates/configMap.yaml b/deploy/templates/configMap.yaml new file mode 100644 index 000000000..4e4c4a965 --- /dev/null +++ b/deploy/templates/configMap.yaml @@ -0,0 +1,9 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ template "name" . }}-config + namespace: default +data: + sha: "{{ .Values.commit.sha }}" + branch: "{{ .Values.commit.branch }}" + repo: "{{ .Values.commit.repo }}" diff --git a/deploy/templates/deployment.yaml b/deploy/templates/deployment.yaml new file mode 100644 index 000000000..9ee903466 --- /dev/null +++ b/deploy/templates/deployment.yaml @@ -0,0 +1,53 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + # appversion: "{{.Values.appversion}}" +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: {{ template "name" . }} + release: {{ .Release.Name }} + # imageinfo : {{.Values.test.key}} + appversion: "{{.Values.appversion}}" + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{.Values.tag}}" + command: ["/bin/sh", "-c", "ls /etc/foo"] + envFrom : + - configMapRef: + name: {{ template "name" . }}-config + volumeMounts: + - name: foo + mountPath: "/etc/foo" + readOnly: true + volumes: + - name: foo + secret: + secretName: db-user-pass + + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - containerPort: {{ .Values.service.internalPort }} + livenessProbe: + httpGet: + path: / + port: {{ .Values.service.internalPort }} + readinessProbe: + httpGet: + path: /mongo + port: {{ .Values.service.internalPort }} + resources: +{{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/deploy/templates/ingress.yaml b/deploy/templates/ingress.yaml new file mode 100644 index 000000000..b09eb9075 --- /dev/null +++ b/deploy/templates/ingress.yaml @@ -0,0 +1,32 @@ +{{- if .Values.ingress.enabled -}} +{{- $serviceName := include "fullname" . -}} +{{- $servicePort := .Values.service.externalPort -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} + annotations: + {{- range $key, $value := .Values.ingress.annotations }} + {{ $key }}: {{ $value | quote }} + {{- end }} +spec: + rules: + {{- range $host := .Values.ingress.hosts }} + - host: {{ $host }} + http: + paths: + - path: / + backend: + serviceName: {{ $serviceName }} + servicePort: {{ $servicePort }} + {{- end -}} + {{- if .Values.ingress.tls }} + tls: +{{ toYaml .Values.ingress.tls | indent 4 }} + {{- end -}} +{{- end -}} diff --git a/deploy/templates/secrets.yaml b/deploy/templates/secrets.yaml new file mode 100644 index 000000000..e69de29bb diff --git a/deploy/templates/service.yaml b/deploy/templates/service.yaml new file mode 100644 index 000000000..f311d10a0 --- /dev/null +++ b/deploy/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "fullname" . }} + labels: + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }} + release: {{ .Release.Name }} + heritage: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.externalPort }} + targetPort: {{ .Values.service.internalPort }} + protocol: TCP + name: {{ .Values.service.name }} + selector: + app: {{ template "name" . }} + release: {{ .Release.Name }} diff --git a/deploy/templates/test/e2e.spec.yaml b/deploy/templates/test/e2e.spec.yaml new file mode 100644 index 000000000..209b131e3 --- /dev/null +++ b/deploy/templates/test/e2e.spec.yaml @@ -0,0 +1,17 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ .Release.Name }}-e2e-test" + annotations: + "helm.sh/hook": test-success +spec: + containers: + - name: {{ .Release.Name }}-e2e-test + image: {{ .Values.test.image}} + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + - name: serviceName + value: {{ .Values.service.name }} + command: ["npm", "test"] + #W["sh", "-c", "curl $serviceNAme:80&&echo workded"] + restartPolicy: Never diff --git a/deploy/values.yaml b/deploy/values.yaml new file mode 100644 index 000000000..a8f094fc1 --- /dev/null +++ b/deploy/values.yaml @@ -0,0 +1,47 @@ +# Default values for demoservice1. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +appversion: 9 +build : "1" +test: + key: "value2" +image: + repository: verchol/demo-service1 + tag: v8 + pullPolicy: IfNotPresent +test: + image: verchol/demo-service1:v2 +service: + name: demo-service1 + type: LoadBalancer + externalPort: 80 + internalPort: 3000 + commit: + sha: "1234" + branch: "master" + repo : "verchol/demochat" +ingress: + enabled: false + # Used to create an Ingress record. + hosts: + - chart-example.local + annotations: + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + tls: + # Secrets must be manually created in the namespace. + # - secretName: chart-example-tls + # hosts: + # - chart-example.local +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi From cdb3e5f1a889294112fa3c6e1e226d97335c73e6 Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 12:31:39 +0200 Subject: [PATCH 02/38] update pull policy repository and image name --- deploy/demochatChart/values.yaml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/deploy/demochatChart/values.yaml b/deploy/demochatChart/values.yaml index 35ad0d137..77d673662 100644 --- a/deploy/demochatChart/values.yaml +++ b/deploy/demochatChart/values.yaml @@ -7,11 +7,11 @@ build : "1" test: key: "value2" image: - repository: verchol/demo-service1 + repository: jennyps/demochat tag: v8 - pullPolicy: IfNotPresent + pullPolicy: Always test: - image: verchol/demo-service1:v2 + image: jennyps/demochat:kubecon service: name: demochat type: LoadBalancer @@ -20,7 +20,7 @@ service: commit: sha: "1234" branch: "master" - repo : "verchol/demochat" + repo : "jennyps/demochat" ingress: enabled: false # Used to create an Ingress record. From 146782c11eff0b7ca8ddea16567f91e212c3fc3f Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 13:01:53 +0200 Subject: [PATCH 03/38] updated spec-->containers-->image --- deploy/demochatChart/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/demochatChart/templates/deployment.yaml b/deploy/demochatChart/templates/deployment.yaml index 00f153adb..c275ce69a 100644 --- a/deploy/demochatChart/templates/deployment.yaml +++ b/deploy/demochatChart/templates/deployment.yaml @@ -19,7 +19,7 @@ spec: appversion: "{{.Values.appversion}}" spec: containers: - - image: containers101/demochat:master + - image: {{ .Values.image.name }} name: app imagePullPolicy: {{ .Values.image.pullPolicy }} env: From 743acecd159a8650d2c882c93f3e461e02aac3fc Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 13:12:04 +0200 Subject: [PATCH 04/38] updated image name --- deploy/demochatChart/values.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/deploy/demochatChart/values.yaml b/deploy/demochatChart/values.yaml index 77d673662..e5762813c 100644 --- a/deploy/demochatChart/values.yaml +++ b/deploy/demochatChart/values.yaml @@ -8,6 +8,7 @@ test: key: "value2" image: repository: jennyps/demochat + name: containers101/demochat tag: v8 pullPolicy: Always test: From 54dd23caf105f378a28e035fadce96a94cd99cf6 Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 14:15:21 +0200 Subject: [PATCH 05/38] updated name and description --- deploy/demochatChart/Chart.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/demochatChart/Chart.yaml b/deploy/demochatChart/Chart.yaml index ce7e5b376..c9db45daf 100644 --- a/deploy/demochatChart/Chart.yaml +++ b/deploy/demochatChart/Chart.yaml @@ -1,4 +1,4 @@ apiVersion: v1 -description: demochat -name: demochat +description: demochatk8 +name: demochatk8 version: 0.0.1 From 2fe79a7195e2a612835f4cc6a582b89b80235faa Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 16:24:13 +0200 Subject: [PATCH 06/38] Update deployment.yaml --- deploy/demochatChart/templates/deployment.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/deploy/demochatChart/templates/deployment.yaml b/deploy/demochatChart/templates/deployment.yaml index c275ce69a..a5685778c 100644 --- a/deploy/demochatChart/templates/deployment.yaml +++ b/deploy/demochatChart/templates/deployment.yaml @@ -18,6 +18,8 @@ spec: # imageinfo : {{.Values.test.key}} appversion: "{{.Values.appversion}}" spec: + imagePullSecrets: + - name: {{ .Values.pull.secret }} containers: - image: {{ .Values.image.name }} name: app From 01a05c6fd3f21b567023a55b5e662e5ee683359e Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 16:26:35 +0200 Subject: [PATCH 07/38] added pull secret --- deploy/demochatChart/templates/deployment.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/demochatChart/templates/deployment.yaml b/deploy/demochatChart/templates/deployment.yaml index a5685778c..9215d5000 100644 --- a/deploy/demochatChart/templates/deployment.yaml +++ b/deploy/demochatChart/templates/deployment.yaml @@ -19,7 +19,7 @@ spec: appversion: "{{.Values.appversion}}" spec: imagePullSecrets: - - name: {{ .Values.pull.secret }} + - name: {{ .Values.pullsecret.name }} containers: - image: {{ .Values.image.name }} name: app From d375cab0c469b0e220fa58aad8ff6ca092b51a0f Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 16:28:21 +0200 Subject: [PATCH 08/38] added pull secret and image from cfcr --- deploy/demochatChart/values.yaml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/deploy/demochatChart/values.yaml b/deploy/demochatChart/values.yaml index e5762813c..d81c13562 100644 --- a/deploy/demochatChart/values.yaml +++ b/deploy/demochatChart/values.yaml @@ -6,9 +6,11 @@ appversion: 9 build : "1" test: key: "value2" +pullsecret: + name: codefresh-generated-r.cfcr.io-cfcr-test1 image: repository: jennyps/demochat - name: containers101/demochat + name: r.cfcr.io/jennyps/jennyps/demochat:master tag: v8 pullPolicy: Always test: From 9951006d8981599f835fef24493cb60cd06d9c8e Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 16:33:16 +0200 Subject: [PATCH 09/38] updated image name --- deploy/demochatChart/values.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/deploy/demochatChart/values.yaml b/deploy/demochatChart/values.yaml index d81c13562..306f755dc 100644 --- a/deploy/demochatChart/values.yaml +++ b/deploy/demochatChart/values.yaml @@ -10,7 +10,7 @@ pullsecret: name: codefresh-generated-r.cfcr.io-cfcr-test1 image: repository: jennyps/demochat - name: r.cfcr.io/jennyps/jennyps/demochat:master + name: r.cfcr.io/jennyps/demochat4k8:master tag: v8 pullPolicy: Always test: From 17525e7388f0e97b5399b49055dc383f1f372d2c Mon Sep 17 00:00:00 2001 From: jennyps Date: Mon, 4 Dec 2017 16:42:16 +0200 Subject: [PATCH 10/38] update login.html --- templates/login.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/templates/login.html b/templates/login.html index b86093c0e..6738cc360 100644 --- a/templates/login.html +++ b/templates/login.html @@ -14,7 +14,7 @@ <% block body %>