Skip to content

Commit

Permalink
feat(ocean): new chart: ocean-metric-exporter (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
yinnonbar authored May 1, 2022
1 parent 92f11ac commit 661ac42
Show file tree
Hide file tree
Showing 8 changed files with 393 additions and 0 deletions.
23 changes: 23 additions & 0 deletions charts/ocean-metric-exporter/.helmignore
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/
18 changes: 18 additions & 0 deletions charts/ocean-metric-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: ocean-metric-exporter
description: A Helm chart for Ocean Metric Exporter
type: application
version: 1.0.0
appVersion: 1.0.0
home: https://github.com/spotinst/charts/tree/main/charts/ocean-metric-exporter
icon: https://docs.spot.io/_media/images/spot_mark.png
sources:
- https://github.com/spotinst/spotinst-kubernetes-exporter
keywords:
- spot
- ocean
- metric
- exporter
maintainers:
- name: spotinst
email: ng-spot-info@netapp.com
50 changes: 50 additions & 0 deletions charts/ocean-metric-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# ocean-metric-exporter

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

A Helm chart for Ocean Metric Exporter.

## 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 `ocean-metric-exporter`:

```sh
helm install my-release spot/ocean-metric-exporter
```

> NOTE: Please configure all required chart values using the `set` command line argument or a `values.yaml` file.
## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| affinity | object | `{}` | (Optional) Pod scheduling preferences. Ref: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/#affinity-and-anti-affinity |
| image.pullPolicy | string | `"IfNotPresent"` | (Optional) Image pull policy. |
| image.pullSecrets | list | `[]` | (Optional) Image pull secrets. |
| image.repository | string | `"gcr.io/spotinst-artifacts/spot-ocean-metric-exporter"` | (Optional) Image repository. |
| image.tag | string | `""` | (Optional) Image tag. Defaults to `.Chart.AppVersion`. |
| nodeSelector | object | `{}` | (Optional) Node selector. |
| oceanController.caBundleSecretName | string | `"spotinst-kubernetes-cluster-controller-ca-bundle"` | (Optional) Secret name of CA bundle. |
| oceanController.configMapName | string | `"spotinst-kubernetes-cluster-controller-config"` | (Optional) ConfigMap name. |
| oceanController.namespace | string | `"kube-system"` | (Optional) Namespace where components should be installed. |
| oceanController.secretName | string | `"spotinst-kubernetes-cluster-controller"` | (Optional) Secret name. |
| podAnnotations | object | `{}` | (Optional) Pod annotations. Ref: https://kubernetes.io/docs/concepts/overview/working-with-objects/annotations/ |
| replicaCount | int | `1` | (Optional) Replicas. Ref: https://kubernetes.io/docs/concepts/workloads/controllers/deployment/#replicas |
| resources | object | `{"limits":{"cpu":"500m","memory":"500Mi"},"requests":{"cpu":"100m","memory":"50Mi"}}` | (Optional) Resource requests and limits. Ref: http://kubernetes.io/docs/user-guide/compute-resources/ |
| service.create | bool | `true` | (Optional) Controls whether a service should be created. |
| tolerations | list | `[{"key":"node-role.kubernetes.io/master","operator":"Exists"}]` | (Optional) Tolerations for nodes that have taints on them. Ref: https://kubernetes.io/docs/concepts/configuration/taint-and-toleration/ |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.7.0](https://github.com/norwoodj/helm-docs/releases/v1.7.0)
35 changes: 35 additions & 0 deletions charts/ocean-metric-exporter/README.md.gotmpl
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" . }}
97 changes: 97 additions & 0 deletions charts/ocean-metric-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
{{/* vim: set filetype=mustache: */}}

{{/*
{{/*
Expand the name of the chart.
*/}}
{{- define "ocean-metric-exporter.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-metric-exporter.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-metric-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels.
*/}}
{{- define "ocean-metric-exporter.labels" -}}
helm.sh/chart: {{ include "ocean-metric-exporter.chart" . }}
{{ include "ocean-metric-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
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 }}

{{/*
Secret name.
*/}}
{{- define "ocean-metric-exporter.secretName" -}}
{{ default (include "ocean-metric-exporter.name" .) .Values.oceanController.secretName }}
{{- end }}

{{/*
ConfigMap name.
*/}}
{{- define "ocean-metric-exporter.configMapName" -}}
{{ default (include "ocean-metric-exporter.name" .) .Values.oceanController.configMapName }}
{{- end }}

{{/*
CA bundle secret name.
*/}}
{{- define "ocean-metric-exporter.caBundleSecretName" -}}
{{ default (include "ocean-metric-exporter.name" .) .Values.oceanController.caBundleSecretName }}
{{- end }}

{{/*
Namespace.
*/}}
{{- define "ocean-metric-exporter.namespace" -}}
{{ default (include "ocean-metric-exporter.name" .) .Values.oceanController.namespace }}
{{- end }}

{{/*
Deployment Name.
*/}}
{{- define "ocean-metric-exporter.deploymentName" -}}
{{- printf "spot-%s" (include "ocean-metric-exporter.name" .) -}}
{{- end }}

{{/*
Service Name.
*/}}
{{- define "ocean-metric-exporter.serviceName" -}}
{{- printf "spot-%s" (include "ocean-metric-exporter.name" .) -}}
{{- end }}
94 changes: 94 additions & 0 deletions charts/ocean-metric-exporter/templates/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "ocean-metric-exporter.deploymentName" . }}
namespace: {{ include "ocean-metric-exporter.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-metric-exporter.secretName" . }}
key: token
optional: true
- name: SPOTINST_TOKEN_LEGACY
valueFrom:
configMapKeyRef:
name: {{ include "ocean-metric-exporter.configMapName" . }}
key: spotinst.token
optional: true
- name: SPOTINST_ACCOUNT
valueFrom:
secretKeyRef:
name: {{ include "ocean-metric-exporter.secretName" . }}
key: account
optional: true
- name: SPOTINST_ACCOUNT_LEGACY
valueFrom:
configMapKeyRef:
name: {{ include "ocean-metric-exporter.configMapName" . }}
key: spotinst.account
optional: true
- name: CLUSTER_IDENTIFIER
valueFrom:
configMapKeyRef:
name: {{ include "ocean-metric-exporter.configMapName" . }}
key: spotinst.cluster-identifier
- name: BASE_SPOTINST_URL
valueFrom:
configMapKeyRef:
name: {{ include "ocean-metric-exporter.configMapName" . }}
key: base-url
optional: true
- name: PROXY_URL
valueFrom:
configMapKeyRef:
name: {{ include "ocean-metric-exporter.configMapName" . }}
key: proxy-url
optional: true
- name: USER_ENV_CERTIFICATES
valueFrom:
secretKeyRef:
name: {{ include "ocean-metric-exporter.caBundleSecretName" . }}
key: userEnvCertificates.pem
optional: true
image: {{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}
imagePullPolicy: {{ .Values.image.pullPolicy }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.nodeSelector }}
nodeSelector:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.affinity }}
affinity:
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.tolerations }}
tolerations:
{{- toYaml . | nindent 8 }}
{{- end }}
19 changes: 19 additions & 0 deletions charts/ocean-metric-exporter/templates/service.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{{- if .Values.service.create }}
apiVersion: v1
kind: Service
metadata:
namespace: {{ include "ocean-metric-exporter.namespace" . }}
name: {{ include "ocean-metric-exporter.serviceName" . }}
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 }}
Loading

0 comments on commit 661ac42

Please sign in to comment.