diff --git a/charts/pv-resizer/v0.1.0/.helmignore b/charts/pv-resizer/v0.1.0/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/pv-resizer/v0.1.0/.helmignore @@ -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/ diff --git a/charts/pv-resizer/v0.1.0/Chart.yaml b/charts/pv-resizer/v0.1.0/Chart.yaml new file mode 100644 index 0000000..b0308a9 --- /dev/null +++ b/charts/pv-resizer/v0.1.0/Chart.yaml @@ -0,0 +1,16 @@ +apiVersion: v2 +name: pv-resizer +description: Job to automatically resize Persistent Volumes + +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: "0.1.0" diff --git a/charts/pv-resizer/v0.1.0/templates/_helpers.tpl b/charts/pv-resizer/v0.1.0/templates/_helpers.tpl new file mode 100644 index 0000000..476a1e4 --- /dev/null +++ b/charts/pv-resizer/v0.1.0/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "pv-resizer.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 "pv-resizer.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 "pv-resizer.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "pv-resizer.labels" -}} +helm.sh/chart: {{ include "pv-resizer.chart" . }} +{{ include "pv-resizer.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "pv-resizer.selectorLabels" -}} +app.kubernetes.io/name: {{ include "pv-resizer.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "pv-resizer.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "pv-resizer.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/pv-resizer/v0.1.0/templates/cronjob.yaml b/charts/pv-resizer/v0.1.0/templates/cronjob.yaml new file mode 100644 index 0000000..ed43e54 --- /dev/null +++ b/charts/pv-resizer/v0.1.0/templates/cronjob.yaml @@ -0,0 +1,37 @@ +apiVersion: batch/v1 +kind: CronJob +metadata: + name: {{ include "pv-resizer.fullname" . }} + labels: + {{- include "pv-resizer.labels" . | nindent 4 }} +spec: + # generate a random backup time between 1 and 5 AM + schedule: {{ .Values.schedule }} + concurrencyPolicy: Forbid + jobTemplate: + spec: + template: + metadata: + labels: + {{- include "pv-resizer.selectorLabels" . | nindent 12 }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 12 }} + {{- end }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 12 }} + containers: + - name: {{ .Release.Name }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + command: [ "/check_full_pvs.sh", "-f" ] + restartPolicy: OnFailure + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 12 }} + {{- end }} diff --git a/charts/pv-resizer/v0.1.0/templates/rbac.yaml b/charts/pv-resizer/v0.1.0/templates/rbac.yaml new file mode 100644 index 0000000..ca8263b --- /dev/null +++ b/charts/pv-resizer/v0.1.0/templates/rbac.yaml @@ -0,0 +1,36 @@ +{{ if .Values.rbac.create }} +# This role is used to allow pv-resizer to get namespaces and patch PVCs +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + name: {{ .Release.Name }} + labels: + {{- include "pv-resizer.labels" . | nindent 4 }} +rules: +- apiGroups: [""] + resources: ["namespaces"] + verbs: ["get"] +- apiGroups: [""] + resources: + - deployments + - statefulsets + - persistentvolumeclaims + verbs: ["get", "list", "patch", "update"] + + +# We bind the role to the pv-resizer ServiceAccount +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ .Release.Name }} + labels: + {{- include "pv-resizer.labels" . | nindent 4 }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: {{ .Release.Name }} +subjects: +- kind: ServiceAccount + name: {{ include "pv-resizer.serviceAccountName" . }} + namespace: {{ .Release.Namespace }} +{{ end }} \ No newline at end of file diff --git a/charts/pv-resizer/v0.1.0/templates/serviceaccount.yaml b/charts/pv-resizer/v0.1.0/templates/serviceaccount.yaml new file mode 100644 index 0000000..f94085c --- /dev/null +++ b/charts/pv-resizer/v0.1.0/templates/serviceaccount.yaml @@ -0,0 +1,12 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "pv-resizer.serviceAccountName" . }} + labels: + {{- include "pv-resizer.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +{{- end }} diff --git a/charts/pv-resizer/v0.1.0/values.yaml b/charts/pv-resizer/v0.1.0/values.yaml new file mode 100644 index 0000000..65d7c6e --- /dev/null +++ b/charts/pv-resizer/v0.1.0/values.yaml @@ -0,0 +1,57 @@ +# Default values for pv-resizer. + +image: + repository: porto.interlegis.leg.br/library/pvresizer + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: true + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +rbac: + create: true + +podAnnotations: {} + +podSecurityContext: {} + # fsGroup: 2000 + +# Defaults to midnight +schedule: "0 0 * * *" + +securityContext: {} + # capabilities: + # drop: + # - ALL + # readOnlyRootFilesystem: true + # runAsNonRoot: true + # runAsUser: 1000 + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +nodeSelector: {} + +tolerations: [] + +affinity: {}