-
Notifications
You must be signed in to change notification settings - Fork 4
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
Adds spire-1.1.1 helm charts #27
Open
alexandrealvino
wants to merge
2
commits into
main
Choose a base branch
from
spire-helm-1.1.1
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
apiVersion: v2 | ||
appVersion: 1.16.0 | ||
description: A Helm chart for Kubernetes | ||
name: spire-agent | ||
type: application | ||
version: 1.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
1. Get the application URL by running these commands: | ||
{{- if .Values.ingress.enabled }} | ||
{{- range $host := .Values.ingress.hosts }} | ||
{{- range .paths }} | ||
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }} | ||
{{- end }} | ||
{{- end }} | ||
{{- else if contains "NodePort" .Values.service.type }} | ||
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "spire-agent.fullname" . }}) | ||
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}") | ||
echo http://$NODE_IP:$NODE_PORT | ||
{{- else if contains "LoadBalancer" .Values.service.type }} | ||
NOTE: It may take a few minutes for the LoadBalancer IP to be available. | ||
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "spire-agent.fullname" . }}' | ||
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "spire-agent.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}") | ||
echo http://$SERVICE_IP:{{ .Values.service.port }} | ||
{{- else if contains "ClusterIP" .Values.service.type }} | ||
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "spire-agent.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}") | ||
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}") | ||
echo "Visit http://127.0.0.1:8080 to use your application" | ||
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "spire-agent.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). | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just wondering if there aren't any bugs that can happen if something gets tweaked? |
||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "spire-agent.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 "spire-agent.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "spire-agent.labels" -}} | ||
helm.sh/chart: {{ include "spire-agent.chart" . }} | ||
{{ include "spire-agent.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "spire-agent.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "spire-agent.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "spire-agent.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "spire-agent.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
61 changes: 61 additions & 0 deletions
61
mithrilctl/helm/spire/spire-agent/templates/configmaps.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# ConfigMap containing the SPIRE agent configuration. | ||
apiVersion: v1 | ||
kind: ConfigMap | ||
metadata: | ||
name: {{ .Values.name }} | ||
namespace: {{ .Values.namespace }} | ||
data: | ||
agent.conf: | | ||
agent { | ||
data_dir = "/run/spire" | ||
log_level = "DEBUG" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think we should consider parametarizing log level for SPIRE apps |
||
server_address = "spire-server" | ||
server_port = "8081" | ||
socket_path = "{{ .Values.configmaps.agentConfig.socketPath }}" | ||
trust_bundle_path = "{{ .Values.configmaps.agentConfig.notifier.trustBundlePath }}" | ||
trust_domain = "{{ .Values.configmaps.agentConfig.trustDomain }}" | ||
{{ if eq .Values.configmaps.agentConfig.federates true }} | ||
|
||
sds = { | ||
default_bundle_name = "null" | ||
default_all_bundles_name = "ROOTCA" | ||
} | ||
|
||
{{ end }} | ||
} | ||
|
||
plugins { | ||
NodeAttestor "k8s_psat" { | ||
plugin_data { | ||
# NOTE: Change this to your cluster name | ||
cluster = "{{ .Values.clusterName }}" | ||
} | ||
} | ||
|
||
KeyManager "memory" { | ||
plugin_data { | ||
} | ||
} | ||
|
||
WorkloadAttestor "k8s" { | ||
plugin_data { | ||
# Defaults to the secure kubelet port by default. | ||
# Minikube does not have a cert in the cluster CA bundle that | ||
# can authenticate the kubelet cert, so skip validation. | ||
skip_kubelet_verification = true | ||
} | ||
} | ||
|
||
WorkloadAttestor "unix" { | ||
plugin_data { | ||
} | ||
} | ||
} | ||
|
||
health_checks { | ||
listener_enabled = true | ||
bind_address = "0.0.0.0" | ||
bind_port = "8080" | ||
live_path = "/live" | ||
ready_path = "/ready" | ||
} |
164 changes: 164 additions & 0 deletions
164
mithrilctl/helm/spire/spire-agent/templates/daemonset.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,164 @@ | ||
apiVersion: apps/v1 | ||
kind: DaemonSet | ||
metadata: | ||
name: {{ .Values.name }} | ||
namespace: {{ .Values.namespace }} | ||
labels: | ||
app: {{ .Values.name }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: {{ .Values.name }} | ||
template: | ||
metadata: | ||
namespace: {{ .Values.namespace }} | ||
labels: | ||
app: {{ .Values.name }} | ||
spec: | ||
hostPID: true | ||
hostNetwork: true | ||
dnsPolicy: ClusterFirstWithHostNet | ||
serviceAccountName: {{ .Values.name }} | ||
initContainers: | ||
- name: init | ||
# This is a small image with wait-for-it, choose whatever image | ||
# you prefer that waits for a service to be up. This image is built | ||
# from https://github.com/lqhl/wait-for-it | ||
image: gcr.io/spiffe-io/wait-for-it | ||
args: ["-t", "30", "spire-server:8081"] | ||
containers: | ||
- name: {{ .Values.name }} | ||
image: gcr.io/spiffe-io/{{ .Values.tag }} | ||
args: ["-config", "/run/spire/config/agent.conf"] | ||
volumeMounts: | ||
- name: spire-config | ||
mountPath: /run/spire/config | ||
readOnly: true | ||
- name: spire-bundle | ||
mountPath: /run/spire/bundle | ||
- name: spire-agent-socket-dir | ||
mountPath: {{ .Values.socketPath }} | ||
- name: spire-token | ||
mountPath: /var/run/secrets/tokens | ||
livenessProbe: | ||
httpGet: | ||
path: /live | ||
port: 8080 | ||
failureThreshold: 2 | ||
initialDelaySeconds: 15 | ||
periodSeconds: 60 | ||
timeoutSeconds: 3 | ||
readinessProbe: | ||
httpGet: | ||
path: /ready | ||
port: 8080 | ||
initialDelaySeconds: 5 | ||
periodSeconds: 5 | ||
# This is the container which runs the SPIFFE CSI driver. | ||
- name: spiffe-csi-driver | ||
image: ghcr.io/spiffe/spiffe-csi-driver:0.1.0 | ||
imagePullPolicy: IfNotPresent | ||
args: [ | ||
"-workload-api-socket-dir", "/spire-agent-socket", | ||
"-csi-socket-path", "/spiffe-csi/csi.sock", | ||
] | ||
env: | ||
# The CSI driver needs a unique node ID. The node name can be | ||
# used for this purpose. | ||
- name: MY_NODE_NAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: spec.nodeName | ||
volumeMounts: | ||
# The volume containing the SPIRE agent socket. The SPIFFE CSI | ||
# driver will mount this directory into containers. | ||
- mountPath: /spire-agent-socket | ||
name: spire-agent-socket-dir | ||
readOnly: true | ||
# The volume that will contain the CSI driver socket shared | ||
# with the kubelet and the driver registrar. | ||
- mountPath: /spiffe-csi | ||
name: spiffe-csi-socket-dir | ||
# The volume containing mount points for containers. | ||
- mountPath: /var/lib/kubelet/pods | ||
mountPropagation: Bidirectional | ||
name: mountpoint-dir | ||
securityContext: | ||
privileged: true | ||
# This container runs the CSI Node Driver Registrar which takes care | ||
# of all the little details required to register a CSI driver with | ||
# the kubelet. | ||
- name: node-driver-registrar | ||
image: k8s.gcr.io/sig-storage/csi-node-driver-registrar:v2.4.0 | ||
imagePullPolicy: IfNotPresent | ||
args: [ | ||
"-csi-address", "/spiffe-csi/csi.sock", | ||
"-kubelet-registration-path", "/var/lib/kubelet/plugins/csi.spiffe.io/csi.sock", | ||
] | ||
volumeMounts: | ||
# The registrar needs access to the SPIFFE CSI driver socket | ||
- mountPath: /spiffe-csi | ||
name: spiffe-csi-socket-dir | ||
# The registrar needs access to the Kubelet plugin registration | ||
# directory | ||
- name: kubelet-plugin-registration-dir | ||
mountPath: /registration | ||
volumes: | ||
- name: spire-config | ||
configMap: | ||
name: {{ .Values.name }} | ||
- name: spire-bundle | ||
configMap: | ||
name: {{ .Values.configmaps.notifier.bundleName }} | ||
- name: spire-token | ||
projected: | ||
sources: | ||
- serviceAccountToken: | ||
path: spire-agent | ||
expirationSeconds: 7200 | ||
audience: spire-server | ||
# This volume is used to share the workload api socket between the | ||
# CSI driver and SPIRE agent | ||
- name: spire-agent-socket-dir | ||
hostPath: | ||
path: /run/spire/socket-dir | ||
type: DirectoryOrCreate | ||
# This volume is where the socket for kubelet->driver communication lives | ||
- name: spiffe-csi-socket-dir | ||
hostPath: | ||
path: /var/lib/kubelet/plugins/csi.spiffe.io | ||
type: DirectoryOrCreate | ||
# This volume is where the SPIFFE CSI driver mounts volumes | ||
- name: mountpoint-dir | ||
hostPath: | ||
path: /var/lib/kubelet/pods | ||
type: Directory | ||
# This volume is where the node-driver-registrar registers the plugin | ||
# with kubelet | ||
- name: kubelet-plugin-registration-dir | ||
hostPath: | ||
path: /var/lib/kubelet/plugins_registry | ||
type: Directory | ||
--- | ||
apiVersion: storage.k8s.io/v1 | ||
kind: CSIDriver | ||
metadata: | ||
name: "csi.spiffe.io" | ||
spec: | ||
# We only support ephemeral, inline volumes. We don't need a controller to | ||
# provision and attach volumes. | ||
attachRequired: false | ||
|
||
# We want the pod information so that the CSI driver can verify that an | ||
# ephemeral mount was requested. | ||
podInfoOnMount: true | ||
|
||
# We don't want (or need) K8s to change ownership on the contents of the mount | ||
# when it is moutned into the pod, since the Workload API is completely open | ||
# (i.e. 0777). | ||
# Note, this was added in Kubernetes 1.19, so omit | ||
fsGroupPolicy: None | ||
|
||
# We only support ephemeral volumes. Note that this requires Kubernetes 1.16 | ||
volumeLifecycleModes: # added in Kubernetes 1.16, this field is beta | ||
- Ephemeral |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{{- if .Values.autoscaling.enabled }} | ||
apiVersion: autoscaling/v2beta1 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: {{ include "spire-agent.fullname" . }} | ||
labels: | ||
{{- include "spire-agent.labels" . | nindent 4 }} | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
name: {{ include "spire-agent.fullname" . }} | ||
minReplicas: {{ .Values.autoscaling.minReplicas }} | ||
maxReplicas: {{ .Values.autoscaling.maxReplicas }} | ||
metrics: | ||
{{- if .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
- type: Resource | ||
resource: | ||
name: cpu | ||
targetAverageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} | ||
{{- end }} | ||
{{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
- type: Resource | ||
resource: | ||
name: memory | ||
targetAverageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} | ||
{{- end }} | ||
{{- end }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't know if this have already been updated in the newer PR's, but if not, we should properly describe the chart