diff --git a/submitted/fengshunli-mongodb/.helmignore b/submitted/fengshunli-mongodb/.helmignore new file mode 100755 index 0000000..50af031 --- /dev/null +++ b/submitted/fengshunli-mongodb/.helmignore @@ -0,0 +1,22 @@ +# 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 +.vscode/ diff --git a/submitted/fengshunli-mongodb/Chart.yaml b/submitted/fengshunli-mongodb/Chart.yaml new file mode 100755 index 0000000..0403f8d --- /dev/null +++ b/submitted/fengshunli-mongodb/Chart.yaml @@ -0,0 +1,13 @@ +apiVersion: v1 +appVersion: "1.0" +description: A Helm chart for Kubernetes +name: fengshunli-mongodb +version: 0.1.0 +home: https://mongodb.org +icon: https://bitnami.com/assets/stacks/mongodb/img/mongodb-stack-220x234.png +sources: +- https://github.com/fengshunli/mongodb +maintainers: +- name: fsl + email: 117131930@qq.com +engine: fsl \ No newline at end of file diff --git a/submitted/fengshunli-mongodb/README.md b/submitted/fengshunli-mongodb/README.md new file mode 100644 index 0000000..41f9ecf --- /dev/null +++ b/submitted/fengshunli-mongodb/README.md @@ -0,0 +1,55 @@ +## Prerequisites + +- Kubernetes 1.4+ with Beta APIs enabled +- PV provisioner support in the underlying infrastructure + +## Configuration + +The following table lists the configurable parameters of the MongoDB chart and their default values. + +| Parameter | Description | Default | +|---------------------------- |------------------------------------- |----------------------------------------------------------| +| `image.registry` | MongoDB image registry | `docker.io` | +| `image.repository` | MongoDB Image name | `bitnami/mongodb` | +| `image.tag` | MongoDB Image tag | `{VERSION}` | +| `image.pullPolicy` | Image pull policy | `Always` if `imageTag` is `latest`, else `IfNotPresent` | +| `image.pullSecrets` | Specify image pull secrets | `nil` | +| `mongodbRootPassword` | MongoDB admin password | `random alhpanumeric string (10)` | +| `mongodbUsername` | MongoDB custom user | `nil` | +| `mongodbPassword` | MongoDB custom user password | `random alhpanumeric string (10)` | +| `mongodbDatabase` | Database to create | `nil` | +| `mongodbExtraFlags` | MongoDB additional command line flags | [] | +| `service.type` | Kubernetes Service type | `ClusterIP` | +| `service.nodePort` | Port to bind to for NodePort service type | `nil` | +| `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` | +| `nodeSelector` | Node labels for pod assignment | {} | +| `livenessProbe.initialDelaySeconds` | Delay before liveness probe is initiated | 30 | +| `livenessProbe.periodSeconds` | How often to perform the probe | 10 | +| `livenessProbe.timeoutSeconds` | When the probe times out | 5 | +| `livenessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | 1 | +| `livenessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 | +| `readinessProbe.initialDelaySeconds`| Delay before readiness probe is initiated | 5 | +| `readinessProbe.periodSeconds` | How often to perform the probe | 10 | +| `readinessProbe.timeoutSeconds` | When the probe times out | 5 | +| `readinessProbe.successThreshold` | Minimum consecutive successes for the probe to be considered successful after having failed. | 1 | +| `readinessProbe.failureThreshold` | Minimum consecutive failures for the probe to be considered failed after having succeeded. | 6 | + +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, + +## 安装使用 + +### helm install +```shell +打包Chart +$ helm package fengshunli-mongodb + +本地安装 +$ helm install fengshunli-mongodb fengshunli-mongodb-0.1.0.tgz +``` + + diff --git a/submitted/fengshunli-mongodb/app-readme.md b/submitted/fengshunli-mongodb/app-readme.md new file mode 100644 index 0000000..b0568e6 --- /dev/null +++ b/submitted/fengshunli-mongodb/app-readme.md @@ -0,0 +1,7 @@ +# 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. + +## 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. diff --git a/submitted/fengshunli-mongodb/questions.yml b/submitted/fengshunli-mongodb/questions.yml new file mode 100644 index 0000000..b0199a6 --- /dev/null +++ b/submitted/fengshunli-mongodb/questions.yml @@ -0,0 +1,140 @@ +categories: +- Database +- NoSQL +questions: +- variable: defaultImage + default: "true" + description: "Use default Docker images" + label: Use Default Images + type: boolean + show_subquestion_if: false + group: "Container Images" + subquestions: + - variable: image.repository + default: "bitnami/mongodb" + description: "MongoDB image name" + type: string + label: MongoDB Image Name + - variable: image.tag + default: "4.0.3" + description: "MongoDB image tag" + type: string + label: Image Tag + - variable: metrics.image.repository + default: "forekshub/percona-mongodb-exporter" + description: "MongoDB metrics image name" + type: string + label: MongoDB Metrics Image Name + show_if: "defaultImage=false&&metrics.enabled=true" + - variable: metrics.image.tag + default: "latest" + description: "MongoDB metrics image tag" + type: string + label: Image Metrics Tag + show_if: "defaultImage=false&&metrics.enabled=true" +- variable: usePassword + default: true + description: "Enable Password Authentication" + type: boolean + label: Enable Password Authentication + required: true + show_subquestion_if: true + group: "MongoDB Settings" + subquestions: + - variable: mongodbUsername + default: "username" + description: "MongoDB username" + type: string + label: MongoDB Username + required: true + - variable: mongodbPassword + default: "password" + description: "MongoDB Password" + type: password + label: MongoDB Password + - variable: mongodbDatabase + default: "database" + description: "MongoDB Database" + type: string + label: MongoDB Database + required: true +- variable: replicaSet.enabled + default: true + description: "Switch to standalone or replicaSet mongodb instance" + type: boolean + label: Enable MongoDB ReplicaSet + required: true + group: "ReplicaSet Configuration" + show_subquestion_if: true + subquestions: + - variable: replicaSet.name + default: "rs0" + description: "Name of the replica set" + type: string + label: ReplicaSet Name + required: true + - variable: replicaSet.key + default: "" + description: "Key used for replica set authentication, will be auto-generated if not set" + type: string + label: ReplicaSet Auth Key +- variable: persistence.enabled + default: "false" + description: "Enable persistent volume for MongoDB" + type: boolean + required: true + label: MongoDB Persistent Volume Enabled + show_subquestion_if: true + group: "Persistent Volume" + subquestions: + - variable: persistence.size + default: "8Gi" + description: "MongoDB Persistent Volume Size" + type: string + label: MongoDB Volume Size + required: true + - variable: persistence.storageClass + default: "" + description: "If undefined or set to null, using the default storageClass. Defaults to null." + type: storageclass + label: Storage Class for MongoDB + - variable: persistence.existingClaim + default: "" + description: "If not empty, uses the specified existing PVC instead of creating new one" + type: pvc + label: Uses Existing Persistent Volume Claim for LocalStorage + show_if: "persistence.enabled=true&&replicaSet.enabled=false" +- variable: service.type + default: "ClusterIP" + description: "MongoDB Kubernetes Service type" + type: enum + group: "Service Settings" + options: + - "ClusterIP" + - "NodePort" + required: true + label: MongoDB Service Type + show_subquestion_if: "NodePort" + subquestions: + - variable: service.nodePort + default: "" + description: "NodePort port number(to set explicitly, choose port between 30000-32767)" + type: int + min: 30000 + max: 32767 + label: Service NodePort number +- variable: metrics.enabled + default: true + description: "Start a side-car prometheus exporter" + type: boolean + required: true + label: Enable MongoDB Metrics + show_subquestion_if: true + group: "Metrics Settings" + subquestions: + - variable: metrics.serviceMonitor.enabled + default: false + description: "If the operator is installed in your cluster, set to true to create a Service Monitor Entry" + type: boolean + label: Create ServiceMonitor Resource for Scraping Metrics Using PrometheusOperator + required: true \ No newline at end of file diff --git a/submitted/fengshunli-mongodb/templates/NOTES.txt b/submitted/fengshunli-mongodb/templates/NOTES.txt new file mode 100755 index 0000000..6217f9e --- /dev/null +++ b/submitted/fengshunli-mongodb/templates/NOTES.txt @@ -0,0 +1,21 @@ +1. Get the application URL by running these commands: +{{- if .Values.ingress.enabled }} +{{- range $host := .Values.ingress.hosts }} + {{- range $.Values.ingress.paths }} + http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host }}{{ . }} + {{- end }} +{{- end }} +{{- else if contains "NodePort" .Values.service.type }} + export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "mongodb.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 {{ include "mongodb.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "mongodb.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + echo http://$SERVICE_IP:{{ .Values.service.port }} +{{- else if contains "ClusterIP" .Values.service.type }} + export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "mongodb.name" . }},app.kubernetes.io/instance={{ .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:80 +{{- end }} diff --git a/submitted/fengshunli-mongodb/templates/_helpers.tpl b/submitted/fengshunli-mongodb/templates/_helpers.tpl new file mode 100755 index 0000000..a34e1dc --- /dev/null +++ b/submitted/fengshunli-mongodb/templates/_helpers.tpl @@ -0,0 +1,32 @@ +{{/* 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). +If release name contains chart name it will be used as a full name. +*/}} +{{- define "mongodb.fullname" -}} +{{- if .Values.fullnameOverride -}} +{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- if contains $name .Release.Name -}} +{{- .Release.Name | trunc 63 | trimSuffix "-" -}} +{{- else -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} +{{- end -}} +{{- end -}} +{{- end -}} + +{{/* +Create chart name and version as used by the chart label. +*/}} +{{- define "mongodb.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} +{{- end -}} diff --git a/submitted/fengshunli-mongodb/templates/deployment.yaml b/submitted/fengshunli-mongodb/templates/deployment.yaml new file mode 100755 index 0000000..2d5aeb6 --- /dev/null +++ b/submitted/fengshunli-mongodb/templates/deployment.yaml @@ -0,0 +1,51 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "mongodb.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "mongodb.name" . }} + helm.sh/chart: {{ include "mongodb.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: {{ .Values.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "mongodb.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "mongodb.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + containers: + - name: {{ .Chart.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/submitted/fengshunli-mongodb/templates/ingress.yaml b/submitted/fengshunli-mongodb/templates/ingress.yaml new file mode 100755 index 0000000..78c328c --- /dev/null +++ b/submitted/fengshunli-mongodb/templates/ingress.yaml @@ -0,0 +1,40 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "mongodb.fullname" . -}} +{{- $ingressPaths := .Values.ingress.paths -}} +apiVersion: extensions/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + app.kubernetes.io/name: {{ include "mongodb.name" . }} + helm.sh/chart: {{ include "mongodb.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: +{{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} +{{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ . | quote }} + http: + paths: + {{- range $ingressPaths }} + - path: {{ . }} + backend: + serviceName: {{ $fullName }} + servicePort: http + {{- end }} + {{- end }} +{{- end }} diff --git a/submitted/fengshunli-mongodb/templates/service.yaml b/submitted/fengshunli-mongodb/templates/service.yaml new file mode 100755 index 0000000..9de1bbc --- /dev/null +++ b/submitted/fengshunli-mongodb/templates/service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "mongodb.fullname" . }} + labels: + app.kubernetes.io/name: {{ include "mongodb.name" . }} + helm.sh/chart: {{ include "mongodb.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "mongodb.name" . }} + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/submitted/fengshunli-mongodb/values.yaml b/submitted/fengshunli-mongodb/values.yaml new file mode 100755 index 0000000..27bbcf9 --- /dev/null +++ b/submitted/fengshunli-mongodb/values.yaml @@ -0,0 +1,48 @@ +# Default values for mongodb. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +replicaCount: 1 + +image: + repository: nginx + tag: stable + pullPolicy: IfNotPresent + +nameOverride: "" +fullnameOverride: "" + +service: + type: ClusterIP + port: 80 + +ingress: + enabled: false + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + paths: [] + hosts: + - chart-example.local + tls: [] + # - 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 + +nodeSelector: {} + +tolerations: [] + +affinity: {}