diff --git a/stable/kubed/.helmignore b/stable/kubed/.helmignore new file mode 100644 index 0000000000..f0c1319444 --- /dev/null +++ b/stable/kubed/.helmignore @@ -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 diff --git a/stable/kubed/Chart.yaml b/stable/kubed/Chart.yaml new file mode 100755 index 0000000000..3a35eb2dab --- /dev/null +++ b/stable/kubed/Chart.yaml @@ -0,0 +1,12 @@ +apiVersion: v1 +description: 'Kubed by AppsCode - Kubernetes daemon' +name: kubed +version: 0.1.0 +appVersion: 0.3.0 +home: https://github.com/appscode/kubed +icon: https://cdn.appscode.com/images/icon/kubed.png +sources: + - https://github.com/appscode/kubed +maintainers: + - name: appscode + email: support@appscode.com diff --git a/stable/kubed/README.md b/stable/kubed/README.md new file mode 100644 index 0000000000..a6420dee61 --- /dev/null +++ b/stable/kubed/README.md @@ -0,0 +1,88 @@ +# Kubed +[Kubed by AppsCode](https://github.com/appscode/kubed) - A Kubernetes cluster manager daemon. + +## TL;DR; + +```bash +$ helm install stable/kubed +``` + +## Introduction + +This chart bootstraps a [Kubed controller](https://github.com/appscode/kubed) deployment on a [Kubernetes](http://kubernetes.io) cluster using the [Helm](https://helm.sh) package manager. + +## Prerequisites + +- Kubernetes 1.7+ + +## Installing the Chart +To install the chart with the release name `my-release`: +```bash +$ helm install stable/kubed --name my-release +``` +The command deploys Kubed operator on the Kubernetes cluster in the default configuration. The [configuration](#configuration) section lists the parameters that can be configured during installation. + +> **Tip**: List all releases using `helm list` + +## Uninstalling the Chart + +To uninstall/delete the `my-release`: + +```bash +$ 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 the Kubed chart and their default values. + + +| Parameter | Description | Default | +| --------------------------| ------------------------------------------------------------------|--------------------| +| `replicaCount` | Number of kubed operator replicas to create (only 1 is supported) | `1` | +| `image` | container image | `appscode/kubed` | +| `tag` | container image tag | `0.3.0` | +| `imagePullSecrets` | Specify image pull secrets | `nil` (does not add image pull secrets to deployed pods) | +| `imagePullPolicy` | Image pull policy | `IfNotPresent` | +| `criticalAddon` | If true, installs kubed operator as critical addon | `false` | +| `logLevel` | Log level for kubed | `3` | +| `nodeSelector` | Node labels for pod assignment | `{}` | +| `rbac.create` | install required rbac service account, roles and rolebindings | `false` | +| `rbac.serviceAccountName` | ServiceAccount Kubed will use (ignored if rbac.create=true) | `default` | + + +Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example: + +```console +$ helm install --name my-release --set image.tag=v0.2.1 stable/kubed +``` + +Alternatively, a YAML file that specifies the values for the parameters can be provided while +installing the chart. For example: + +```console +$ helm install --name my-release --values values.yaml stable/kubed +``` + +## RBAC +By default the chart will not install the recommended RBAC roles and rolebindings. + +You need to have the flag `--authorization-mode=RBAC` on the api server. See the following document for how to enable [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/). + +To determine if your cluster supports RBAC, run the the following command: + +```console +$ kubectl api-versions | grep rbac +``` + +If the output contains "beta", you may install the chart with RBAC enabled (see below). + +### Enable RBAC role/rolebinding creation + +To enable the creation of RBAC resources (On clusters with RBAC). Do the following: + +```console +$ helm install --name my-release stable/kubed --set rbac.create=true +``` diff --git a/stable/kubed/templates/NOTES.txt b/stable/kubed/templates/NOTES.txt new file mode 100644 index 0000000000..cab510dcc0 --- /dev/null +++ b/stable/kubed/templates/NOTES.txt @@ -0,0 +1,3 @@ +To verify that Kubed has started, run: + + kubectl --namespace={{ .Release.Namespace }} get deployments -l "release={{ .Release.Name }}, app={{ template "kubed.name" . }}" diff --git a/stable/kubed/templates/_helpers.tpl b/stable/kubed/templates/_helpers.tpl new file mode 100644 index 0000000000..5a4617423d --- /dev/null +++ b/stable/kubed/templates/_helpers.tpl @@ -0,0 +1,16 @@ +{{/* vim: set filetype=mustache: */}} +{{/* +Expand the name of the chart. +*/}} +{{- define "kubed.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 "kubed.fullname" -}} +{{- $name := default .Chart.Name .Values.nameOverride -}} +{{- printf "%s-%s" $name .Release.Name | trunc 63 -}} +{{- end -}} diff --git a/stable/kubed/templates/cluster-role-binding.yaml b/stable/kubed/templates/cluster-role-binding.yaml new file mode 100644 index 0000000000..993c668481 --- /dev/null +++ b/stable/kubed/templates/cluster-role-binding.yaml @@ -0,0 +1,19 @@ +{{ if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRoleBinding +metadata: + name: {{ template "kubed.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app: "{{ template "kubed.name" . }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: {{ template "kubed.fullname" . }} +subjects: +- kind: ServiceAccount + name: {{ template "kubed.fullname" . }} + namespace: {{ .Release.Namespace }} +{{ end }} diff --git a/stable/kubed/templates/cluster-role.yaml b/stable/kubed/templates/cluster-role.yaml new file mode 100644 index 0000000000..7ace4a7800 --- /dev/null +++ b/stable/kubed/templates/cluster-role.yaml @@ -0,0 +1,72 @@ +{{ if .Values.rbac.create }} +apiVersion: rbac.authorization.k8s.io/v1beta1 +kind: ClusterRole +metadata: + name: {{ template "kubed.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app: "{{ template "kubed.name" . }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" +rules: +- apiGroups: + - voyager.appscode.com + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: + - monitoring.appscode.com + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: + - stash.appscode.com + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: + - kubedb.com + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: + - monitoring.coreos.com + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: + - extensions + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: + - apps + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: [""] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: [""] + resources: + - configmaps + - secrets + verbs: ["get", "create", "update"] +- apiGroups: ["autoscaling"] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: ["batch"] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: ["authorization.k8s.io"] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: ["rbac.authorization.k8s.io"] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: ["abac.authorization.k8s.io"] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: ["authentication.k8s.io"] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: ["storage.k8s.io"] + resources: ["*"] + verbs: ["list", "watch"] +- apiGroups: ["certificates.k8s.io"] + resources: ["*"] + verbs: ["list", "watch"] +{{ end }} diff --git a/stable/kubed/templates/deployment.yaml b/stable/kubed/templates/deployment.yaml new file mode 100644 index 0000000000..4ea9d14075 --- /dev/null +++ b/stable/kubed/templates/deployment.yaml @@ -0,0 +1,62 @@ +apiVersion: extensions/v1beta1 +kind: Deployment +metadata: + name: {{ template "kubed.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app: "{{ template "kubed.name" . }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" +spec: + replicas: {{ .Values.replicaCount }} + template: + metadata: + labels: + app: "{{ template "kubed.name" . }}" + release: "{{ .Release.Name }}" +{{- if and .Values.criticalAddon (eq .Release.Namespace "kube-system") }} + annotations: + scheduler.alpha.kubernetes.io/critical-pod: '' +{{- end }} + spec: + serviceAccountName: {{ if .Values.rbac.create }}{{ template "kubed.fullname" . }}{{ else }}"{{ .Values.rbac.serviceAccountName }}"{{ end }} + containers: + - name: kubed + args: + - run + - --v={{ .Values.logLevel }} + - --api.address=:8080 + - --web.address=:56790 + image: '{{ .Values.kubed.image }}:{{ .Values.kubed.tag }}' + imagePullPolicy: {{ .Values.imagePullPolicy }} + {{- if .Values.imagePullSecrets }} + imagePullSecrets: +{{ toYaml .Values.imagePullSecrets | indent 8 }} + {{- end }} + ports: + - containerPort: 8080 + name: api + protocol: TCP + - containerPort: 56790 + name: web + protocol: TCP + volumeMounts: + - name: config + mountPath: /srv/kubed + - name: scratch + mountPath: /tmp + volumes: + - name: config + secret: + secretName: {{ template "kubed.fullname" . }} + - name: scratch + emptyDir: {} +{{- if and .Values.criticalAddon (eq .Release.Namespace "kube-system") }} + tolerations: + - key: "CriticalAddonsOnly" + operator: "Exists" +{{- end -}} +{{- if .Values.nodeSelector }} + nodeSelector: +{{ toYaml .Values.nodeSelector | indent 8 }} +{{- end -}} diff --git a/stable/kubed/templates/secret.yaml b/stable/kubed/templates/secret.yaml new file mode 100644 index 0000000000..f7fd1f4c30 --- /dev/null +++ b/stable/kubed/templates/secret.yaml @@ -0,0 +1,18 @@ +apiVersion: v1 +kind: Secret +metadata: + name: {{ template "kubed.fullname" . }} + labels: + app: "{{ template "kubed.name" . }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +data: + config.yaml: {{ ` +apiServer: + address: :8080 + enableReverseIndex: true + enableSearchIndex: true +clusterName: unicorn +enableConfigSyncer: true +` | trim | b64enc | quote }} diff --git a/stable/kubed/templates/service-account.yaml b/stable/kubed/templates/service-account.yaml new file mode 100644 index 0000000000..89aa5e3789 --- /dev/null +++ b/stable/kubed/templates/service-account.yaml @@ -0,0 +1,11 @@ +{{ if .Values.rbac.create }} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ template "kubed.fullname" . }} + labels: + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + app: "{{ template "kubed.name" . }}" + heritage: "{{ .Release.Service }}" + release: "{{ .Release.Name }}" +{{ end }} diff --git a/stable/kubed/templates/service.yaml b/stable/kubed/templates/service.yaml new file mode 100644 index 0000000000..ce8bce963a --- /dev/null +++ b/stable/kubed/templates/service.yaml @@ -0,0 +1,22 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ template "kubed.fullname" . }} + labels: + app: "{{ template "kubed.name" . }}" + chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" + release: "{{ .Release.Name }}" + heritage: "{{ .Release.Service }}" +spec: + ports: + - name: api + port: 8080 + protocol: TCP + targetPort: api + - name: web + port: 56790 + protocol: TCP + targetPort: web + selector: + app: "{{ template "kubed.name" . }}" + release: "{{ .Release.Name }}" diff --git a/stable/kubed/values.yaml b/stable/kubed/values.yaml new file mode 100644 index 0000000000..7f93330f69 --- /dev/null +++ b/stable/kubed/values.yaml @@ -0,0 +1,32 @@ +# Default values for kubed. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. +replicaCount: 1 +kubed: + image: appscode/kubed + tag: 0.3.0 +## 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 +## Specify a imagePullPolicy +## ref: http://kubernetes.io/docs/user-guide/images/#pre-pulling-images +## +imagePullPolicy: IfNotPresent +## Installs Searchlight operator as critical addon +## https://kubernetes.io/docs/tasks/administer-cluster/guaranteed-scheduling-critical-addon-pods/ +criticalAddon: false +## Log level for kubed +logLevel: 3 +## Node labels for pod assignment +## Ref: https://kubernetes.io/docs/user-guide/node-selection/ +## +nodeSelector: {} +## Install Default RBAC roles and bindings +rbac: + ## If true, create & use RBAC resources + create: false + ## Ignored if rbac.create is true + serviceAccountName: default