diff --git a/cmd/helm/dependency_build_test.go b/cmd/helm/dependency_build_test.go index 3e092ae00..0e76381f4 100644 --- a/cmd/helm/dependency_build_test.go +++ b/cmd/helm/dependency_build_test.go @@ -102,7 +102,9 @@ func TestDependencyBuildCmd(t *testing.T) { } func TestDependencyBuildCmdWithHelmV2Hash(t *testing.T) { - cmd := fmt.Sprintf("dependency build '%s'", "testdata/testcharts/issue-7233") + chartName := "testdata/testcharts/issue-7233" + + cmd := fmt.Sprintf("dependency build '%s'", chartName) _, out, err := executeActionCommand(cmd) // Want to make sure the build can verify Helm v2 hash @@ -110,4 +112,10 @@ func TestDependencyBuildCmdWithHelmV2Hash(t *testing.T) { t.Logf("Output: %s", out) t.Fatal(err) } + + // Make sure the child chart file got downloaded. + expect := filepath.Join(chartName, "charts/alpine-0.1.0.tgz") + if _, err := os.Stat(expect); err != nil { + t.Fatal(err) + } } diff --git a/cmd/helm/testdata/testcharts/issue-7233/charts/alpine-0.1.0.tgz b/cmd/helm/testdata/testcharts/issue-7233/charts/alpine-0.1.0.tgz new file mode 100644 index 000000000..925018e84 Binary files /dev/null and b/cmd/helm/testdata/testcharts/issue-7233/charts/alpine-0.1.0.tgz differ diff --git a/cmd/helm/testdata/testcharts/issue-7233/charts/mysql-1.6.2.tgz b/cmd/helm/testdata/testcharts/issue-7233/charts/mysql-1.6.2.tgz deleted file mode 100644 index 8eab64bcd..000000000 Binary files a/cmd/helm/testdata/testcharts/issue-7233/charts/mysql-1.6.2.tgz and /dev/null differ diff --git a/cmd/helm/testdata/testcharts/issue-7233/requirements.lock b/cmd/helm/testdata/testcharts/issue-7233/requirements.lock index 67c951584..62744125b 100644 --- a/cmd/helm/testdata/testcharts/issue-7233/requirements.lock +++ b/cmd/helm/testdata/testcharts/issue-7233/requirements.lock @@ -1,6 +1,6 @@ dependencies: -- name: mysql - repository: file://../mysql - version: 1.6.2 -digest: sha256:add2a8a6b181881747598aabe3bebab079c86624a083bb87ef8ece3fc3207026 -generated: "2020-01-30T17:21:42.015287763Z" +- name: alpine + repository: file://../alpine + version: 0.1.0 +digest: sha256:7b380b1a826e7be1eecb089f66209d6d3df54be4bf879d4a8e6f8a9e871710e5 +generated: "2020-01-31T11:30:21.911547651Z" diff --git a/cmd/helm/testdata/testcharts/issue-7233/requirements.yaml b/cmd/helm/testdata/testcharts/issue-7233/requirements.yaml index f2de5d35d..f0195cb15 100644 --- a/cmd/helm/testdata/testcharts/issue-7233/requirements.yaml +++ b/cmd/helm/testdata/testcharts/issue-7233/requirements.yaml @@ -1,4 +1,4 @@ dependencies: -- name: mysql - version: 1.6.2 - repository: file://../mysql +- name: alpine + version: 0.1.0 + repository: file://../alpine diff --git a/cmd/helm/testdata/testcharts/issue-7233/templates/NOTES.txt b/cmd/helm/testdata/testcharts/issue-7233/templates/NOTES.txt deleted file mode 100644 index 9533aaa50..000000000 --- a/cmd/helm/testdata/testcharts/issue-7233/templates/NOTES.txt +++ /dev/null @@ -1,21 +0,0 @@ -1. Get the application URL by running these commands: -{{- if .Values.ingress.enabled }} -{{- range $host := .Values.ingress.hosts }} - {{- range .paths }} - http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.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 "issue-7233.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 --namespace {{ .Release.Namespace }} svc -w {{ include "issue-7233.fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "issue-7233.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") - 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 "issue-7233.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/cmd/helm/testdata/testcharts/issue-7233/templates/_helpers.tpl b/cmd/helm/testdata/testcharts/issue-7233/templates/_helpers.tpl deleted file mode 100644 index 78b9df4b9..000000000 --- a/cmd/helm/testdata/testcharts/issue-7233/templates/_helpers.tpl +++ /dev/null @@ -1,56 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "issue-7233.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 "issue-7233.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 "issue-7233.chart" -}} -{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}} -{{- end -}} - -{{/* -Common labels -*/}} -{{- define "issue-7233.labels" -}} -app.kubernetes.io/name: {{ include "issue-7233.name" . }} -helm.sh/chart: {{ include "issue-7233.chart" . }} -app.kubernetes.io/instance: {{ .Release.Name }} -{{- if .Chart.AppVersion }} -app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} -{{- end }} -app.kubernetes.io/managed-by: {{ .Release.Service }} -{{- end -}} - -{{/* -Create the name of the service account to use -*/}} -{{- define "issue-7233.serviceAccountName" -}} -{{- if .Values.serviceAccount.create -}} - {{ default (include "issue-7233.fullname" .) .Values.serviceAccount.name }} -{{- else -}} - {{ default "default" .Values.serviceAccount.name }} -{{- end -}} -{{- end -}} diff --git a/cmd/helm/testdata/testcharts/issue-7233/templates/configmap.yaml b/cmd/helm/testdata/testcharts/issue-7233/templates/configmap.yaml new file mode 100644 index 000000000..53880b25d --- /dev/null +++ b/cmd/helm/testdata/testcharts/issue-7233/templates/configmap.yaml @@ -0,0 +1,7 @@ +apiVersion: v1 +kind: ConfigMap +metadata: + name: {{ .Release.Name }}-configmap +data: + myvalue: "Hello World" + drink: {{ .Values.favoriteDrink }} diff --git a/cmd/helm/testdata/testcharts/issue-7233/templates/deployment.yaml b/cmd/helm/testdata/testcharts/issue-7233/templates/deployment.yaml deleted file mode 100644 index 8eb73636c..000000000 --- a/cmd/helm/testdata/testcharts/issue-7233/templates/deployment.yaml +++ /dev/null @@ -1,57 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ include "issue-7233.fullname" . }} - labels: -{{ include "issue-7233.labels" . | indent 4 }} -spec: - replicas: {{ .Values.replicaCount }} - selector: - matchLabels: - app.kubernetes.io/name: {{ include "issue-7233.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - template: - metadata: - labels: - app.kubernetes.io/name: {{ include "issue-7233.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} - spec: - {{- with .Values.imagePullSecrets }} - imagePullSecrets: - {{- toYaml . | nindent 8 }} - {{- end }} - serviceAccountName: {{ template "issue-7233.serviceAccountName" . }} - securityContext: - {{- toYaml .Values.podSecurityContext | nindent 8 }} - containers: - - name: {{ .Chart.Name }} - securityContext: - {{- toYaml .Values.securityContext | nindent 12 }} - 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/cmd/helm/testdata/testcharts/issue-7233/templates/ingress.yaml b/cmd/helm/testdata/testcharts/issue-7233/templates/ingress.yaml deleted file mode 100644 index 9b56c8d90..000000000 --- a/cmd/helm/testdata/testcharts/issue-7233/templates/ingress.yaml +++ /dev/null @@ -1,41 +0,0 @@ -{{- if .Values.ingress.enabled -}} -{{- $fullName := include "issue-7233.fullname" . -}} -{{- $svcPort := .Values.service.port -}} -{{- if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} -apiVersion: networking.k8s.io/v1beta1 -{{- else -}} -apiVersion: extensions/v1beta1 -{{- end }} -kind: Ingress -metadata: - name: {{ $fullName }} - labels: -{{ include "issue-7233.labels" . | indent 4 }} - {{- 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: {{ .host | quote }} - http: - paths: - {{- range .paths }} - - path: {{ . }} - backend: - serviceName: {{ $fullName }} - servicePort: {{ $svcPort }} - {{- end }} - {{- end }} -{{- end }} diff --git a/cmd/helm/testdata/testcharts/issue-7233/templates/service.yaml b/cmd/helm/testdata/testcharts/issue-7233/templates/service.yaml deleted file mode 100644 index aea07f5a4..000000000 --- a/cmd/helm/testdata/testcharts/issue-7233/templates/service.yaml +++ /dev/null @@ -1,16 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ include "issue-7233.fullname" . }} - labels: -{{ include "issue-7233.labels" . | indent 4 }} -spec: - type: {{ .Values.service.type }} - ports: - - port: {{ .Values.service.port }} - targetPort: http - protocol: TCP - name: http - selector: - app.kubernetes.io/name: {{ include "issue-7233.name" . }} - app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/cmd/helm/testdata/testcharts/issue-7233/templates/serviceaccount.yaml b/cmd/helm/testdata/testcharts/issue-7233/templates/serviceaccount.yaml deleted file mode 100644 index 0d6e8df58..000000000 --- a/cmd/helm/testdata/testcharts/issue-7233/templates/serviceaccount.yaml +++ /dev/null @@ -1,8 +0,0 @@ -{{- if .Values.serviceAccount.create -}} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "issue-7233.serviceAccountName" . }} - labels: -{{ include "issue-7233.labels" . | indent 4 }} -{{- end -}} diff --git a/cmd/helm/testdata/testcharts/issue-7233/templates/tests/test-connection.yaml b/cmd/helm/testdata/testcharts/issue-7233/templates/tests/test-connection.yaml deleted file mode 100644 index ca844cca7..000000000 --- a/cmd/helm/testdata/testcharts/issue-7233/templates/tests/test-connection.yaml +++ /dev/null @@ -1,15 +0,0 @@ -apiVersion: v1 -kind: Pod -metadata: - name: "{{ include "issue-7233.fullname" . }}-test-connection" - labels: -{{ include "issue-7233.labels" . | indent 4 }} - annotations: - "helm.sh/hook": test-success -spec: - containers: - - name: wget - image: busybox - command: ['wget'] - args: ['{{ include "issue-7233.fullname" . }}:{{ .Values.service.port }}'] - restartPolicy: Never diff --git a/cmd/helm/testdata/testcharts/issue-7233/values.yaml b/cmd/helm/testdata/testcharts/issue-7233/values.yaml index cc8472208..b1aa168d7 100644 --- a/cmd/helm/testdata/testcharts/issue-7233/values.yaml +++ b/cmd/helm/testdata/testcharts/issue-7233/values.yaml @@ -1,68 +1 @@ -# Default values for issue-7233. -# This is a YAML-formatted file. -# Declare variables to be passed into your templates. - -replicaCount: 1 - -image: - repository: nginx - tag: stable - pullPolicy: IfNotPresent - -imagePullSecrets: [] -nameOverride: "" -fullnameOverride: "" - -serviceAccount: - # Specifies whether a service account should be created - create: true - # The name of the service account to use. - # If not set and create is true, a name is generated using the fullname template - name: - -podSecurityContext: {} - # fsGroup: 2000 - -securityContext: {} - # capabilities: - # drop: - # - ALL - # readOnlyRootFilesystem: true - # runAsNonRoot: true - # runAsUser: 1000 - -service: - type: ClusterIP - port: 80 - -ingress: - enabled: false - annotations: {} - # kubernetes.io/ingress.class: nginx - # kubernetes.io/tls-acme: "true" - hosts: - - host: chart-example.local - paths: [] - - 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: {} +favoriteDrink: coffee diff --git a/cmd/helm/testdata/testcharts/mysql/.helmignore b/cmd/helm/testdata/testcharts/mysql/.helmignore deleted file mode 100644 index a1c17ae45..000000000 --- a/cmd/helm/testdata/testcharts/mysql/.helmignore +++ /dev/null @@ -1,2 +0,0 @@ -.git -OWNERS \ No newline at end of file diff --git a/cmd/helm/testdata/testcharts/mysql/Chart.yaml b/cmd/helm/testdata/testcharts/mysql/Chart.yaml deleted file mode 100644 index ad89e5187..000000000 --- a/cmd/helm/testdata/testcharts/mysql/Chart.yaml +++ /dev/null @@ -1,21 +0,0 @@ -apiVersion: v1 -appVersion: 5.7.28 -description: Fast, reliable, scalable, and easy to use open-source relational database - system. -engine: gotpl -home: https://www.mysql.com/ -icon: https://www.mysql.com/common/logos/logo-mysql-170x115.png -keywords: -- mysql -- database -- sql -maintainers: -- email: o.with@sportradar.com - name: olemarkus -- email: viglesias@google.com - name: viglesiasce -name: mysql -sources: -- https://github.com/kubernetes/charts -- https://github.com/docker-library/mysql -version: 1.6.2 diff --git a/cmd/helm/testdata/testcharts/mysql/README.md b/cmd/helm/testdata/testcharts/mysql/README.md deleted file mode 100644 index 8d729cbc4..000000000 --- a/cmd/helm/testdata/testcharts/mysql/README.md +++ /dev/null @@ -1,241 +0,0 @@ -# MySQL - -[MySQL](https://MySQL.org) is one of the most popular database servers in the world. Notable users include Wikipedia, Facebook and Google. - -## Introduction - -This chart bootstraps a single node MySQL deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. - -## Prerequisites - -- Kubernetes 1.10+ 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/mysql -``` - -The command deploys MySQL on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. - -By default a random password will be generated for the root user. If you'd like to set your own password change the mysqlRootPassword -in the values.yaml. - -You can retrieve your root password by running the following command. Make sure to replace [YOUR_RELEASE_NAME]: - - printf $(printf '\%o' `kubectl get secret [YOUR_RELEASE_NAME]-mysql -o jsonpath="{.data.mysql-root-password[*]}"`) - -> **Tip**: List all releases using `helm list` - -## Uninstalling the Chart - -To uninstall/delete the `my-release` deployment: - -```bash -$ helm delete --purge my-release -``` - -The command removes all the Kubernetes components associated with the chart and deletes the release completely. - -## Configuration - -The following table lists the configurable parameters of the MySQL chart and their default values. - -| Parameter | Description | Default | -| -------------------------------------------- | -------------------------------------------------------------------------------------------- | ---------------------------------------------------- | -| `args` | Additional arguments to pass to the MySQL container. | `[]` | -| `initContainer.resources` | initContainer resource requests/limits | Memory: `10Mi`, CPU: `10m` | -| `image` | `mysql` image repository. | `mysql` | -| `imageTag` | `mysql` image tag. | `5.7.14` | -| `busybox.image` | `busybox` image repository. | `busybox` | -| `busybox.tag` | `busybox` image tag. | `1.29.3` | -| `testFramework.enabled` | `test-framework` switch. | `true` | -| `testFramework.image` | `test-framework` image repository. | `dduportal/bats` | -| `testFramework.tag` | `test-framework` image tag. | `0.4.0` | -| `imagePullPolicy` | Image pull policy | `IfNotPresent` | -| `existingSecret` | Use Existing secret for Password details | `nil` | -| `extraVolumes` | Additional volumes as a string to be passed to the `tpl` function | | -| `extraVolumeMounts` | Additional volumeMounts as a string to be passed to the `tpl` function | | -| `extraInitContainers` | Additional init containers as a string to be passed to the `tpl` function | | -| `mysqlRootPassword` | Password for the `root` user. Ignored if existing secret is provided | Random 10 characters | -| `mysqlUser` | Username of new user to create. | `nil` | -| `mysqlPassword` | Password for the new user. Ignored if existing secret is provided | Random 10 characters | -| `mysqlDatabase` | Name for new database to create. | `nil` | -| `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. | 3 | -| `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 | 1 | -| `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. | 3 | -| `schedulerName` | Name of the k8s scheduler (other than default) | `nil` | -| `persistence.enabled` | Create a volume to store data | true | -| `persistence.size` | Size of persistent volume claim | 8Gi RW | -| `persistence.storageClass` | Type of persistent volume claim | nil | -| `persistence.accessMode` | ReadWriteOnce or ReadOnly | ReadWriteOnce | -| `persistence.existingClaim` | Name of existing persistent volume | `nil` | -| `persistence.subPath` | Subdirectory of the volume to mount | `nil` | -| `persistence.annotations` | Persistent Volume annotations | {} | -| `nodeSelector` | Node labels for pod assignment | {} | -| `tolerations` | Pod taint tolerations for deployment | {} | -| `metrics.enabled` | Start a side-car prometheus exporter | `false` | -| `metrics.image` | Exporter image | `prom/mysqld-exporter` | -| `metrics.imageTag` | Exporter image | `v0.10.0` | -| `metrics.imagePullPolicy` | Exporter image pull policy | `IfNotPresent` | -| `metrics.resources` | Exporter resource requests/limit | `nil` | -| `metrics.livenessProbe.initialDelaySeconds` | Delay before metrics liveness probe is initiated | 15 | -| `metrics.livenessProbe.timeoutSeconds` | When the probe times out | 5 | -| `metrics.readinessProbe.initialDelaySeconds` | Delay before metrics readiness probe is initiated | 5 | -| `metrics.readinessProbe.timeoutSeconds` | When the probe times out | 1 | -| `metrics.flags` | Additional flags for the mysql exporter to use | `[]` | -| `metrics.serviceMonitor.enabled` | Set this to `true` to create ServiceMonitor for Prometheus operator | `false` | -| `metrics.serviceMonitor.additionalLabels` | Additional labels that can be used so ServiceMonitor will be discovered by Prometheus | `{}` | -| `resources` | CPU/Memory resource requests/limits | Memory: `256Mi`, CPU: `100m` | -| `configurationFiles` | List of mysql configuration files | `nil` | -| `configurationFilesPath` | Path of mysql configuration files | `/etc/mysql/conf.d/` | -| `securityContext.enabled` | Enable security context (mysql pod) | `false` | -| `securityContext.fsGroup` | Group ID for the container (mysql pod) | 999 | -| `securityContext.runAsUser` | User ID for the container (mysql pod) | 999 | -| `service.annotations` | Kubernetes annotations for mysql | {} | -| `service.type` | Kubernetes service type | ClusterIP | -| `service.loadBalancerIP` | LoadBalancer service IP | `""` | -| `serviceAccount.create` | Specifies whether a ServiceAccount should be created | `false` | -| `serviceAccount.name` | The name of the ServiceAccount to create | Generated using the mysql.fullname template | -| `ssl.enabled` | Setup and use SSL for MySQL connections | `false` | -| `ssl.secret` | Name of the secret containing the SSL certificates | mysql-ssl-certs | -| `ssl.certificates[0].name` | Name of the secret containing the SSL certificates | `nil` | -| `ssl.certificates[0].ca` | CA certificate | `nil` | -| `ssl.certificates[0].cert` | Server certificate (public key) | `nil` | -| `ssl.certificates[0].key` | Server key (private key) | `nil` | -| `imagePullSecrets` | Name of Secret resource containing private registry credentials | `nil` | -| `initializationFiles` | List of SQL files which are run after the container started | `nil` | -| `timezone` | Container and mysqld timezone (TZ env) | `nil` (UTC depending on image) | -| `podAnnotations` | Map of annotations to add to the pods | `{}` | -| `podLabels` | Map of labels to add to the pods | `{}` | -| `priorityClassName` | Set pod priorityClassName | `{}` | -| `deploymentAnnotations` | Map of annotations for deployment | `{}` | -| `strategy` | Update strategy policy | `{type: "Recreate"}` | - -Some of the parameters above map to the env variables defined in the [MySQL DockerHub image](https://hub.docker.com/_/mysql/). - -Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, - -```bash -$ helm install --name my-release \ - --set mysqlRootPassword=secretpassword,mysqlUser=my-user,mysqlPassword=my-password,mysqlDatabase=my-database \ - stable/mysql -``` - -The above command sets the MySQL `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/mysql -``` - -> **Tip**: You can use the default [values.yaml](values.yaml) - -## Persistence - -The [MySQL](https://hub.docker.com/_/mysql/) image stores the MySQL data and configurations at the `/var/lib/mysql` path of the container. - -By default a PersistentVolumeClaim is created and mounted into that directory. In order to disable this functionality -you can change the values.yaml to disable persistence and use an emptyDir instead. - -> *"An emptyDir volume is first created when a Pod is assigned to a Node, and exists as long as that Pod is running on that node. When a Pod is removed from a node for any reason, the data in the emptyDir is deleted forever."* - -**Notice**: You may need to increase the value of `livenessProbe.initialDelaySeconds` when enabling persistence by using PersistentVolumeClaim from PersistentVolume with varying properties. Since its IO performance has impact on the database initialization performance. The default limit for database initialization is `60` seconds (`livenessProbe.initialDelaySeconds` + `livenessProbe.periodSeconds` * `livenessProbe.failureThreshold`). Once such initialization process takes more time than this limit, kubelet will restart the database container, which will interrupt database initialization then causing persisent data in an unusable state. - -## Custom MySQL configuration files - -The [MySQL](https://hub.docker.com/_/mysql/) image accepts custom configuration files at the path `/etc/mysql/conf.d`. If you want to use a customized MySQL configuration, you can create your alternative configuration files by passing the file contents on the `configurationFiles` attribute. Note that according to the MySQL documentation only files ending with `.cnf` are loaded. - -```yaml -configurationFiles: - mysql.cnf: |- - [mysqld] - skip-host-cache - skip-name-resolve - sql-mode=STRICT_TRANS_TABLES,NO_ZERO_IN_DATE,NO_ZERO_DATE,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION - mysql_custom.cnf: |- - [mysqld] -``` - -## MySQL initialization files - -The [MySQL](https://hub.docker.com/_/mysql/) image accepts *.sh, *.sql and *.sql.gz files at the path `/docker-entrypoint-initdb.d`. -These files are being run exactly once for container initialization and ignored on following container restarts. -If you want to use initialization scripts, you can create initialization files by passing the file contents on the `initializationFiles` attribute. - - -```yaml -initializationFiles: - first-db.sql: |- - CREATE DATABASE IF NOT EXISTS first DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; - second-db.sql: |- - CREATE DATABASE IF NOT EXISTS second DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -``` - -## SSL - -This chart supports configuring MySQL to use [encrypted connections](https://dev.mysql.com/doc/refman/5.7/en/encrypted-connections.html) with TLS/SSL certificates provided by the user. This is accomplished by storing the required Certificate Authority file, the server public key certificate, and the server private key as a Kubernetes secret. The SSL options for this chart support the following use cases: - -* Manage certificate secrets with helm -* Manage certificate secrets outside of helm - -## Manage certificate secrets with helm - -Include your certificate data in the `ssl.certificates` section. For example: - -``` -ssl: - enabled: false - secret: mysql-ssl-certs - certificates: - - name: mysql-ssl-certs - ca: |- - -----BEGIN CERTIFICATE----- - ... - -----END CERTIFICATE----- - cert: |- - -----BEGIN CERTIFICATE----- - ... - -----END CERTIFICATE----- - key: |- - -----BEGIN RSA PRIVATE KEY----- - ... - -----END RSA PRIVATE KEY----- -``` - -> **Note**: Make sure your certificate data has the correct formatting in the values file. - -## Manage certificate secrets outside of helm - -1. Ensure the certificate secret exist before installation of this chart. -2. Set the name of the certificate secret in `ssl.secret`. -3. Make sure there are no entries underneath `ssl.certificates`. - -To manually create the certificate secret from local files you can execute: -``` -kubectl create secret generic mysql-ssl-certs \ - --from-file=ca.pem=./ssl/certificate-authority.pem \ - --from-file=server-cert.pem=./ssl/server-public-key.pem \ - --from-file=server-key.pem=./ssl/server-private-key.pem -``` -> **Note**: `ca.pem`, `server-cert.pem`, and `server-key.pem` **must** be used as the key names in this generic secret. - -If you are using a certificate your configurationFiles must include the three ssl lines under [mysqld] - -``` -[mysqld] - ssl-ca=/ssl/ca.pem - ssl-cert=/ssl/server-cert.pem - ssl-key=/ssl/server-key.pem -``` diff --git a/cmd/helm/testdata/testcharts/mysql/templates/NOTES.txt b/cmd/helm/testdata/testcharts/mysql/templates/NOTES.txt deleted file mode 100644 index d33753aa9..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/NOTES.txt +++ /dev/null @@ -1,43 +0,0 @@ -MySQL can be accessed via port 3306 on the following DNS name from within your cluster: -{{ template "mysql.fullname" . }}.{{ .Release.Namespace }}.svc.cluster.local - -{{- if .Values.existingSecret }} -If you have not already created the mysql password secret: - - kubectl create secret generic {{ .Values.existingSecret }} --namespace {{ .Release.Namespace }} --from-file=./mysql-root-password --from-file=./mysql-password -{{ else }} - -To get your root password run: - - MYSQL_ROOT_PASSWORD=$(kubectl get secret --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath="{.data.mysql-root-password}" | base64 --decode; echo) -{{- end }} - -To connect to your database: - -1. Run an Ubuntu pod that you can use as a client: - - kubectl run -i --tty ubuntu --image=ubuntu:16.04 --restart=Never -- bash -il - -2. Install the mysql client: - - $ apt-get update && apt-get install mysql-client -y - -3. Connect using the mysql cli, then provide your password: - $ mysql -h {{ template "mysql.fullname" . }} -p - -To connect to your database directly from outside the K8s cluster: - {{- if contains "NodePort" .Values.service.type }} - MYSQL_HOST=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath='{.items[0].status.addresses[0].address}') - MYSQL_PORT=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "mysql.fullname" . }} -o jsonpath='{.spec.ports[0].nodePort}') - - {{- else if contains "ClusterIP" .Values.service.type }} - MYSQL_HOST=127.0.0.1 - MYSQL_PORT={{ .Values.service.port }} - - # Execute the following command to route the connection: - kubectl port-forward svc/{{ template "mysql.fullname" . }} {{ .Values.service.port }} - - {{- end }} - - mysql -h ${MYSQL_HOST} -P${MYSQL_PORT} -u root -p${MYSQL_ROOT_PASSWORD} - diff --git a/cmd/helm/testdata/testcharts/mysql/templates/_helpers.tpl b/cmd/helm/testdata/testcharts/mysql/templates/_helpers.tpl deleted file mode 100644 index f10842577..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/_helpers.tpl +++ /dev/null @@ -1,43 +0,0 @@ -{{/* vim: set filetype=mustache: */}} -{{/* -Expand the name of the chart. -*/}} -{{- define "mysql.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 "mysql.fullname" -}} -{{- if .Values.fullnameOverride -}} -{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- $name := default .Chart.Name .Values.nameOverride -}} -{{- if contains $name .Release.Name -}} -{{- printf .Release.Name | trunc 63 | trimSuffix "-" -}} -{{- else -}} -{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} -{{- end -}} -{{- end -}} -{{- end -}} - -{{/* -Generate chart secret name -*/}} -{{- define "mysql.secretName" -}} -{{ default (include "mysql.fullname" .) .Values.existingSecret }} -{{- end -}} - -{{/* -Create the name of the service account to use -*/}} -{{- define "mysql.serviceAccountName" -}} -{{- if .Values.serviceAccount.create -}} -{{ default (include "mysql.fullname" .) .Values.serviceAccount.name }} -{{- else -}} -{{ default "default" .Values.serviceAccount.name }} -{{- end -}} -{{- end -}} diff --git a/cmd/helm/testdata/testcharts/mysql/templates/configurationFiles-configmap.yaml b/cmd/helm/testdata/testcharts/mysql/templates/configurationFiles-configmap.yaml deleted file mode 100644 index ebed8cc7b..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/configurationFiles-configmap.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.configurationFiles }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "mysql.fullname" . }}-configuration - namespace: {{ .Release.Namespace }} -data: -{{- range $key, $val := .Values.configurationFiles }} - {{ $key }}: |- -{{ $val | indent 4}} -{{- end }} -{{- end -}} \ No newline at end of file diff --git a/cmd/helm/testdata/testcharts/mysql/templates/deployment.yaml b/cmd/helm/testdata/testcharts/mysql/templates/deployment.yaml deleted file mode 100644 index 48dc369a3..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/deployment.yaml +++ /dev/null @@ -1,248 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{ template "mysql.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" -{{- with .Values.deploymentAnnotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} - -spec: - strategy: -{{ toYaml .Values.strategy | indent 4 }} - selector: - matchLabels: - app: {{ template "mysql.fullname" . }} - release: {{ .Release.Name }} - template: - metadata: - labels: - app: {{ template "mysql.fullname" . }} - release: {{ .Release.Name }} -{{- with .Values.podLabels }} -{{ toYaml . | indent 8 }} -{{- end }} -{{- with .Values.podAnnotations }} - annotations: -{{ toYaml . | indent 8 }} -{{- end }} - spec: - {{- if .Values.schedulerName }} - schedulerName: "{{ .Values.schedulerName }}" - {{- end }} - {{- if .Values.imagePullSecrets }} - imagePullSecrets: -{{ toYaml .Values.imagePullSecrets | indent 8 }} - {{- end }} - {{- if .Values.priorityClassName }} - priorityClassName: "{{ .Values.priorityClassName }}" - {{- end }} - {{- if .Values.securityContext.enabled }} - securityContext: - fsGroup: {{ .Values.securityContext.fsGroup }} - runAsUser: {{ .Values.securityContext.runAsUser }} - {{- end }} - serviceAccountName: {{ template "mysql.serviceAccountName" . }} - initContainers: - - name: "remove-lost-found" - image: "{{ .Values.busybox.image}}:{{ .Values.busybox.tag }}" - imagePullPolicy: {{ .Values.imagePullPolicy | quote }} - resources: -{{ toYaml .Values.initContainer.resources | indent 10 }} - command: ["rm", "-fr", "/var/lib/mysql/lost+found"] - volumeMounts: - - name: data - mountPath: /var/lib/mysql - {{- if .Values.persistence.subPath }} - subPath: {{ .Values.persistence.subPath }} - {{- end }} - {{- if .Values.extraInitContainers }} -{{ tpl .Values.extraInitContainers . | indent 6 }} - {{- end }} - {{- if .Values.nodeSelector }} - nodeSelector: -{{ toYaml .Values.nodeSelector | indent 8 }} - {{- end }} - {{- if .Values.tolerations }} - tolerations: -{{ toYaml .Values.tolerations | indent 8 }} - {{- end }} - containers: - - name: {{ template "mysql.fullname" . }} - image: "{{ .Values.image }}:{{ .Values.imageTag }}" - imagePullPolicy: {{ .Values.imagePullPolicy | quote }} - - {{- with .Values.args }} - args: - {{- range . }} - - {{ . | quote }} - {{- end }} - {{- end }} - resources: -{{ toYaml .Values.resources | indent 10 }} - env: - {{- if .Values.mysqlAllowEmptyPassword }} - - name: MYSQL_ALLOW_EMPTY_PASSWORD - value: "true" - {{- end }} - {{- if not (and .Values.allowEmptyRootPassword (not .Values.mysqlRootPassword)) }} - - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "mysql.secretName" . }} - key: mysql-root-password - {{- if .Values.mysqlAllowEmptyPassword }} - optional: true - {{- end }} - {{- end }} - {{- if not (and .Values.allowEmptyRootPassword (not .Values.mysqPassword)) }} - - name: MYSQL_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "mysql.secretName" . }} - key: mysql-password - {{- if or .Values.mysqlAllowEmptyPassword (empty .Values.mysqlUser) }} - optional: true - {{- end }} - {{- end }} - - name: MYSQL_USER - value: {{ default "" .Values.mysqlUser | quote }} - - name: MYSQL_DATABASE - value: {{ default "" .Values.mysqlDatabase | quote }} - {{- if .Values.timezone }} - - name: TZ - value: {{ .Values.timezone }} - {{- end }} - ports: - - name: mysql - containerPort: 3306 - livenessProbe: - exec: - command: - {{- if .Values.mysqlAllowEmptyPassword }} - - mysqladmin - - ping - {{- else }} - - sh - - -c - - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}" - {{- end }} - initialDelaySeconds: {{ .Values.livenessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.livenessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.livenessProbe.timeoutSeconds }} - successThreshold: {{ .Values.livenessProbe.successThreshold }} - failureThreshold: {{ .Values.livenessProbe.failureThreshold }} - readinessProbe: - exec: - command: - {{- if .Values.mysqlAllowEmptyPassword }} - - mysqladmin - - ping - {{- else }} - - sh - - -c - - "mysqladmin ping -u root -p${MYSQL_ROOT_PASSWORD}" - {{- end }} - initialDelaySeconds: {{ .Values.readinessProbe.initialDelaySeconds }} - periodSeconds: {{ .Values.readinessProbe.periodSeconds }} - timeoutSeconds: {{ .Values.readinessProbe.timeoutSeconds }} - successThreshold: {{ .Values.readinessProbe.successThreshold }} - failureThreshold: {{ .Values.readinessProbe.failureThreshold }} - volumeMounts: - - name: data - mountPath: /var/lib/mysql - {{- if .Values.persistence.subPath }} - subPath: {{ .Values.persistence.subPath }} - {{- end }} - {{- if .Values.configurationFiles }} - {{- range $key, $val := .Values.configurationFiles }} - - name: configurations - mountPath: {{ $.Values.configurationFilesPath }}{{ $key }} - subPath: {{ $key }} - {{- end -}} - {{- end }} - {{- if .Values.initializationFiles }} - - name: migrations - mountPath: /docker-entrypoint-initdb.d - {{- end }} - {{- if .Values.ssl.enabled }} - - name: certificates - mountPath: /ssl - {{- end }} - {{- if .Values.extraVolumeMounts }} -{{ tpl .Values.extraVolumeMounts . | indent 8 }} - {{- end }} - {{- if .Values.metrics.enabled }} - - name: metrics - image: "{{ .Values.metrics.image }}:{{ .Values.metrics.imageTag }}" - imagePullPolicy: {{ .Values.metrics.imagePullPolicy | quote }} - {{- if .Values.mysqlAllowEmptyPassword }} - command: - - 'sh' - - '-c' - - 'DATA_SOURCE_NAME="root@(localhost:3306)/" /bin/mysqld_exporter' - {{- else }} - env: - - name: MYSQL_ROOT_PASSWORD - valueFrom: - secretKeyRef: - name: {{ template "mysql.secretName" . }} - key: mysql-root-password - command: - - 'sh' - - '-c' - - 'DATA_SOURCE_NAME="root:$MYSQL_ROOT_PASSWORD@(localhost:3306)/" /bin/mysqld_exporter' - {{- end }} - {{- range $f := .Values.metrics.flags }} - - {{ $f | quote }} - {{- end }} - ports: - - name: metrics - containerPort: 9104 - livenessProbe: - httpGet: - path: / - port: metrics - initialDelaySeconds: {{ .Values.metrics.livenessProbe.initialDelaySeconds }} - timeoutSeconds: {{ .Values.metrics.livenessProbe.timeoutSeconds }} - readinessProbe: - httpGet: - path: / - port: metrics - initialDelaySeconds: {{ .Values.metrics.readinessProbe.initialDelaySeconds }} - timeoutSeconds: {{ .Values.metrics.readinessProbe.timeoutSeconds }} - resources: -{{ toYaml .Values.metrics.resources | indent 10 }} - {{- end }} - volumes: - {{- if .Values.configurationFiles }} - - name: configurations - configMap: - name: {{ template "mysql.fullname" . }}-configuration - {{- end }} - {{- if .Values.initializationFiles }} - - name: migrations - configMap: - name: {{ template "mysql.fullname" . }}-initialization - {{- end }} - {{- if .Values.ssl.enabled }} - - name: certificates - secret: - secretName: {{ .Values.ssl.secret }} - {{- end }} - - name: data - {{- if .Values.persistence.enabled }} - persistentVolumeClaim: - claimName: {{ .Values.persistence.existingClaim | default (include "mysql.fullname" .) }} - {{- else }} - emptyDir: {} - {{- end -}} - {{- if .Values.extraVolumes }} -{{ tpl .Values.extraVolumes . | indent 6 }} - {{- end }} diff --git a/cmd/helm/testdata/testcharts/mysql/templates/initializationFiles-configmap.yaml b/cmd/helm/testdata/testcharts/mysql/templates/initializationFiles-configmap.yaml deleted file mode 100644 index 38c3795c7..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/initializationFiles-configmap.yaml +++ /dev/null @@ -1,12 +0,0 @@ -{{- if .Values.initializationFiles }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "mysql.fullname" . }}-initialization - namespace: {{ .Release.Namespace }} -data: -{{- range $key, $val := .Values.initializationFiles }} - {{ $key }}: |- -{{ $val | indent 4}} -{{- end }} -{{- end -}} \ No newline at end of file diff --git a/cmd/helm/testdata/testcharts/mysql/templates/pvc.yaml b/cmd/helm/testdata/testcharts/mysql/templates/pvc.yaml deleted file mode 100644 index 39e9bf8e2..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/pvc.yaml +++ /dev/null @@ -1,29 +0,0 @@ -{{- if and .Values.persistence.enabled (not .Values.persistence.existingClaim) }} -kind: PersistentVolumeClaim -apiVersion: v1 -metadata: - name: {{ template "mysql.fullname" . }} - namespace: {{ .Release.Namespace }} -{{- with .Values.persistence.annotations }} - annotations: -{{ toYaml . | indent 4 }} -{{- end }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" -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/cmd/helm/testdata/testcharts/mysql/templates/secrets.yaml b/cmd/helm/testdata/testcharts/mysql/templates/secrets.yaml deleted file mode 100644 index d9dfd126d..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/secrets.yaml +++ /dev/null @@ -1,51 +0,0 @@ -{{- if not .Values.existingSecret }} -{{- if or (not .Values.allowEmptyRootPassword) (or .Values.mysqlRootPassword .Values.mysqlPassword) }} -apiVersion: v1 -kind: Secret -metadata: - name: {{ template "mysql.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" -type: Opaque -data: - {{ if .Values.mysqlRootPassword }} - mysql-root-password: {{ .Values.mysqlRootPassword | b64enc | quote }} - {{ else }} - {{ if not .Values.allowEmptyRootPassword }} - mysql-root-password: {{ randAlphaNum 10 | b64enc | quote }} - {{ end }} - {{ end }} - {{ if .Values.mysqlPassword }} - mysql-password: {{ .Values.mysqlPassword | b64enc | quote }} - {{ else }} - {{ if not .Values.allowEmptyRootPassword }} - mysql-password: {{ randAlphaNum 10 | b64enc | quote }} - {{ end }} - {{ end }} -{{ end }} -{{- if .Values.ssl.enabled }} -{{ if .Values.ssl.certificates }} -{{- range .Values.ssl.certificates }} ---- -apiVersion: v1 -kind: Secret -metadata: - name: {{ .name }} - labels: - app: {{ template "mysql.fullname" $ }} - chart: "{{ $.Chart.Name }}-{{ $.Chart.Version }}" - release: "{{ $.Release.Name }}" - heritage: "{{ $.Release.Service }}" -type: Opaque -data: - ca.pem: {{ .ca | b64enc }} - server-cert.pem: {{ .cert | b64enc }} - server-key.pem: {{ .key | b64enc }} -{{- end }} -{{- end }} -{{- end }} -{{- end }} diff --git a/cmd/helm/testdata/testcharts/mysql/templates/serviceaccount.yaml b/cmd/helm/testdata/testcharts/mysql/templates/serviceaccount.yaml deleted file mode 100644 index 36ce6b3b7..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/serviceaccount.yaml +++ /dev/null @@ -1,11 +0,0 @@ -{{- if .Values.serviceAccount.create }} -apiVersion: v1 -kind: ServiceAccount -metadata: - name: {{ template "mysql.serviceAccountName" . }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" -{{- end }} diff --git a/cmd/helm/testdata/testcharts/mysql/templates/servicemonitor.yaml b/cmd/helm/testdata/testcharts/mysql/templates/servicemonitor.yaml deleted file mode 100644 index bd830be65..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/servicemonitor.yaml +++ /dev/null @@ -1,26 +0,0 @@ -{{- if and .Values.metrics.enabled .Values.metrics.serviceMonitor.enabled }} -apiVersion: monitoring.coreos.com/v1 -kind: ServiceMonitor -metadata: - name: {{ include "mysql.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" - {{- if .Values.metrics.serviceMonitor.additionalLabels }} -{{ toYaml .Values.metrics.serviceMonitor.additionalLabels | indent 4 }} - {{- end }} -spec: - endpoints: - - port: metrics - interval: 30s - namespaceSelector: - matchNames: - - {{ .Release.Namespace }} - selector: - matchLabels: - app: {{ include "mysql.fullname" . }} - release: {{ .Release.Name }} -{{- end }} diff --git a/cmd/helm/testdata/testcharts/mysql/templates/svc.yaml b/cmd/helm/testdata/testcharts/mysql/templates/svc.yaml deleted file mode 100644 index b9687f2a9..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/svc.yaml +++ /dev/null @@ -1,36 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{ template "mysql.fullname" . }} - namespace: {{ .Release.Namespace }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - release: "{{ .Release.Name }}" - heritage: "{{ .Release.Service }}" - annotations: -{{- if .Values.service.annotations }} -{{ toYaml .Values.service.annotations | indent 4 }} -{{- end }} -{{- if and (.Values.metrics.enabled) (.Values.metrics.annotations) }} -{{ toYaml .Values.metrics.annotations | indent 4 }} -{{- end }} -spec: - type: {{ .Values.service.type }} - {{- if (and (eq .Values.service.type "LoadBalancer") (not (empty .Values.service.loadBalancerIP))) }} - loadBalancerIP: {{ .Values.service.loadBalancerIP }} - {{- end }} - ports: - - name: mysql - port: {{ .Values.service.port }} - targetPort: mysql - {{- if .Values.service.nodePort }} - nodePort: {{ .Values.service.nodePort }} - {{- end }} - {{- if .Values.metrics.enabled }} - - name: metrics - port: 9104 - targetPort: metrics - {{- end }} - selector: - app: {{ template "mysql.fullname" . }} diff --git a/cmd/helm/testdata/testcharts/mysql/templates/tests/test-configmap.yaml b/cmd/helm/testdata/testcharts/mysql/templates/tests/test-configmap.yaml deleted file mode 100644 index ece5a4705..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/tests/test-configmap.yaml +++ /dev/null @@ -1,23 +0,0 @@ -{{- if .Values.testFramework.enabled }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: {{ template "mysql.fullname" . }}-test - namespace: {{ .Release.Namespace }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - heritage: "{{ .Release.Service }}" - release: "{{ .Release.Name }}" -data: - run.sh: |- - {{- if .Values.ssl.enabled | and .Values.mysqlRootPassword }} - @test "Testing SSL MySQL Connection" { - mysql --host={{ template "mysql.fullname" . }} --port={{ .Values.service.port | default "3306" }} --ssl-cert=/ssl/server-cert.pem --ssl-key=ssl/server-key.pem -u root -p{{ .Values.mysqlRootPassword }} - } - {{- else if .Values.mysqlRootPassword }} - @test "Testing MySQL Connection" { - mysql --host={{ template "mysql.fullname" . }} --port={{ .Values.service.port | default "3306" }} -u root -p{{ .Values.mysqlRootPassword }} - } - {{- end }} -{{- end }} diff --git a/cmd/helm/testdata/testcharts/mysql/templates/tests/test.yaml b/cmd/helm/testdata/testcharts/mysql/templates/tests/test.yaml deleted file mode 100644 index 30392a940..000000000 --- a/cmd/helm/testdata/testcharts/mysql/templates/tests/test.yaml +++ /dev/null @@ -1,54 +0,0 @@ -{{- if .Values.testFramework.enabled }} -apiVersion: v1 -kind: Pod -metadata: - name: {{ template "mysql.fullname" . }}-test - namespace: {{ .Release.Namespace }} - labels: - app: {{ template "mysql.fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - heritage: "{{ .Release.Service }}" - release: "{{ .Release.Name }}" - annotations: - "helm.sh/hook": test-success -spec: - initContainers: - - name: test-framework - image: "{{ .Values.testFramework.image}}:{{ .Values.testFramework.tag }}" - command: - - "bash" - - "-c" - - | - set -ex - # copy bats to tools dir - cp -R /usr/local/libexec/ /tools/bats/ - volumeMounts: - - mountPath: /tools - name: tools - containers: - - name: {{ .Release.Name }}-test - image: "{{ .Values.image }}:{{ .Values.imageTag }}" - command: ["/tools/bats/bats", "-t", "/tests/run.sh"] - volumeMounts: - - mountPath: /tests - name: tests - readOnly: true - - mountPath: /tools - name: tools - {{- if .Values.ssl.enabled }} - - name: certificates - mountPath: /ssl - {{- end }} - volumes: - - name: tests - configMap: - name: {{ template "mysql.fullname" . }}-test - - name: tools - emptyDir: {} - {{- if .Values.ssl.enabled }} - - name: certificates - secret: - secretName: {{ .Values.ssl.secret }} - {{- end }} - restartPolicy: Never -{{- end }} diff --git a/cmd/helm/testdata/testcharts/mysql/values.yaml b/cmd/helm/testdata/testcharts/mysql/values.yaml deleted file mode 100644 index 7fe76a2d1..000000000 --- a/cmd/helm/testdata/testcharts/mysql/values.yaml +++ /dev/null @@ -1,227 +0,0 @@ -## mysql image version -## ref: https://hub.docker.com/r/library/mysql/tags/ -## -image: "mysql" -imageTag: "5.7.28" - -strategy: - type: Recreate - -busybox: - image: "busybox" - tag: "1.29.3" - -testFramework: - enabled: true - image: "dduportal/bats" - tag: "0.4.0" - -## Specify password for root user -## -## Default: random 10 character string -# mysqlRootPassword: testing - -## Create a database user -## -# mysqlUser: -## Default: random 10 character string -# mysqlPassword: - -## Allow unauthenticated access, uncomment to enable -## -# mysqlAllowEmptyPassword: true - -## Create a database -## -# mysqlDatabase: - -## Specify an imagePullPolicy (Required) -## It's recommended to change this to 'Always' if the image tag is 'latest' -## ref: http://kubernetes.io/docs/user-guide/images/#updating-images -## -imagePullPolicy: IfNotPresent - -## Additionnal arguments that are passed to the MySQL container. -## For example use --default-authentication-plugin=mysql_native_password if older clients need to -## connect to a MySQL 8 instance. -args: [] - -extraVolumes: | - # - name: extras - # emptyDir: {} - -extraVolumeMounts: | - # - name: extras - # mountPath: /usr/share/extras - # readOnly: true - -extraInitContainers: | - # - name: do-something - # image: busybox - # command: ['do', 'something'] - -# Optionally specify an array of imagePullSecrets. -# Secrets must be manually created in the namespace. -# ref: https://kubernetes.io/docs/concepts/containers/images/#specifying-imagepullsecrets-on-a-pod -# imagePullSecrets: - # - name: myRegistryKeySecretName - -## Node selector -## ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#nodeselector -nodeSelector: {} - -## Tolerations for pod assignment -## Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ -## -tolerations: [] - -livenessProbe: - initialDelaySeconds: 30 - periodSeconds: 10 - timeoutSeconds: 5 - successThreshold: 1 - failureThreshold: 3 - -readinessProbe: - initialDelaySeconds: 5 - periodSeconds: 10 - timeoutSeconds: 1 - successThreshold: 1 - failureThreshold: 3 - -## Persist data to a persistent volume -persistence: - enabled: true - ## database 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 - annotations: {} - -## Use an alternate scheduler, e.g. "stork". -## ref: https://kubernetes.io/docs/tasks/administer-cluster/configure-multiple-schedulers/ -## -# schedulerName: - -## Security context -securityContext: - enabled: false - runAsUser: 999 - fsGroup: 999 - -## Configure resource requests and limits -## ref: http://kubernetes.io/docs/user-guide/compute-resources/ -## -resources: - requests: - memory: 256Mi - cpu: 100m - -# Custom mysql configuration files path -configurationFilesPath: /etc/mysql/conf.d/ - -# Custom mysql configuration files used to override default mysql settings -configurationFiles: {} -# mysql.cnf: |- -# [mysqld] -# skip-name-resolve -# ssl-ca=/ssl/ca.pem -# ssl-cert=/ssl/server-cert.pem -# ssl-key=/ssl/server-key.pem - -# Custom mysql init SQL files used to initialize the database -initializationFiles: {} -# first-db.sql: |- -# CREATE DATABASE IF NOT EXISTS first DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; -# second-db.sql: |- -# CREATE DATABASE IF NOT EXISTS second DEFAULT CHARACTER SET utf8 DEFAULT COLLATE utf8_general_ci; - -metrics: - enabled: false - image: prom/mysqld-exporter - imageTag: v0.10.0 - imagePullPolicy: IfNotPresent - resources: {} - annotations: {} - # prometheus.io/scrape: "true" - # prometheus.io/port: "9104" - livenessProbe: - initialDelaySeconds: 15 - timeoutSeconds: 5 - readinessProbe: - initialDelaySeconds: 5 - timeoutSeconds: 1 - flags: [] - serviceMonitor: - enabled: false - additionalLabels: {} - -## Configure the service -## ref: http://kubernetes.io/docs/user-guide/services/ -service: - annotations: {} - ## Specify a service type - ## ref: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services---service-types - type: ClusterIP - port: 3306 - # nodePort: 32000 - # loadBalancerIP: - -## Pods Service Account -## ref: https://kubernetes.io/docs/tasks/configure-pod-container/configure-service-account/ -serviceAccount: - ## Specifies whether a ServiceAccount should be created - ## - create: false - ## The name of the ServiceAccount to use. - ## If not set and create is true, a name is generated using the mariadb.fullname template - # name: - -ssl: - enabled: false - secret: mysql-ssl-certs - certificates: -# - name: mysql-ssl-certs -# ca: |- -# -----BEGIN CERTIFICATE----- -# ... -# -----END CERTIFICATE----- -# cert: |- -# -----BEGIN CERTIFICATE----- -# ... -# -----END CERTIFICATE----- -# key: |- -# -----BEGIN RSA PRIVATE KEY----- -# ... -# -----END RSA PRIVATE KEY----- - -## Populates the 'TZ' system timezone environment variable -## ref: https://dev.mysql.com/doc/refman/5.7/en/time-zone-support.html -## -## Default: nil (mysql will use image's default timezone, normally UTC) -## Example: 'Australia/Sydney' -# timezone: - -# Deployment Annotations -deploymentAnnotations: {} - -# To be added to the database server pod(s) -podAnnotations: {} -podLabels: {} - -## Set pod priorityClassName -# priorityClassName: {} - - -## Init container resources defaults -initContainer: - resources: - requests: - memory: 10Mi - cpu: 10m diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index 083c44a21..b8b67790c 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -93,10 +93,10 @@ func (m *Manager) Build() error { if c.Metadata.APIVersion == chart.APIVersionV1 { log.Println("warning: a valid Helm v3 hash was not found. Checking against Helm v2 hash...") if sum, err := resolver.HashV2Req(req); err != nil || sum != lock.Digest { - return errors.New("Chart.lock is out of sync with Chart.yaml") + return errors.New("the lock file is out of sync with the dependencies file. Please update the dependencies") } } else { - return errors.New("Chart.lock is out of sync with Chart.yaml") + return errors.New("the lock file is out of sync with the dependencies file. Please update the dependencies") } }