From 7f57bed91fa09469536e48aa22110f9cae087d5c Mon Sep 17 00:00:00 2001 From: ranchodeluxe Date: Fri, 21 Jul 2023 20:08:56 -0700 Subject: [PATCH 1/2] root path HTML --- helm-chart/eoapi/CHANGELOG.md | 9 ++++++ helm-chart/eoapi/Chart.yaml | 4 +-- .../eoapi/templates/services/configmap.yaml | 20 +++++++++++++ .../eoapi/templates/services/deployment.yaml | 29 +++++++++++++++++++ .../templates/services/ingress-nginx.yaml | 9 +++++- .../eoapi/templates/services/service.yaml | 13 +++++++++ 6 files changed, 81 insertions(+), 3 deletions(-) create mode 100644 helm-chart/eoapi/CHANGELOG.md diff --git a/helm-chart/eoapi/CHANGELOG.md b/helm-chart/eoapi/CHANGELOG.md new file mode 100644 index 00000000..1e120d48 --- /dev/null +++ b/helm-chart/eoapi/CHANGELOG.md @@ -0,0 +1,9 @@ +version numbers below correspond to helm chart `appVersion`: see ./helm-chart/eoapi/Chart.yaml +--- +# 0.1.1 (2023-07-21) + +* For the shared-nginx ingress option [add root path with docs](https://github.com/developmentseed/eoapi-k8s/issues/18) pointing to path rewrites + +# 0.1.0 (2023-07-01) + +* Adds basic AWS EKS services with ALB and NLB options diff --git a/helm-chart/eoapi/Chart.yaml b/helm-chart/eoapi/Chart.yaml index 10fadc15..fddfa12f 100644 --- a/helm-chart/eoapi/Chart.yaml +++ b/helm-chart/eoapi/Chart.yaml @@ -17,10 +17,10 @@ kubeVersion: ">=1.23.0-0" # 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.2" +version: "0.1.3" # 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.1.0" +appVersion: "0.1.1" diff --git a/helm-chart/eoapi/templates/services/configmap.yaml b/helm-chart/eoapi/templates/services/configmap.yaml index 96fe1f26..b4ae6074 100644 --- a/helm-chart/eoapi/templates/services/configmap.yaml +++ b/helm-chart/eoapi/templates/services/configmap.yaml @@ -16,3 +16,23 @@ data: {{- end }} {{/* END: range $serviceName, $v := .Values*/}} {{- end }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-root-html +data: + index.html: | + + + eoAPI + + +

This is the root path /

+

Your service configuration is using ingress-nginx with path rewrites. So use these paths for each service:

+ + + diff --git a/helm-chart/eoapi/templates/services/deployment.yaml b/helm-chart/eoapi/templates/services/deployment.yaml index 3264617b..52374717 100644 --- a/helm-chart/eoapi/templates/services/deployment.yaml +++ b/helm-chart/eoapi/templates/services/deployment.yaml @@ -68,3 +68,32 @@ spec: {{- end }} {{/* END: range $serviceName, $v := .Values*/}} {{- end }} +{{- if (and (.Values.ingress.className) (eq .Values.ingress.className "nginx")) }} +apiVersion: apps/v1 +kind: Deployment +metadata: + name: doc-server +spec: + replicas: 1 + selector: + matchLabels: + app: doc-server + template: + metadata: + labels: + app: doc-server + spec: + containers: + - name: doc-server + image: nginx:alpine + volumeMounts: + - name: doc-html + mountPath: /usr/share/nginx/html + ports: + - containerPort: 80 + volumes: + - name: doc-html + configMap: + name: nginx-root-html +{{- end }} + diff --git a/helm-chart/eoapi/templates/services/ingress-nginx.yaml b/helm-chart/eoapi/templates/services/ingress-nginx.yaml index 3bc1fe94..bc4af9d4 100644 --- a/helm-chart/eoapi/templates/services/ingress-nginx.yaml +++ b/helm-chart/eoapi/templates/services/ingress-nginx.yaml @@ -33,6 +33,13 @@ spec: {{- end }}{{/* END: if index $v "enabled" */}} {{- end }}{{/* END: if (or (eq $serviceName "raster") (eq $serviceName "stac") (eq $serviceName "vector")) */}} {{- end }}{{/* END: range $serviceName, $v := .Values*/}} + - pathType: Prefix + path: /(/|$) + backend: + service: + name: doc-server + port: + number: 80 --- -{{/* END: if .Values.ingress.className "alb" */}} +{{/* END: if .Values.ingress.className "nginx" */}} {{- end }} \ No newline at end of file diff --git a/helm-chart/eoapi/templates/services/service.yaml b/helm-chart/eoapi/templates/services/service.yaml index d3984872..6d10dd31 100644 --- a/helm-chart/eoapi/templates/services/service.yaml +++ b/helm-chart/eoapi/templates/services/service.yaml @@ -28,3 +28,16 @@ spec: {{- end }} {{/* END: range $serviceName, $v := .Values*/}} {{- end }} +{{- if (and (.Values.ingress.className) (eq .Values.ingress.className "nginx")) }} +apiVersion: v1 +kind: Service +metadata: + name: doc-server +spec: + selector: + app: doc-server + ports: + - protocol: TCP + port: 80 + targetPort: 80 +{{- end }} From 9c47c9fc76936fd2dcb37c0125c9f748a3fec9f2 Mon Sep 17 00:00:00 2001 From: ranchodeluxe Date: Sat, 22 Jul 2023 05:15:41 -0700 Subject: [PATCH 2/2] break out separately so tests don't fail --- .../eoapi/templates/services/configmap.yaml | 20 ------ .../eoapi/templates/services/deployment.yaml | 29 --------- .../templates/services/nginx-doc-server.yaml | 62 +++++++++++++++++++ .../eoapi/templates/services/service.yaml | 13 ---- 4 files changed, 62 insertions(+), 62 deletions(-) create mode 100644 helm-chart/eoapi/templates/services/nginx-doc-server.yaml diff --git a/helm-chart/eoapi/templates/services/configmap.yaml b/helm-chart/eoapi/templates/services/configmap.yaml index b4ae6074..96fe1f26 100644 --- a/helm-chart/eoapi/templates/services/configmap.yaml +++ b/helm-chart/eoapi/templates/services/configmap.yaml @@ -16,23 +16,3 @@ data: {{- end }} {{/* END: range $serviceName, $v := .Values*/}} {{- end }} -apiVersion: v1 -kind: ConfigMap -metadata: - name: nginx-root-html -data: - index.html: | - - - eoAPI - - -

This is the root path /

-

Your service configuration is using ingress-nginx with path rewrites. So use these paths for each service:

- - - diff --git a/helm-chart/eoapi/templates/services/deployment.yaml b/helm-chart/eoapi/templates/services/deployment.yaml index 52374717..3264617b 100644 --- a/helm-chart/eoapi/templates/services/deployment.yaml +++ b/helm-chart/eoapi/templates/services/deployment.yaml @@ -68,32 +68,3 @@ spec: {{- end }} {{/* END: range $serviceName, $v := .Values*/}} {{- end }} -{{- if (and (.Values.ingress.className) (eq .Values.ingress.className "nginx")) }} -apiVersion: apps/v1 -kind: Deployment -metadata: - name: doc-server -spec: - replicas: 1 - selector: - matchLabels: - app: doc-server - template: - metadata: - labels: - app: doc-server - spec: - containers: - - name: doc-server - image: nginx:alpine - volumeMounts: - - name: doc-html - mountPath: /usr/share/nginx/html - ports: - - containerPort: 80 - volumes: - - name: doc-html - configMap: - name: nginx-root-html -{{- end }} - diff --git a/helm-chart/eoapi/templates/services/nginx-doc-server.yaml b/helm-chart/eoapi/templates/services/nginx-doc-server.yaml new file mode 100644 index 00000000..e13737ac --- /dev/null +++ b/helm-chart/eoapi/templates/services/nginx-doc-server.yaml @@ -0,0 +1,62 @@ +{{- if (and (.Values.ingress.className) (eq .Values.ingress.className "nginx")) }} +apiVersion: v1 +kind: ConfigMap +metadata: + name: nginx-root-html +data: + index.html: | + + + eoAPI + + +

This is the root path /

+

Your service configuration is using ingress-nginx with path rewrites. So use these paths for each service:

+ + + +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: doc-server +spec: + replicas: 1 + selector: + matchLabels: + app: doc-server + template: + metadata: + labels: + app: doc-server + spec: + containers: + - name: doc-server + image: nginx:alpine + volumeMounts: + - name: doc-html + mountPath: /usr/share/nginx/html + ports: + - containerPort: 80 + volumes: + - name: doc-html + configMap: + name: nginx-root-html +--- +apiVersion: v1 +kind: Service +metadata: + name: doc-server +spec: + selector: + app: doc-server + ports: + - protocol: TCP + port: 80 + targetPort: 80 +--- +{{- end }} \ No newline at end of file diff --git a/helm-chart/eoapi/templates/services/service.yaml b/helm-chart/eoapi/templates/services/service.yaml index 6d10dd31..d3984872 100644 --- a/helm-chart/eoapi/templates/services/service.yaml +++ b/helm-chart/eoapi/templates/services/service.yaml @@ -28,16 +28,3 @@ spec: {{- end }} {{/* END: range $serviceName, $v := .Values*/}} {{- end }} -{{- if (and (.Values.ingress.className) (eq .Values.ingress.className "nginx")) }} -apiVersion: v1 -kind: Service -metadata: - name: doc-server -spec: - selector: - app: doc-server - ports: - - protocol: TCP - port: 80 - targetPort: 80 -{{- end }}