Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Chore/con 24753 add components #110

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion charts/ocean-kubernetes-controller/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: v2
name: ocean-kubernetes-controller
description: A Helm chart for Ocean Kubernetes Controller
type: application
version: 0.1.30
version: 0.1.31
appVersion: 2.0.50
kubeVersion: ">=1.20.0-0"
maintainers:
Expand Down
43 changes: 42 additions & 1 deletion charts/ocean-kubernetes-controller/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# ocean-kubernetes-controller

![Version: 0.1.30](https://img.shields.io/badge/Version-0.1.30-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.50](https://img.shields.io/badge/AppVersion-2.0.50-informational?style=flat-square)
![Version: 0.1.31](https://img.shields.io/badge/Version-0.1.31-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square) ![AppVersion: 2.0.50](https://img.shields.io/badge/AppVersion-2.0.50-informational?style=flat-square)

A Helm chart for Ocean Kubernetes Controller.

Expand Down Expand Up @@ -108,6 +108,46 @@ Kubernetes: `>=1.20.0-0`
| metrics-server.image.tag | string | `""` | |
| nameOverride | string | `""` | |
| nodeSelector | object | `{}` | |
| ocean-metric-exporter | object | `{"affinity":{},"deployChart":false,"image":{"pullPolicy":"IfNotPresent","pullSecrets":[],"repository":"gcr.io/spotinst-artifacts/spot-ocean-metric-exporter","tag":"1.0.4"},"metricsConfiguration":{"allowLabels":null,"allowMetrics":null,"categories":["scaling"],"denyLabels":null,"denyMetrics":null},"nodeSelector":{},"podAnnotations":{},"podEnvVariables":[],"probes":{"enabled":true,"liveness":{"enabled":false,"failureThreshold":3,"initialDelaySeconds":15,"periodSeconds":10,"timeoutSeconds":1},"readiness":{"enabled":false,"failureThreshold":3,"initialDelaySeconds":15,"periodSeconds":10,"successThreshold":1,"timeoutSeconds":1}},"replicaCount":1,"resources":{"limits":{"cpu":"500m","memory":"500Mi"},"requests":{"cpu":"100m","memory":"50Mi"}},"service":{"create":true},"tolerations":[{"key":"node-role.kubernetes.io/master","operator":"Exists"},{"key":"node-role.kubernetes.io/control-plane","operator":"Exists"}]}` | Configurations for Ocean Metric Exporter. |
| ocean-metric-exporter.affinity | Optional | `{}` | Pod scheduling preferences. Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity |
| ocean-metric-exporter.deployChart | bool | `false` | Specifies whether the Ocean Metric Exporter should be deployed. (Optional) |
| ocean-metric-exporter.image.pullPolicy | Optional | `"IfNotPresent"` | Image pull policy. |
| ocean-metric-exporter.image.pullSecrets | Optional | `[]` | Image pull secrets. |
| ocean-metric-exporter.image.repository | Optional | `"gcr.io/spotinst-artifacts/spot-ocean-metric-exporter"` | Image repository. |
| ocean-metric-exporter.image.tag | Optional | `"1.0.4"` | Image tag. Defaults to `.Chart.AppVersion`. |
| ocean-metric-exporter.metricsConfiguration | Optional | `{"allowLabels":null,"allowMetrics":null,"categories":["scaling"],"denyLabels":null,"denyMetrics":null}` | Exporter Metrics Configurations |
| ocean-metric-exporter.metricsConfiguration.allowLabels | Array[string] | `nil` | List of Labels to allow - if empty will get everything. Shouldn't be used with `denyLabels`. Possible values can be found here: https://docs.spot.io/ocean/tools-and-integrations/prometheus/scrape?id=labels |
| ocean-metric-exporter.metricsConfiguration.allowMetrics | Array[string] | `nil` | List of Metrics to allow - if empty will get everything. Shouldn't be used with `denyMetrics`. Possible values can be found here: https://docs.spot.io/ocean/tools-and-integrations/prometheus/scrape?id=metrics |
| ocean-metric-exporter.metricsConfiguration.categories | Array[string] | `["scaling"]` | List of Categories to enable - if empty will get no metrics. Additional possible values can be found here: https://docs.spot.io/ocean/tools-and-integrations/prometheus/scrape?id=categories |
| ocean-metric-exporter.metricsConfiguration.denyLabels | Array[string] | `nil` | List of Labels to deny - if empty will get everything. Shouldn't be used with `allowLabels`. Possible values can be found here: https://docs.spot.io/ocean/tools-and-integrations/prometheus/scrape?id=labels |
| ocean-metric-exporter.metricsConfiguration.denyMetrics | Array[string] | `nil` | List of Metrics to deny - if empty will get everything. Shouldn't be used with `allowMetrics`. Possible values can be found here: https://docs.spot.io/ocean/tools-and-integrations/prometheus/scrape?id=metrics |
| ocean-metric-exporter.nodeSelector | Optional | `{}` | Node selector. |
| ocean-metric-exporter.podAnnotations | Optional | `{}` | Pod annotations. Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ |
| ocean-metric-exporter.podEnvVariables | Optional | `[]` | Additional environment variables for the exporter container. |
| ocean-metric-exporter.probes.enabled | Bool | `true` | Whether to include both liveness and readiness probe, if this is set to true it will ignore the nested enabled booleans. |
| ocean-metric-exporter.probes.liveness.enabled | Bool | `false` | Whether to include liveness probe, this will be ignored if probes.enabled was set to true. |
| ocean-metric-exporter.probes.liveness.failureThreshold | Integer | `3` | Liveness probe failure threshold. |
| ocean-metric-exporter.probes.liveness.initialDelaySeconds | Integer | `15` | Liveness probe initial delay. |
| ocean-metric-exporter.probes.liveness.periodSeconds | Integer | `10` | Liveness probe period. |
| ocean-metric-exporter.probes.liveness.timeoutSeconds | Integer | `1` | Liveness probe timeout. |
| ocean-metric-exporter.probes.readiness.enabled | Bool | `false` | Whether to include readiness probe, this will be ignored if probes.enabled was set to true. |
| ocean-metric-exporter.probes.readiness.failureThreshold | Integer | `3` | Readiness probe failure threshold. |
| ocean-metric-exporter.probes.readiness.initialDelaySeconds | Integer | `15` | Readiness probe initial delay. |
| ocean-metric-exporter.probes.readiness.periodSeconds | Integer | `10` | Readiness probe period. |
| ocean-metric-exporter.probes.readiness.successThreshold | Integer | `1` | Readiness probe success threshold. |
| ocean-metric-exporter.probes.readiness.timeoutSeconds | Integer | `1` | Readiness probe timeout. |
| ocean-metric-exporter.replicaCount | Optional | `1` | Replicas. Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#replicas |
| ocean-metric-exporter.resources | Optional | `{"limits":{"cpu":"500m","memory":"500Mi"},"requests":{"cpu":"100m","memory":"50Mi"}}` | Resource requests and limits. Ref: http://kubernetes.io/docs/user-guide/compute-resources/ |
| ocean-metric-exporter.service.create | Optional | `true` | Controls whether a service should be created. |
| ocean-metric-exporter.tolerations | Optional | `[{"key":"node-role.kubernetes.io/master","operator":"Exists"},{"key":"node-role.kubernetes.io/control-plane","operator":"Exists"}]` | Tolerations for nodes that have taints on them. Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ |
| ocean-network-client | object | `{"deployChart":false,"image":{"pullPolicy":"IfNotPresent","pullSecrets":[],"repository":"public.ecr.aws/spotinst/spot-network-client","tag":"1.0.6"},"resources":{"requests":{"cpu":"30m","memory":"150Mi"}},"tolerations":[{"operator":"Exists"}]}` | Configurations for Ocean Network Client. |
| ocean-network-client.deployChart | bool | `false` | Specifies whether the Ocean Network Client should be deployed. (Optional) |
| ocean-network-client.image.pullPolicy | Optional | `"IfNotPresent"` | Image pull policy. |
| ocean-network-client.image.pullSecrets | Optional | `[]` | Image pull secrets. |
| ocean-network-client.image.repository | Optional | `"public.ecr.aws/spotinst/spot-network-client"` | Image repository. |
| ocean-network-client.image.tag | Optional | `"1.0.6"` | Image tag. Defaults to `.Chart.AppVersion`. |
| ocean-network-client.resources | Optional | `{"requests":{"cpu":"30m","memory":"150Mi"}}` | Resource requests and limits. Ref: http://kubernetes.io/docs/user-guide/compute-resources/ |
| ocean-network-client.tolerations | Optional | `[{"operator":"Exists"}]` | Tolerations - Enable pods to run an all nodes in cluster Ref: https://kubernetes.io/docs/concepts/scheduling-eviction/taint-and-toleration/ |
| podAnnotations | object | `{}` | |
| podLabels | object | `{}` | |
| podSecurityContext.fsGroup | int | `10001` | |
Expand Down Expand Up @@ -137,6 +177,7 @@ Kubernetes: `>=1.20.0-0`
| spotinst.disableAutoUpdate | bool | `false` | Disable auto update. (Optional) |
| spotinst.disableAutomaticRightSizing | bool | `false` | Disable automatic RightSizing. (Optional) |
| spotinst.enableCsrApproval | bool | `false` | Enable CSR approval. (Optional) |
| spotinst.httpBaseUrl | string | `""` | HTTP Base URL. (Optional) |
| spotinst.proxyUrl | string | `""` | Proxy URL. (Optional) |
| spotinst.token | string | `""` | Spot Token. (Required) Ref: https://docs.spot.io/administration/api/create-api-token |
| tolerations | string | `nil` | Tolerations for nodes that have taints on them. (Optional) Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ |
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,16 @@ rules:
resourceNames:
- {{ printf "%s-auth-reader" (include "metrics-server.fullname" .) }}
{{- end }}

# Network Client requires
{{- if (index .Values "ocean-network-client" "deployChart") }}
- apiGroups: [ "rbac.authorization.k8s.io" ]
resources: [ "clusterroles" ]
verbs: [ "get", "patch", "escalate", "bind" ]
resourceNames: [ {{ include "ocean-network-client.fullname" . }} ]
- apiGroups: [ "rbac.authorization.k8s.io" ]
resources: [ "clusterrolebindings" ]
verbs: [ "get", "patch" ]
resourceNames: [ {{ include "ocean-network-client.fullname" . }} ]
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,31 @@ rules:
resourceNames: [ {{ include "metrics-server.fullname" . }} ]
verbs: [ "get", "patch" ]
{{- end }}

# Network Client requires
{{- if (index .Values "ocean-network-client" "deployChart") }}
- apiGroups: [ "" ]
resources: [ "serviceaccounts" ]
resourceNames: [ {{ include "ocean-network-client.fullname" . }} ]
verbs: [ "get", "patch" ]
- apiGroups: ["apps"]
resources: [ "daemonsets" ]
resourceNames: [ {{ include "ocean-network-client.fullname" . }} ]
verbs: [ "get", "patch" ]
{{- end }}

# Metric Exporter requires
{{- if index .Values "ocean-metric-exporter" "deployChart" -}}
{{- $values := index .Values "ocean-metric-exporter" }}
{{- if $values.service.create }}
- apiGroups: [ "" ]
resources: [ "services" ]
resourceNames: [ {{ include "ocean-metric-exporter.fullname" . }} ]
verbs: [ "get", "patch" ]
{{- end }}
- apiGroups: [ "apps" ]
resources: [ "deployments" ]
resourceNames: [ {{ include "ocean-metric-exporter.fullname" . }} ]
verbs: [ "get", "patch" ]
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ metadata:
data:
spotinst.cluster-identifier: {{ required "`spotinst.clusterIdentifier` must be specified" .Values.spotinst.clusterIdentifier }}
base-url: {{ default "" .Values.spotinst.baseUrl | quote }}
http-base-url: {{ default "" .Values.spotinst.httpBaseUrl | 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 }}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "ocean-metric-exporter.name" -}}
{{- $values := (index .Values "ocean-metric-exporter") -}}
{{- default "ocean-metric-exporter" $values.name | 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-metric-exporter.fullname" -}}
{{- $values := (index .Values "ocean-metric-exporter") -}}
{{- if $values.fullnameOverride }}
{{- $values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default (include "ocean-metric-exporter.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 }}

{{/*
Common labels
*/}}
{{- define "ocean-metric-exporter.labels" -}}
helm.sh/chart: {{ include "ocean-kubernetes-controller.chart" . }}
{{ include "ocean-metric-exporter.selectorLabels" . }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "ocean-metric-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "ocean-metric-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Container command.
*/}}
{{- define "ocean-metric-exporter.command" -}}
{{- printf "[ \"java\", \"-Dspring.profiles.active=prod,default\", \"-jar\", \"/app/app.jar\" ]" -}}
{{- end }}

{{/*
probes.
*/}}
{{- define "ocean-metric-exporter.probes" -}}
{{- $values := index .Values "ocean-metric-exporter" }}
{{- if or $values.probes.liveness.enabled $values.probes.enabled }}
livenessProbe:
httpGet:
path: /health/liveness
port: exporter
initialDelaySeconds: {{ $values.probes.liveness.initialDelaySeconds }}
periodSeconds: {{ $values.probes.liveness.periodSeconds }}
failureThreshold: {{ $values.probes.liveness.failureThreshold }}
timeoutSeconds: {{ $values.probes.liveness.timeoutSeconds }}
{{- end}}
{{- if or $values.probes.readiness.enabled $values.probes.enabled }}
readinessProbe:
httpGet:
path: /health/readiness
port: exporter
initialDelaySeconds: {{ $values.probes.readiness.initialDelaySeconds }}
periodSeconds: {{ $values.probes.readiness.periodSeconds }}
failureThreshold: {{ $values.probes.readiness.failureThreshold }}
successThreshold: {{ $values.probes.readiness.successThreshold }}
timeoutSeconds: {{ $values.probes.readiness.timeoutSeconds }}
{{- end}}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
{{- if index .Values "ocean-metric-exporter" "deployChart" -}}
{{- $values := index .Values "ocean-metric-exporter" }}
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ocean-metric-exporter.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "ocean-metric-exporter.labels" . | nindent 4 }}
spec:
replicas: {{ $values.replicaCount }}
selector:
matchLabels:
{{- include "ocean-metric-exporter.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with $values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "ocean-metric-exporter.selectorLabels" . | nindent 8 }}
spec:
{{- with $values.image.pullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
containers:
- name: spot-ocean-metric-exporter
ports:
- containerPort: 5050
name: exporter
env:
- name: SPOTINST_TOKEN
valueFrom:
secretKeyRef:
name: {{ include "ocean-kubernetes-controller.secretName" . }}
key: token
optional: true
- name: SPOTINST_TOKEN_LEGACY
valueFrom:
configMapKeyRef:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
key: spotinst.token
optional: true
- name: SPOTINST_ACCOUNT
valueFrom:
secretKeyRef:
name: {{ include "ocean-kubernetes-controller.secretName" . }}
key: account
optional: true
- name: SPOTINST_ACCOUNT_LEGACY
valueFrom:
configMapKeyRef:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
key: spotinst.account
optional: true
- name: CLUSTER_IDENTIFIER
valueFrom:
configMapKeyRef:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
key: spotinst.cluster-identifier
- name: BASE_SPOTINST_URL
valueFrom:
configMapKeyRef:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
key: http-base-url
optional: true
- name: PROXY_URL
valueFrom:
configMapKeyRef:
name: {{ include "ocean-kubernetes-controller.configMapName" . }}
key: proxy-url
optional: true
- name: USER_ENV_CERTIFICATES
valueFrom:
secretKeyRef:
name: {{ include "ocean-kubernetes-controller.caBundleSecretName" . }}
key: {{ .Values.caBundleSecret.key }}
optional: true
{{- with $values.podEnvVariables }}
{{- toYaml . | nindent 8 }}
{{- end }}
image: {{ $values.image.repository }}:{{ $values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ $values.image.pullPolicy }}
command: {{ include "ocean-metric-exporter.command" . }}
args:
- --categories={{ join "," $values.metricsConfiguration.categories }}
- --allow-metrics={{ join "," $values.metricsConfiguration.allowMetrics }}
- --deny-metrics={{ join "," $values.metricsConfiguration.denyMetrics }}
- --allow-labels={{ join "," $values.metricsConfiguration.allowLabels }}
- --deny-labels={{ join "," $values.metricsConfiguration.denyLabels }}
resources:
{{- toYaml $values.resources | nindent 12 }}
{{- include "ocean-metric-exporter.probes" . | nindent 8 }}
{{- with $values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with $values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- end }}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if index .Values "ocean-metric-exporter" "deployChart" -}}
{{- $values := index .Values "ocean-metric-exporter" }}
{{- if $values.service.create }}
apiVersion: v1
kind: Service
metadata:
name: {{ include "ocean-metric-exporter.fullname" . }}
namespace: {{ .Release.Namespace }}
labels:
{{- include "ocean-metric-exporter.labels" . | nindent 4 }}
spec:
ports:
- name: exporter
port: 5050
protocol: TCP
targetPort: exporter
selector:
{{- include "ocean-metric-exporter.selectorLabels" . | nindent 4 }}
sessionAffinity: None
type: ClusterIP
{{- end }}
{{- end }}
Loading
Loading