Skip to content

Commit 39e4d9e

Browse files
authored
Add dev chart (#31)
* Add dev chart * fix copy-paste error
1 parent 8ab9049 commit 39e4d9e

File tree

10 files changed

+237
-0
lines changed

10 files changed

+237
-0
lines changed

development/Chart.yaml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
apiVersion: v1
2+
name: backend
3+
description: A Helm chart to deploy the backend (coordination API) of the Open Management Portal
4+
5+
# A chart can be either an 'application' or a 'library' chart.
6+
#
7+
# Application charts are a collection of templates that can be packaged into versioned archives
8+
# to be deployed.
9+
#
10+
# Library charts provide useful utilities or functions for the chart developer. They're included as
11+
# a dependency of application charts to inject those utilities and functions into the rendering
12+
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
13+
type: application
14+
15+
# This is the chart version. This version number should be incremented each time you make changes
16+
# to the chart and its templates, including the app version.
17+
version: 0.1.0
18+
19+
# This is the version number of the application being deployed. This version number should be
20+
# incremented each time you make changes to the application.
21+
appVersion: 1.0.0

development/README.md

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Development on OpenShift
2+
3+
This directory contains a Helm chart which can be used to deploy a development version of this app for rapid testing.
4+
5+
Before you use it, you will need to download & install Helm 3.
6+
7+
To use it, move to the `development` directory (i.e. `cd development/`), and deploy using the following Helm command:
8+
9+
```shell script
10+
helm template . \
11+
--set git.uri=https://github.com/rht-labs/open-management-portal-git-api.git \
12+
--set git.ref=master \
13+
--set cacheService=<your-infinispan-service-name> \
14+
--set cacheUseAuth=<use-infinispan-auth> \
15+
--set configRepositoryId=<your-config-repository-id> \
16+
--set deployKey=<your-gitlab-deploy-key-id> \
17+
--set gitLabApiUrl=<your-gitlab-base-url> \
18+
--set gitLabPersonalAccessToken=<your-gitlab-personal-access-token> \
19+
--set jwtVerifyPublicKeyLocation=<your-openid-connect-cert-url> \
20+
--set residenciesParentRepositoryId=<your-gitlab-group-id> \
21+
--set templateRepositoryId=<your-template-repository-id> \
22+
--set trustedClientKey=<your-trusted-client-key> \
23+
| oc apply -f -
24+
```
25+
26+
It accepts the following variables
27+
28+
| Variable | Use |
29+
|---|---|
30+
| `git.uri` | The HTTPS reference to the repo (your fork!) to build |
31+
| `git.ref` | The branch name to build |
32+
| `cacheService` | The service name of the Infinispan deployment |
33+
| `cacheUseAuth` | Enable authentication against the cache |
34+
| `configRepositoryId` | The GitLab ID of the config repository |
35+
| `deployKey` | The ID of the GitLab deploy key to enable on newly-created repositories |
36+
| `gitLabApiUrl` | The base URL of the GitLab instance to use |
37+
| `gitLabPersonalAccessToken` | The access token to use to auth against GitLab |
38+
| `jwtVerifyPublicKeyLocation` | The URL at which your OpenID Connect (SSO) provider exposes its public key |
39+
| `residenciesParentRepositoryId` | The ID of the GitLab group under which to create new projects |
40+
| `templateRepositoryId` | The ID of the GitLab repository which defines a template to use for creating new repos |
41+
| `trustedClientKey` | [Temporary] Used as a placeholder to authenticate client requests, being replaced by validating JWT tokens against the `jwtVerifyPublicKeyLocation` |
42+
43+
This will spin up all of the usual resources that this service needs in production, plus a `BuildConfig` configured to build it from source from the Git repository specified. To trigger this build, use `oc start-build omp-git-api`.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: build.openshift.io/v1
2+
kind: BuildConfig
3+
metadata:
4+
labels:
5+
app: {{ .Values.name }}
6+
name: {{ .Values.name }}
7+
spec:
8+
failedBuildsHistoryLimit: 5
9+
nodeSelector: null
10+
output:
11+
to:
12+
kind: ImageStreamTag
13+
name: "{{ .Values.imageName }}:{{ .Values.imageTag }}"
14+
postCommit: {}
15+
resources: {}
16+
runPolicy: Serial
17+
source:
18+
git:
19+
uri: {{ .Values.git.uri }}
20+
ref: {{ .Values.git.ref }}
21+
type: Git
22+
strategy:
23+
sourceStrategy:
24+
from:
25+
kind: DockerImage
26+
name: "{{ .Values.builderImage }}:{{ .Values.builderImageTag }}"
27+
type: Source
28+
successfulBuildsHistoryLimit: 5
29+
triggers:
30+
- type: ConfigChange
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: omp-cache-secret
5+
type: Opaque
6+
data:
7+
identities.yaml: >-
8+
Y3JlZGVudGlhbHM6Ci0gdXNlcm5hbWU6IG9tcAogIHBhc3N3b3JkOiBvbXAKLSB1c2VybmFtZTogb3BlcmF0b3IKICBwYXNzd29yZDogb3BlcmF0b3IxCg==
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
apiVersion: apps.openshift.io/v1
2+
kind: DeploymentConfig
3+
metadata:
4+
labels:
5+
app: {{ .Values.name }}
6+
name: {{ .Values.name }}
7+
spec:
8+
replicas: 1
9+
revisionHistoryLimit: 10
10+
selector:
11+
app: {{ .Values.name }}
12+
deploymentconfig: {{ .Values.name }}
13+
strategy:
14+
activeDeadlineSeconds: 21600
15+
resources: {}
16+
rollingParams:
17+
intervalSeconds: 1
18+
maxSurge: 25%
19+
maxUnavailable: 25%
20+
timeoutSeconds: 600
21+
updatePeriodSeconds: 1
22+
type: Rolling
23+
template:
24+
metadata:
25+
labels:
26+
app: {{ .Values.name }}
27+
deploymentconfig: {{ .Values.name }}
28+
spec:
29+
containers:
30+
- envFrom:
31+
- secretRef:
32+
name: omp-gitlab-configuration
33+
image: "{{ .Values.imageName }}:{{ .Values.imageTag }}"
34+
imagePullPolicy: Always
35+
name: {{ .Values.name }}
36+
ports:
37+
- containerPort: 8080
38+
protocol: TCP
39+
resources: {}
40+
terminationMessagePath: /dev/termination-log
41+
terminationMessagePolicy: File
42+
dnsPolicy: ClusterFirst
43+
restartPolicy: Always
44+
schedulerName: default-scheduler
45+
securityContext: {}
46+
terminationGracePeriodSeconds: 30
47+
test: false
48+
triggers:
49+
- type: ConfigChange
50+
- type: ImageChange
51+
imageChangeParams:
52+
containerNames:
53+
- {{ .Values.name }}
54+
automatic: true
55+
from:
56+
kind: "ImageStreamTag"
57+
name: "{{ .Values.imageName }}:{{ .Values.imageTag }}"
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Secret
3+
metadata:
4+
name: omp-gitlab-configuration
5+
type: Opaque
6+
stringData:
7+
CACHE_SERVICE: "{{ .Values.cacheService }}"
8+
CACHE_USE_AUTH: "{{ .Values.cacheUseAuth }}"
9+
CONFIG_REPOSITORY_ID: "{{ .Values.configRepositoryId }}"
10+
DEPLOY_KEY: "{{ .Values.deployKey }}"
11+
GITLAB_API_URL: "{{ .Values.gitLabApiUrl }}"
12+
GITLAB_PERSONAL_ACCESS_TOKEN: "{{ .Values.gitLabPersonalAccessToken }}"
13+
MP_JWT_VERIFY_PUBLICKEY_LOCATION: >-
14+
{{ .Values.jwtVerifyPublicKeyLocation }}
15+
RESIDENCIES_PARENT_REPOSITORIES_ID: "{{ .Values.residenciesParentRepositoryId }}"
16+
TEMPLATE_REPOSITORY_ID: "{{ .Values.templateRepositoryId }}"
17+
TRUSTED_CLIENT_KEY: "{{ .Values.trustedClientKey }}"
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
apiVersion: image.openshift.io/v1
2+
kind: ImageStream
3+
metadata:
4+
name: {{ .Values.imageName }}
5+
spec:
6+
lookupPolicy:
7+
local: false
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
apiVersion: infinispan.org/v1
2+
kind: Infinispan
3+
metadata:
4+
name: omp-cache
5+
spec:
6+
replicas: 1
7+
image: infinispan/server:10.1
8+
logging:
9+
categories:
10+
org.infinispan: info
11+
org.jgroups: info
12+
security:
13+
endpointSecretName: omp-cache-secret

development/templates/service.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
apiVersion: v1
2+
kind: Service
3+
metadata:
4+
labels:
5+
app: {{ .Values.name }}
6+
name: {{ .Values.name }}
7+
spec:
8+
ports:
9+
- name: "{{ .Values.servicePort }}-tcp"
10+
port: {{ .Values.servicePort }}
11+
protocol: TCP
12+
targetPort: {{ .Values.servicePort }}
13+
selector:
14+
app: {{ .Values.name }}
15+
deploymentconfig: {{ .Values.name }}
16+
sessionAffinity: None
17+
type: ClusterIP

development/values.yaml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
name: omp-git-api
2+
3+
servicePort: 8080
4+
5+
imageName: "omp-git-api"
6+
imageTag: "latest"
7+
8+
builderImage: registry.access.redhat.com/redhat-openjdk-18/openjdk18-openshift
9+
builderImageTag: 1.8
10+
11+
git:
12+
uri: https://github.com/rht-labs/open-management-portal-git-api.git
13+
ref: master
14+
15+
cacheService: false
16+
cacheUseAuth: false
17+
configRepositoryId: false
18+
deployKey: false
19+
gitLabApiUrl: false
20+
gitLabPersonalAccessToken: false
21+
jwtVerifyPublicKeyLocation: false
22+
residenciesParentRepositoryId: false
23+
templateRepositoryId: false
24+
trustedClientKey: false

0 commit comments

Comments
 (0)