-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPS-250 Creates Helm Chart for registration-service #2
Merged
Merged
Changes from all commits
Commits
Show all changes
75 commits
Select commit
Hold shift + click to select a range
04aab0c
SPS-250 Adds basic Drone file
fbc5526
SPS-250 Ensures Drone runs off of a push
e0b01dd
SPS-250 Changes file extension for Drone YML
7bc50b2
SPS-250 Removes older Drone file with invalid extension
c9767b7
SPS-250 Sets Helm image to Alpine image from Docker Hub
994913d
SPS-250 Sets Helm image to ukhomeoffice Quay Helm image
5af0331
SPS-250 Breaks up build steps and prints Kube versions
fcf41cc
SPS-250 Passes robot token to Helm
869d188
SPS-250 Passes KUBE_SERVER env variable to Helm
3ba9558
SPS-250 Validates how Drone shows secrets
fe5da04
SPS-250 Validates how Drone shows secrets
818c975
SPS-250 Validates how Drone shows secrets
ea0a4a4
SPS-250 Validates how Drone shows secrets
21d5a76
SPS-250 Validates how Drone shows secrets
8a7d292
SPS-250 Passes kube variables to Helm
cabcb0b
SPS-250 Validates how Drone shows secrets
618e761
SPS-250 Validates how Drone shows secrets
85925b5
SPS-250 Explicitly switch k8s context
b25da13
SPS-250 Prefixes env variables
a07eebe
SPS-250 Prefixes env variables
e112516
SPS-250 Switches to pod listing
b6ae267
SPS-250 Bumps Helm version
6add5e8
SPS-250 Passes kube context to Helm
010c010
SPS-250 Passes kube context to kubectl command
3b7b044
SPS-250 Fixes buildstep context name
7010332
SPS-250 Adds template for Deployment
cdc77f1
SPS-250 Removes unnecessary templates
2534978
SPS-250 Adds simple Dockerfile for registration service
7c1a415
SPS-250 Changes tag logic
476b7ff
SPS-250 Tests Docker pushes with personal credentials
b57cd35
Revert "SPS-250 Tests Docker pushes with personal credentials"
2578d42
SPS-250 Adds step for publishing Helm chart
4af4475
SPS-250 Adds basic Helm chart
a13bf51
SPS-254 Adds Helm values file for tactical database and updates README
ed9a898
Added liquibase config
chriswhunter89 d546f9c
Delete UserConfig.java
chriswhunter89 73137d3
Fix application.properties to use env vars
a76e08e
Remove UserConfig - no longer needed
b291292
Fix indentation
chriswhunter89 37aa45e
Fixed dependency injection
chriswhunter89 949a02d
Added authorname to changesets
chriswhunter89 e8e9c46
Add unique constraint on email field
chriswhunter89 9d60470
Adds local context to populate-users changeset and set's current cont…
chriswhunter89 9fcf918
Setup local springboot profile
chriswhunter89 5e42535
Add application-local.properties config
chriswhunter89 4f02b2c
Fixed formatting issue
b498aa9
Fixed typo
6fd708f
SPS-250 Adds simple values file for the dev environment
ae1c2a8
SPS-250 Adds simple values file for the dev environment
bc0d62b
SPS-250 Adds template for serviceaccount
2f65fea
SPS-250 Removes duplicate Chart
43f4492
SPS-250 Configures deployment to run image
c74b301
SPS-250 Sets author full name in the change logs
6bdc661
SPS-250 Changes env names for DB connectivity
165f566
SPS-250 Changes env names for DB connectivity
1a40fe9
SPS-250 Passed persistence nv variables through to deployment
7f9b65e
SPS-250 Takes Dockerfile from other branch
b5d6b8d
SPS-250 Removes .DS_Store files
ce9291b
SPS-250 Adds .DS_Store to gitignore
d6f11dc
SPS-250 Removes Helm step which is not ready
dd1a992
SPS-250 Fixes error with incorrect profile being set
ae087a6
SPS-250 Removes profile hardcoding
ac99908
SPS-250 Hardcodes profile to dsa-re-dev
9822f9b
SPS-250 Enables management probes
ce19417
SPS-250 Adds actuator libraries and bumps Java version to 21
fa04205
SPS-250 Configures probes to use actuator endpoints
bc90605
SPS-250 Configures probes
b76acf8
SPS-250 Adds Dynatrace feature flag to Deployment
be124f9
SPS-250 Separates serice port from container port
05c9284
SPS-230 Adds Dockerfile for tools image
3bd7ac0
Modified registerNewUser function to throw error to simulate problem …
chriswhunter89 fceb39e
Update table name in users.java
chriswhunter89 324286c
Merge branch 'main' into SPS-250-helm-deployment
abd2a7b
SPS-250 Removes deliberate exception added for testing
85cf0a7
SPS-250 Ensure ip specific egress for network policy
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Binary file not shown.
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
Binary file not shown.
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,61 @@ | ||
kind: pipeline | ||
type: kubernetes | ||
name: build-test | ||
|
||
platform: | ||
os: linux | ||
arch: amd64 | ||
|
||
steps: | ||
|
||
- name: docker | ||
image: plugins/docker | ||
settings: | ||
dockerfile: backend/registration-service/Dockerfile | ||
registry: quay.io | ||
context: backend/registration-service | ||
tags: | ||
- latest | ||
repo: quay.io/ukhomeofficedigital/dsa-re-registration-service | ||
username: | ||
from_secret: ROBOT_QUAY_USER | ||
password: | ||
from_secret: ROBOT_QUAY_PASS | ||
|
||
trigger: | ||
event: | ||
- push | ||
|
||
# - name: debug-versions | ||
# image: quay.io/ukhomeofficedigital/helm:3.15.4-build.1 | ||
# commands: | ||
# - kubectl config set-cluster buildstep --server=$SHOWCASE_KUBE_SERVER | ||
# - kubectl config set-credentials $SHOWCASE_KUBE_USER --token=$SHOWCASE_KUBE_TOKEN | ||
# - kubectl config set-context buildstep --cluster=buildstep --user=$SHOWCASE_KUBE_USER --namespace=$SHOWCASE_KUBE_NAMESPACE | ||
# - kubectl config use-context buildstep | ||
# - helm version | ||
# - kubectl --context=buildstep version | ||
# - helm list --kube-context=buildstep | ||
# - helm list --namespace=$SHOWCASE_KUBE_NAMESPACE --kube-apiserver=$SHOWCASE_KUBE_SERVER --kube-token=$SHOWCASE_KUBE_TOKEN | ||
# environment: | ||
# SHOWCASE_KUBE_USER: | ||
# from_secret: KUBE_NAMESPACE_DEV | ||
# SHOWCASE_KUBE_NAMESPACE: | ||
# from_secret: KUBE_NAMESPACE_DEV | ||
# SHOWCASE_KUBE_SERVER: | ||
# from_secret: KUBE_SERVER_NOT_PROD | ||
# SHOWCASE_KUBE_TOKEN: | ||
# from_secret: KUBE_TOKEN_DEV | ||
|
||
# - name: helm-test | ||
# image: quay.io/ukhomeofficedigital/helm:v3.5.4 | ||
# commands: | ||
# - helm version | ||
# - kubectl version | ||
|
||
# - name: helm-install | ||
# image: quay.io/ukhomeofficedigital/helm:v3.5.4 | ||
# commands: | ||
# - helm version | ||
# - kubectl version | ||
|
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,37 @@ | ||
# Stage 1 - Build Application | ||
|
||
# Base image with JDK | ||
FROM quay.io/ukhomeofficedigital/dsa-re-amazoncorretto:21.0.5-alpine3.20 AS builder | ||
|
||
#Set working directory | ||
WORKDIR /app | ||
|
||
# Copy over maven wrapper files | ||
COPY mvnw . | ||
COPY mvnw.cmd . | ||
COPY .mvn ./.mvn | ||
|
||
# Ensure mvnw is executable | ||
RUN chmod +x mvnw | ||
|
||
# Copy over pom and application source code | ||
COPY pom.xml . | ||
COPY src ./src | ||
|
||
# Compile code into jar | ||
RUN ./mvnw clean install -Dskiptests | ||
|
||
# Stage 2 - Run application | ||
FROM quay.io/ukhomeofficedigital/dsa-re-amazoncorretto:21.0.5-alpine3.20 | ||
|
||
#Set working directory | ||
WORKDIR /app | ||
|
||
# Copy over jar from stage 1 | ||
COPY --from=builder app/target/registration-service-0.0.1-SNAPSHOT.jar app.jar | ||
|
||
# Expose port | ||
EXPOSE 8080 | ||
|
||
# Run Springboot app | ||
ENTRYPOINT [ "java", "-jar", "app.jar" ] |
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
23 changes: 23 additions & 0 deletions
23
backend/registration-service/registration-service-chart/.helmignore
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,23 @@ | ||
# Patterns to ignore when building packages. | ||
# This supports shell glob matching, relative path matching, and | ||
# negation (prefixed with !). Only one pattern per line. | ||
.DS_Store | ||
# Common VCS dirs | ||
.git/ | ||
.gitignore | ||
.bzr/ | ||
.bzrignore | ||
.hg/ | ||
.hgignore | ||
.svn/ | ||
# Common backup files | ||
*.swp | ||
*.bak | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
5 changes: 5 additions & 0 deletions
5
backend/registration-service/registration-service-chart/Chart.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,5 @@ | ||
apiVersion: v2 | ||
name: registration-service | ||
description: A Helm chart for deploying registration-service to Kubernetes | ||
type: application | ||
version: 0.1.0 |
62 changes: 62 additions & 0 deletions
62
backend/registration-service/registration-service-chart/templates/_helpers.tpl
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,62 @@ | ||
{{/* | ||
Expand the name of the chart. | ||
*/}} | ||
{{- define "registration-service.name" -}} | ||
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create a default fully qualified app name. | ||
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec). | ||
If release name contains chart name it will be used as a full name. | ||
*/}} | ||
{{- define "registration-service.fullname" -}} | ||
{{- if .Values.fullnameOverride }} | ||
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- $name := default .Chart.Name .Values.nameOverride }} | ||
{{- if contains $name .Release.Name }} | ||
{{- .Release.Name | trunc 63 | trimSuffix "-" }} | ||
{{- else }} | ||
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
{{- end }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create chart name and version as used by the chart label. | ||
*/}} | ||
{{- define "registration-service.chart" -}} | ||
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }} | ||
{{- end }} | ||
|
||
{{/* | ||
Common labels | ||
*/}} | ||
{{- define "registration-service.labels" -}} | ||
helm.sh/chart: {{ include "registration-service.chart" . }} | ||
{{ include "registration-service.selectorLabels" . }} | ||
{{- if .Chart.AppVersion }} | ||
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} | ||
{{- end }} | ||
app.kubernetes.io/managed-by: {{ .Release.Service }} | ||
{{- end }} | ||
|
||
{{/* | ||
Selector labels | ||
*/}} | ||
{{- define "registration-service.selectorLabels" -}} | ||
app.kubernetes.io/name: {{ include "registration-service.name" . }} | ||
app.kubernetes.io/instance: {{ .Release.Name }} | ||
{{- end }} | ||
|
||
{{/* | ||
Create the name of the service account to use | ||
*/}} | ||
{{- define "registration-service.serviceAccountName" -}} | ||
{{- if .Values.serviceAccount.create }} | ||
{{- default (include "registration-service.fullname" .) .Values.serviceAccount.name }} | ||
{{- else }} | ||
{{- default "default" .Values.serviceAccount.name }} | ||
{{- end }} | ||
{{- end }} |
134 changes: 134 additions & 0 deletions
134
backend/registration-service/registration-service-chart/templates/deployment.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,134 @@ | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
name: {{ include "registration-service.fullname" . }} | ||
labels: | ||
{{- include "registration-service.labels" . | nindent 4 }} | ||
spec: | ||
replicas: {{ .Values.replicaCount }} | ||
selector: | ||
matchLabels: | ||
{{- include "registration-service.selectorLabels" . | nindent 6 }} | ||
template: | ||
metadata: | ||
{{- with .Values.podAnnotations }} | ||
annotations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
labels: | ||
{{- include "registration-service.labels" . | nindent 8 }} | ||
{{- with .Values.podLabels }} | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
spec: | ||
{{- with .Values.imagePullSecrets }} | ||
imagePullSecrets: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
serviceAccountName: {{ include "registration-service.serviceAccountName" . }} | ||
automountServiceAccountToken: {{ .Values.serviceAccount.automount }} | ||
securityContext: | ||
fsGroup: 1000 | ||
runAsNonRoot: true | ||
runAsUser: 1000 | ||
{{- if((.Values.dynatrace).podRuntimeInjection).enabled }} | ||
initContainers: | ||
- name: install-oneagent | ||
image: {{ (((.Values).dynatrace).podRuntimeInjection).image | default "quay.io/ukhomeofficedigital/alpine:v3.15" | quote }} | ||
command: | ||
- /bin/sh | ||
args: | ||
- -c | ||
- ARCHIVE=$(mktemp) && time wget --no-check-certificate -O $ARCHIVE "$DT_API_URL/v1/deployment/installer/agent/unix/paas/latest?Api-Token=$DT_PAAS_TOKEN&$DT_ONEAGENT_OPTIONS" && time unzip -o -d /opt/dynatrace/oneagent $ARCHIVE && rm -f $ARCHIVE | ||
env: | ||
- name: DT_API_URL | ||
valueFrom: | ||
secretKeyRef: | ||
name: registration-service-dynatrace-oneagent | ||
key: api-url | ||
- name: DT_PAAS_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: registration-service-dynatrace-oneagent | ||
key: paas-installer-download-token | ||
- name: DT_ONEAGENT_OPTIONS | ||
value: flavor=multidistro&include=java | ||
volumeMounts: | ||
- mountPath: /opt/dynatrace/oneagent | ||
name: {{ (((.Values).dynatrace).podRuntimeInjection).volumeName | default "oneagent" }} | ||
{{- end }} | ||
containers: | ||
- name: {{ .Chart.Name }} | ||
image: "quay.io/ukhomeofficedigital/dsa-re-registration-service:{{ .Values.image.tag | default .Chart.AppVersion }}" | ||
imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
ports: | ||
- name: http | ||
containerPort: 8080 | ||
livenessProbe: | ||
httpGet: | ||
path: /actuator/health/liveness | ||
port: http | ||
initialDelaySeconds: 30 | ||
periodSeconds: 30 | ||
readinessProbe: | ||
httpGet: | ||
path: /actuator/health/readiness | ||
port: http | ||
initialDelaySeconds: 60 | ||
periodSeconds: 30 | ||
resources: | ||
{{- toYaml .Values.resources | nindent 12 }} | ||
env: | ||
- name: JAVA_OPTIONS | ||
value: -Dspring.profiles.active={{ .Release.Namespace }} | ||
- name: SHOWCASE_SERVICES_DB_ENDPOINT | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.persistenceCredentialsSecretName }} | ||
key: endpoint | ||
- name: SHOWCASE_SERVICES_DB_PORT | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.persistenceCredentialsSecretName }} | ||
key: port | ||
- name: SHOWCASE_SERVICES_DB_NAME | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.persistenceCredentialsSecretName }} | ||
key: default_db | ||
- name: SHOWCASE_SERVICES_DB_USER | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.persistenceCredentialsSecretName }} | ||
key: username | ||
- name: SHOWCASE_SERVICES_DB_PWD | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.persistenceCredentialsSecretName }} | ||
key: password | ||
{{- if((.Values.dynatrace).podRuntimeInjection).enabled }} | ||
- name: LD_PRELOAD | ||
value: /opt/dynatrace/oneagent/agent/lib64/liboneagentproc.so | ||
{{- end -}} | ||
{{- if((.Values.dynatrace).podRuntimeInjection).enabled }} | ||
volumeMounts: | ||
- name: {{ (((.Values).dynatrace).podRuntimeInjection).volumeName | default "oneagent" }} | ||
mountPath: /opt/dynatrace/oneagent | ||
{{- end -}} | ||
{{- if((.Values.dynatrace).podRuntimeInjection).enabled }} | ||
volumes: | ||
- name: {{ (((.Values).dynatrace).podRuntimeInjection).volumeName | default "oneagent" }} | ||
emptyDir: {} | ||
{{- end -}} | ||
{{- with .Values.nodeSelector }} | ||
nodeSelector: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.affinity }} | ||
affinity: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} | ||
{{- with .Values.tolerations }} | ||
tolerations: | ||
{{- toYaml . | nindent 8 }} | ||
{{- end }} |
29 changes: 29 additions & 0 deletions
29
backend/registration-service/registration-service-chart/templates/networkpolicy.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,29 @@ | ||
apiVersion: networking.k8s.io/v1 | ||
kind: NetworkPolicy | ||
metadata: | ||
name: {{ include "registration-service.fullname" . }} | ||
labels: | ||
{{- include "registration-service.labels" . | nindent 4 }} | ||
spec: | ||
ingress: | ||
- from: | ||
- namespaceSelector: | ||
matchLabels: | ||
kubernetes.io/metadata.name: {{ .Release.Namespace }} | ||
egress: | ||
- to: | ||
{{- range .Values.namespaceToAllowEgress }} | ||
- namespaceSelector: | ||
matchLabels: | ||
name: {{ . }} | ||
{{- end }} | ||
{{- range .Values.ipBlockToAllowEgress }} | ||
- ipBlock: | ||
cidr: {{ . }} | ||
{{- end }} | ||
podSelector: | ||
matchLabels: | ||
{{- include "registration-service.selectorLabels" . | nindent 6 }} | ||
policyTypes: | ||
- Ingress | ||
- Egress |
14 changes: 14 additions & 0 deletions
14
backend/registration-service/registration-service-chart/templates/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,14 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: {{ include "registration-service.fullname" . }} | ||
labels: | ||
{{- include "registration-service.labels" . | nindent 4 }} | ||
spec: | ||
type: {{ .Values.service.type }} | ||
ports: | ||
- port: {{ .Values.service.port }} | ||
targetPort: http | ||
protocol: TCP | ||
selector: | ||
{{- include "registration-service.selectorLabels" . | nindent 4 }} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that this will likely change later, we probably don't want to be pushing to latest, or at the very least we want to push to a tag as well, whatever that might be.