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

Add Parquet-Exporter helm chart #195

Merged
merged 17 commits into from
Jan 19, 2025
Merged
Show file tree
Hide file tree
Changes from 5 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.DS_Store
24 changes: 24 additions & 0 deletions charts/opencost-parquet-exporter/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: opencost-parquet-exporter
description: OpenCost Parquet Exporter

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 0.1.0

# This is the version number of the application being deployed. This version number should be
# incremented each time you make changes to the application. Versions are not expected to
# follow Semantic Versioning. They should reflect the version the application is using.
# It is recommended to use it with quotes.
appVersion: "1.16.0"
38 changes: 38 additions & 0 deletions charts/opencost-parquet-exporter/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# opencost-parquet-exporter

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

OpenCost Parquet Exporter

## Values

| Key | Type | Default | Description |
|-----|------|---------|-------------|
| activeDeadlineSeconds | int | `3600` | Keep job running (from start time) for [activeDeadlineSeconds] |
| awsRolename | string | `"testrole"` | AWS IAM role to use when writing to the S3 Bucket. |
| concurrencyPolicy | string | `"Forbid"` | Do not allow multiple runs |
| dnsConfig | object | `{"options":[{"name":"single-request-reopen"},{"name":"ndots","value":"2"}]}` | Specific DNS parameters of the pod |
| dnsConfig.options[0] | object | `{"name":"single-request-reopen"}` | Turning this option on [...] so that if two requests from the same port are not handled correctly it will close the socket and open a new one before sending the second request. See also "[single-request-reopen](https://man7.org/linux/man-pages/man5/resolv.conf.5.html)" |
| dnsConfig.options[1] | object | `{"name":"ndots","value":"2"}` | Sets a threshold for the number of dots which must appear in a name [...] before an initial absolute query will be made. . See also "[ndots](https://man7.org/linux/man-pages/man5/resolv.conf.5.html)" |
| dnsPolicy | string | `"ClusterFirst"` | A pod's [DNS polics](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy) |
| env | list | `[{"name":"AWS_REGION","value":"us-west-2"},{"name":"KUBE_CLUSTER","value":"YOUR_CLUSTER_NAME_CHANGE_ME"},{"name":"OPENCOST_PARQUET_FILE_KEY_PREFIX","value":"cluster=$(KUBE_CLUSTER)"},{"name":"OPENCOST_PARQUET_S3_BUCKET","value":"YOUR_S3_BUCKET_NAME_CHANGE_ME"},{"name":"OPENCOST_PARQUET_S3_REGION","value":"YOUR_S3_BUCKET_REGION_NAME_CHANGE_ME"},{"name":"OPENCOST_PARQUET_SVC_HOSTNAME","value":"opencost.opencost.svc.cluster.local"},{"name":"OPENCOST_PARQUET_SVC_PORT","value":"9003"}]` | List of env vars |
| envFrom | string | `nil` | |
| existingServiceAccount | string | `nil` | Optional ServiceAccount use to run this pod |
| failedJobsHistoryLimit | int | `3` | Keep up to three failed jobs |
| image.imagePullPolicy | string | `"Always"` | |
| image.repository | string | `"ghcr.io/opencost/opencost-parquet-exporter"` | |
| image.tag | string | `"main"` | |
| resources | object | `{"limits":{"cpu":2,"memory":"5Gi"},"requests":{"cpu":1,"memory":"1Gi"}}` | Compute resources required |
| restartPolicy | string | `"Never"` | |
| schedule | string | `"* * * * *"` | Schedule on which to run the cron job |
| securityContext.capabilities.drop[0] | string | `"ALL"` | |
| securityContext.readOnlyRootFilesystem | bool | `true` | |
| securityContext.runAsNonRoot | bool | `true` | |
| securityContext.runAsUser | int | `1001` | |
| successfulJobsHistoryLimit | int | `3` | Keep up to three successful jobs |
| suspend | bool | `false` | |
| terminationGracePeriodSeconds | int | `30` | |
| ttlSecondsAfterFinished | int | `14400` | Limit the lifetime of the execution |

