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

[node-app] Add ability to disable probes #43

Merged
merged 1 commit into from
Jan 14, 2024
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
2 changes: 1 addition & 1 deletion charts/node-app/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ apiVersion: v2
name: node-app
description: A generic helm chart for a node app, load code into pod with `kubectl cp <app code foder> <pod name>:/app`. will automatically load new changes
type: application
version: 0.2.0
version: 0.4.0
maintainers:
- name: bryopsida
7 changes: 4 additions & 3 deletions charts/node-app/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# node-app

![Version: 0.2.0](https://img.shields.io/badge/Version-0.2.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)
![Version: 0.4.0](https://img.shields.io/badge/Version-0.4.0-informational?style=flat-square) ![Type: application](https://img.shields.io/badge/Type-application-informational?style=flat-square)

A generic helm chart for a node app, load code into pod with `kubectl cp <app code foder> <pod name>:/app`. will automatically load new changes

Expand Down Expand Up @@ -34,7 +34,7 @@ A generic helm chart for a node app, load code into pod with `kubectl cp <app co
| image.repository | string | `"node"` | |
| image.tag | string | `"lts"` | |
| imagePullSecrets | list | `[]` | |
| initContainers[0] | object | `{"command":["node","/seed/seed.mjs"],"image":"node:lts","name":"seed-container","volumeMounts":[{"mountPath":"/seed","name":"seed"},{"mountPath":"/app","name":"app-code","subPath":"app-code"},{"mountPath":"/home/node/.npm","name":"npm-cache","subPath":"npm-cache"}]}` | seed container, this copies in the pacßkage.json, package-lock.json, and index.js to kick start server that passes health checks the intent is this can be changed live and persisted in the app-code pvc as you make changes through the dev side car, when you finish making changes for a cycle you can disable the dev side car. If the ability to rollback is important to you, use a storage system with snapshotting and rollback. |
| initContainers[0] | object | `{"command":["node","/seed/seed.mjs"],"image":"node:lts","name":"seed-container","securityContext":{"runAsUser":1000},"volumeMounts":[{"mountPath":"/seed","name":"seed"},{"mountPath":"/app","name":"app-code","subPath":"app-code"},{"mountPath":"/home/node/.npm","name":"npm-cache","subPath":"npm-cache"}]}` | seed container, this copies in the pacßkage.json, package-lock.json, and index.js to kick start server that passes health checks the intent is this can be changed live and persisted in the app-code pvc as you make changes through the dev side car, when you finish making changes for a cycle you can disable the dev side car. If the ability to rollback is important to you, use a storage system with snapshotting and rollback. |
| managedStorage | object | `{"app-code":{"size":"1Gi"},"dropbear":{"size":"256Mi"},"home":{"size":"10Gi"},"node-modules":{"size":"5Gi"},"npm-cache":{"size":"5Gi"}}` | Map of storage volumes managed by the helm release |
| managedStorage.app-code | object | `{"size":"1Gi"}` | PVC to hold application specific code |
| managedStorage.dropbear | object | `{"size":"256Mi"}` | PVC to persist dropbear config such as public keys |
Expand All @@ -46,7 +46,8 @@ A generic helm chart for a node app, load code into pod with `kubectl cp <app co
| nodeSelector | object | `{}` | Control what node(s) pods can be scheduled on |
| podAnnotations | object | `{}` | |
| podLabels | object | `{}` | |
| podSecurityContext | object | `{}` | |
| podSecurityContext.fsGroup | int | `1000` | |
| probesEnabled | bool | `true` | Toggle use of probes, if you plan on pausing/break pointing app server, you'll want to disable probes |
| replicaCount | int | `1` | |
| resources | object | `{}` | Set resource allocations for the service/app container |
| securityContext | object | `{"runAsNonRoot":true,"runAsUser":1000}` | Set security context settings for the service/app container |
Expand Down
2 changes: 2 additions & 0 deletions charts/node-app/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ spec:
- name: http
containerPort: {{ .Values.service.port }}
protocol: TCP
{{- if .Values.probesEnabled }}
livenessProbe:
httpGet:
path: /
Expand All @@ -62,6 +63,7 @@ spec:
httpGet:
path: /
port: http
{{- end }}
resources:
{{- toYaml .Values.resources | nindent 12 }}
{{- with .Values.volumeMounts }}
Expand Down
8 changes: 7 additions & 1 deletion charts/node-app/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,11 @@ serviceAccount:
podAnnotations: {}
podLabels: {}

podSecurityContext: {}
podSecurityContext:
fsGroup: 1000

# -- Toggle use of probes, if you plan on pausing/break pointing app server, you'll want to disable probes
probesEnabled: true

# -- Set security context settings for the service/app container
securityContext:
Expand Down Expand Up @@ -121,6 +125,8 @@ initContainers:
# system with snapshotting and rollback.
- name: seed-container
image: node:lts
securityContext:
runAsUser: 1000
volumeMounts:
- name: seed
mountPath: "/seed"
Expand Down