From bcb4436d85a30f9912fd59dde502407fe2e36f23 Mon Sep 17 00:00:00 2001 From: Michael Goodness Date: Mon, 13 Feb 2017 14:06:48 -0600 Subject: [PATCH] Spartakus v1.1.0 (#614) * Adopt best practices for labeling --- stable/spartakus/Chart.yaml | 4 +-- stable/spartakus/README.md | 30 +++++++++++---------- stable/spartakus/templates/NOTES.txt | 2 +- stable/spartakus/templates/_helpers.tpl | 6 ++--- stable/spartakus/templates/deployment.yaml | 31 +++++++++++++++------- stable/spartakus/values.yaml | 21 ++++++++++----- 6 files changed, 58 insertions(+), 36 deletions(-) diff --git a/stable/spartakus/Chart.yaml b/stable/spartakus/Chart.yaml index 489d4a7383..9f26514c9f 100755 --- a/stable/spartakus/Chart.yaml +++ b/stable/spartakus/Chart.yaml @@ -1,6 +1,6 @@ name: spartakus -version: 1.0.0 -description: A Spartakus Helm chart for Kubernetes. Spartakus aims to collect information about Kubernetes clusters. +version: 1.1.0 +description: Collect information about Kubernetes clusters to help improve the project. sources: - https://github.com/kubernetes-incubator/spartakus maintainers: diff --git a/stable/spartakus/README.md b/stable/spartakus/README.md index 7f13788703..de146bde0b 100644 --- a/stable/spartakus/README.md +++ b/stable/spartakus/README.md @@ -13,15 +13,14 @@ $ helm install stable/spartakus This chart bootstraps a [Spartakus](https://github.com/kubernetes-incubator/spartakus) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. ## Prerequisites - -- Kubernetes 1.3+ with Beta APIs enabled + - Kubernetes 1.3+ with Beta APIs enabled ## Installing the Chart To install the chart with the release name `my-release`: ```console -$ helm install --name my-release stable/spartakus +$ helm install stable/spartakus --name my-release ``` The command deploys Spartakus on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. @@ -42,26 +41,29 @@ The command removes all the Kubernetes components associated with the chart and The following tables lists the configurable parameters of the Spartakus chart and their default values. -| Parameter | Description | Default | -| ------------------------------- | ------------------------------- | ---------------------------------------------------------- | -| `image` | Container image | `gcr.io/google_containers/spartakus-amd64:{VERSION}` | -| `imagePullPolicy` | Image pull policy | `Always` if `image` tag is `latest`, else `IfNotPresent` | -| `resources.requests.cpu` | CPU resource request | `2m` | -| `resources.requests.memory` | Memory resource request | `8Mi` | -| `uuid` | Unique cluster ID | Dynamically generated using `uuidv4` template function | +Parameter | Description | Default +--- | --- | --- +`extraArgs` | Additional container arguments | `{}` +`image.repository` | Image | `gcr.io/google_containers/spartakus-amd64` +`image.tag` | Image tag | `v1.0.0` +`image.pullPolicy` | Image pull policy | `Always` if `image.tag` is `latest`, else `IfNotPresent` +`nodeSelector` | node labels for pod assignment | `{}` +`podAnnotations` | annotations to be added to pods | `{}` +`replicaCount` | desired number of pods | `1` +`resources` | pod resource requests & limits | `requests: {cpu: 2m, memory: 8Mi}` +`uuid` | Unique cluster ID | Dynamically generated using `uuidv4` template function Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example, ```console -$ helm install --name my-release \ - --set uuid=19339C6E-FD73-4787-BFD8-F710C8D8364E \ - stable/spartakus +$ helm install stable/spartakus --name my-release \ + --set uuid=19339C6E-FD73-4787-BFD8-F710C8D8364E ``` Alternatively, a YAML file that specifies the values for the above parameters can be provided while installing the chart. For example, ```console -$ helm install --name my-release -f values.yaml stable/spartakus +$ helm install stable/spartakus --name my-release -f values.yaml ``` > **Tip**: You can use the default [values.yaml](values.yaml) diff --git a/stable/spartakus/templates/NOTES.txt b/stable/spartakus/templates/NOTES.txt index 01e2bff740..9827934dca 100644 --- a/stable/spartakus/templates/NOTES.txt +++ b/stable/spartakus/templates/NOTES.txt @@ -1,6 +1,6 @@ To verify that Spartakus has started, run: - kubectl --namespace={{ .Release.Namespace }} get pods -l "app={{ template "fullname" . }}" + kubectl --namespace={{ .Release.Namespace }} get pods -l "app={{ template "name" . }},release={{ .Release.Name }}" THIS APPLICATION DOES NOT REPORT ANY PERSONAL INFORMATION. Anything that might be identifying, including things like IP addresses, container images, and object names are anonymized. We take diff --git a/stable/spartakus/templates/_helpers.tpl b/stable/spartakus/templates/_helpers.tpl index 234480de71..f0d83d2edb 100644 --- a/stable/spartakus/templates/_helpers.tpl +++ b/stable/spartakus/templates/_helpers.tpl @@ -3,14 +3,14 @@ Expand the name of the chart. */}} {{- define "name" -}} -{{- default .Chart.Name .Values.nameOverride | trunc 24 -}} +{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}} {{- end -}} {{/* Create a default fully qualified app name. -We truncate at 24 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). +We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). */}} {{- define "fullname" -}} {{- $name := default .Chart.Name .Values.nameOverride -}} -{{- printf "%s-%s" .Release.Name $name | trunc 24 -}} +{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}} {{- end -}} diff --git a/stable/spartakus/templates/deployment.yaml b/stable/spartakus/templates/deployment.yaml index d382990512..45c0ea1913 100644 --- a/stable/spartakus/templates/deployment.yaml +++ b/stable/spartakus/templates/deployment.yaml @@ -2,25 +2,36 @@ apiVersion: extensions/v1beta1 kind: Deployment metadata: labels: - app: {{ template "fullname" . }} - chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" - heritage: "{{ .Release.Service }}" - release: "{{ .Release.Name }}" + app: {{ template "name" . }} + chart: {{ .Chart.Name }}-{{ .Chart.Version }} + heritage: {{ .Release.Service }} + release: {{ .Release.Name }} name: {{ template "fullname" . }} spec: - replicas: 1 + replicas: {{ .Values.replicaCount }} template: metadata: + {{- if .Values.podAnnotations }} + annotations: +{{ toYaml .Values.podAnnotations | indent 8}} + {{- end }} labels: - app: {{ template "fullname" . }} - release: "{{ .Release.Name }}" + app: {{ template "name" . }} + release: {{ .Release.Name }} spec: containers: - name: {{ template "name" . }} - image: "{{ .Values.image }}" - imagePullPolicy: {{ default "" .Values.imagePullPolicy | quote }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}" + imagePullPolicy: "{{ .Values.image.pullPolicy }}" args: - volunteer - - --cluster-id={{ uuidv4 | default .Values.uuid | quote }} + - --cluster-id="{{ uuidv4 | default .Values.uuid }}" + {{- range $key, $value := .Values.extraArgs }} + - --{{ $key }}={{ $value }} + {{- end }} resources: {{ toYaml .Values.resources | indent 12 }} + {{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} + {{- end }} diff --git a/stable/spartakus/values.yaml b/stable/spartakus/values.yaml index beb2213830..1ad41e9f8b 100644 --- a/stable/spartakus/values.yaml +++ b/stable/spartakus/values.yaml @@ -1,12 +1,21 @@ +extraArgs: {} + ## Container image ## -image: gcr.io/google_containers/spartakus-amd64:v1.0.0 +image: + repository: gcr.io/google_containers/spartakus-amd64 + tag: v1.0.0 + pullPolicy: IfNotPresent -## imagePullPolicy -## Default: 'Always' if image tag is 'latest', else 'IfNotPresent' -## Ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +nodeSelector: {} + +## Annotations to be added to pods ## -# imagePullPolicy: +podAnnotations: {} + +replicaCount: 1 ## Resource requests and limits ## Ref: http://kubernetes.io/docs/user-guide/compute-resources/ @@ -22,4 +31,4 @@ resources: ## A version 4 UUID to uniquely identify the cluster ## If not provided, Helm will generate automatically at install-time. ## -# uuid: +uuid: ""