From aa859e3f88291c94220d26e9d1127c1557c2af98 Mon Sep 17 00:00:00 2001 From: Adam Reese Date: Fri, 18 May 2018 12:09:54 -0700 Subject: [PATCH] feat(*): remove Time, Namespace, and Revision from template functions Removes Time, Namespace, and Revision from being exposed to templates to make template rendering discrete and repeatable. --- cmd/helm/template.go | 4 +- .../testdata/output/template-absolute.txt | 1 - .../testdata/output/template-kube-version.txt | 1 - .../output/template-name-template.txt | 1 - cmd/helm/testdata/output/template-name.txt | 1 - cmd/helm/testdata/output/template-notes.txt | 1 - cmd/helm/testdata/output/template-set.txt | 1 - .../testdata/output/template-values-files.txt | 1 - cmd/helm/testdata/output/template.txt | 1 - .../alpine/templates/alpine-pod.yaml | 2 - .../novals/templates/alpine-pod.yaml | 2 - .../signtest/alpine/templates/alpine-pod.yaml | 2 - docs/chart_template_guide/builtin_objects.md | 3 - docs/chart_template_guide/named_templates.md | 2 +- docs/charts.md | 57 +++++++++---------- pkg/chartutil/create.go | 8 +-- .../charts/alpine/templates/alpine-pod.yaml | 2 - .../charts/alpine/templates/alpine-pod.yaml | 2 - .../charts/alpine/templates/alpine-pod.yaml | 2 - .../charts/alpine/templates/alpine-pod.yaml | 2 - .../charts/alpine/templates/alpine-pod.yaml | 2 - .../charts/alpine/templates/alpine-pod.yaml | 2 - .../charts/alpine/templates/alpine-pod.yaml | 2 - .../charts/subchart1/templates/service.yaml | 1 - pkg/chartutil/values.go | 7 --- pkg/chartutil/values_test.go | 7 --- .../signtest/alpine/templates/alpine-pod.yaml | 2 - pkg/lint/rules/template.go | 3 +- pkg/tiller/release_install.go | 3 - pkg/tiller/release_update.go | 3 - 30 files changed, 33 insertions(+), 95 deletions(-) diff --git a/cmd/helm/template.go b/cmd/helm/template.go index 97a490045..a69cd6c6f 100644 --- a/cmd/helm/template.go +++ b/cmd/helm/template.go @@ -165,9 +165,7 @@ func (o *templateOptions) run(out io.Writer) error { return errors.Wrap(err, "cannot load requirements") } options := chartutil.ReleaseOptions{ - Name: o.releaseName, - Time: time.Now(), - Namespace: getNamespace(), + Name: o.releaseName, } if err := chartutil.ProcessRequirementsEnabled(c, config); err != nil { diff --git a/cmd/helm/testdata/output/template-absolute.txt b/cmd/helm/testdata/output/template-absolute.txt index 3360f08bd..eede3b0b2 100644 --- a/cmd/helm/testdata/output/template-absolute.txt +++ b/cmd/helm/testdata/output/template-absolute.txt @@ -6,7 +6,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "RELEASE-NAME" kube-version/major: "1" kube-version/minor: "9" diff --git a/cmd/helm/testdata/output/template-kube-version.txt b/cmd/helm/testdata/output/template-kube-version.txt index 5b26fe084..21c9b7aa7 100644 --- a/cmd/helm/testdata/output/template-kube-version.txt +++ b/cmd/helm/testdata/output/template-kube-version.txt @@ -42,7 +42,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "RELEASE-NAME" kube-version/major: "1" kube-version/minor: "6" diff --git a/cmd/helm/testdata/output/template-name-template.txt b/cmd/helm/testdata/output/template-name-template.txt index 2ec6cbe33..27e9afa72 100644 --- a/cmd/helm/testdata/output/template-name-template.txt +++ b/cmd/helm/testdata/output/template-name-template.txt @@ -42,7 +42,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "foobar-YWJj-baz" kube-version/major: "1" kube-version/minor: "9" diff --git a/cmd/helm/testdata/output/template-name.txt b/cmd/helm/testdata/output/template-name.txt index 78cd777bc..a7fc5c286 100644 --- a/cmd/helm/testdata/output/template-name.txt +++ b/cmd/helm/testdata/output/template-name.txt @@ -42,7 +42,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "test" kube-version/major: "1" kube-version/minor: "9" diff --git a/cmd/helm/testdata/output/template-notes.txt b/cmd/helm/testdata/output/template-notes.txt index 8a20426ff..812e36802 100644 --- a/cmd/helm/testdata/output/template-notes.txt +++ b/cmd/helm/testdata/output/template-notes.txt @@ -42,7 +42,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "RELEASE-NAME" kube-version/major: "1" kube-version/minor: "9" diff --git a/cmd/helm/testdata/output/template-set.txt b/cmd/helm/testdata/output/template-set.txt index 3360f08bd..eede3b0b2 100644 --- a/cmd/helm/testdata/output/template-set.txt +++ b/cmd/helm/testdata/output/template-set.txt @@ -6,7 +6,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "RELEASE-NAME" kube-version/major: "1" kube-version/minor: "9" diff --git a/cmd/helm/testdata/output/template-values-files.txt b/cmd/helm/testdata/output/template-values-files.txt index 83acc98f4..bcb93148a 100644 --- a/cmd/helm/testdata/output/template-values-files.txt +++ b/cmd/helm/testdata/output/template-values-files.txt @@ -42,7 +42,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "RELEASE-NAME" kube-version/major: "1" kube-version/minor: "9" diff --git a/cmd/helm/testdata/output/template.txt b/cmd/helm/testdata/output/template.txt index 829abac03..c9fb07138 100644 --- a/cmd/helm/testdata/output/template.txt +++ b/cmd/helm/testdata/output/template.txt @@ -42,7 +42,6 @@ metadata: name: subchart1 labels: chart: "subchart1-0.1.0" - namespace: "default" release-name: "RELEASE-NAME" kube-version/major: "1" kube-version/minor: "9" diff --git a/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml index 424920782..ee61f2056 100644 --- a/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/alpine/templates/alpine-pod.yaml @@ -13,8 +13,6 @@ metadata: # This makes it easy to audit chart usage. chart: "{{.Chart.Name}}-{{.Chart.Version}}" values: {{.Values.test.Name}} - annotations: - "helm.sh/created": {{.Release.Time.Seconds | quote }} spec: # This shows how to use a simple value. This will look for a passed-in value # called restartPolicy. If it is not found, it will use the default value. diff --git a/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml index c15ab8efc..3c77e97b5 100644 --- a/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/novals/templates/alpine-pod.yaml @@ -12,8 +12,6 @@ metadata: release: {{.Release.Name | quote }} # This makes it easy to audit chart usage. chart: "{{.Chart.Name}}-{{.Chart.Version}}" - annotations: - "helm.sh/created": {{.Release.Time.Seconds | quote }} spec: # This shows how to use a simple value. This will look for a passed-in value # called restartPolicy. If it is not found, it will use the default value. diff --git a/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml b/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml +++ b/cmd/helm/testdata/testcharts/signtest/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/docs/chart_template_guide/builtin_objects.md b/docs/chart_template_guide/builtin_objects.md index 319f59a71..de2145d05 100644 --- a/docs/chart_template_guide/builtin_objects.md +++ b/docs/chart_template_guide/builtin_objects.md @@ -8,10 +8,7 @@ In the previous section, we use `{{.Release.Name}}` to insert the name of a rele - `Release`: This object describes the release itself. It has several objects inside of it: - `Release.Name`: The release name - - `Release.Time`: The time of the release - - `Release.Namespace`: The namespace to be released into (if the manifest doesn't override) - `Release.Service`: The name of the releasing service (always `Tiller`). - - `Release.Revision`: The revision number of this release. It begins at 1 and is incremented for each `helm upgrade`. - `Release.IsUpgrade`: This is set to `true` if the current operation is an upgrade or rollback. - `Release.IsInstall`: This is set to `true` if the current operation is an install. - `Values`: Values passed into the template from the `values.yaml` file and from user-supplied files. By default, `Values` is empty. diff --git a/docs/chart_template_guide/named_templates.md b/docs/chart_template_guide/named_templates.md index 33425d102..d214f867c 100644 --- a/docs/chart_template_guide/named_templates.md +++ b/docs/chart_template_guide/named_templates.md @@ -179,7 +179,7 @@ Say we've defined a simple template that looks like this: ```yaml {{- define "mychart.app" -}} app_name: {{ .Chart.Name }} -app_version: "{{ .Chart.Version }}+{{ .Release.Time.Seconds }}" +app_version: "{{ .Chart.Version }}" {{- end -}} ``` diff --git a/docs/charts.md b/docs/charts.md index 88ac46477..f41377048 100644 --- a/docs/charts.md +++ b/docs/charts.md @@ -141,9 +141,9 @@ for greater detail. ## Chart Dependencies -In Helm, one chart may depend on any number of other charts. +In Helm, one chart may depend on any number of other charts. These dependencies can be dynamically linked through the `requirements.yaml` -file or brought in to the `charts/` directory and managed manually. +file or brought in to the `charts/` directory and managed manually. Although manually managing your dependencies has a few advantages some teams need, the preferred method of declaring dependencies is by using a @@ -290,11 +290,11 @@ tags: In the above example all charts with the tag `front-end` would be disabled but since the `subchart1.enabled` path evaluates to 'true' in the parent's values, the condition will override the -`front-end` tag and `subchart1` will be enabled. +`front-end` tag and `subchart1` will be enabled. Since `subchart2` is tagged with `back-end` and that tag evaluates to `true`, `subchart2` will be enabled. Also notes that although `subchart2` has a condition specified in `requirements.yaml`, there -is no corresponding path and value in the parent's values so that condition has no effect. +is no corresponding path and value in the parent's values so that condition has no effect. ##### Using the CLI with Tags and Conditions @@ -317,19 +317,19 @@ helm install --set tags.front-end=true --set subchart2.enabled=false #### Importing Child Values via requirements.yaml -In some cases it is desirable to allow a child chart's values to propagate to the parent chart and be -shared as common defaults. An additional benefit of using the `exports` format is that it will enable future +In some cases it is desirable to allow a child chart's values to propagate to the parent chart and be +shared as common defaults. An additional benefit of using the `exports` format is that it will enable future tooling to introspect user-settable values. -The keys containing the values to be imported can be specified in the parent chart's `requirements.yaml` file -using a YAML list. Each item in the list is a key which is imported from the child chart's `exports` field. +The keys containing the values to be imported can be specified in the parent chart's `requirements.yaml` file +using a YAML list. Each item in the list is a key which is imported from the child chart's `exports` field. To import values not contained in the `exports` key, use the [child-parent](#using-the-child-parent-format) format. Examples of both formats are described below. ##### Using the exports format -If a child chart's `values.yaml` file contains an `exports` field at the root, its contents may be imported +If a child chart's `values.yaml` file contains an `exports` field at the root, its contents may be imported directly into the parent's values by specifying the keys to import as in the example below: ```yaml @@ -346,8 +346,8 @@ exports: myint: 99 ``` -Since we are specifying the key `data` in our import list, Helm looks in the `exports` field of the child -chart for `data` key and imports its contents. +Since we are specifying the key `data` in our import list, Helm looks in the `exports` field of the child +chart for `data` key and imports its contents. The final parent values would contain our exported field: @@ -358,16 +358,16 @@ myint: 99 ``` -Please note the parent key `data` is not contained in the parent's final values. If you need to specify the -parent key, use the 'child-parent' format. +Please note the parent key `data` is not contained in the parent's final values. If you need to specify the +parent key, use the 'child-parent' format. ##### Using the child-parent format -To access values that are not contained in the `exports` key of the child chart's values, you will need to -specify the source key of the values to be imported (`child`) and the destination path in the parent chart's +To access values that are not contained in the `exports` key of the child chart's values, you will need to +specify the source key of the values to be imported (`child`) and the destination path in the parent chart's values (`parent`). -The `import-values` in the example below instructs Helm to take any values found at `child:` path and copy them +The `import-values` in the example below instructs Helm to take any values found at `child:` path and copy them to the parent's values at the path specified in `parent:` ```yaml @@ -382,7 +382,7 @@ dependencies: parent: myimports ``` In the above example, values found at `default.data` in the subchart1's values will be imported -to the `myimports` key in the parent chart's values as detailed below: +to the `myimports` key in the parent chart's values as detailed below: ```yaml # parent's values.yaml file @@ -391,7 +391,7 @@ myimports: myint: 0 mybool: false mystring: "helm rocks!" - + ``` ```yaml # subchart1's values.yaml file @@ -400,7 +400,7 @@ default: data: myint: 999 mybool: true - + ``` The parent chart's resulting values would be: @@ -468,7 +468,7 @@ Furthermore, A is dependent on chart B that creates objects - replicaset "B-ReplicaSet" - service "B-Service" -After installation/upgrade of chart A a single Helm release is created/modified. The release will +After installation/upgrade of chart A a single Helm release is created/modified. The release will create/update all of the above Kubernetes objects in the following order: - A-Namespace @@ -478,16 +478,16 @@ create/update all of the above Kubernetes objects in the following order: - A-Service - B-Service -This is because when Helm installs/upgrades charts, -the Kubernetes objects from the charts and all its dependencies are +This is because when Helm installs/upgrades charts, +the Kubernetes objects from the charts and all its dependencies are -- aggregrated into a single set; then -- sorted by type followed by name; and then -- created/updated in that order. +- aggregrated into a single set; then +- sorted by type followed by name; and then +- created/updated in that order. Hence a single release is created with all the objects for the chart and its dependencies. -The install order of Kubernetes types is given by the enumeration InstallOrder in kind_sorter.go +The install order of Kubernetes types is given by the enumeration InstallOrder in kind_sorter.go (see [the Helm source file](https://github.com/kubernetes/helm/blob/master/pkg/tiller/kind_sorter.go#L26)). ## Templates and Values @@ -574,16 +574,11 @@ cannot be overridden. As with all values, the names are _case sensitive_. - `Release.Name`: The name of the release (not the chart) -- `Release.Time`: The time the chart release was last updated. This will - match the `Last Released` time on a Release object. -- `Release.Namespace`: The namespace the chart was released to. - `Release.Service`: The service that conducted the release. Usually this is `Tiller`. - `Release.IsUpgrade`: This is set to true if the current operation is an upgrade or rollback. - `Release.IsInstall`: This is set to true if the current operation is an install. -- `Release.Revision`: The revision number. It begins at 1, and increments with - each `helm upgrade`. - `Chart`: The contents of the `Chart.yaml`. Thus, the chart version is obtainable as `Chart.Version` and the maintainers are in `Chart.Maintainers`. diff --git a/pkg/chartutil/create.go b/pkg/chartutil/create.go index de0cceb18..a2e024047 100644 --- a/pkg/chartutil/create.go +++ b/pkg/chartutil/create.go @@ -243,16 +243,16 @@ const defaultNotes = `1. Get the application URL by running these commands: http{{ if $.Values.ingress.tls }}s{{ end }}://{{ . }}{{ $.Values.ingress.path }} {{- end }} {{- else if contains "NodePort" .Values.service.type }} - export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template ".fullname" . }}) - export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") + export NODE_PORT=$(kubectl get -o jsonpath="{.spec.ports[0].nodePort}" services {{ template ".fullname" . }}) + export NODE_IP=$(kubectl get nodes -o jsonpath="{.items[0].status.addresses[0].address}") echo http://$NODE_IP:$NODE_PORT {{- else if contains "LoadBalancer" .Values.service.type }} NOTE: It may take a few minutes for the LoadBalancer IP to be available. You can watch the status of by running 'kubectl get svc -w {{ template ".fullname" . }}' - export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template ".fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}') + export SERVICE_IP=$(kubectl get svc {{ template ".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={{ template ".name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") + export POD_NAME=$(kubectl get pods -l "app={{ template ".name" . }},release={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") echo "Visit http://127.0.0.1:8080 to use your application" kubectl port-forward $POD_NAME 8080:80 {{- end }} diff --git a/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-alias/charts/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-helmignore/charts/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-no-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-with-all-in-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/dependent-chart-with-mixed-requirements-yaml/charts/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/frobnitz/charts/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml b/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100755 --- a/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml +++ b/pkg/chartutil/testdata/frobnitz_backslash/charts/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml index 3835a3d0b..3c6395ef4 100644 --- a/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml +++ b/pkg/chartutil/testdata/subpop/charts/subchart1/templates/service.yaml @@ -4,7 +4,6 @@ metadata: name: {{ .Chart.Name }} labels: chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - namespace: "{{ .Release.Namespace }}" release-name: "{{ .Release.Name }}" kube-version/major: "{{ .Capabilities.KubeVersion.Major }}" kube-version/minor: "{{ .Capabilities.KubeVersion.Minor }}" diff --git a/pkg/chartutil/values.go b/pkg/chartutil/values.go index d430d1047..ad499b687 100644 --- a/pkg/chartutil/values.go +++ b/pkg/chartutil/values.go @@ -21,7 +21,6 @@ import ( "io/ioutil" "log" "strings" - "time" "github.com/ghodss/yaml" "github.com/pkg/errors" @@ -335,11 +334,8 @@ func coalesceTables(dst, src map[string]interface{}) map[string]interface{} { // for the composition of the final values struct type ReleaseOptions struct { Name string - Time time.Time - Namespace string IsUpgrade bool IsInstall bool - Revision int } // ToRenderValues composes the struct from the data coming from the Releases, Charts and Values files @@ -361,11 +357,8 @@ func ToRenderValuesCaps(chrt *chart.Chart, chrtVals []byte, options ReleaseOptio top := map[string]interface{}{ "Release": map[string]interface{}{ "Name": options.Name, - "Time": options.Time, - "Namespace": options.Namespace, "IsUpgrade": options.IsUpgrade, "IsInstall": options.IsInstall, - "Revision": options.Revision, "Service": "Helm", }, "Chart": chrt.Metadata, diff --git a/pkg/chartutil/values_test.go b/pkg/chartutil/values_test.go index 4b85e56cc..8fe1b3be5 100644 --- a/pkg/chartutil/values_test.go +++ b/pkg/chartutil/values_test.go @@ -22,7 +22,6 @@ import ( "fmt" "testing" "text/template" - "time" kversion "k8s.io/apimachinery/pkg/version" @@ -104,10 +103,7 @@ where: o := ReleaseOptions{ Name: "Seven Voyages", - Time: time.Now(), - Namespace: "al Basrah", IsInstall: true, - Revision: 5, } caps := &Capabilities{ @@ -129,9 +125,6 @@ where: if name := relmap["Name"]; name.(string) != "Seven Voyages" { t.Errorf("Expected release name 'Seven Voyages', got %q", name) } - if rev := relmap["Revision"]; rev.(int) != 5 { - t.Errorf("Expected release revision %d, got %q", 5, rev) - } if relmap["IsUpgrade"].(bool) { t.Error("Expected upgrade to be false.") } diff --git a/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml b/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml index 08cf3c2c1..0c6980cf7 100644 --- a/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml +++ b/pkg/downloader/testdata/signtest/alpine/templates/alpine-pod.yaml @@ -6,8 +6,6 @@ metadata: heritage: {{.Release.Service}} chartName: {{.Chart.Name}} chartVersion: {{.Chart.Version | quote}} - annotations: - "helm.sh/created": "{{.Release.Time.Seconds}}" spec: restartPolicy: {{default "Never" .restart_policy}} containers: diff --git a/pkg/lint/rules/template.go b/pkg/lint/rules/template.go index 6405d9ab2..6b2a75027 100644 --- a/pkg/lint/rules/template.go +++ b/pkg/lint/rules/template.go @@ -19,7 +19,6 @@ package rules import ( "os" "path/filepath" - "time" "github.com/ghodss/yaml" "github.com/pkg/errors" @@ -51,7 +50,7 @@ func Templates(linter *support.Linter, values []byte, namespace string, strict b return } - options := chartutil.ReleaseOptions{Name: "testRelease", Time: time.Now(), Namespace: namespace} + options := chartutil.ReleaseOptions{Name: "testRelease"} caps := &chartutil.Capabilities{ APIVersions: chartutil.DefaultVersionSet, KubeVersion: chartutil.DefaultKubeVersion, diff --git a/pkg/tiller/release_install.go b/pkg/tiller/release_install.go index 1c8ba8a35..db07249f5 100644 --- a/pkg/tiller/release_install.go +++ b/pkg/tiller/release_install.go @@ -69,9 +69,6 @@ func (s *ReleaseServer) prepareRelease(req *hapi.InstallReleaseRequest) (*releas ts := time.Now() options := chartutil.ReleaseOptions{ Name: name, - Time: ts, - Namespace: req.Namespace, - Revision: revision, IsInstall: true, } valuesToRender, err := chartutil.ToRenderValuesCaps(req.Chart, req.Values, options, caps) diff --git a/pkg/tiller/release_update.go b/pkg/tiller/release_update.go index 39abae713..3bcc9cfcf 100644 --- a/pkg/tiller/release_update.go +++ b/pkg/tiller/release_update.go @@ -98,10 +98,7 @@ func (s *ReleaseServer) prepareUpdate(req *hapi.UpdateReleaseRequest) (*release. ts := time.Now() options := chartutil.ReleaseOptions{ Name: req.Name, - Time: ts, - Namespace: currentRelease.Namespace, IsUpgrade: true, - Revision: revision, } caps, err := capabilities(s.discovery)