Skip to content

Commit

Permalink
feat(objects): declare new objects (#10)
Browse files Browse the repository at this point in the history
  • Loading branch information
amartingarcia authored May 12, 2023
1 parent 6249682 commit 25aa29c
Show file tree
Hide file tree
Showing 9 changed files with 290 additions and 53 deletions.
26 changes: 26 additions & 0 deletions charts/default-resources/templates/limitrange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{{ if .Values.limitRange.create }}
{{ range .Values.limitRange.config }}
---
apiVersion: v1
kind: LimitRange
metadata:
name: {{ .name }}
namespace: {{ .namespace }}
labels:
{{- if .labels }}
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
limits:
{{ toYaml .spec | indent 4 }}

{{ end }}
{{ end }}
16 changes: 14 additions & 2 deletions charts/default-resources/templates/namespace.yaml
Original file line number Diff line number Diff line change
@@ -1,10 +1,22 @@
{{ if .Values.namespaces.create }}
{{ range .Values.namespaces.name }}
{{ range .Values.namespaces.config }}
---
apiVersion: v1
kind: Namespace
metadata:
name: {{ . }}
name: {{ .name }}
labels:
{{- if .labels }}
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}

{{ end }}
{{ end }}
25 changes: 25 additions & 0 deletions charts/default-resources/templates/networkpolicy.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
{{ if .Values.networkPolicies.create }}
{{ range .Values.networkPolicies.config }}
---
apiVersion: networking.k8s.io/v1
kind: NetworkPolicy
metadata:
name: {{ .name }}
namespace: {{ .namespace }}
{{- if .labels }}
labels:
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
{{ toYaml .spec | indent 2 }}

{{ end }}
{{ end }}
14 changes: 13 additions & 1 deletion charts/default-resources/templates/quota.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,20 @@
apiVersion: v1
kind: ResourceQuota
metadata:
name: {{ .namespace }}
name: {{ .name }}
namespace: {{ .namespace }}
{{- if .labels }}
labels:
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
spec:
hard:
{{ toYaml .spec | indent 4 }}
Expand Down
12 changes: 12 additions & 0 deletions charts/default-resources/templates/secrets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,18 @@ kind: Secret
metadata:
name: {{ .name }}
namespace: {{ .namespace }}
{{- if .labels }}
labels:
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
type: {{ .type }}
data:
{{- range $key, $value := $secrets.data }}
Expand Down
11 changes: 10 additions & 1 deletion charts/default-resources/templates/serviceaccount.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,20 @@ apiVersion: v1
kind: ServiceAccount
metadata:
name: {{ .name }}
namespace: {{ .namespace }}
{{- if .labels }}
labels:
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
namespace: {{ .namespace }}
{{- end }}
automountServiceAccountToken: {{ .automountServiceAccountToken }}

{{ end }}
{{ end }}
44 changes: 44 additions & 0 deletions charts/default-resources/templates/storageclass.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
{{ if .Values.storageClass.create }}
{{ range .Values.storageClass.config }}
---
apiVersion: storage.k8s.io/v1
kind: StorageClass
metadata:
name: {{ .name }}
labels:
{{- if .labels }}
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
provisioner: {{ .provisioner }}
parameters:
{{- with .parameters }}
{{- toYaml . | nindent 2 }}
{{- end }}
allowVolumeExpansion: {{ .allowVolumeExpansion }}
reclaimPolicy: {{ .reclaimPolicy }}
{{- if .mountOptions }}
mountOptions:
{{- with .mountOptions }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}
{{- if .allowVolumeExpansion }}
volumeBindingMode: {{ .volumeBindingMode }}
{{- end }}
{{- if .allowedTopologies }}
allowedTopologies:
{{- with .allowedTopologies }}
{{- toYaml . | nindent 2 }}
{{- end }}
{{- end }}

{{ end }}
{{ end }}
12 changes: 10 additions & 2 deletions charts/default-resources/templates/volumesnapshotclass.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@
{{ if .Values.VolumeSnapshotClass.create }}
{{ range .Values.VolumeSnapshotClass.config }}
{{ if .Values.volumeSnapshotClass.create }}
{{ range .Values.volumeSnapshotClass.config }}
---
apiVersion: snapshot.storage.k8s.io/v1
kind: VolumeSnapshotClass
metadata:
name: {{ .name }}
{{- if .labels }}
labels:
{{- with .labels }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- if .annotations }}
annotations:
{{- with .annotations }}
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
driver: {{ .driver }}
deletionPolicy: {{ .deletionPolicy }}
parameters:
Expand Down
Loading

0 comments on commit 25aa29c

Please sign in to comment.