Skip to content
This repository has been archived by the owner on Jul 25, 2023. It is now read-only.

Commit

Permalink
302: Introducing initial helm chart for aegis-0.18.1
Browse files Browse the repository at this point in the history
Signed-off-by: Abhishek Sharma <abhisheks2@vmware.com>
  • Loading branch information
Abhishek Sharma committed Jul 22, 2023
1 parent 094502b commit d73ab02
Show file tree
Hide file tree
Showing 43 changed files with 2,332 additions and 0 deletions.
23 changes: 23 additions & 0 deletions helm-charts/.helmignore
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/
42 changes: 42 additions & 0 deletions helm-charts/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
apiVersion: v2
name: aegis
description: Helm chart for aegis

# 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
sources:
- https://github.com/shieldworks/aegis

# 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.18.1"
home: https://aegis.ist/
icon: https://raw.githubusercontent.com/shieldworks/aegis/main/assets/aegis-banner.png
keywords:
- secrets

dependencies:
- name: spire
repository: file://charts/spire
version: 0.1.0
condition: global.deploySpire
- name: safe
repository: file://charts/safe
version: 0.18.1
- name: sentinel
repository: file://charts/sentinel
version: 0.18.1
40 changes: 40 additions & 0 deletions helm-charts/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Aegis Helm Chart

Aegis keeps your secrets secret. With Aegis, you can rest assured that your sensitive data is always secure and protected. Aegis is perfect for securely storing arbitrary configuration information at a central location and securely dispatching it to workloads.

## Installation

To use Aegis, follow the steps below:

1. Add Aegis Helm repository:

```bash
helm repo add aegis https://abhishek44sharma.github.io/aegis/
```

2. Install Aegis using Helm:

```bash
helm install aegis aegis/helm-charts --version 0.1.0
```

## Options

The following options can be passed to the `helm install` command to set global variables:

- `--set global.deploySpire=<true/false>`: This flag can be passed to install or skip Spire.
- `--set global.baseImage=<distroless/distroless-fips/photon/photos-fips>`: This flag can be passed to install Aegis with the given baseImage Docker image.

Default values are `true` and `distroless` for `global.deploySpire` and `global.baseImage` respectively.

Here's an example command with the above options:
```bash
helm install aegis aegis/helm-charts --version 0.1.0 --set global.deploySpire=true --set global.baseImage=distroless
```
Make sure to replace `<true/false>` and `<distroless/distroless-fips/photon/photos-fips>` with the desired values.
## License
This project is licensed under the [MIT License](LICENSE).
Binary file added helm-charts/charts/.DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions helm-charts/charts/safe/.helmignore
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/
24 changes: 24 additions & 0 deletions helm-charts/charts/safe/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: v2
name: safe
description: Helm chart for aegis-safe

