diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..0385e34 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,9 @@ +# EditorConfig is awesome: https://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true diff --git a/.github/ct.yaml b/.github/ct.yaml deleted file mode 100644 index 1cdfee0..0000000 --- a/.github/ct.yaml +++ /dev/null @@ -1,5 +0,0 @@ -helm-extra-args: --timeout 600s -check-version-increment: false -debug: true -chart-repos: bitnami=https://charts.bitnami.com/bitnami -target-branch: main \ No newline at end of file diff --git a/.github/helm-docs.sh b/.github/helm-docs.sh deleted file mode 100755 index 8667e74..0000000 --- a/.github/helm-docs.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -mkdir ./.bin -export PATH="./.bin:$PATH" - -set -euxo pipefail - -# renovate: datasource=github-releases depName=helm-docs packageName=norwoodj/helm-docs -HELM_DOCS_VERSION=1.11.0 - -# install helm-docs -curl --silent --show-error --fail --location --output /tmp/helm-docs.tar.gz https://github.com/norwoodj/helm-docs/releases/download/v"${HELM_DOCS_VERSION}"/helm-docs_"${HELM_DOCS_VERSION}"_Linux_x86_64.tar.gz -tar -C .bin/ -xf /tmp/helm-docs.tar.gz helm-docs - -# validate docs -helm-docs -git diff --exit-code \ No newline at end of file diff --git a/.github/kubeval.sh b/.github/kubeval.sh deleted file mode 100755 index 3808aa1..0000000 --- a/.github/kubeval.sh +++ /dev/null @@ -1,48 +0,0 @@ -#!/bin/bash - -mkdir ./.bin -export PATH="./.bin:$PATH" - -set -euxo pipefail - -# renovate: datasource=github-releases depName=kubeval packageName=instrumenta/kubeval -KUBEVAL_VERSION=v0.16.1 - -# renovate: datasource=github-releases depName=semver2 packageName=Ariel-Rodriguez/sh-semversion-2 -SEMVER_VERSION=1.0.3 - -CHART_DIRS="$(git diff --find-renames --name-only "$(git rev-parse --abbrev-ref HEAD)" remotes/origin/main -- charts | cut -d '/' -f 2 | uniq)" -SCHEMA_LOCATION="https://raw.githubusercontent.com/yannh/kubernetes-json-schema/master/" - -# install kubeval -curl --silent --show-error --fail --location --output /tmp/kubeval.tar.gz https://github.com/instrumenta/kubeval/releases/download/"${KUBEVAL_VERSION}"/kubeval-linux-amd64.tar.gz -tar -C .bin/ -xf /tmp/kubeval.tar.gz kubeval - -# install semver compare -curl -sSfLo .bin/semver2 https://raw.githubusercontent.com/Ariel-Rodriguez/sh-semversion-2/${SEMVER_VERSION}/semver2.sh -chmod +x .bin/semver2 - -# add helm repos -helm repo add bitnami https://charts.bitnami.com/bitnami - -# Compute required kubernetes api versions -apis=() - -if [[ "$(semver2 "${KUBERNETES_VERSION#v}" 1.21.0)" -ge 0 ]]; then - apis=("${apis[@]}" --api-versions batch/v1/CronJob) -else - apis=("${apis[@]}" --api-versions batch/v1beta1/CronJob) -fi - -# validate charts -for CHART_DIR in ${CHART_DIRS}; do - (cd "charts/${CHART_DIR}"; helm dependency build) - helm template \ - "${apis[@]}" \ - --values charts/"${CHART_DIR}"/ci/ci-values.yaml \ - charts/"${CHART_DIR}" | kubeval \ - --strict \ - --ignore-missing-schemas \ - --kubernetes-version "${KUBERNETES_VERSION#v}" \ - --schema-location "${SCHEMA_LOCATION}" -done \ No newline at end of file diff --git a/.github/workflows/lint-and-test-charts.yaml b/.github/workflows/lint-and-test-charts.yaml deleted file mode 100644 index cdec64c..0000000 --- a/.github/workflows/lint-and-test-charts.yaml +++ /dev/null @@ -1,106 +0,0 @@ -name: lint-and-test-charts - -on: - push: - branches: - - main - pull_request: - -concurrency: - group: ${{ github.workflow }}-${{ github.event.number || github.ref }} - cancel-in-progress: true - -jobs: - lint-chart: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 - with: - fetch-depth: 0 - - - name: Install Helm - uses: azure/setup-helm@b5b231a831f96336bbfeccc1329990f0005c5bb1 # tag=v3.3 - with: - version: v3.9.4 # renovate: datasource=github-releases depName=helm packageName=helm/helm - - - uses: actions/setup-python@b55428b1882923874294fa556849718a1d7f2ca5 # tag=v4.2.0 - with: - python-version: 3.7 - - - name: Install chart-testing - uses: helm/chart-testing-action@09ed88797198755e5031f25be13da255e7e33aad # tag=v2.3.0 - with: - version: v3.7.0 # renovate: datasource=github-releases depName=chart-testing packageName=helm/chart-testing - - - name: Run lint - run: ct lint --config .github/ct.yaml - - lint-docs: - runs-on: ubuntu-latest - needs: lint-chart - steps: - - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 - - name: Run helm-docs - run: .github/helm-docs.sh - - kubeval-chart: - runs-on: ubuntu-latest - needs: - - lint-chart - - lint-docs - strategy: - matrix: - k8s: - # from https://github.com/yannh/kubernetes-json-schema - - v1.22.13 - - v1.23.10 - - v1.24.4 - - v1.25.0 - steps: - - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 - with: - fetch-depth: 0 - - - name: Run kubeval - env: - KUBERNETES_VERSION: ${{ matrix.k8s }} - run: .github/kubeval.sh - - install-chart: - name: install-chart - runs-on: ubuntu-latest - if: ${{ github.event_name != 'pull_request' || github.repository_owner != github.event.pull_request.head.repo.owner.login || !startsWith(github.event.pull_request.head.ref, 'renovate/') }} - needs: - - lint-chart - - lint-docs - - kubeval-chart - strategy: - matrix: - k8s: - # from https://hub.docker.com/r/kindest/node/tags - - v1.22.13 # renovate: kindest - - v1.23.10 # renovate: kindest - - v1.24.4 # renovate: kindest - - v1.25.0 # renovate: kindest - steps: - - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 - with: - fetch-depth: 0 - - - name: Create kind ${{ matrix.k8s }} cluster - uses: helm/kind-action@d08cf6ff1575077dee99962540d77ce91c62387d # tag=v1.3.0 - with: - node_image: kindest/node:${{ matrix.k8s }} - version: v0.15.0 # renovate: datasource=github-releases depName=kind packageName=kubernetes-sigs/kind - - - name: Install chart-testing - uses: helm/chart-testing-action@09ed88797198755e5031f25be13da255e7e33aad # tag=v2.3.0 - with: - version: v3.7.0 # renovate: datasource=github-releases depName=chart-testing packageName=helm/chart-testing - - - name: Run chart install - run: ct install --config .github/ct.yaml \ No newline at end of file diff --git a/.github/workflows/lint-test.yaml b/.github/workflows/lint-test.yaml new file mode 100644 index 0000000..8ebd293 --- /dev/null +++ b/.github/workflows/lint-test.yaml @@ -0,0 +1,45 @@ +name: Lint and Test Charts + +on: pull_request + +jobs: + lint-test: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up Helm + uses: azure/setup-helm@v4.0.0 + with: + version: v3.12.1 + + - uses: actions/setup-python@v5 + with: + python-version: "3.10" + check-latest: true + + - name: Set up chart-testing + uses: helm/chart-testing-action@v2 + + - name: Run chart-testing (list-changed) + id: list-changed + run: | + changed=$(ct list-changed --target-branch ${{ github.event.repository.default_branch }}) + if [[ -n "$changed" ]]; then + echo "changed=true" >> "$GITHUB_OUTPUT" + fi + + - name: Run chart-testing (lint) + if: steps.list-changed.outputs.changed == 'true' + run: ct lint --target-branch ${{ github.event.repository.default_branch }} + + - name: Create kind cluster + if: steps.list-changed.outputs.changed == 'true' + uses: helm/kind-action@v1 + + - name: Run chart-testing (install) + if: steps.list-changed.outputs.changed == 'true' + run: ct install --target-branch ${{ github.event.repository.default_branch }} diff --git a/.github/workflows/release-charts.yaml b/.github/workflows/release-charts.yaml deleted file mode 100644 index 7b7bddd..0000000 --- a/.github/workflows/release-charts.yaml +++ /dev/null @@ -1,45 +0,0 @@ -name: Release Charts - -on: - push: - branches: - - main - paths: - - 'charts/**' - workflow_dispatch: - -jobs: - release: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@2541b1294d2704b0964813337f33b291d3f8596b # tag=v3.0.2 - with: - fetch-depth: 0 - - - name: Configure Git - run: | - git config user.name "$GITHUB_ACTOR" - git config user.email "$GITHUB_ACTOR@users.noreply.github.com" - - - name: Install Helm - uses: azure/setup-helm@b5b231a831f96336bbfeccc1329990f0005c5bb1 # tag=v3.3 - with: - version: v3.9.4 # renovate: datasource=github-releases depName=helm packageName=helm/helm - - - name: Add external Helm repos - run: helm repo add bitnami https://charts.bitnami.com/bitnami - - - name: Build chart dependencies - run: | - for dir in charts/*/ - do - (cd ${dir}; helm dependency build) - done - - - name: Run chart-releaser - uses: helm/chart-releaser-action@a3454e46a6f5ac4811069a381e646961dda2e1bf # tag=v1.4.0 - with: - version: v1.4.0 # renovate: datasource=github-releases depName=chart-releaser packageName=helm/chart-releaser - env: - CR_TOKEN: '${{ secrets.GITHUB_TOKEN }}' \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..5144ce8 --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,28 @@ +name: Release Charts + +on: + push: + branches: + - main + +jobs: + release: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Configure Git + run: | + git config user.name "$GITHUB_ACTOR" + git config user.email "$GITHUB_ACTOR@users.noreply.github.com" + + - name: Install Helm + uses: azure/setup-helm@v4.0.0 + + - name: Run chart-releaser + uses: helm/chart-releaser-action@v1 + env: + CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" diff --git a/charts/netbird/.helmignore b/charts/netbird/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/netbird/.helmignore @@ -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/ diff --git a/charts/netbird/Chart.yaml b/charts/netbird/Chart.yaml new file mode 100644 index 0000000..f8b93ea --- /dev/null +++ b/charts/netbird/Chart.yaml @@ -0,0 +1,32 @@ +apiVersion: v2 +name: netbird +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: 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 + +dependencies: + - name: dashboard + condition: dashboard.enabled + version: 0.1.0 + - name: management + condition: management.enabled + version: 0.1.0 + - name: signal + condition: signal.enabled + version: 0.1.0 + +maintainers: + - name: ph1ll diff --git a/charts/netbird/charts/dashboard/.helmignore b/charts/netbird/charts/dashboard/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/netbird/charts/dashboard/.helmignore @@ -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/ diff --git a/charts/netbird/charts/dashboard/Chart.yaml b/charts/netbird/charts/dashboard/Chart.yaml new file mode 100644 index 0000000..78acd27 --- /dev/null +++ b/charts/netbird/charts/dashboard/Chart.yaml @@ -0,0 +1,27 @@ +apiVersion: v2 +name: dashboard +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: 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: "v2.0.3" + +maintainers: + - name: ph1ll diff --git a/charts/netbird/charts/dashboard/templates/NOTES.txt b/charts/netbird/charts/dashboard/templates/NOTES.txt new file mode 100644 index 0000000..9b9d4e3 --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/NOTES.txt @@ -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 "dashboard.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 "dashboard.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "dashboard.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 "dashboard.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 }} diff --git a/charts/netbird/charts/dashboard/templates/_helpers.tpl b/charts/netbird/charts/dashboard/templates/_helpers.tpl new file mode 100644 index 0000000..cc7fdc3 --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "dashboard.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 "dashboard.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 "dashboard.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "dashboard.labels" -}} +helm.sh/chart: {{ include "dashboard.chart" . }} +{{ include "dashboard.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "dashboard.selectorLabels" -}} +app.kubernetes.io/name: {{ include "dashboard.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "dashboard.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "dashboard.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/netbird/charts/dashboard/templates/deployment.yaml b/charts/netbird/charts/dashboard/templates/deployment.yaml new file mode 100644 index 0000000..d0c9683 --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/deployment.yaml @@ -0,0 +1,141 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "dashboard.fullname" . }} + labels: + {{- include "dashboard.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "dashboard.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "dashboard.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "dashboard.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + env: + {{- if .Values.global.auth0.domain }} + - name: AUTH0_DOMAIN + value: "{{ .Values.global.auth0.domain }}" + {{- end }} + {{- if .Values.global.auth0.clientId }} + - name: AUTH0_CLIENT_ID + value: "{{ .Values.global.auth0.clientId }}" + {{- end }} + {{- if .Values.global.auth0.audience }} + - name: AUTH0_AUDIENCE + value: "{{ .Values.global.auth0.audience }}" + {{- end }} + {{- if .Values.global.auth.authority }} + - name: AUTH_AUTHORITY + value: "{{ .Values.global.auth.authority }}" + {{- end }} + {{- if .Values.global.auth.clientId }} + - name: AUTH_CLIENT_ID + value: "{{ .Values.global.auth.clientId }}" + {{- end }} + {{- if .Values.global.auth.clientSecret }} + - name: AUTH_CLIENT_SECRET + value: "{{ .Values.global.auth.clientSecret }}" + {{- end }} + {{- if .Values.global.auth.audience }} + - name: AUTH_AUDIENCE + value: "{{ .Values.global.auth.audience }}" + {{- end }} + {{- if .Values.global.auth.redirectUri }} + - name: AUTH_REDIRECT_URI + value: "{{ .Values.global.auth.redirectUri }}" + {{- end }} + {{- if .Values.global.auth.silentRedirectUri }} + - name: AUTH_SILENT_REDIRECT_URI + value: "{{ .Values.global.auth.silentRedirectUri }}" + {{- end }} + {{- if hasKey .Values.global.auth0 "enabled" }} + - name: USE_AUTH0 + value: "{{ .Values.global.auth0.enabled }}" + {{- end }} + {{- if .Values.global.auth.supportedScopes }} + - name: AUTH_SUPPORTED_SCOPES + value: "{{ .Values.global.auth.supportedScopes }}" + {{- end }} + {{- if .Values.global.managementApiEndpoint }} + - name: NETBIRD_MGMT_API_ENDPOINT + value: "{{ .Values.global.netbird.managementApiEndpoint }}" + {{- end }} + {{- if .Values.global.netbird.managementGrpcApiEndpoint }} + - name: NETBIRD_MGMT_GRPC_API_ENDPOINT + value: "{{ .Values.global.netbird.managementGrpcApiEndpoint }}" + {{- end }} + {{- if .Values.global.netbird.hotjarTrackId }} + - name: NETBIRD_HOTJAR_TRACK_ID + value: "{{ .Values.global.netbird.hotjarTrackId }}" + {{- end }} + {{- if .Values.global.netbird.googleAnalyticsId }} + - name: NETBIRD_GOOGLE_ANALYTICS_ID + value: "{{ .Values.global.netbird.googleAnalyticsId }}" + {{- end }} + {{- if .Values.global.netbird.tokenSource }} + - name: NETBIRD_TOKEN_SOURCE + value: "{{ .Values.global.netbird.tokenSource }}" + {{- end }} + {{- if .Values.global.netbird.dragQueryParams }} + - name: NETBIRD_DRAG_QUERY_PARAMS + value: "{{ .Values.global.netbird.dragQueryParams }}" + {{- end }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/netbird/charts/dashboard/templates/hpa.yaml b/charts/netbird/charts/dashboard/templates/hpa.yaml new file mode 100644 index 0000000..c5f6544 --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "dashboard.fullname" . }} + labels: + {{- include "dashboard.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "dashboard.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/netbird/charts/dashboard/templates/ingress.yaml b/charts/netbird/charts/dashboard/templates/ingress.yaml new file mode 100644 index 0000000..dc4cffc --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "dashboard.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "dashboard.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/netbird/charts/dashboard/templates/service.yaml b/charts/netbird/charts/dashboard/templates/service.yaml new file mode 100644 index 0000000..155124b --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "dashboard.fullname" . }} + labels: + {{- include "dashboard.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "dashboard.selectorLabels" . | nindent 4 }} diff --git a/charts/netbird/charts/dashboard/templates/serviceaccount.yaml b/charts/netbird/charts/dashboard/templates/serviceaccount.yaml new file mode 100644 index 0000000..41f2265 --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "dashboard.serviceAccountName" . }} + labels: + {{- include "dashboard.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/netbird/charts/dashboard/templates/tests/test-connection.yaml b/charts/netbird/charts/dashboard/templates/tests/test-connection.yaml new file mode 100644 index 0000000..90a22ee --- /dev/null +++ b/charts/netbird/charts/dashboard/templates/tests/test-connection.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "dashboard.fullname" . }}-test-connection" + labels: + {{- include "dashboard.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: wget + image: busybox + command: ['wget'] + args: ['{{ include "dashboard.fullname" . }}:{{ .Values.service.port }}'] + restartPolicy: Never diff --git a/charts/netbird/charts/dashboard/values.yaml b/charts/netbird/charts/dashboard/values.yaml new file mode 100644 index 0000000..d2cfe97 --- /dev/null +++ b/charts/netbird/charts/dashboard/values.yaml @@ -0,0 +1,103 @@ +# Default values for dashboard. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +global: + +replicaCount: 1 + +image: + repository: netbirdio/dashboard + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: false + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: + seccompProfile: + type: RuntimeDefault + +securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 10000 + runAsGroup: 10000 + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/netbird/charts/management/.helmignore b/charts/netbird/charts/management/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/netbird/charts/management/.helmignore @@ -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/ diff --git a/charts/netbird/charts/management/Chart.yaml b/charts/netbird/charts/management/Chart.yaml new file mode 100644 index 0000000..55dc477 --- /dev/null +++ b/charts/netbird/charts/management/Chart.yaml @@ -0,0 +1,27 @@ +apiVersion: v2 +name: management +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: 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.25.8" + +maintainers: + - name: ph1ll diff --git a/charts/netbird/charts/management/templates/NOTES.txt b/charts/netbird/charts/management/templates/NOTES.txt new file mode 100644 index 0000000..c57a367 --- /dev/null +++ b/charts/netbird/charts/management/templates/NOTES.txt @@ -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 "management.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 "management.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "management.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 "management.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 }} diff --git a/charts/netbird/charts/management/templates/_helpers.tpl b/charts/netbird/charts/management/templates/_helpers.tpl new file mode 100644 index 0000000..6641e86 --- /dev/null +++ b/charts/netbird/charts/management/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "management.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 "management.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 "management.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "management.labels" -}} +helm.sh/chart: {{ include "management.chart" . }} +{{ include "management.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "management.selectorLabels" -}} +app.kubernetes.io/name: {{ include "management.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "management.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "management.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/netbird/charts/management/templates/deployment.yaml b/charts/netbird/charts/management/templates/deployment.yaml new file mode 100644 index 0000000..c082b3c --- /dev/null +++ b/charts/netbird/charts/management/templates/deployment.yaml @@ -0,0 +1,83 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "management.fullname" . }} + labels: + {{- include "management.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "management.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "management.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "management.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - --log-file + - console + - --log-level + - {{ .Values.logLevel | default "info" }} + - --port + - {{ quote .Values.service.port }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + httpGet: + path: / + port: http + readinessProbe: + httpGet: + path: / + port: http + resources: + {{- toYaml .Values.resources | nindent 12 }} + volumeMounts: + - mountPath: /var/lib/netbird + name: data + volumes: + - name: data + {{- if .Values.persistentVolume.enabled }} + persistentVolumeClaim: + claimName: {{ include "management.fullname" . }}-data + {{- else }} + emptyDir: + medium: Memory + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/netbird/charts/management/templates/hpa.yaml b/charts/netbird/charts/management/templates/hpa.yaml new file mode 100644 index 0000000..9783458 --- /dev/null +++ b/charts/netbird/charts/management/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "management.fullname" . }} + labels: + {{- include "management.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "management.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/netbird/charts/management/templates/ingress-grpc.yaml b/charts/netbird/charts/management/templates/ingress-grpc.yaml new file mode 100644 index 0000000..1df55f4 --- /dev/null +++ b/charts/netbird/charts/management/templates/ingress-grpc.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.grpc.enabled -}} +{{- $fullName := include "management.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.grpc.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.grpc.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.grpc.annotations "kubernetes.io/ingress.class" .Values.ingress.grpc.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }}-grpc + labels: + {{- include "management.labels" . | nindent 4 }} + {{- with .Values.ingress.grpc.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.grpc.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.grpc.className }} + {{- end }} + {{- if .Values.ingress.grpc.tls }} + tls: + {{- range .Values.ingress.grpc.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.grpc.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/netbird/charts/management/templates/ingress-http.yaml b/charts/netbird/charts/management/templates/ingress-http.yaml new file mode 100644 index 0000000..c66a97d --- /dev/null +++ b/charts/netbird/charts/management/templates/ingress-http.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.http.enabled -}} +{{- $fullName := include "management.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.http.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.http.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.http.annotations "kubernetes.io/ingress.class" .Values.ingress.http.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }}-http + labels: + {{- include "management.labels" . | nindent 4 }} + {{- with .Values.ingress.http.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.http.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.http.className }} + {{- end }} + {{- if .Values.ingress.http.tls }} + tls: + {{- range .Values.ingress.http.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.http.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/netbird/charts/management/templates/pvc.yaml b/charts/netbird/charts/management/templates/pvc.yaml new file mode 100644 index 0000000..55fae55 --- /dev/null +++ b/charts/netbird/charts/management/templates/pvc.yaml @@ -0,0 +1,16 @@ +{{- if .Values.persistentVolume.enabled -}} +apiVersion: v1 +kind: PersistentVolumeClaim +metadata: + name: {{ include "management.fullname" . }}-data + labels: + {{- include "management.labels" . | nindent 4 }} +spec: + {{- with .Values.persistentVolume.accessModes }} + accessModes: + {{- toYaml . | nindent 4 }} + {{- end }} + resources: + requests: + storage: "{{ .Values.persistentVolume.size }}" +{{- end -}} diff --git a/charts/netbird/charts/management/templates/service.yaml b/charts/netbird/charts/management/templates/service.yaml new file mode 100644 index 0000000..b079201 --- /dev/null +++ b/charts/netbird/charts/management/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "management.fullname" . }} + labels: + {{- include "management.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + {{- include "management.selectorLabels" . | nindent 4 }} diff --git a/charts/netbird/charts/management/templates/serviceaccount.yaml b/charts/netbird/charts/management/templates/serviceaccount.yaml new file mode 100644 index 0000000..c21f635 --- /dev/null +++ b/charts/netbird/charts/management/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "management.serviceAccountName" . }} + labels: + {{- include "management.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/netbird/charts/management/templates/tests/test-connection.yaml b/charts/netbird/charts/management/templates/tests/test-connection.yaml new file mode 100644 index 0000000..1feac96 --- /dev/null +++ b/charts/netbird/charts/management/templates/tests/test-connection.yaml @@ -0,0 +1,61 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "management.fullname" . }}-test-connection" + labels: + {{- include "management.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: golang + image: golang + command: + - /bin/sh + args: + - -c + - | + cd /root + go mod init netbird-helm-chart/management-test + go get github.com/netbirdio/netbird/encryption@v{{ .Chart.AppVersion }} + go get github.com/netbirdio/netbird/management/client@v{{ .Chart.AppVersion }} + go get github.com/netbirdio/netbird/management/proto@v{{ .Chart.AppVersion }} + go get github.com/netbirdio/netbird/version@v{{ .Chart.AppVersion }} + cat < main.go + package main + + import ( + "context" + "fmt" + "os" + "golang.zx2c4.com/wireguard/wgctrl/wgtypes" + management "github.com/netbirdio/netbird/management/client" + managementProto "github.com/netbirdio/netbird/management/proto" + ) + + func main() { + key, err := wgtypes.GeneratePrivateKey() + if err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } + + ctx := context.Background() + + client, err := management.NewClient(ctx, "{{ include "management.fullname" . }}:{{ .Values.service.port }}", key, false) + if err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } + + if client.IsHealthy() { + fmt.Println("IsHealthy() reported success!") + os.Exit(0) + } else { + fmt.Println("IsHealthy() reported failure!") + os.Exit(1) + } + } + EOF + go run . + restartPolicy: Never diff --git a/charts/netbird/charts/management/values.yaml b/charts/netbird/charts/management/values.yaml new file mode 100644 index 0000000..f396aa9 --- /dev/null +++ b/charts/netbird/charts/management/values.yaml @@ -0,0 +1,119 @@ +# Default values for management. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +global: + +replicaCount: 1 + +image: + repository: netbirdio/management + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: false + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: + seccompProfile: + type: RuntimeDefault + +securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 10000 + runAsGroup: 10000 + +service: + type: ClusterIP + port: 8080 + +ingress: + http: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + grpc: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/netbird/charts/signal/.helmignore b/charts/netbird/charts/signal/.helmignore new file mode 100644 index 0000000..0e8a0eb --- /dev/null +++ b/charts/netbird/charts/signal/.helmignore @@ -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/ diff --git a/charts/netbird/charts/signal/Chart.yaml b/charts/netbird/charts/signal/Chart.yaml new file mode 100644 index 0000000..a9e494e --- /dev/null +++ b/charts/netbird/charts/signal/Chart.yaml @@ -0,0 +1,27 @@ +apiVersion: v2 +name: signal +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: 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.25.8" + +maintainers: + - name: ph1ll diff --git a/charts/netbird/charts/signal/templates/NOTES.txt b/charts/netbird/charts/signal/templates/NOTES.txt new file mode 100644 index 0000000..4e5af05 --- /dev/null +++ b/charts/netbird/charts/signal/templates/NOTES.txt @@ -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 "signal.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 "signal.fullname" . }}' + export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "signal.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 "signal.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 }} diff --git a/charts/netbird/charts/signal/templates/_helpers.tpl b/charts/netbird/charts/signal/templates/_helpers.tpl new file mode 100644 index 0000000..abd52db --- /dev/null +++ b/charts/netbird/charts/signal/templates/_helpers.tpl @@ -0,0 +1,62 @@ +{{/* +Expand the name of the chart. +*/}} +{{- define "signal.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 "signal.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 "signal.chart" -}} +{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} +{{- end }} + +{{/* +Common labels +*/}} +{{- define "signal.labels" -}} +helm.sh/chart: {{ include "signal.chart" . }} +{{ include "signal.selectorLabels" . }} +{{- if .Chart.AppVersion }} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + +{{/* +Selector labels +*/}} +{{- define "signal.selectorLabels" -}} +app.kubernetes.io/name: {{ include "signal.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + +{{/* +Create the name of the service account to use +*/}} +{{- define "signal.serviceAccountName" -}} +{{- if .Values.serviceAccount.create }} +{{- default (include "signal.fullname" .) .Values.serviceAccount.name }} +{{- else }} +{{- default "default" .Values.serviceAccount.name }} +{{- end }} +{{- end }} diff --git a/charts/netbird/charts/signal/templates/deployment.yaml b/charts/netbird/charts/signal/templates/deployment.yaml new file mode 100644 index 0000000..136356f --- /dev/null +++ b/charts/netbird/charts/signal/templates/deployment.yaml @@ -0,0 +1,77 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "signal.fullname" . }} + labels: + {{- include "signal.labels" . | nindent 4 }} +spec: + {{- if not .Values.autoscaling.enabled }} + replicas: {{ .Values.replicaCount }} + {{- end }} + selector: + matchLabels: + {{- include "signal.selectorLabels" . | nindent 6 }} + template: + metadata: + {{- with .Values.podAnnotations }} + annotations: + {{- toYaml . | nindent 8 }} + {{- end }} + labels: + {{- include "signal.labels" . | nindent 8 }} + {{- with .Values.podLabels }} + {{- toYaml . | nindent 8 }} + {{- end }} + spec: + {{- with .Values.imagePullSecrets }} + imagePullSecrets: + {{- toYaml . | nindent 8 }} + {{- end }} + serviceAccountName: {{ include "signal.serviceAccountName" . }} + securityContext: + {{- toYaml .Values.podSecurityContext | nindent 8 }} + containers: + - name: {{ .Chart.Name }} + securityContext: + {{- toYaml .Values.securityContext | nindent 12 }} + image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}" + imagePullPolicy: {{ .Values.image.pullPolicy }} + args: + - --log-file + - console + - --log-level + - {{ .Values.logLevel | default "info" }} + - --port + - {{ quote .Values.service.port }} + ports: + - name: http + containerPort: {{ .Values.service.port }} + protocol: TCP + livenessProbe: + tcpSocket: + port: {{ .Values.service.port }} + readinessProbe: + tcpSocket: + port: {{ .Values.service.port }} + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.volumeMounts }} + volumeMounts: + {{- toYaml . | nindent 12 }} + {{- end }} + {{- with .Values.volumes }} + volumes: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/charts/netbird/charts/signal/templates/hpa.yaml b/charts/netbird/charts/signal/templates/hpa.yaml new file mode 100644 index 0000000..d15e245 --- /dev/null +++ b/charts/netbird/charts/signal/templates/hpa.yaml @@ -0,0 +1,32 @@ +{{- if .Values.autoscaling.enabled }} +apiVersion: autoscaling/v2 +kind: HorizontalPodAutoscaler +metadata: + name: {{ include "signal.fullname" . }} + labels: + {{- include "signal.labels" . | nindent 4 }} +spec: + scaleTargetRef: + apiVersion: apps/v1 + kind: Deployment + name: {{ include "signal.fullname" . }} + minReplicas: {{ .Values.autoscaling.minReplicas }} + maxReplicas: {{ .Values.autoscaling.maxReplicas }} + metrics: + {{- if .Values.autoscaling.targetCPUUtilizationPercentage }} + - type: Resource + resource: + name: cpu + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetCPUUtilizationPercentage }} + {{- end }} + {{- if .Values.autoscaling.targetMemoryUtilizationPercentage }} + - type: Resource + resource: + name: memory + target: + type: Utilization + averageUtilization: {{ .Values.autoscaling.targetMemoryUtilizationPercentage }} + {{- end }} +{{- end }} diff --git a/charts/netbird/charts/signal/templates/ingress.yaml b/charts/netbird/charts/signal/templates/ingress.yaml new file mode 100644 index 0000000..b4edad5 --- /dev/null +++ b/charts/netbird/charts/signal/templates/ingress.yaml @@ -0,0 +1,61 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "signal.fullname" . -}} +{{- $svcPort := .Values.service.port -}} +{{- if and .Values.ingress.className (not (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion)) }} + {{- if not (hasKey .Values.ingress.annotations "kubernetes.io/ingress.class") }} + {{- $_ := set .Values.ingress.annotations "kubernetes.io/ingress.class" .Values.ingress.className}} + {{- end }} +{{- end }} +{{- if semverCompare ">=1.19-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1 +{{- else if semverCompare ">=1.14-0" .Capabilities.KubeVersion.GitVersion -}} +apiVersion: networking.k8s.io/v1beta1 +{{- else -}} +apiVersion: extensions/v1beta1 +{{- end }} +kind: Ingress +metadata: + name: {{ $fullName }} + labels: + {{- include "signal.labels" . | nindent 4 }} + {{- with .Values.ingress.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + {{- if and .Values.ingress.className (semverCompare ">=1.18-0" .Capabilities.KubeVersion.GitVersion) }} + ingressClassName: {{ .Values.ingress.className }} + {{- end }} + {{- if .Values.ingress.tls }} + tls: + {{- range .Values.ingress.tls }} + - hosts: + {{- range .hosts }} + - {{ . | quote }} + {{- end }} + secretName: {{ .secretName }} + {{- end }} + {{- end }} + rules: + {{- range .Values.ingress.hosts }} + - host: {{ .host | quote }} + http: + paths: + {{- range .paths }} + - path: {{ .path }} + {{- if and .pathType (semverCompare ">=1.18-0" $.Capabilities.KubeVersion.GitVersion) }} + pathType: {{ .pathType }} + {{- end }} + backend: + {{- if semverCompare ">=1.19-0" $.Capabilities.KubeVersion.GitVersion }} + service: + name: {{ $fullName }} + port: + number: {{ $svcPort }} + {{- else }} + serviceName: {{ $fullName }} + servicePort: {{ $svcPort }} + {{- end }} + {{- end }} + {{- end }} +{{- end }} diff --git a/charts/netbird/charts/signal/templates/service.yaml b/charts/netbird/charts/signal/templates/service.yaml new file mode 100644 index 0000000..b90c688 --- /dev/null +++ b/charts/netbird/charts/signal/templates/service.yaml @@ -0,0 +1,15 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "signal.fullname" . }} + labels: + {{- include "signal.labels" . | nindent 4 }} +spec: + type: {{ .Values.service.type }} + ports: + - port: {{ .Values.service.port }} + targetPort: {{ .Values.service.port }} + protocol: TCP + name: http + selector: + {{- include "signal.selectorLabels" . | nindent 4 }} diff --git a/charts/netbird/charts/signal/templates/serviceaccount.yaml b/charts/netbird/charts/signal/templates/serviceaccount.yaml new file mode 100644 index 0000000..cd33060 --- /dev/null +++ b/charts/netbird/charts/signal/templates/serviceaccount.yaml @@ -0,0 +1,13 @@ +{{- if .Values.serviceAccount.create -}} +apiVersion: v1 +kind: ServiceAccount +metadata: + name: {{ include "signal.serviceAccountName" . }} + labels: + {{- include "signal.labels" . | nindent 4 }} + {{- with .Values.serviceAccount.annotations }} + annotations: + {{- toYaml . | nindent 4 }} + {{- end }} +automountServiceAccountToken: {{ .Values.serviceAccount.automount }} +{{- end }} diff --git a/charts/netbird/charts/signal/templates/tests/test-connection.yaml b/charts/netbird/charts/signal/templates/tests/test-connection.yaml new file mode 100644 index 0000000..33fc2a8 --- /dev/null +++ b/charts/netbird/charts/signal/templates/tests/test-connection.yaml @@ -0,0 +1,72 @@ +apiVersion: v1 +kind: Pod +metadata: + name: "{{ include "signal.fullname" . }}-test-connection" + labels: + {{- include "signal.labels" . | nindent 4 }} + annotations: + "helm.sh/hook": test +spec: + containers: + - name: golang + image: golang + command: + - /bin/sh + args: + - -c + - | + cd /root + go mod init netbird-helm-chart/signal-test + go get github.com/netbirdio/netbird/encryption@v{{ .Chart.AppVersion }} + go get github.com/netbirdio/netbird/signal/client@v{{ .Chart.AppVersion }} + go get github.com/netbirdio/netbird/signal/proto@v{{ .Chart.AppVersion }} + go get github.com/netbirdio/netbird/version@v{{ .Chart.AppVersion }} + cat < main.go + package main + + import ( + "context" + "fmt" + "os" + "golang.zx2c4.com/wireguard/wgctrl/wgtypes" + signal "github.com/netbirdio/netbird/signal/client" + signalProto "github.com/netbirdio/netbird/signal/proto" + ) + + func main() { + key, err := wgtypes.GeneratePrivateKey() + if err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } + + ctx := context.Background() + + client, err := signal.NewClient(ctx, "{{ include "signal.fullname" . }}:{{ .Values.service.port }}", key, false) + if err != nil { + fmt.Fprintf(os.Stderr, "error: %v\n", err) + os.Exit(1) + } + + go func() { + err := client.Receive(func(msg *signalProto.Message) error { + return nil + }) + if err != nil { + return + } + }() + + client.WaitStreamConnected() + + if client.IsHealthy() { + fmt.Println("IsHealthy() reported success!") + os.Exit(0) + } else { + fmt.Println("IsHealthy() reported failure!") + os.Exit(1) + } + } + EOF + go run . + restartPolicy: Never diff --git a/charts/netbird/charts/signal/values.yaml b/charts/netbird/charts/signal/values.yaml new file mode 100644 index 0000000..cb6d278 --- /dev/null +++ b/charts/netbird/charts/signal/values.yaml @@ -0,0 +1,103 @@ +# Default values for signal. +# This is a YAML-formatted file. +# Declare variables to be passed into your templates. + +global: + +replicaCount: 1 + +image: + repository: netbirdio/signal + pullPolicy: IfNotPresent + # Overrides the image tag whose default is the chart appVersion. + tag: "" + +imagePullSecrets: [] +nameOverride: "" +fullnameOverride: "" + +serviceAccount: + # Specifies whether a service account should be created + create: false + # Automatically mount a ServiceAccount's API credentials? + automount: false + # Annotations to add to the service account + annotations: {} + # The name of the service account to use. + # If not set and create is true, a name is generated using the fullname template + name: "" + +podAnnotations: {} +podLabels: {} + +podSecurityContext: + seccompProfile: + type: RuntimeDefault + +securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - ALL + readOnlyRootFilesystem: true + runAsNonRoot: true + runAsUser: 10000 + runAsGroup: 10000 + +service: + type: ClusterIP + port: 8080 + +ingress: + enabled: false + className: "" + annotations: {} + # kubernetes.io/ingress.class: nginx + # kubernetes.io/tls-acme: "true" + hosts: + - host: chart-example.local + paths: + - path: / + pathType: ImplementationSpecific + tls: [] + # - secretName: chart-example-tls + # hosts: + # - chart-example.local + +resources: {} + # We usually recommend not to specify default resources and to leave this as a conscious + # choice for the user. This also increases chances charts run on environments with little + # resources, such as Minikube. If you do want to specify resources, uncomment the following + # lines, adjust them as necessary, and remove the curly braces after 'resources:'. + # limits: + # cpu: 100m + # memory: 128Mi + # requests: + # cpu: 100m + # memory: 128Mi + +autoscaling: + enabled: false + minReplicas: 1 + maxReplicas: 100 + targetCPUUtilizationPercentage: 80 + # targetMemoryUtilizationPercentage: 80 + +# Additional volumes on the output Deployment definition. +volumes: [] +# - name: foo +# secret: +# secretName: mysecret +# optional: false + +# Additional volumeMounts on the output Deployment definition. +volumeMounts: [] +# - name: foo +# mountPath: "/etc/foo" +# readOnly: true + +nodeSelector: {} + +tolerations: [] + +affinity: {} diff --git a/charts/netbird/templates/.gitkeep b/charts/netbird/templates/.gitkeep new file mode 100644 index 0000000..e69de29 diff --git a/charts/netbird/values.yaml b/charts/netbird/values.yaml new file mode 100644 index 0000000..ab95c09 --- /dev/null +++ b/charts/netbird/values.yaml @@ -0,0 +1,108 @@ +global: + auth0: + enabled: + domain: + clientId: + audience: + auth: + authority: + clientId: + clientSecret: + audience: + redirectUri: + silentRedirectUri: + supportedScopes: + netbird: + managementApiEndpoint: + managementGrpcApiEndpoint: + hotjarTrackId: + googleAnalyticsId: + tokenSource: + dragQueryParams: + + +dashboard: + enabled: false + ingress: + enabled: true + className: nginx + annotations: + cert-manager.io/cluster-issuer: letsencrypt + hosts: + - host: netbird.myorg.example + paths: + - path: / + pathType: Prefix + tls: + - secretName: netbird.myorg.example-tls + hosts: + - netbird.myorg.example + +management: + enabled: true + persistentVolume: + enabled: true + accessModes: + - ReadWriteOnce + size: 1Gi + ingress: + http: + enabled: true + className: nginx + annotations: + cert-manager.io/cluster-issuer: letsencrypt + hosts: + - host: netbird.myorg.example + paths: + - path: /api/ + pathType: Prefix + tls: + - secretName: netbird.myorg.example-tls + hosts: + - netbird.myorg.example + grpc: + enabled: true + className: nginx + annotations: + cert-manager.io/cluster-issuer: letsencrypt + nginx.ingress.kubernetes.io/backend-protocol: GRPC + nginx.ingress.kubernetes.io/configuration-snippet: | + grpc_ssl_verify off; + grpc_socket_keepalive on; + grpc_read_timeout 1d; + grpc_send_timeout 1d; + hosts: + - host: netbird.myorg.example + paths: + - path: /management.ManagementService/ + pathType: Prefix + tls: + - secretName: netbird.myorg.example-tls + hosts: + - netbird.myorg.example + +signal: + enabled: false + ingress: + enabled: true + className: nginx + annotations: + cert-manager.io/cluster-issuer: letsencrypt + nginx.ingress.kubernetes.io/backend-protocol: GRPC + nginx.ingress.kubernetes.io/configuration-snippet: | + grpc_ssl_verify off; + grpc_socket_keepalive on; + grpc_read_timeout 1d; + grpc_send_timeout 1d; + hosts: + - host: netbird.myorg.example + paths: + - path: /signalexchange.SignalExchange/ + pathType: Prefix + tls: + - secretName: netbird.myorg.example-tls + hosts: + - netbird.myorg.example + +coturn: + enabled: false diff --git a/ct.yaml b/ct.yaml new file mode 100644 index 0000000..c8681f7 --- /dev/null +++ b/ct.yaml @@ -0,0 +1,4 @@ +# See https://github.com/helm/chart-testing#configuration +remote: origin +chart-dirs: + - charts