Skip to content

Commit

Permalink
Merge pull request #149 from xenit-eu/XENOPS-1164
Browse files Browse the repository at this point in the history
[Xenops 1164] remove defaultbackend and replace with nginx-default
  • Loading branch information
gert-glassee authored May 13, 2024
2 parents 277f7ab + 427016c commit f18fdae
Show file tree
Hide file tree
Showing 8 changed files with 63 additions and 46 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
chronology things are added/fixed/changed and - where possible - links to the PRs involved.

### Changes
[XENOPS-1164] date: 10 May 2024
* remove defaultBackend from ingress rules, this should not be set by individual namespace resources
* defaultBackend will point to new nginx-default-service providing 404 if page not found.
* defaultBackend will be mapped to default ingress root path for the alfresco host only



[XENOPS-1161]
* change liveness probe threshold to trigger after readiness probe failure to avoid looping restarts on slow systems

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ For more information take a look at
* Required: false
* Default: None
* Remark: Do not use this to set the root`/` path, that should be set by the defaultBackend
* Example:
```yaml
Expand All @@ -274,7 +275,7 @@ For more information take a look at
#### `ingress.defaultBackend.service`

* Required: true
* Default: acs-service
* Default: nginx-default-service
* Description: the default service name that ingress will point to

#### `ingress.defaultBackend.port`
Expand All @@ -288,6 +289,8 @@ For more information take a look at
* Required: false
* Default: `true`
* Description: Enable 403 handler for alfresco api solr endpoints


#### `ingress.blockAcsSolrApi.paths`

* Required: false
Expand Down
16 changes: 10 additions & 6 deletions xenit-alfresco/templates/ingress/alfresco-ingress.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,19 @@ spec:
# Provide a unique secret to store the SSL credentials
secretName: tls-alfresco-{{ .Release.Name }}-secret
{{- end }}
defaultBackend:
service:
name: {{ .Values.ingress.defaultBackend.service }}
port:
number: {{ .Values.ingress.defaultBackend.port }}
rules:
- host: {{ required "A host where your alfresco services can be reached on must be specified in values.ingress.host" .Values.ingress.host }}
http:
paths:
{{- if .Values.ingress.defaultBackend }}
- path: /
pathType: Prefix
backend:
service:
name: {{ .Values.ingress.defaultBackend.service }}
port:
number: {{ .Values.ingress.defaultBackend.port }}
{{- end }}
{{- if .Values.acs.ingress.enabled }}
- path: /alfresco
pathType: Prefix
Expand Down Expand Up @@ -71,7 +75,7 @@ spec:
pathType: Prefix
backend:
service:
name: nginx-403-service
name: nginx-default-service
port:
number: 30403
{{- end }}
Expand Down
26 changes: 0 additions & 26 deletions xenit-alfresco/templates/ingress/nginx-403-config.yaml

This file was deleted.

33 changes: 33 additions & 0 deletions xenit-alfresco/templates/ingress/nginx-default-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: nginx-default-configmap
namespace: {{ .Release.Namespace | quote }}
labels:
app: nginx-default
data:
nginx.conf: |
worker_processes 1;
events {
worker_connections 1024;
}
http{
log_format xenit_json escape=json '{ "time":"$time_iso8601","timestamp":$msec,"responseStatus":$status,"type":"access","requestTime":"$request_time","requestMethod":"$request_method","remoteAddr":"$remote_addr","requestUri":"$request" }';
access_log /var/log/nginx/access.log xenit_json;
server {
listen 80;
server_name _;
{{- if .Values.ingress.blockAcsSolrApi.enabled -}}
{{- range $.Values.ingress.blockAcsSolrApi.paths }}
location {{ . }} {
return 403 'Forbidden';
}
{{- end }}
{{- end }}
location / {
return 404 'Sorry, this page is not served here.';
}
}
}
Original file line number Diff line number Diff line change
@@ -1,20 +1,19 @@
{{- if .Values.ingress.blockAcsSolrApi.enabled -}}
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-403
name: nginx-default
namespace: {{ .Release.Namespace | quote }}
labels:
app: nginx-403
app: nginx-default
spec:
replicas: 1
selector:
matchLabels:
app: nginx-403
app: nginx-default
template:
metadata:
labels:
app: nginx-403
app: nginx-default
spec:
containers:
- name: nginx
Expand All @@ -28,5 +27,4 @@ spec:
volumes:
- name: config-volume
configMap:
name: nginx-403-configmap
{{- end }}
name: nginx-default-configmap
Original file line number Diff line number Diff line change
@@ -1,17 +1,15 @@
{{- if .Values.ingress.blockAcsSolrApi.enabled -}}
apiVersion: v1
kind: Service
metadata:
name: nginx-403-service
name: nginx-default-service
namespace: {{ .Release.Namespace | quote }}
spec:
{{- if .Values.general.serviceType }}
type: {{ .Values.general.serviceType }}
{{- end }}
selector:
app: nginx-403
app: nginx-default
ports:
- port: 30403
targetPort: 80
protocol: TCP
{{- end }}
4 changes: 2 additions & 2 deletions xenit-alfresco/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ ingress:
kubernetes.io/ingress.class: "nginx"
cert-manager.io/cluster-issuer: "letsencrypt-production"
defaultBackend:
service: acs-service
port: 30000
service: nginx-default-service
port: 30403
blockAcsSolrApi:
enabled: true
paths:
Expand Down

0 comments on commit f18fdae

Please sign in to comment.