-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #67 from nycmeshnet/james/admin-helm
Helm + deploy for admin map
- Loading branch information
Showing
10 changed files
with
309 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
name: Deploy Helm Chart | ||
permissions: read-all | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
environment: | ||
required: true | ||
type: string | ||
|
||
jobs: | ||
helm_deploy: | ||
name: Deploy helm chart | ||
environment: ${{ inputs.environment }} | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out the repo | ||
uses: actions/checkout@v4 | ||
|
||
- name: Install SSH key | ||
uses: shimataro/ssh-key-action@d4fffb50872869abe2d9a9098a6d9c5aa7d16be4 # v2 | ||
with: | ||
key: ${{ secrets.SSH_PRIVATE_KEY }} | ||
name: id_ed25519 # optional | ||
known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }} | ||
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail) | ||
|
||
- name: Setup WireGuard | ||
run: | | ||
sudo apt install wireguard | ||
echo "${{ secrets.WIREGUARD_PRIVATE_KEY }}" > privatekey | ||
sudo ip link add dev wg1 type wireguard | ||
sudo ip address add dev wg1 ${{ secrets.WIREGUARD_OVERLAY_NETWORK_IP }} peer ${{ secrets.SSH_TARGET_IP }} | ||
sudo wg set wg1 listen-port 48123 private-key privatekey peer ${{ secrets.WIREGUARD_PEER_PUBLIC_KEY }} allowed-ips 0.0.0.0/0 endpoint ${{ secrets.WIREGUARD_ENDPOINT }} | ||
sudo ip link set up dev wg1 | ||
- name: Install Helm Chart | ||
run: | | ||
scp ${{ secrets.SSH_USER }}@${{ secrets.SSH_TARGET_IP }}:~/.kube/config ./ | ||
helm upgrade \ | ||
adminmap \ | ||
./infra/admin-map \ | ||
--install \ | ||
--kubeconfig ./config \ | ||
--kube-apiserver https://${{ secrets.SSH_TARGET_IP }}:6443 \ | ||
-n ${{ vars.APP_NAMESPACE }} \ | ||
--create-namespace \ | ||
-f ./infra/admin-map/values.yaml \ | ||
--set adminmap.fqdn.legacy="${{ vars.ADMIN_FQDN_LEGACY }}" \ | ||
--set adminmap.fqdn="${{ vars.ADMIN_FQDN }}" | ||
# Rolling restart | ||
kubectl --kubeconfig ./config --server https://${{ secrets.SSH_TARGET_IP }}:6443 -n ${{ vars.APP_NAMESPACE }} rollout restart deploy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
apiVersion: v2 | ||
name: admin-map | ||
description: A Helm chart for Kubernetes | ||
|
||
type: application | ||
|
||
version: 0.1.0 | ||
|
||
appVersion: "1.16.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "admin-map.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 "admin-map.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 "admin-map.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "admin-map.labels" -}} | ||
helm.sh/chart: {{ include "admin-map.chart" . }} | ||
{{ include "admin-map.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "admin-map.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "admin-map.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "admin-map.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "admin-map.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "admin-map.fullname" . }} | ||
namespace: {{ .Values.adminmap_namespace }} | ||
labels: | ||
{{- include "admin-map.labels" . | nindent 4 }} | ||
spec: | ||
selector: | ||
matchLabels: | ||
{{- include "admin-map.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
app: adminmap | ||
{{- include "admin-map.labels" . | nindent 8 }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "{{ .Values.adminmap.image.repository }}:{{ .Values.adminmap.image.tag }}" | ||
imagePullPolicy: {{ .Values.adminmap.image.pullPolicy }} | ||
env: | ||
- name: NODE_ENV | ||
value: production | ||
ports: | ||
- name: http | ||
containerPort: {{ .Values.adminmap.port }} | ||
protocol: TCP | ||
# livenessProbe: | ||
# {{/* - toYaml .Values.livenessProbe | nindent 12 */}} | ||
# readinessProbe: | ||
# {{/* - toYaml .Values.readinessProbe | nindent 12 */}} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
name: {{ include "admin-map.fullname" . }} | ||
namespace: {{ .Values.adminmap_namespace }} | ||
labels: | ||
{{- include "admin-map.labels" . | nindent 4 }} | ||
spec: | ||
rules: | ||
- host: {{ .Values.adminmap.fqdn }} | ||
http: | ||
paths: | ||
- path: "/" | ||
pathType: ImplementationSpecific | ||
backend: | ||
service: | ||
name: {{ include "admin-map.fullname" . }} | ||
port: | ||
number: {{ .Values.adminmap.port }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "admin-map.fullname" . }} | ||
namespace: {{ .Values.adminmap_namespace }} | ||
labels: | ||
{{- include "admin-map.labels" . | nindent 4 }} | ||
spec: | ||
type: ClusterIP | ||
ports: | ||
- port: {{ .Values.adminmap.port }} | ||
targetPort: {{ .Values.adminmap.port }} | ||
protocol: TCP | ||
name: http | ||
selector: | ||
app: adminmap |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Default values for admin-map. | ||
# This is a YAML-formatted file. | ||
# Declare variables to be passed into your templates. | ||
|
||
replicaCount: 1 | ||
|
||
adminmap_namespace: "adminmap" | ||
|
||
adminmap: | ||
image: | ||
repository: willnilges/network-map | ||
tag: admin-helm | ||
pullPolicy: Always | ||
port: 3000 | ||
|
||
nameOverride: "" | ||
fullnameOverride: "" | ||
|
||
podAnnotations: {} | ||
podLabels: {} | ||
|
||
resources: | ||
limits: | ||
cpu: 512m | ||
memory: 256Mi | ||
requests: | ||
cpu: 256m | ||
memory: 128Mi | ||
|
||
livenessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
readinessProbe: | ||
httpGet: | ||
path: / | ||
port: http | ||
|
||
nodeSelector: {} | ||
|
||
tolerations: [] | ||
|
||
affinity: {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters