-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update k8s manifests to deploy the home app (#1037)
Add some k8s manifests so that we can deploy the new home app. I needed to add a second ingress file to handle rewriting the requests the app receives - in essence, I'm using Nginx to rewrite requests for `/mats-dev/` to `/`. There were some subtleties here with ingress preferring to match requests to paths with longer lengths & the regex capture groups Nginx rewrite-target needs artificially inflating the char "length" of the path. I've duplicated the changes to `gsl-dev` to the `local` setup as well. PR stacked on top of #1032
- Loading branch information
Showing
13 changed files
with
180 additions
and
3 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,27 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: home | ||
labels: | ||
app.kubernetes.io/name: home | ||
app.kubernetes.io/part-of: mats | ||
app.kubernetes.io/component: frontend | ||
app: home | ||
spec: | ||
replicas: 1 | ||
selector: | ||
matchLabels: | ||
app: home | ||
template: | ||
metadata: | ||
labels: | ||
app: home | ||
spec: | ||
containers: | ||
- name: home | ||
image: ghcr.io/noaa-gsl/mats/development/home:development | ||
ports: | ||
- containerPort: 8080 | ||
securityContext: | ||
allowPrivilegeEscalation: false | ||
|
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,3 @@ | ||
resources: | ||
- deployment.yaml | ||
- service.yaml |
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,15 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: home | ||
labels: | ||
app: home | ||
spec: | ||
selector: | ||
app: home | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
name: http | ||
type: ClusterIP |
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,28 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: home | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: home | ||
resources: | ||
requests: | ||
memory: "1Gi" | ||
cpu: "0.25" | ||
limits: | ||
memory: "8Gi" | ||
cpu: "4" | ||
volumeMounts: | ||
- name: home-settings-file | ||
mountPath: /app/settings.json | ||
subPath: settings.json | ||
readOnly: true | ||
imagePullPolicy: Always # Since we track a long-lived tag | ||
imagePullSecrets: | ||
- name: mats-ghcr | ||
volumes: | ||
- name: home-settings-file | ||
configMap: | ||
name: home-config |
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,14 @@ | ||
resources: | ||
- ../../../base/home | ||
|
||
patchesStrategicMerge: | ||
- deployment.yaml | ||
|
||
images: | ||
- name: ghcr.io/noaa-gsl/mats/development/home | ||
newTag: development | ||
|
||
configMapGenerator: | ||
- name: home-config | ||
files: | ||
- settings.json # Should mirror the appropriate settings.json file in mats-settings |
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,25 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
# Use nginx's rewrite-target to strip the path prefix before sending the request to the home service | ||
nginx.ingress.kubernetes.io/use-regex: "true" | ||
nginx.ingress.kubernetes.io/rewrite-target: /$1 | ||
name: mats-home | ||
namespace: mats-dev | ||
spec: | ||
rules: | ||
- host: apps-dev.gsd.esrl.noaa.gov | ||
http: | ||
paths: | ||
# Note - this rewrite rule can cause issues if the "path" with the regex capture group | ||
# for the nginx rewrite-target gets longer than the paths in ingress-mats.yaml. | ||
# This has happened before with the rule for `/mats-dev/ptype`. If multiple paths match, | ||
# Kubernetes will prefer the longer path. | ||
- path: /mats-dev/(.*) | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: home | ||
port: | ||
number: 80 |
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,28 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: home | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: home | ||
resources: | ||
requests: | ||
memory: "1Gi" | ||
cpu: "0.25" | ||
limits: | ||
memory: "8Gi" | ||
cpu: "4" | ||
volumeMounts: | ||
- name: home-settings-file | ||
mountPath: /app/settings.json | ||
subPath: settings.json | ||
readOnly: true | ||
imagePullPolicy: Always # Since we track a long-lived tag | ||
imagePullSecrets: | ||
- name: mats-ghcr | ||
volumes: | ||
- name: home-settings-file | ||
configMap: | ||
name: home-config |
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,14 @@ | ||
resources: | ||
- ../../../base/home | ||
|
||
patchesStrategicMerge: | ||
- deployment.yaml | ||
|
||
images: | ||
- name: ghcr.io/noaa-gsl/mats/development/home | ||
newTag: 1029-create-new-home-application | ||
|
||
configMapGenerator: | ||
- name: home-config | ||
files: | ||
- settings.json # Should mirror the appropriate settings.json file in mats-settings |
File renamed without changes.
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,20 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: Ingress | ||
metadata: | ||
annotations: | ||
traefik.ingress.kubernetes.io/router.entrypoints: web | ||
|
||
name: mats-home | ||
namespace: mats-dev | ||
spec: | ||
rules: | ||
- host: mats.127.0.0.1.nip.io | ||
http: | ||
paths: | ||
- path: / | ||
pathType: Prefix | ||
backend: | ||
service: | ||
name: home | ||
port: | ||
number: 80 |
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