diff --git a/.azure/pipelines/Phonebook.preview.yml b/.azure/pipelines/Phonebook.preview.yml index b162bdefc..498ae7704 100644 --- a/.azure/pipelines/Phonebook.preview.yml +++ b/.azure/pipelines/Phonebook.preview.yml @@ -156,6 +156,15 @@ jobs: namespace: $(image_tag) steps: - checkout: none + - task: HelmInstaller@1 + displayName: 'Install Helm 2.14.2' + inputs: + helmVersionToInstall: 2.14.2 + - task: HelmDeploy@0 + inputs: + connectionType: 'None' + command: 'delete' + arguments: 'phonebook-$(namespace)' - task: Kubernetes@1 displayName: 'Delete Namespace' inputs: diff --git a/Phonebook/local-values.yml b/Phonebook/local-values.yml new file mode 100644 index 000000000..aa6200c9b --- /dev/null +++ b/Phonebook/local-values.yml @@ -0,0 +1,39 @@ +host: &host "demo-phonebook.local" +contactUrl: "https://github.com/T-Systems-MMS/phonebook/issues" +roomPlanningToolUrl: null +contactEmail: &contactEmail "phonebook-t-systems-mms@mg.telekom.de" +ravenUrl: null +employeePictureEndpoint: null +assetsEndpoint: "https://demo-phonebook.local/assets" +environment: "development" +environmentTag: "dev" +rocketChatUrl: "https://open.rocket.chat" + +frontend: + replicaCount: 1 + +source: + peoplesoft: + replicaCount: 1 + environment: Development + +traefik: + enabled: true + startupArguments: + - "" + dashboard: + enabled: true + domain: board.demo-phonebook.local + ingress: + annotations: + traefik.frontend.priority: "100" + + ssl: + enabled: true + enforced: true + rbac: + enabled: true + kubernetes: + namespaces: + - kube-public + - default diff --git a/Phonebook/phonebook/requirements.lock b/Phonebook/phonebook/requirements.lock index 4f017d5ae..0bb16a8c6 100644 --- a/Phonebook/phonebook/requirements.lock +++ b/Phonebook/phonebook/requirements.lock @@ -1,6 +1,6 @@ dependencies: -- name: traefik - repository: https://kubernetes-charts.storage.googleapis.com - version: 1.78.4 -digest: sha256:c389e7cea35c8eb944d23340716cefac726a8dcf7dc1e76fd4338b619383899f -generated: "2019-10-21T22:00:43.8811404+02:00" + - name: traefik + repository: https://kubernetes-charts.storage.googleapis.com + version: 1.86.2 +digest: sha256:6a6097b475625d15d6e156f79ec0950f5a850ae13b3dd7463c75e39526b6bc14 +generated: "2020-04-10T21:54:06.4266672+02:00" diff --git a/Phonebook/phonebook/templates/frontend-ingress.yaml b/Phonebook/phonebook/templates/frontend-ingress.yaml index dcbb53c09..b06fc5029 100644 --- a/Phonebook/phonebook/templates/frontend-ingress.yaml +++ b/Phonebook/phonebook/templates/frontend-ingress.yaml @@ -1,6 +1,6 @@ {{- if .Values.ingress.enabled -}} {{- $fullName := include "phonebook.fullname" . -}} -apiVersion: extensions/v1beta1 +apiVersion: networking.k8s.io/v1beta1 kind: Ingress metadata: name: {{ $fullName }} @@ -9,8 +9,10 @@ metadata: helm.sh/chart: {{ include "phonebook.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} - {{- with .Values.ingress.annotations }} annotations: + kubernetes.io/ingress.class: traefik + traefik.frontend.priority: '10' + {{- with .Values.ingress.annotations }} {{- toYaml . | nindent 4 }} {{- end }} spec: diff --git a/Phonebook/phonebook/templates/frontend-service.yaml b/Phonebook/phonebook/templates/frontend-service.yaml index d930f2b02..85d4d4c51 100644 --- a/Phonebook/phonebook/templates/frontend-service.yaml +++ b/Phonebook/phonebook/templates/frontend-service.yaml @@ -7,8 +7,6 @@ metadata: helm.sh/chart: {{ include "phonebook.chart" . }} app.kubernetes.io/instance: {{ .Release.Name }} app.kubernetes.io/managed-by: {{ .Release.Service }} - annotations: - kubernetes.io/ingress.class: traefik spec: type: {{ .Values.frontend.service.type }} ports: diff --git a/Phonebook/phonebook/templates/source-peoplesoft-deployment.yaml b/Phonebook/phonebook/templates/source-peoplesoft-deployment.yaml new file mode 100644 index 000000000..e2b6e382e --- /dev/null +++ b/Phonebook/phonebook/templates/source-peoplesoft-deployment.yaml @@ -0,0 +1,60 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: {{ include "phonebook.fullname" . }}-peoplesoft + labels: + app.kubernetes.io/name: {{ include "phonebook.name" . }}-peoplesoft + helm.sh/chart: {{ include "phonebook.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + replicas: {{ .Values.source.peoplesoft.replicaCount }} + selector: + matchLabels: + app.kubernetes.io/name: {{ include "phonebook.name" . }}-peoplesoft + app.kubernetes.io/instance: {{ .Release.Name }} + template: + metadata: + labels: + app.kubernetes.io/name: {{ include "phonebook.name" . }}-peoplesoft + app.kubernetes.io/instance: {{ .Release.Name }} + spec: + nodeSelector: + 'beta.kubernetes.io/os': linux + containers: + - name: {{ .Chart.Name }}-{{ .Values.source.peoplesoft.name }}-peoplesoft + image: "{{ .Values.source.peoplesoft.image.repository }}/{{ .Values.source.peoplesoft.image.name}}:{{ .Values.source.peoplesoft.image.tag }}" + imagePullPolicy: {{ .Values.source.peoplesoft.image.pullPolicy }} + ports: + - name: http + containerPort: 80 + protocol: TCP + # TODO: use when issue #594 is resolved + # livenessProbe: + # httpGet: + # path: /health + # port: http + # initialDelaySeconds: 6 + # readinessProbe: + # httpGet: + # path: /health + # port: http + # initialDelaySeconds: 6 + env: + - name: ASPNETCORE_ENVIRONMENT + value: "{{ .Values.source.peoplesoft.environment }}" + # See more in Doku https://t-systems-mms.github.io/phonebook/pages/development-guides/backend/getting-started + resources: + {{- toYaml .Values.resources | nindent 12 }} + {{- with .Values.nodeSelector }} + nodeSelector: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.affinity }} + affinity: + {{- toYaml . | nindent 8 }} + {{- end }} + {{- with .Values.tolerations }} + tolerations: + {{- toYaml . | nindent 8 }} + {{- end }} diff --git a/Phonebook/phonebook/templates/source-peoplesoft-ingress.yaml b/Phonebook/phonebook/templates/source-peoplesoft-ingress.yaml new file mode 100644 index 000000000..058e08c6b --- /dev/null +++ b/Phonebook/phonebook/templates/source-peoplesoft-ingress.yaml @@ -0,0 +1,27 @@ +{{- if .Values.ingress.enabled -}} +{{- $fullName := include "phonebook.fullname" . -}} +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: {{ $fullName }}-peoplesoft + labels: + app.kubernetes.io/name: {{ include "phonebook.name" . }}-peoplesoft + helm.sh/chart: {{ include "phonebook.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} + annotations: + kubernetes.io/ingress.class: traefik + traefik.frontend.priority: '50' + {{- with .Values.ingress.annotations }} + {{- toYaml . | nindent 4 }} + {{- end }} +spec: + rules: + - host: {{ .Values.host }} + http: + paths: + - path: /api + backend: + serviceName: {{ $fullName }}-peoplesoft + servicePort: http +{{- end }} diff --git a/Phonebook/phonebook/templates/source-peoplesoft-service.yaml b/Phonebook/phonebook/templates/source-peoplesoft-service.yaml new file mode 100644 index 000000000..9ee613a75 --- /dev/null +++ b/Phonebook/phonebook/templates/source-peoplesoft-service.yaml @@ -0,0 +1,19 @@ +apiVersion: v1 +kind: Service +metadata: + name: {{ include "phonebook.fullname" . }}-peoplesoft + labels: + app.kubernetes.io/name: {{ include "phonebook.name" . }} + helm.sh/chart: {{ include "phonebook.chart" . }} + app.kubernetes.io/instance: {{ .Release.Name }} + app.kubernetes.io/managed-by: {{ .Release.Service }} +spec: + type: {{ .Values.source.peoplesoft.service.type }} + ports: + - port: {{ .Values.source.peoplesoft.service.port }} + targetPort: http + protocol: TCP + name: http + selector: + app.kubernetes.io/name: {{ include "phonebook.name" . }}-peoplesoft + app.kubernetes.io/instance: {{ .Release.Name }} diff --git a/Phonebook/phonebook/values.yaml b/Phonebook/phonebook/values.yaml index 449f9fcfa..8b7213502 100644 --- a/Phonebook/phonebook/values.yaml +++ b/Phonebook/phonebook/values.yaml @@ -2,6 +2,7 @@ # General Variables host: &host 'localhost' +environment: 'production' # Frontend Variables frontend: @@ -9,24 +10,37 @@ frontend: image: repository: tsystemsmms name: phonebook-frontend - tag: 1.22.3 + tag: 1.41.0 pullPolicy: Always replicaCount: 3 service: type: ClusterIP port: 80 +source: + peoplesoft: + name: source-peoplesoft + environment: Live + image: + repository: tsystemsmms + # TODO: Change to new image + name: phonebook-source-peoplesoft + tag: latest + pullPolicy: Always + replicaCount: 3 + service: + type: ClusterIP + port: 80 + ingress: enabled: true - annotations: - {} - + annotations: {} -# Traefik Configuration +# Traefik Configuration traefik: enabled: true startupArguments: - - '' + - "" ssl: enabled: true enforced: true diff --git a/Phonebook/readme.md b/Phonebook/readme.md index ab6d723c6..ed9aed15f 100644 --- a/Phonebook/readme.md +++ b/Phonebook/readme.md @@ -1,7 +1,7 @@ # Phonebook Application The Deployment Guide for the Phonebook. -We use [traefik](https://traefik.io/) under the hood. +We use [traefik](https://traefik.io/) under the hood. ## Deployment @@ -11,17 +11,17 @@ We use [traefik](https://traefik.io/) under the hood. 1. Create your `values.yml`. For settings look [here](#Settings). - ```yml - # Minimal Working Example - host: &host 'example.com' - contactUrl: '' - roomPlanningToolUrl: '' - contactEmail: &contactEmail '' - employeePictureEndpoint: '' - assetsEndpoint: '' - ``` + ```yml + # Minimal Working Example + host: &host 'example.com' + contactUrl: '' + roomPlanningToolUrl: '' + contactEmail: &contactEmail '' + employeePictureEndpoint: '' + assetsEndpoint: '' + ``` - For a more complete Example have a look at our demo [values.yml](../demo/values.yml). + For a more complete Example have a look at our demo [values.yml](../demo/values.yml). 2. Install your Phonebook application by running `helm install --values ./path/to/your/values.yml https://github.com/T-Systems-MMS/phonebook/releases/download//phonebook.tgz` @@ -37,10 +37,10 @@ If you install into a different namespace than `kube-public` please be sure to a | `environment` | Yes | Determines the Environment the application is running in. Possible values: `development`, `preview`, `production`. Read more [here](..\Phonebook.Frontend\src\environments\EnvironmentInterfaces.ts) | `development` | `production` | | `environmentTag` | Yes | The tag that will be displayed alongside the title of the page. Can be any string. | Depends on the environment: `development` - `dev`, `preview`- `preview`, `production` - none | `demo-label` | | `contactUrl` | Yes | The contact Url used for private Feedback throughout the app | none | `https://github.com/T-Systems-MMS/phonebook/issues` | -| `roomPlanningToolUrl` | No | If you are using a Room Planning Tool you can provide a link here. | none | `https://room.tool.com` | +| `roomPlanningToolUrl` | No | If you are using a Room Planning Tool you can provide a link here. | none | `https://room.tool.com` | | `contactEmail` | Yes | Provide a contact Email for your users. | none | `help@here.com` | | `ravenUrl` | No | If you want to collect Bug Reports automatically you can setup a [Sentry](https://sentry.io/) Instance provide the link for Raven through this parameter. | none | `https://@sentry.io/` | -| `employeePictureEnpoint` | No | Provide an Endpoint for the pictures of you users. | none | `https://employee.pictures.com` | +| `employeePictureEnpoint` | No | Provide an Endpoint for the pictures of you users. | none | `https://employee.pictures.com` | | `assetsEndpoint` | Yes | Provide an Endpoint for the assets (roomplans, pictures of Building). | none | `https://assets.company.com` | | `rocketChatUrl` | No | Add a direct link from the user profile to [RocketChat](https://rocket.chat/). (Linked by `person.Id`) | none | `https://rocketchat.yourcompany.com` | @@ -63,4 +63,10 @@ helm delete ## Development -Execute `helm install --dry-run --debug` +You need `helm2` and a running kubernetes cluster. + +1. Add `phonebook-demo.local` to your hosts, pointing to `localhost` (127.0.0.1). +2. cd into the `/Phonebook` Folder +3. `helm install -f ./local-values.yml -n phonebook .\phonebook\` + +Debug: `helm install --dry-run --debug -n phonebook .\phonebook\` diff --git a/demo/assets/Dockerfile b/demo/assets/Dockerfile index bcd01b46f..713040329 100644 --- a/demo/assets/Dockerfile +++ b/demo/assets/Dockerfile @@ -8,4 +8,4 @@ COPY ./nginx/ ./ RUN rm -r /usr/share/nginx/html/* COPY ./assets /usr/share/nginx/html -CMD ["nginx"] \ No newline at end of file +CMD ["nginx"] diff --git a/demo/values.yml b/demo/values.yml index dcc6ca55f..aede101ee 100644 --- a/demo/values.yml +++ b/demo/values.yml @@ -1,22 +1,27 @@ -# Default values for phonebook. +# Demo values for phonebook. # This is a YAML-formatted file. # Declare variables to be passed into your templates. # General Variables -host: &host 'demo-phonebook.me' -contactUrl: 'https://github.com/T-Systems-MMS/phonebook/issues' +host: &host "demo-phonebook.me" +contactUrl: "https://github.com/T-Systems-MMS/phonebook/issues" roomPlanningToolUrl: null -contactEmail: &contactEmail 'phonebook-t-systems-mms@mg.telekom.de' +contactEmail: &contactEmail "phonebook-t-systems-mms@mg.telekom.de" ravenUrl: null employeePictureEndpoint: null -assetsEndpoint: 'https://demo-phonebook.me/assets' -environment: 'preview' -environmentTag: 'demo' -rocketChatUrl: 'https://open.rocket.chat' +assetsEndpoint: "https://demo-phonebook.me/assets" +environment: "preview" +environmentTag: "demo" +rocketChatUrl: "https://open.rocket.chat" frontend: replicaCount: 1 +source: + peoplesoft: + replicaCount: 1 + environment: Development + resources: # We usually recommend not to specify default resources and to leave this as a conscious # choice for the user. This also increases chances charts run on environments with little @@ -39,13 +44,13 @@ affinity: {} traefik: enabled: true startupArguments: - - '' + - "" dashboard: enabled: true domain: board.demo-phonebook.me ingress: annotations: - traefik.frontend.priority: '100' + traefik.frontend.priority: "100" ssl: enabled: true enforced: true @@ -54,10 +59,8 @@ traefik: enabled: true email: *contactEmail onHostRule: true - challengeType: 'http-01' + challengeType: "http-01" domains: enabled: true rbac: enabled: true - kubernetes: - namespaces: