diff --git a/incubator/node/Chart.yaml b/incubator/node/Chart.yaml index 5a1fbdee3..112016ce3 100644 --- a/incubator/node/Chart.yaml +++ b/incubator/node/Chart.yaml @@ -1,6 +1,6 @@ name: node version: 0.1.0 -description: NodeJs Event-driven I/O server-side JavaScript environment based on V8 +description: Event-driven I/O server-side JavaScript environment based on V8 keywords: - node - javascript @@ -13,4 +13,4 @@ maintainers: - name: Bitnami email: containers@bitnami.com engine: gotpl -icon: +icon: https://d33np9n32j53g7.cloudfront.net/assets/stacks/nodejs/img/nodejs-stack-110x117-331955cd5e874f1ebd26ff9bb0c5af4c.png diff --git a/incubator/node/README.md b/incubator/node/README.md index 701a8c0d8..4f6bff025 100644 --- a/incubator/node/README.md +++ b/incubator/node/README.md @@ -1,4 +1,4 @@ -# node +# Node [Node](https://www.nodejs.org) Event-driven I/O server-side JavaScript environment based on V8 @@ -12,7 +12,7 @@ $ helm install . This chart bootstraps a [Node](https://github.com/bitnami/bitnami-docker-node) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. -It clones and deploy a nodejs application from a git repository and defined revision. +It clones and deploys a Node.js application from a git repository. ## Prerequisites @@ -27,7 +27,9 @@ To install the chart with the release name `my-release`: $ helm install --name my-release . ``` -The command deploys node on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. +The command deploys Node.js on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. Also includes support for MariaDB chart out of the box. + +Due that the Helm Chart clones the application on the /app volume while the container is initializing, there's not a hard dependency on Persistent Volumes. > **Tip**: List all releases using `helm list` @@ -43,20 +45,16 @@ The command removes all the Kubernetes components associated with the chart and ## Configuration -The following tables lists the configurable parameters of the node chart and their default values. +The following tables lists the configurable parameters of the Node chart and their default values. | Parameter | Description | Default | |--------------------------------------|------------------------------------------|---------------------------------------------------------| -| `image` | node image | `bitnami/node:{VERSION}` | +| `image` | Node image | `bitnami/node:{VERSION}` | | `imagePullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` | | `repository` | Repo of the application | `git@github.com:jbianquetti-nami/simple-node-app.git` | | `revision` | Revision to checkout | `master` | | `mariadb.mariadbRootPassword` | MariaDB admin password | `nil` | | `serviceType` | Kubernetes Service type | `LoadBalancer` | -| `persistence.enabled` | Enable persistence using PVC | `true` | -| `persistence.node.storageClass` | PVC Storage Class for node volume | `generic` | -| `persistence.node.accessMode` | PVC Access Mode for node volume | `ReadWriteOnce` | -| `persistence.node.size` | PVC Storage Request for node volume | `8Gi` | | `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` | The above parameters map to the env variables defined in [bitnami/node](http://github.com/bitnami/bitnami-docker-node). For more information please refer to the [bitnami/node](http://github.com/bitnami/bitnami-docker-node) image documentation. @@ -65,11 +63,11 @@ Specify each parameter using the `--set key=value[,key=value]` argument to `helm ```console $ helm install --name my-release \ - --set repository=git@github.com:jbianquetti-nami/simple-node-app.git,mariadb.mariadbRootPassword=secretpassword \ + --set repository=http://github.com/jbianquetti-nami/simple-node-app.git,mariadb.mariadbRootPassword=secretpassword \ stable/node ``` -The above command sets the node administrator account username and password to `admin` and `password` respectively. Additionally it sets the MariaDB `root` user password to `secretpassword`. +The above command clones the remote git repository to the `/app/` directory of the container. Additionally it sets the MariaDB `root` user password to `secretpassword`. Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, @@ -81,7 +79,7 @@ $ helm install --name my-release -f values.yaml stable/node ## Persistence -The [Bitnami node](https://github.com/bitnami/bitnami-docker-node) image stores the node data and configurations at the `/bitnami/node` and `/bitnami/apache` paths of the container. +The [Bitnami Node](https://github.com/bitnami/bitnami-docker-node) image stores the Node application and configurations at the `/app` path of the container. Persistent Volume Claims are used to keep the data across deployments. This is known to work in GCE, AWS, and minikube. See the [Configuration](#configuration) section to configure the PVC or to disable persistence. diff --git a/incubator/node/templates/NOTES.txt b/incubator/node/templates/NOTES.txt index 9c5ecc40f..ccf91d215 100644 --- a/incubator/node/templates/NOTES.txt +++ b/incubator/node/templates/NOTES.txt @@ -20,8 +20,3 @@ echo http://127.0.0.1:8080/ kubectl port-forward $POD_NAME 8080:80 {{- end }} - -2. Get your node login credentials by running: - - echo Username: {{ .Values.nodeUser }} - echo Password: $(printf $(printf '\%o' `kubectl get secret --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath="{.data.node-password[*]}"`)) diff --git a/incubator/node/templates/deployment.yaml b/incubator/node/templates/deployment.yaml index 52b502619..acc8dff5e 100644 --- a/incubator/node/templates/deployment.yaml +++ b/incubator/node/templates/deployment.yaml @@ -13,6 +13,20 @@ spec: metadata: labels: app: {{ template "fullname" . }} + annotations: + pod.beta.kubernetes.io/init-containers: '[ + { + "name": "git-clone-app", + "image": "{{ .Values.image }}", + "command": [ "/bin/sh", "-c" , "git clone {{ .Values.repository }} /app" ], + "volumeMounts": [ + { + "name": "node-data", + "mountPath": "/app" + } + ] + } + ]' spec: containers: - name: {{ template "fullname" . }} @@ -25,9 +39,8 @@ spec: - "/bin/bash" - "-ec" - | - DIR=$(echo $GIT_REPO | awk -F '/' '{print $NF }' | sed 's/.git$//g') + git checkout {{ .Values.revision }} chown -R bitnami:daemon /app - cd /app/$DIR su bitnami -c 'PATH=$PATH:/opt/bitnami/node/bin/ npm install' su bitnami -c 'PATH=$PATH:/opt/bitnami/node/bin/ npm start' ports: @@ -52,6 +65,4 @@ spec: mountPath: /app volumes: - name: node-data - gitRepo: - repository: {{ .Values.repository }} - revision: {{ .Values.revision }} + emptyDir: {} diff --git a/incubator/node/values.yaml b/incubator/node/values.yaml index acfa232f3..6d798e9be 100644 --- a/incubator/node/values.yaml +++ b/incubator/node/values.yaml @@ -3,7 +3,6 @@ ## image: bitnami/node:7.0.0-r1 - ## Git repository http/https ## repository: https://github.com/jbianquetti-nami/simple-node-app.git @@ -31,7 +30,7 @@ mariadb: ## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/ ## persistence: - enabled: true + enabled: true storageClass: generic accessMode: ReadWriteOnce size: 8Gi