----------------------------------------------
Autogenerated from chart metadata using [helm-docs v1.13.1](https://github.com/norwoodj/helm-docs/releases/v1.13.1)
8 changes: 8 additions & 0 deletions charts/opencost-parquet-exporter/templates/_annotations.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{{/*
Common labels
*/}}
{{- define "parquet-exporter.annotations" -}}
lmello marked this conversation as resolved.
Show resolved Hide resolved
{{- if .Values.awsRolename }}
iam.amazonaws.com/role: {{ .Values.awsRolename }}
{{- end }}
{{- end }}
51 changes: 51 additions & 0 deletions charts/opencost-parquet-exporter/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "parquet-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 "parquet-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 "parquet-exporter.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "parquet-exporter.labels" -}}
helm.sh/chart: {{ include "parquet-exporter.chart" . }}
{{ include "parquet-exporter.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "parquet-exporter.selectorLabels" -}}
app.kubernetes.io/name: {{ include "parquet-exporter.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}
73 changes: 73 additions & 0 deletions charts/opencost-parquet-exporter/templates/cronjob.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
apiVersion: batch/v1
kind: CronJob
metadata:
name: {{ include "parquet-exporter.name" $ }}
annotations:
{{- include "parquet-exporter.annotations" $ | indent 4 }}
labels:
{{ include "parquet-exporter.labels" . | indent 4 }}
spec:
concurrencyPolicy: {{ .Values.concurrencyPolicy | quote}}
failedJobsHistoryLimit: {{ .Values.failedJobsHistoryLimit }}
schedule: {{ .Values.schedule | quote}}
successfulJobsHistoryLimit: {{ .Values.successfulJobsHistoryLimit }}
suspend: {{ .Values.suspend }}
jobTemplate:
metadata:
name: {{ include "parquet-exporter.name" $ }}
spec:
activeDeadlineSeconds: {{ .Values.activeDeadlineSeconds }}
ttlSecondsAfterFinished: {{ .Values.ttlSecondsAfterFinished }}
backoffLimit: 3
template:
metadata:
annotations:
{{- include "parquet-exporter.annotations" $ | indent 12 }}
labels:
{{ include "parquet-exporter.labels" . | indent 12 }}
name: {{ include "parquet-exporter.name" $ }}
spec:
{{- if .Values.imagePullSecrets }}
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- end }}
{{- if not ( .Values.existingServiceAccount | empty ) }}
serviceAccountName: {{ .Values.existingServiceAccount }}
{{- end }}
{{- if hasKey .Values "securityContext" }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
{{- end }}
{{- else}}
securityContext: {}
{{- end }}
containers:
- image: {{ .Values.image.repository }}:{{ .Values.image.tag }}
imagePullPolicy: {{ .Values.image.imagePullPolicy }}
name: {{ include "parquet-exporter.name" $ }}
{{- with .Values.resources }}
resources:
{{ toYaml . | indent 16 }}
{{- end }}
{{- with .Values.env }}
env:
{{ toYaml . | indent 16 }}
{{- end }}
{{- with .Values.envFrom }}
envFrom:
{{ toYaml . | indent 16 }}
{{- end }}
{{- with .Values.dnsConfig }}
dnsConfig:
{{ toYaml . | indent 12 }}
{{- end }}
{{- if .Values.dnsPolicy}}
dnsPolicy: {{ .Values.dnsPolicy }}
{{- end }}
restartPolicy: {{ .Values.restartPolicy }}
{{- if .Values.terminationGracePeriodSeconds }}
terminationGracePeriodSeconds: {{ .Values.terminationGracePeriodSeconds}}
{{- end }}
65 changes: 65 additions & 0 deletions charts/opencost-parquet-exporter/values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# -- AWS IAM role to use when writing to the S3 Bucket.
awsRolename: testrole
# -- Do not allow multiple runs
concurrencyPolicy: Forbid
# -- Keep up to three failed jobs
failedJobsHistoryLimit: 3
# -- Schedule on which to run the cron job
schedule: "* * * * *"
# -- Keep up to three successful jobs
successfulJobsHistoryLimit: 3
suspend: false
# -- Keep job running (from start time) for [activeDeadlineSeconds]
activeDeadlineSeconds: 3600
# -- Limit the lifetime of the execution
ttlSecondsAfterFinished: 14400
# -- Optional ServiceAccount use to run this pod
existingServiceAccount:
securityContext:
runAsUser: 1001
readOnlyRootFilesystem: true
runAsNonRoot: true
capabilities:
drop:
- ALL
image:
repository: ghcr.io/opencost/opencost-parquet-exporter
tag: main
imagePullPolicy: Always
# -- List of env vars
env:
- name: AWS_REGION
value: us-west-2
- name: KUBE_CLUSTER
value: YOUR_CLUSTER_NAME_CHANGE_ME
- name: OPENCOST_PARQUET_FILE_KEY_PREFIX
value: cluster=$(KUBE_CLUSTER)
- name: OPENCOST_PARQUET_S3_BUCKET
value: YOUR_S3_BUCKET_NAME_CHANGE_ME
- name: OPENCOST_PARQUET_S3_REGION
value: YOUR_S3_BUCKET_REGION_NAME_CHANGE_ME
- name: OPENCOST_PARQUET_SVC_HOSTNAME
value: opencost.opencost.svc.cluster.local
- name: OPENCOST_PARQUET_SVC_PORT
value: "9003"
envFrom:
# -- Compute resources required
resources:
limits:
cpu: 2
memory: 5Gi
requests:
cpu: 1
memory: 1Gi
# -- Specific DNS parameters of the pod
dnsConfig:
options:
# -- Turning this option on [...] so that if two requests from the same port are not handled correctly it will close the socket and open a new one before sending the second request. See also "[single-request-reopen](https://man7.org/linux/man-pages/man5/resolv.conf.5.html)"
- name: single-request-reopen
# -- Sets a threshold for the number of dots which must appear in a name [...] before an initial absolute query will be made. . See also "[ndots](https://man7.org/linux/man-pages/man5/resolv.conf.5.html)"
- name: ndots
value: "2"
# -- A pod's [DNS polics](https://kubernetes.io/docs/concepts/services-networking/dns-pod-service/#pod-s-dns-policy)
dnsPolicy: ClusterFirst
restartPolicy: Never
terminationGracePeriodSeconds: 30