创建自己的helm chart仓库
parent
64c35213b6
commit
374b0dd643
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
Binary file not shown.
After Width: | Height: | Size: 62 KiB |
File diff suppressed because one or more lines are too long
|
@ -0,0 +1,19 @@
|
|||
name: mean
|
||||
version: 0.1.3
|
||||
description: MEAN is a free and open-source JavaScript software stack for building dynamic web sites and web applications. The MEAN stack is MongoDB, Express.js, Angular, and Node.js. Because all components of the MEAN stack support programs written in JavaScript, MEAN applications can be written in one language for both server-side and client-side execution environments.
|
||||
keywords:
|
||||
- node
|
||||
- javascript
|
||||
- mongodb
|
||||
- express
|
||||
- angular
|
||||
- nodejs
|
||||
- git
|
||||
home: http://nodejs.org/
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-node
|
||||
maintainers:
|
||||
- name: Bitnami
|
||||
email: containers@bitnami.com
|
||||
engine: gotpl
|
||||
icon: https://bitnami.com/assets/stacks/meanstack/img/meanstack-stack-220x234.png
|
|
@ -0,0 +1,101 @@
|
|||
# NodeJS
|
||||
|
||||
[NodeJS](https://www.nodejs.org) The MEAN stack is MongoDB, Express.js, Angular, and Node.js. Because all components of the MEAN stack support programs written in JavaScript, MEAN applications can be written in one language for both server-side and client-side execution environments.
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```console
|
||||
$ helm install incubator/mean
|
||||
```
|
||||
|
||||
## Introduction
|
||||
|
||||
This chart bootstraps a [NodeJS](https://github.com/bitnami/bitnami-docker-node) and 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.
|
||||
|
||||
It clones and deploys a Node.js application from a git repository. Defaults to a demo MEAN application: https://github.com/scotch-io/node-todo.git
|
||||
|
||||
## 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`:
|
||||
|
||||
```console
|
||||
$ helm install --name my-release incubator/mean
|
||||
```
|
||||
|
||||
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 MongoDB chart out of the box.
|
||||
|
||||
Due that the Helm Chart clones the application on the /app volume while the container is initializing, a persistent volume is not required.
|
||||
|
||||
> **Tip**: List all releases using `helm list`
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the `my-release` deployment:
|
||||
|
||||
```console
|
||||
$ 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 NodeJS chart and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|------------------------------------|-------------------------------------|-----------------------------------------------------------|
|
||||
| `image` | NodeJS image | `bitnami/node:{VERSION}` |
|
||||
| `imagePullPolicy` | Image pull policy | `IfNotPresent` |
|
||||
| `repository` | Repo of the application | `https://github.com/scotch-io/node-todo.git` |
|
||||
| `revision` | Revision to checkout | `master` |
|
||||
| `config` | Contents of the config file for app | `See repo file config/database.js` |
|
||||
| `configfile` | Filename of config file for app | `database.js` |
|
||||
| `mongodb.mongodbRootPassword` | MongoDB admin password | `nil` |
|
||||
| `mongodb.mongodbUsername` | MongoDB username | `nil` |
|
||||
| `mongodb.mongodbPassword` | MongoDB username password | `nil` |
|
||||
| `mongodb.mongodbDatabase` | MongoDB database name | `nil` |
|
||||
| `mongodb.persistence.enabled` | MongoDB Persistent Volume enabled? | `false` |
|
||||
| `mongodb.persistence.storageClass` | Type of storage for PVC | `default` |
|
||||
| `mongodb.persistence.accessMode` | Type of access mode for PVC | `ReadWriteOnce` |
|
||||
| `mongodb.persistence.size` | Disk size | `8Gi` |
|
||||
| `serviceType` | Kubernetes Service type | `LoadBalancer` |
|
||||
| `resources` | CPU/Memory resource requests/limits | Memory: `512Mi`, CPU: `300m` |
|
||||
| `persistence.enabled` | NodeJS persistence enabled? | `false` |
|
||||
| `persistence.storageClass` | Type of storage for PVC | If defined: |
|
||||
| `volume.beta.kubernetes.io/storage-class: <storageClass>` |
|
||||
| Defaults: |
|
||||
| `volume.alpha.kubernetes.io/storage-class: default` |
|
||||
|--------------------------------------------------------------------------------------------------------------------------------------|
|
||||
|
||||
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.
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example,
|
||||
|
||||
```console
|
||||
$ helm install --name my-release \
|
||||
--set repository=https://github.com/scotch-io/node-todo.git,mongodb.mongodbRootPassword=secretpassword \
|
||||
incubator/mean
|
||||
```
|
||||
|
||||
The above command clones the remote git repository to the `/app/` directory of the container. Additionally it sets the MongoDB `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,
|
||||
|
||||
```console
|
||||
$ helm install --name my-release -f values.yaml incubator/mean
|
||||
```
|
||||
|
||||
> **Tip**: You can use the default [values.yaml](values.yaml)
|
||||
|
||||
## Persistence
|
||||
|
||||
The [Bitnami NodeJS](https://github.com/bitnami/bitnami-docker-node) image stores the NodeJS application and configurations at the `/app` path of the container.
|
||||
This storage is ephemeral and it will disappear when the pods are taken away
|
||||
|
||||
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.
|
|
@ -0,0 +1 @@
|
|||
.git
|
|
@ -0,0 +1,17 @@
|
|||
appVersion: 3.4.9
|
||||
description: NoSQL document-oriented database that stores JSON-like documents with
|
||||
dynamic schemas, simplifying the integration of data in content-driven applications.
|
||||
engine: gotpl
|
||||
home: https://mongodb.org
|
||||
icon: https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png
|
||||
keywords:
|
||||
- mongodb
|
||||
- database
|
||||
- nosql
|
||||
maintainers:
|
||||
- email: containers@bitnami.com
|
||||
name: Bitnami
|
||||
name: mongodb
|
||||
sources:
|
||||
- https://github.com/bitnami/bitnami-docker-mongodb
|
||||
version: 0.4.17
|
|
@ -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.
|
|
@ -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 -}}
|
||||
|
|
@ -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 -}}
|
|
@ -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 -}}
|
|
@ -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 }}
|
|
@ -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 }}
|
|
@ -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" . }}
|
|
@ -0,0 +1,49 @@
|
|||
## Bitnami MongoDB image version
|
||||
## ref: https://hub.docker.com/r/bitnami/mongodb/tags/
|
||||
##
|
||||
image: sz-pg-oam-docker-hub-001.tendcloud.com/library/bitnami-mongodb:3.4.9-r1
|
||||
|
||||
## 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: false
|
||||
## mongodb data Persistent Volume Storage Class
|
||||
## If defined, storageClassName: <storageClass>
|
||||
## 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: "null"
|
||||
accessMode: ReadWriteOnce
|
||||
size: 8Gi
|
||||
|
||||
## Configure resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources:
|
||||
requests:
|
||||
memory: 256Mi
|
||||
cpu: 100m
|
|
@ -0,0 +1,10 @@
|
|||
dependencies:
|
||||
- condition: ""
|
||||
enabled: false
|
||||
import-values: null
|
||||
name: mongodb
|
||||
repository: http://localhost:8879/
|
||||
tags: null
|
||||
version: 0.4.17
|
||||
digest: sha256:955f80c2844df5fb24c06440898df8d3b2143d7081ac11409d8604720e47b814
|
||||
generated: 2017-10-24T11:45:19.054114+08:00
|
|
@ -0,0 +1,4 @@
|
|||
dependencies:
|
||||
- name: mongodb
|
||||
repository: http://localhost:8879
|
||||
version: 0.4.x
|
|
@ -0,0 +1,23 @@
|
|||
|
||||
Get the URL of your Node app by running:
|
||||
|
||||
{{- if contains "NodePort" .Values.serviceType }}
|
||||
|
||||
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.serviceType }}
|
||||
|
||||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
|
||||
echo http://$SERVICE_IP/
|
||||
|
||||
It may take a few minutes for the LoadBalancer IP address to be available.
|
||||
Watch the status with: 'kubectl get svc -w {{ template "fullname" . }} --namespace {{ .Release.Namespace }}'
|
||||
|
||||
{{- else if contains "ClusterIP" .Values.serviceType }}
|
||||
|
||||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
|
||||
echo http://127.0.0.1:8080/
|
||||
kubectl port-forward $POD_NAME 8080:80
|
||||
{{- end }}
|
|
@ -0,0 +1,24 @@
|
|||
{{/* 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 | trimSuffix "-" 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 -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 | trimSuffix "-" chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "mongodb.fullname" -}}
|
||||
{{- printf "%s-%s" .Release.Name "mongodb" | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
|
@ -0,0 +1,14 @@
|
|||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
data:
|
||||
{{ default "database.js" .Values.configfile}}: |-
|
||||
{{- if .Values.config }}
|
||||
{{ default "" .Values.config | indent 4 }}
|
||||
{{- end -}}
|
|
@ -0,0 +1,136 @@
|
|||
apiVersion: extensions/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
spec:
|
||||
replicas: 1
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
annotations:
|
||||
pod.beta.kubernetes.io/init-containers: '[
|
||||
{
|
||||
"name": "wait-for-db-service",
|
||||
"image": "{{ .Values.image }}",
|
||||
"imagePullPolicy": "{{ .Values.imagePullPolicy }}",
|
||||
"command": ["/bin/bash", "-c", "for i in {1..100}; do if nc -z -w 1 {{ template "mongodb.fullname" . }} 27017; then exit 0; fi; done; exit 1;"]
|
||||
},
|
||||
{
|
||||
"name": "git-clone-app",
|
||||
"image": "{{ .Values.image }}",
|
||||
"imagePullPolicy": "{{ .Values.imagePullPolicy }}",
|
||||
"command": [ "/bin/sh", "-c" , "git clone {{ .Values.repository }} /app && git checkout {{ .Values.revision }}" ],
|
||||
"volumeMounts": [
|
||||
{
|
||||
"name": "app",
|
||||
"mountPath": "/app"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "npm-install",
|
||||
"image": "{{ .Values.image }}",
|
||||
"imagePullPolicy": "{{ .Values.imagePullPolicy }}",
|
||||
"command": [ "/bin/sh", "-c" , "npm install" ],
|
||||
"volumeMounts": [
|
||||
{
|
||||
"name": "app",
|
||||
"mountPath": "/app"
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"name": "fixing-permissions",
|
||||
"image": "{{ .Values.image }}",
|
||||
"imagePullPolicy": "{{ .Values.imagePullPolicy }}",
|
||||
"command": [ "/bin/sh", "-c" , "chown bitnami:bitnami -R /app /home/bitnami {{ .Values.persistence.path }}"],
|
||||
"volumeMounts": [
|
||||
{
|
||||
"name": "app",
|
||||
"mountPath": "/app"
|
||||
},
|
||||
{
|
||||
"name": "data",
|
||||
"mountPath": "{{ .Values.persistence.path }}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]'
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ template "fullname" . }}
|
||||
securityContext:
|
||||
readOnlyRootFilesystem: true
|
||||
image: "{{ .Values.image }}"
|
||||
imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }}
|
||||
env:
|
||||
- name: MONGODB_HOST
|
||||
value: {{ template "mongodb.fullname" . }}
|
||||
- name: MONGODB_PORT
|
||||
value: "27017"
|
||||
- name: MONGODB_ROOT_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "mongodb.fullname" . }}
|
||||
key: mongodb-root-password
|
||||
- name: MONGODB_USERNAME
|
||||
value: {{ default "" .Values.mongodb.mongodbUsername | quote }}
|
||||
- name: MONGODB_PASSWORD
|
||||
valueFrom:
|
||||
secretKeyRef:
|
||||
name: {{ template "mongodb.fullname" . }}
|
||||
key: mongodb-password
|
||||
- name: MONGODB_DATABASE
|
||||
value: {{ default "" .Values.mongodb.mongodbDatabase | quote }}
|
||||
- name: GIT_REPO
|
||||
value: {{ .Values.repository }}
|
||||
command:
|
||||
- /bin/bash
|
||||
- -ec
|
||||
- sudo -HEu bitnami npm start
|
||||
ports:
|
||||
- name: http
|
||||
containerPort: 8080
|
||||
livenessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 180
|
||||
timeoutSeconds: 5
|
||||
failureThreshold: 6
|
||||
readinessProbe:
|
||||
httpGet:
|
||||
path: /
|
||||
port: http
|
||||
initialDelaySeconds: 30
|
||||
timeoutSeconds: 3
|
||||
periodSeconds: 5
|
||||
volumeMounts:
|
||||
- name: app
|
||||
mountPath: /app
|
||||
- name: data
|
||||
mountPath: {{ .Values.persistence.path }}
|
||||
- name: config
|
||||
mountPath: /app/config
|
||||
volumes:
|
||||
- name: app
|
||||
emptyDir: {}
|
||||
- name: data
|
||||
{{- if .Values.persistence.enabled }}
|
||||
persistentVolumeClaim:
|
||||
claimName: {{ template "fullname" . }}
|
||||
{{- else }}
|
||||
emptyDir: {}
|
||||
{{- end }}
|
||||
- name: config
|
||||
configMap:
|
||||
name: {{ template "fullname" . }}
|
||||
items:
|
||||
- key: {{ .Values.configfile | quote }}
|
||||
path: {{ .Values.configfile | quote }}
|
|
@ -0,0 +1,26 @@
|
|||
{{- if .Values.persistence.enabled }}
|
||||
kind: PersistentVolumeClaim
|
||||
apiVersion: v1
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
annotations:
|
||||
{{- if .Values.persistence.storageClass }}
|
||||
volume.beta.kubernetes.io/storage-class: {{ .Values.persistence.storageClass | quote }}
|
||||
{{- else }}
|
||||
volume.alpha.kubernetes.io/storage-class: default
|
||||
{{- end }}
|
||||
{{- range $key, $value := .Values.persistence.annotations }}
|
||||
{{ $key }}: {{ $value }}
|
||||
{{- end }}
|
||||
spec:
|
||||
accessModes:
|
||||
- {{ .Values.persistence.accessMode | quote }}
|
||||
resources:
|
||||
requests:
|
||||
storage: {{ .Values.persistence.size | quote }}
|
||||
{{- end }}
|
|
@ -0,0 +1,17 @@
|
|||
apiVersion: v1
|
||||
kind: Service
|
||||
metadata:
|
||||
name: {{ template "fullname" . }}
|
||||
labels:
|
||||
app: {{ template "fullname" . }}
|
||||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}"
|
||||
release: "{{ .Release.Name }}"
|
||||
heritage: "{{ .Release.Service }}"
|
||||
spec:
|
||||
type: {{ .Values.serviceType }}
|
||||
ports:
|
||||
- name: http
|
||||
port: 80
|
||||
targetPort: http
|
||||
selector:
|
||||
app: {{ template "fullname" . }}
|
|
@ -0,0 +1,81 @@
|
|||
## Bitnami node image version
|
||||
## ref: https://hub.docker.com/r/bitnami/node/tags/
|
||||
##
|
||||
image: sz-pg-oam-docker-hub-001.tendcloud.com/library/bitnami-node:7.5.0-r0
|
||||
|
||||
## Git repository http/https
|
||||
##
|
||||
repository: https://github.com/scotch-io/node-todo.git
|
||||
|
||||
## Git repository revision to checkout
|
||||
##
|
||||
revision: 5750cb4
|
||||
|
||||
## Specify a imagePullPolicy
|
||||
## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images
|
||||
##
|
||||
imagePullPolicy: IfNotPresent
|
||||
|
||||
## Configure the application with a custom config file
|
||||
## ref: https://github.com/scotch-io/node-todo#installation
|
||||
##
|
||||
config: |-
|
||||
module.exports = {
|
||||
remoteUrl: "mongodb://" + process.env.MONGODB_USERNAME +":" + process.env.MONGODB_PASSWORD + "@" + process.env.MONGODB_HOST +":"+ process.env.MONGODB_PORT + "/" + process.env.MONGODB_DATABASE ,
|
||||
localUrl: "mongodb://" + process.env.MONGODB_USERNAME +":" + process.env.MONGODB_PASSWORD + "@" + process.env.MONGODB_HOST +":"+ process.env.MONGODB_PORT + "/" + process.env.MONGODB_DATABASE
|
||||
};
|
||||
|
||||
configfile: database.js
|
||||
|
||||
##
|
||||
## MongoDB chart configuration
|
||||
##
|
||||
mongodb:
|
||||
## 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:
|
||||
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
enabled: false
|
||||
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
|
||||
## Default: volume.alpha.kubernetes.io/storage-class: default
|
||||
##
|
||||
storageClass: "null"
|
||||
accessMode: ReadWriteOnce
|
||||
size: 8Gi
|
||||
|
||||
## Kubernetes configuration
|
||||
## For minikube, set this to NodePort, elsewhere use LoadBalancer
|
||||
##
|
||||
serviceType: ClusterIP
|
||||
|
||||
## Enable persistence using Persistent Volume Claims
|
||||
## ref: http://kubernetes.io/docs/user-guide/persistent-volumes/
|
||||
##
|
||||
persistence:
|
||||
enabled: false
|
||||
path: /app/data
|
||||
## If defined, volume.beta.kubernetes.io/storage-class: <storageClass>
|
||||
## Default: volume.alpha.kubernetes.io/storage-class: default
|
||||
##
|
||||
storageClass: "null"
|
||||
accessMode: ReadWriteOnce
|
||||
size: 1Gi
|
||||
|
||||
## Configure resource requests and limits
|
||||
## ref: http://kubernetes.io/docs/user-guide/compute-resources/
|
||||
##
|
||||
resources:
|
||||
requests:
|
||||
memory: 512Mi
|
||||
cpu: 300m
|
|
@ -3,8 +3,8 @@
|
|||
# Declare variables to be passed into your templates.
|
||||
replicaCount: 1
|
||||
image:
|
||||
repository: nginx
|
||||
tag: stable
|
||||
repository: sz-pg-oam-docker-hub-001.tendcloud.com/library/nginx
|
||||
tag: 1.9
|
||||
pullPolicy: IfNotPresent
|
||||
service:
|
||||
name: nginx
|
||||
|
|
|
@ -33,3 +33,12 @@ spec:
|
|||
backend:
|
||||
serviceName: k8s-app-monitor-agent
|
||||
servicePort: 8080
|
||||
- host: mean.jimmysong.io
|
||||
http:
|
||||
paths:
|
||||
- path: /
|
||||
backend:
|
||||
serviceName: orbiting-platypus-mean
|
||||
servicePort: 80
|
||||
|
||||
|
||||
|
|
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue