-
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.
- Loading branch information
Showing
8 changed files
with
338 additions
and
11 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
78 changes: 78 additions & 0 deletions
78
charts/ocean-kubernetes-controller/templates/metric-exporter/_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,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 }} |
108 changes: 108 additions & 0 deletions
108
charts/ocean-kubernetes-controller/templates/metric-exporter/deployment.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,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 }} |
22 changes: 22 additions & 0 deletions
22
charts/ocean-kubernetes-controller/templates/metric-exporter/service.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,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 }} |
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
2 changes: 1 addition & 1 deletion
2
charts/ocean-kubernetes-controller/templates/network-client/daemonset.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
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