Add spire-lib chart (#289)

* Add spire-lib chart

Make spire-lib bits into its own library chart.

Signed-off-by: Kevin Fox <[email protected]>

* Apply suggestions from code review

Co-authored-by: Marco Franssen <[email protected]>
Signed-off-by: kfox1111 <[email protected]>

* Move notes back

Signed-off-by: Kevin Fox <[email protected]>

* Fix NOTES

Signed-off-by: Kevin Fox <[email protected]>

---------

Signed-off-by: Kevin Fox <[email protected]>
Signed-off-by: kfox1111 <[email protected]>
Co-authored-by: Marco Franssen <[email protected]>
This commit is contained in:
kfox1111
2024-04-18 08:21:31 -07:00
committed by GitHub
co-authored by Marco Franssen
parent 260b02f973
commit 08f699bdb0
10 changed files with 86 additions and 4 deletions
+3
View File
@@ -22,6 +22,9 @@ maintainers:
email: [email protected]
kubeVersion: ">=1.21.0-0"
dependencies:
- name: spire-lib
repository: file://./charts/spire-lib
version: 0.1.0
- name: spire-server
condition: spire-server.enabled
repository: file://./charts/spire-server
+23
View File
@@ -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/
+24
View File
@@ -0,0 +1,24 @@
apiVersion: v2
name: spire-lib
description: A Helm chart for Kubernetes
# 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: library
# 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: ""
+14
View File
@@ -0,0 +1,14 @@
# SPIRE Common Library Chart
A [Helm Library Chart](https://helm.sh/docs/topics/library_charts/#helm) for grouping common logic between SPIRE charts.
## TL;DR
```yaml
dependencies:
- name: spire-lib
version: 0.1.0
repository: https://spiffe.github.io/helm-charts-hardened/
```
## Parameters
@@ -0,0 +1,5 @@
{{- define "spire-lib.namespaces" }}
{{- include "spire-lib.namespace.system" . }}
---
{{- include "spire-lib.namespace.server" . }}
{{- end }}
@@ -1,12 +1,13 @@
{{- define "spire.namespace.default_server_labels" }}
{{- define "spire-lib.namespace.default_server_labels" }}
"pod-security.kubernetes.io/warn": restricted
"pod-security.kubernetes.io/audit": restricted
"pod-security.kubernetes.io/enforce": restricted
{{- end }}
{{- define "spire-lib.namespace.server" }}
{{- if or .Values.global.spire.namespaces.create .Values.global.spire.namespaces.server.create }}
{{- $labels := dict }}
{{- if and (dig "spire" "recommendations" "enabled" false .Values.global) (dig "spire" "recommendations" "namespacePSS" true .Values.global) }}
{{- $labels = mergeOverwrite $labels (include "spire.namespace.default_server_labels" . | fromYaml) }}
{{- $labels = mergeOverwrite $labels (include "spire-lib.namespace.default_server_labels" . | fromYaml) }}
{{- if (dig "openshift" false .Values.global) }}
{{- $_ := set $labels "security.openshift.io/scc.podSecurityLabelSync" "false" }}
{{- if (index .Values "spiffe-oidc-discovery-provider").enabled }}
@@ -28,3 +29,4 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
@@ -1,12 +1,13 @@
{{- define "spire.namespace.default_system_labels" }}
{{- define "spire-lib.namespace.default_system_labels" }}
"pod-security.kubernetes.io/warn": privileged
"pod-security.kubernetes.io/audit": privileged
"pod-security.kubernetes.io/enforce": privileged
{{- end }}
{{- define "spire-lib.namespace.system" }}
{{- if or .Values.global.spire.namespaces.create .Values.global.spire.namespaces.system.create }}
{{- $labels := dict }}
{{- if and (dig "spire" "recommendations" "enabled" false .Values.global) (dig "spire" "recommendations" "namespacePSS" true .Values.global) }}
{{- $labels = mergeOverwrite $labels (include "spire.namespace.default_system_labels" . | fromYaml) }}
{{- $labels = mergeOverwrite $labels (include "spire-lib.namespace.default_system_labels" . | fromYaml) }}
{{- if (dig "openshift" false .Values.global) }}
{{- $_ := set $labels "security.openshift.io/scc.podSecurityLabelSync" "false" }}
{{- end }}
@@ -25,3 +26,4 @@ metadata:
{{- toYaml . | nindent 4 }}
{{- end }}
{{- end }}
{{- end }}
@@ -0,0 +1,8 @@
# Default values for spire-lib.
# This is a YAML-formatted file.
# Declare variables to be passed into your templates.
## It is required by CI/CD tools and processes.
## @skip exampleValue
##
exampleValue: spire-lib
+1
View File
@@ -0,0 +1 @@
{{- include "spire-lib.namespaces" . }}