# 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: "0.18.1"
100 changes: 100 additions & 0 deletions helm-charts/charts/safe/templates/Deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "safe.fullname" . }}
namespace: {{ .Values.global.aegis.namespace }}
labels:
{{- include "safe.labels" . | nindent 4 }}
spec:
{{- if not .Values.autoscaling.enabled }}
replicas: {{ .Values.replicaCount }}
{{- end }}
selector:
matchLabels:
{{- include "safe.selectorLabels" . | nindent 6 }}
template:
metadata:
{{- with .Values.podAnnotations }}
annotations:
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "safe.selectorLabels" . | nindent 8 }}
spec:
{{- with .Values.imagePullSecrets }}
imagePullSecrets:
{{- toYaml . | nindent 8 }}
{{- end }}
serviceAccountName: {{ include "safe.serviceAccountName" . }}
securityContext:
{{- toYaml .Values.podSecurityContext | nindent 8 }}
containers:
- name: main
image: "{{ .Values.global.registry }}/{{- include "safe.repository" .}}:{{ .Values.global.images.safe.tag }}"
imagePullPolicy: {{ .Values.global.images.safe.pullPolicy }}
ports:
- containerPort: 8443
volumeMounts:
- name: spire-agent-socket
mountPath: /spire-agent-socket
readOnly: true
- name: aegis-data
mountPath: /data
- name: aegis-age
mountPath: /key
readOnly: true
#
# You can configure Aegis Safe by providing environment variables.
#
# See https://aegis.ist/docs/configuration for more information about
# these environment variables.
#
# When you don’t explicitly provide env vars here, Aegis Safe will assume
# the default values outlined in the given link above.
#
env:
{{- range .Values.environments }}
- name: {{ .name }}
value: {{ .value | quote }}
{{- end }}
- name: AEGIS_SENTINEL_SVID_PREFIX
value: "spiffe://aegis.ist/workload/aegis-sentinel/ns/{{ .Values.global.aegis.namespace }}/sa/aegis-sentinel/n/"
- name: AEGIS_SAFE_SVID_PREFIX
value: "spiffe://aegis.ist/workload/aegis-safe/ns/{{ .Values.global.aegis.namespace }}/sa/aegis-safe/n/"
- name: AEGIS_PROBE_LIVENESS_PORT
value: ":{{ .Values.livenessPort }}"
- name: AEGIS_PROBE_READINESS_PORT
value: ":{{ .Values.readynessPort }}"
livenessProbe:
httpGet:
path: /
port: {{ .Values.livenessPort }}
initialDelaySeconds: 1
periodSeconds: 10
readinessProbe:
httpGet:
path: /
port: {{ .Values.readynessPort }}
initialDelaySeconds: 1
periodSeconds: 10
resources:
{{- toYaml .Values.resources | nindent 12 }}
volumes:
# Using SPIFFE CSI Driver to bind to the SPIRE Agent Socket
# ref: https://github.com/spiffe/spiffe-csi
- name: spire-agent-socket
csi:
driver: "csi.spiffe.io"
readOnly: true
# `aegis-data` is used to persist the encrypted backups of the secrets.
- name: aegis-data
hostPath:
path: /var/local/aegis/data
type: DirectoryOrCreate
# `aegis-age` stores the encryption keys to restore secrets from aegis-data.
- name: aegis-age
secret:
secretName: {{ .Values.ageKeySecretName }}
items:
- key: KEY_TXT
path: key.txt
22 changes: 22 additions & 0 deletions helm-charts/charts/safe/templates/NOTES.txt
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 "safe.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 "safe.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "safe.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 "safe.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 }}
80 changes: 80 additions & 0 deletions helm-charts/charts/safe/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "safe.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 "safe.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 "safe.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Selector labels
*/}}
{{- define "safe.selectorLabels" -}}
app.kubernetes.io/name: {{ include "safe.fullname" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
app.kubernetes.io/part-of: {{ .Values.global.aegis.namespace }}
{{- end }}

{{/*
Create the name of the service account to use
*/}}
{{- define "safe.serviceAccountName" -}}
{{- if .Values.serviceAccount.create }}
{{- default (include "safe.fullname" .) .Values.serviceAccount.name }}
{{- else }}
{{- default "default" .Values.serviceAccount.name }}
{{- end }}
{{- end }}

{{/*
Define image for aegis safe
*/}}
{{- define "safe.repository" -}}
{{- if eq (lower $.Values.global.baseImage) "distroless" }}
{{- .Values.global.images.safe.distrolessRepository }}
{{- else if eq (lower $.Values.global.baseImage) "distroless-fips" }}
{{- .Values.global.images.safe.distrolessFipsRepository }}
{{- else if eq (lower $.Values.global.baseImage) "photon" }}
{{- .Values.global.images.safe.photonRepository }}
{{- else if eq (lower $.Values.global.baseImage) "photon-fips" }}
{{- .Values.global.images.safe.photonFipsRepository }}
{{- else }}
{{- .Values.global.images.safe.distrolessRepository }}
{{- end }}
{{- end }}
Loading

0 comments on commit d73ab02

Please sign in to comment.