Configure nginx ingress and routing

This commit is contained in:
Tobias Eidelpes 2021-06-16 22:21:15 +02:00
parent 391683831f
commit 4d30f79900
7 changed files with 27 additions and 15 deletions

View File

@ -6,7 +6,7 @@ WORKDIR /app
COPY . .
RUN npm ci && npm run build
RUN npm ci && npm run build -- --configuration=production
# Stage 2

View File

@ -5,7 +5,7 @@ import {environment} from '../../environments/environment';
@Injectable()
export class RestService {
private currentLocation = 'http://' + environment.location + ':' + environment.port + '/api/v1/resources/';
private currentLocation = environment.location + '/api/v1/resources/';
constructor(
private logger: NGXLogger,

View File

@ -2,7 +2,6 @@ import {NgxLoggerLevel} from 'ngx-logger';
export const environment = {
production: true,
location: 'xway',
port: 5004,
location: '/xway',
log_level: NgxLoggerLevel.WARN,
};

View File

@ -6,8 +6,7 @@ import {NgxLoggerLevel} from 'ngx-logger';
export const environment = {
production: false,
location: 'xway',
port: 5004,
location: 'http://xway:5004',
log_level: NgxLoggerLevel.DEBUG,
};

View File

@ -2,11 +2,26 @@ apiVersion: networking.k8s.io/v1
kind: Ingress
metadata:
name: dse2021-ingress
annotations:
kubernetes.io/ingress.class: "nginx"
nginx.ingress.kubernetes.io/add-base-url: "true"
nginx.ingress.kubernetes.io/rewrite-target: /$1
nginx.ingress.kubernetes.io/service-upstream: "true"
spec:
rules:
- host:
http:
paths:
- backend:
serviceName: controlcenter
servicePort: 80
- http:
paths:
- path: /(.+)
pathType: ImplementationSpecific
backend:
service:
name: controlcenter
port:
number: 80
- path: /xway/(.+)
pathType: ImplementationSpecific
backend:
service:
name: xway
port:
number: 5004

View File

@ -5,12 +5,10 @@ metadata:
labels:
app: controlcenter
spec:
type: NodePort
selector:
app: controlcenter
type: LoadBalancer
ports:
- name: "80"
port: 80
targetPort: 80
status:
loadBalancer: {}

View File

@ -5,6 +5,7 @@ metadata:
labels:
app: xway
spec:
type: NodePort
selector:
app: xway
ports: