-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Con 22853 create controller v2 chart (#50)
* added new kubernetes controller chart
- Loading branch information
Showing
14 changed files
with
800 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# 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 | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
dependencies: | ||
- name: metrics-server | ||
repository: https://kubernetes-sigs.github.io/metrics-server | ||
version: 3.11.0 | ||
digest: sha256:d72c6e2556ad01652833d9a81cd6ec626611244912a878d32d9ed58203d831bb | ||
generated: "2023-09-21T16:24:22.598098+03:00" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
apiVersion: v2 | ||
name: ocean-kubernetes-controller | ||
description: A Helm chart for Ocean Controller | ||
type: application | ||
version: 0.1.0 | ||
appVersion: 2.0.17 | ||
kubeVersion: ">=1.20.0-0" | ||
maintainers: | ||
- name: spotinst | ||
email: ng-spot-info@netapp.com | ||
icon: https://docs.spot.io/_media/images/spot_mark.png | ||
keywords: | ||
- spot | ||
- ocean | ||
- controller | ||
dependencies: | ||
- name: metrics-server | ||
version: 3.11.0 | ||
repository: https://kubernetes-sigs.github.io/metrics-server | ||
condition: metrics-server.enabled | ||
annotations: | ||
artifacthub.io/prerelease: "true" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
{{ template "chart.header" . }} | ||
|
||
{{ template "chart.deprecationWarning" . }} | ||
|
||
{{ template "chart.versionBadge" . }}{{ template "chart.typeBadge" . }}{{ template "chart.appVersionBadge" . }} | ||
|
||
{{ template "chart.description" . }}. | ||
|
||
## Installation | ||
|
||
1. Add the Spot Helm chart repository: | ||
|
||
```sh | ||
helm repo add spot https://charts.spot.io | ||
``` | ||
|
||
2. Update your local Helm chart repository cache: | ||
|
||
```sh | ||
helm repo update | ||
``` | ||
|
||
3. Install `{{ template "chart.name" . }}`: | ||
|
||
```sh | ||
helm install my-release spot/{{ template "chart.name" . }} | ||
``` | ||
|
||
> NOTE: Please configure all required chart values using the `set` command line argument or a `values.yaml` file. | ||
|
||
{{ template "chart.requirementsSection" . }} | ||
|
||
{{ template "chart.valuesSection" . }} | ||
|
||
{{ template "helm-docs.versionFooter" . }} |
Binary file not shown.
140 changes: 140 additions & 0 deletions
140
charts/ocean-kubernetes-controller/templates/_helpers.tpl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,140 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.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 "ocean-kubernetes-controller.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 "ocean-kubernetes-controller.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
The image to use | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.image" -}} | ||
{{- printf "%s:%s" .Values.image.repository (default (printf "v%s" .Chart.AppVersion) .Values.image.tag) }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.labels" -}} | ||
helm.sh/chart: {{ include "ocean-kubernetes-controller.chart" . }} | ||
{{ include "ocean-kubernetes-controller.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "ocean-kubernetes-controller.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
ConfigMap name. | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.configMapName" -}} | ||
{{ default (include "ocean-kubernetes-controller.fullname" .) .Values.configMap.name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Secret name. | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.secretName" -}} | ||
{{ default (include "ocean-kubernetes-controller.fullname" .) .Values.secret.name }} | ||
{{- end }} | ||
|
||
{{/* | ||
CA bundle secret name. | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.caBundleSecretName" -}} | ||
{{ default (printf "%s-ca-bundle" (include "ocean-kubernetes-controller.fullname" .)) .Values.caBundleSecret.name }} | ||
{{- end }} | ||
|
||
{{/* | ||
ClusterRole name. | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.clusterRoleName" -}} | ||
{{ include "ocean-kubernetes-controller.fullname" . }} | ||
{{- end }} | ||
|
||
{{/* | ||
ClusterRoleBinding name. | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.clusterRoleBindingName" -}} | ||
{{ include "ocean-kubernetes-controller.fullname" . }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service-account to use | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "ocean-kubernetes-controller.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Figure out if we should deploy metrics server. We are checking: | ||
- if 'metrics-server.deployChart' is true: | ||
- try to fetch the 'v1beta1.metrics.k8s.io' APIService | ||
- if it exists: | ||
- check for it's helm annotations to see if it was installed as part of the | ||
same release we are installing now (release name and namespace annotations). | ||
- if it's not the same release -> fail | ||
*/}} | ||
{{- define "ocean-kubernetes-controller.deployMetricsServer" }} | ||
{{- if (index .Values "metrics-server" "deployChart") }} | ||
{{- $apiService := lookup "apiregistration.k8s.io/v1" "APIService" "" "v1beta1.metrics.k8s.io" }} | ||
{{- $releaseName := .Release.Name }} | ||
{{- $releaseNamespace := .Release.Namespace }} | ||
{{- if $apiService -}} | ||
{{- with $apiService }} | ||
{{- if (or | ||
(not .metadata.annotations) | ||
(or | ||
(ne | ||
$releaseName | ||
(index .metadata.annotations "meta.helm.sh/release-name") | ||
) | ||
(ne | ||
$releaseNamespace | ||
(index .metadata.annotations "meta.helm.sh/release-namespace") | ||
) | ||
)) | ||
}} | ||
{{- fail "\nThe value: 'metrics-server.deployChart' was set to 'true' but we found another installation of metrics-server in your cluster.\nYou must use:\n --set metrics-server.deployChart=false" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} |
117 changes: 117 additions & 0 deletions
117
charts/ocean-kubernetes-controller/templates/clusterrole.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,117 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRole | ||
metadata: | ||
name: {{ include "ocean-kubernetes-controller.fullname" . }} | ||
labels: | ||
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }} | ||
rules: | ||
# --------------------------------------------------------------------------- | ||
# feature: ocean/readonly | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: [ "" ] | ||
resources: [ "pods", "nodes", "services", "namespaces", "replicationcontrollers", "limitranges", "events", "persistentvolumes", "persistentvolumeclaims" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "apps" ] | ||
resources: [ "deployments", "daemonsets", "statefulsets", "replicasets" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "storage.k8s.io" ] | ||
resources: [ "storageclasses" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "batch" ] | ||
resources: [ "jobs", "cronjobs" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "policy" ] | ||
resources: [ "poddisruptionbudgets" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "metrics.k8s.io" ] | ||
resources: [ "pods" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "autoscaling" ] | ||
resources: [ "horizontalpodautoscalers" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "apiextensions.k8s.io" ] | ||
resources: [ "customresourcedefinitions" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- apiGroups: [ "node.k8s.io" ] | ||
resources: [ "runtimeclasses" ] | ||
verbs: [ "get", "list", "watch" ] | ||
- nonResourceURLs: [ "/version/", "/version" ] | ||
verbs: [ "get" ] | ||
# --------------------------------------------------------------------------- | ||
# feature: ocean/draining | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["patch", "update"] | ||
- apiGroups: [""] | ||
resources: ["pods"] | ||
verbs: ["delete"] | ||
- apiGroups: [""] | ||
resources: ["pods/eviction"] | ||
verbs: ["create"] | ||
# --------------------------------------------------------------------------- | ||
# feature: ocean/cleanup | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: [""] | ||
resources: ["nodes"] | ||
verbs: ["delete"] | ||
# --------------------------------------------------------------------------- | ||
# feature: ocean/csr-approval | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: ["certificates.k8s.io"] | ||
resources: ["certificatesigningrequests"] | ||
verbs: ["get", "list", "delete", "create"] | ||
- apiGroups: ["certificates.k8s.io"] | ||
resources: ["certificatesigningrequests/approval"] | ||
verbs: ["patch", "update"] | ||
- apiGroups: ["certificates.k8s.io"] | ||
resources: ["signers"] | ||
resourceNames: ["kubernetes.io/kubelet-serving", "kubernetes.io/kube-apiserver-client-kubelet"] | ||
verbs: ["approve"] | ||
# --------------------------------------------------------------------------- | ||
# feature: ocean/auto-update | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: ["rbac.authorization.k8s.io"] | ||
resources: ["clusterroles"] | ||
resourceNames: ["spotinst-kubernetes-cluster-controller"] | ||
verbs: ["patch", "update", "escalate"] | ||
- apiGroups: ["apps"] | ||
resources: ["deployments"] | ||
resourceNames: ["spotinst-kubernetes-cluster-controller"] | ||
verbs: ["patch", "update"] | ||
# --------------------------------------------------------------------------- | ||
# feature: ocean/apply | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: ["apps"] | ||
resources: ["deployments", "daemonsets"] | ||
verbs: ["get", "list", "patch", "update", "create", "delete"] | ||
- apiGroups: [""] | ||
resources: ["pods"] | ||
verbs: ["get", "list", "patch", "update", "create", "delete"] | ||
- apiGroups: ["batch"] | ||
resources: ["jobs"] | ||
verbs: ["get", "list", "patch", "update", "create", "delete"] | ||
# --------------------------------------------------------------------------- | ||
# feature: wave | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: ["sparkoperator.k8s.io"] | ||
resources: ["sparkapplications", "scheduledsparkapplications"] | ||
verbs: ["get", "list", "patch", "update", "create", "delete"] | ||
- apiGroups: ["wave.spot.io"] | ||
resources: ["sparkapplications", "wavecomponents", "waveenvironments"] | ||
verbs: ["get", "list"] | ||
- apiGroups: ["bigdata.spot.io"] | ||
resources: ["bigdataenvironments"] | ||
verbs: ["get", "list", "patch", "update", "create", "delete"] | ||
# --------------------------------------------------------------------------- | ||
# feature: controller/leader-election (high-availability) | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: [ "coordination.k8s.io" ] | ||
resources: [ "leases" ] | ||
verbs: [ "get","list","patch","update","create","delete" ] | ||
# --------------------------------------------------------------------------- | ||
# feature: controller/report-events | ||
# --------------------------------------------------------------------------- | ||
- apiGroups: [ "" ] | ||
resources: [ "events" ] | ||
verbs: [ "create" ] |
14 changes: 14 additions & 0 deletions
14
charts/ocean-kubernetes-controller/templates/clusterrolebinding.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
kind: ClusterRoleBinding | ||
metadata: | ||
name: {{ include "ocean-kubernetes-controller.fullname" . }} | ||
labels: | ||
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }} | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: {{ include "ocean-kubernetes-controller.fullname" . }} | ||
subjects: | ||
- kind: ServiceAccount | ||
name: {{ include "ocean-kubernetes-controller.serviceAccountName" . }} | ||
namespace: {{ .Release.Namespace }} |
15 changes: 15 additions & 0 deletions
15
charts/ocean-kubernetes-controller/templates/configmap.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
{{- if .Values.configMap.create }} | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ include "ocean-kubernetes-controller.configMapName" . }} | ||
labels: | ||
{{- include "ocean-kubernetes-controller.labels" . | nindent 4 }} | ||
data: | ||
spotinst.cluster-identifier: {{ required "`spotinst.clusterIdentifier` must be specified" .Values.spotinst.clusterIdentifier }} | ||
base-url: {{ default "" .Values.spotinst.baseUrl | quote }} | ||
proxy-url: {{ default "" .Values.spotinst.proxyUrl | quote }} | ||
leader-election: {{ gt (int .Values.replicas) 1 | quote }} | ||
disable-auto-update: {{ default "false" .Values.spotinst.disableAutoUpdate | quote }} | ||
enable-csr-approval: {{ default "false" .Values.spotinst.enableCsrApproval | quote }} | ||
{{- end }} |
Oops, something went wrong.