mirror of
https://github.com/helm/charts.git
synced 2026-08-23 22:37:45 +00:00
[stable/gcp-night-king] Add new Helm Chart for GCP Night King service (#3205)
This commit is contained in:
committed by
k8s-ci-robot
parent
f47993df93
commit
7ea5f277ad
@@ -0,0 +1,21 @@
|
||||
# Patterns to ignore when building packages.
|
||||
# This supports shell glob matching, relative path matching, and
|
||||
# negation (prefixed with !). Only one pattern per line.
|
||||
.DS_Store
|
||||
# Common VCS dirs
|
||||
.git/
|
||||
.gitignore
|
||||
.bzr/
|
||||
.bzrignore
|
||||
.hg/
|
||||
.hgignore
|
||||
.svn/
|
||||
# Common backup files
|
||||
*.swp
|
||||
*.bak
|
||||
*.tmp
|
||||
*~
|
||||
# Various IDEs
|
||||
.project
|
||||
.idea/
|
||||
*.tmproj
|
||||
@@ -0,0 +1,12 @@
|
||||
apiVersion: v1
|
||||
description: A Helm chart for GCP Night King
|
||||
name: gcp-night-king
|
||||
version: 1.0.0
|
||||
appVersion: 1.0
|
||||
home: https://hub.docker.com/r/itamarost/gcp-night-king/
|
||||
sources:
|
||||
- https://github.com/itamaro/gcp-go-night-king
|
||||
- https://github.com/itamaro/gcp-night-king
|
||||
maintainers:
|
||||
- name: itamaro
|
||||
email: itamarost@gmail.com
|
||||
@@ -0,0 +1,52 @@
|
||||
# GCP Night King Helm Chart
|
||||
|
||||
This directory contains a Kubernetes chart to deploy a
|
||||
[GCP Night King](https://github.com/itamaro/gcp-go-night-king) service.
|
||||
|
||||
## TL;DR;
|
||||
|
||||
```console
|
||||
$ helm install stable/gcp-night-king --set projectID=$( gcloud config get-value project )
|
||||
```
|
||||
|
||||
## Chart Details
|
||||
|
||||
This chart will do the following:
|
||||
|
||||
* Install a service (K8s Deployment) that listens on a Pub/Sub subscription for instance preemption
|
||||
messages and resurrects preempted instances once they are terminated.
|
||||
|
||||
## Installing the Chart
|
||||
|
||||
To install the chart with the release name `my-release`:
|
||||
|
||||
```console
|
||||
$ helm install --name my-release stable/gcp-night-king
|
||||
```
|
||||
|
||||
## Uninstalling the Chart
|
||||
|
||||
To uninstall/delete the my-release deployment:
|
||||
|
||||
```console
|
||||
$ helm delete my-release
|
||||
```
|
||||
|
||||
The command removes all the Kubernetes components associated with the chart and deletes the release.
|
||||
|
||||
## Configuration
|
||||
|
||||
The following tables lists the configurable parameters of this chart and their default values.
|
||||
|
||||
| Parameter | Description | Default |
|
||||
|------------------------|-------------------------------------------|---------------------------------|
|
||||
| `image.pullPolicy` | Container pull policy | `IfNotPresent` |
|
||||
| `image.repository` | Container image to use | `itamarost/gcp-night-king` |
|
||||
| `image.tag` | Container image tag to deploy | `v1-golang` |
|
||||
| `replicaCount` | k8s replicas | `1` |
|
||||
| `resources` | Service resource requests and limits | `nil` |
|
||||
| `projectID` | GCE project ID for GCE API | Mandatory parameter |
|
||||
| `subscriptionName` | Pub/Sub subscription name to listen on | `nil` |
|
||||
| `nodeSelector` | Node labels for pod assignment | `{}` |
|
||||
|
||||
Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`.
|
||||
@@ -0,0 +1,20 @@
|
||||
{{- if eq (printf "%s" .Values.projectID) "MUST PROVIDE PROJECT ID" }}
|
||||
##############################################################################
|
||||
#### ERROR: You did not provide projectID in your 'helm install' call. ####
|
||||
##############################################################################
|
||||
|
||||
This deployment will be incomplete until provide a project ID:
|
||||
|
||||
helm upgrade {{ .Release.Name }} \
|
||||
--set projectID=YOUR_PROJECT_ID stable/gcp-night-king
|
||||
|
||||
{{- else -}}
|
||||
|
||||
The Night King service is installed!
|
||||
|
||||
The service is listening for Pub/Sub pre-emption messages
|
||||
{{ if .Values.subscriptionName }}on subscription {{ .Values.subscriptionName }}{{ else }}on the default subscription{{ end }} in GCP project {{ .Values.projectID }}.
|
||||
|
||||
Make sure to set up your resurrectable preemptible GCE instances with a shutdown script
|
||||
(see https://github.com/itamaro/gcp-go-night-king#configure-shutdown-script).
|
||||
{{- end }}
|
||||
@@ -0,0 +1,16 @@
|
||||
{{/* vim: set filetype=mustache: */}}
|
||||
{{/*
|
||||
Expand the name of the chart.
|
||||
*/}}
|
||||
{{- define "gcp-night-king.name" -}}
|
||||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
|
||||
{{/*
|
||||
Create a default fully qualified app name.
|
||||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
|
||||
*/}}
|
||||
{{- define "gcp-night-king.fullname" -}}
|
||||
{{- $name := default .Chart.Name .Values.nameOverride -}}
|
||||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
|
||||
{{- end -}}
|
||||
@@ -0,0 +1,14 @@
|
||||
apiVersion: v1
|
||||
kind: ConfigMap
|
||||
metadata:
|
||||
name: {{ template "gcp-night-king.fullname" . }}-config
|
||||
labels:
|
||||
app: {{ template "gcp-night-king.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version }}
|
||||
heritage: {{ .Release.Service }}
|
||||
release: {{ .Release.Name }}
|
||||
data:
|
||||
project.id: {{ quote .Values.projectID }}
|
||||
{{- if .Values.subscriptionName }}
|
||||
subscription.name: {{ quote .Values.subscriptionName }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,52 @@
|
||||
{{- if ne (printf "%s" .Values.projectID) "MUST PROVIDE PROJECT ID" }}
|
||||
apiVersion: apps/v1beta1
|
||||
kind: Deployment
|
||||
metadata:
|
||||
name: {{ template "gcp-night-king.fullname" . }}
|
||||
labels:
|
||||
app: {{ template "gcp-night-king.name" . }}
|
||||
chart: {{ .Chart.Name }}-{{ .Chart.Version | replace "+" "_" }}
|
||||
release: {{ .Release.Name }}
|
||||
heritage: {{ .Release.Service }}
|
||||
spec:
|
||||
replicas: {{ .Values.replicaCount }}
|
||||
template:
|
||||
metadata:
|
||||
labels:
|
||||
app: {{ template "gcp-night-king.name" . }}
|
||||
release: {{ .Release.Name }}
|
||||
annotations:
|
||||
checksum/config: {{ include (print $.Template.BasePath "/configmap.yaml") . | sha256sum | quote }}
|
||||
spec:
|
||||
containers:
|
||||
- name: {{ .Chart.Name }}
|
||||
image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}"
|
||||
imagePullPolicy: {{ .Values.image.pullPolicy }}
|
||||
command:
|
||||
- /usr/bin/nightking
|
||||
- "-project"
|
||||
- $(PROJECT_ID)
|
||||
{{- if .Values.subscriptionName }}
|
||||
- "-subscription-name"
|
||||
- $(SUBSCRIPTION_NAME)
|
||||
{{- end }}
|
||||
env:
|
||||
- name: "PROJECT_ID"
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: {{ template "gcp-night-king.fullname" . }}-config
|
||||
key: project.id
|
||||
{{- if .Values.subscriptionName }}
|
||||
- name: "SUBSCRIPTION_NAME"
|
||||
valueFrom:
|
||||
configMapKeyRef:
|
||||
name: {{ template "gcp-night-king.fullname" . }}-config
|
||||
key: subscription.name
|
||||
{{- end }}
|
||||
resources:
|
||||
{{ toYaml .Values.resources | indent 12 }}
|
||||
{{- if .Values.nodeSelector }}
|
||||
nodeSelector:
|
||||
{{ toYaml .Values.nodeSelector | indent 8 }}
|
||||
{{- end }}
|
||||
{{- end }}
|
||||
@@ -0,0 +1,28 @@
|
||||
# Default values for gcp-night-king.
|
||||
# This is a YAML-formatted file.
|
||||
# Declare variables to be passed into your templates.
|
||||
replicaCount: 1
|
||||
image:
|
||||
repository: itamarost/gcp-night-king
|
||||
tag: v1-golang
|
||||
pullPolicy: IfNotPresent
|
||||
## Node labels for pod assignment
|
||||
## Ref: https://kubernetes.io/docs/user-guide/node-selection/
|
||||
##
|
||||
nodeSelector: {}
|
||||
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
|
||||
|
||||
# GCE project ID for GCE API usage - mandatory paramter
|
||||
projectID: "MUST PROVIDE PROJECT ID"
|
||||
# Pub/Sub subscription name to listen on
|
||||
# subscriptionName: your-pubsub-subscription-name
|
||||
Reference in New Issue
Block a user