Skip to content

Commit 7389fa7

Browse files
authored
Merge pull request #9 from jpopelka/mix
Simplify
2 parents afceb68 + 2578cc9 commit 7389fa7

File tree

11 files changed

+89
-159
lines changed

11 files changed

+89
-159
lines changed

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
packit-service-validation-install:
2+
make -C ocp-deployments/packit-service-validation install
3+
4+
packit-service-validation-dryrun:
5+
make -C ocp-deployments/packit-service-validation dryrun

README.md

Lines changed: 36 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
# udp
1+
# [Unified Openshift Deployment Process](https://docs.google.com/presentation/d/1MlLuuawzxJg6U15zbPby6JAtNNEWZAhfGEWNcpYSWeo)
22

3-
[Unified Openshift deployment Project](https://docs.google.com/presentation/d/1MlLuuawzxJg6U15zbPby6JAtNNEWZAhfGEWNcpYSWeo)
43
for the [Packit Service Validation](https://github.com/packit/deployment/tree/main/cron-jobs/packit-service-validation).
54

65
To deploy the *Packit Service Validation* through *Helm* follow this steps:
@@ -10,43 +9,51 @@ To deploy the *Packit Service Validation* through *Helm* follow this steps:
109
Helm uses an **image** created through a GitHub action and pushed to Quay.io,
1110
the **tag** for this image is the first *7 digit for the commit SHA* of the packit/deployment repo.
1211

13-
To use a new image update the referenced tag [here](https://github.com/packit/udp/blob/main/ocp-deployments/packit-service-validation-prod.yaml#L18).
12+
To use a new image update the referenced tag
13+
[here](https://github.com/packit/udp/blob/main/ocp-deployments/packit-service-validation-prod.yaml#L18).
1414

15-
Copy your OpenShift *API token* from the [PSI Cluster](https://ocp4.psi.redhat.com/)
15+
### Install Helm Chart
1616

17-
```
18-
git clone https://github.com/packit/udp.git
19-
oc login --token=sha256~.... --server= ....
20-
oc project cyborg
21-
export PACKIT_SENTRY=$( echo -n 'token from bitwarden' | base64 )
22-
export PACKIT_GITHUB_TOKEN=$( echo -n 'token from bitwarden' | base64 )
23-
```
17+
Login to OpenShift cluster and switch to proper project. In case of packit-service validation
18+
it's `cyborg` project @ [PSI Cluster](https://ocp4.psi.redhat.com).
2419

25-
### Install Helm Chart
20+
oc login --token=sha256~.... --server= ....
21+
oc project cyborg
22+
23+
Get secrets from Bitwarden.
24+
Sentry from `extra-vars.yml` in `secrets-packit-[prod|stg]` item and
25+
GitHub token from `Release/usercont bot` item.
26+
27+
export SENTRY=$( echo -n 'token from bitwarden' | base64 )
28+
export GITHUB=$( echo -n 'token from bitwarden' | base64 )
29+
30+
#### Install from this repo
31+
32+
make packit-service-validation-install DEPLOYMENT=[production|staging]
33+
34+
#### Install from chart repository
35+
36+
If you're going to use the chart from outside (without having this repo cloned),
37+
you can install the chart from our chart repository. You just need to have a file
38+
with keys overriding those defined in `values.yaml` with `~` value.
39+
40+
helm repo add packit https://helm.packit.dev
41+
helm repo update
42+
helm upgrade --install --cleanup-on-fail packit-service-validation packit/packit-service-validation --set secrets.sentry=${SENTRY} --set secrets.github=${GITHUB} --values your-values-file.yaml
2643

27-
#### From this repo
28-
```
29-
helm upgrade --install --cleanup-on-fail packit-service-validation ocp-helm-charts/packit-service-validation/ --set secrets.sentry=${PACKIT_SENTRY} --set secrets.github=${PACKIT_GITHUB_TOKEN} --values ocp-deployments/packit-service-validation-prod.yaml
30-
```
44+
### Render templates
3145

32-
#### From chart repository
33-
```
34-
helm repo add packit https://helm.packit.dev
35-
helm repo update
36-
helm upgrade --install --cleanup-on-fail packit-service-validation packit/packit-service-validation --set secrets.sentry=${PACKIT_SENTRY} --set secrets.github=${PACKIT_GITHUB_TOKEN} --values ocp-deployments/packit-service-validation-prod.yaml
37-
```
46+
If you just want to see how the rendered templates would look like:
3847

39-
### Uninstall Helm Chart
40-
```
41-
helm uninstall packit-service-validation
42-
```
48+
make packit-service-validation-dryrun DEPLOYMENT=[production|staging]
4349

4450
### Releases
45-
There's a [release workflow](.github/workflows/release.yml) to automate releasing the Helm charts.
46-
It uses [Helm Chart Releaser Action](https://github.com/marketplace/actions/helm-chart-releaser)
51+
There's a [release workflow](https://github.com/packit/udp/blob/main/.github/workflows/release.yml)
52+
to automate releasing the Helm charts. It uses
53+
[Helm Chart Releaser Action](https://github.com/marketplace/actions/helm-chart-releaser)
4754
which turns this project into a self-hosted Helm chart repository.
4855
It does this – during every push to `main` – by checking each chart in the project,
4956
and whenever there's a new chart version, creates a corresponding GitHub release
5057
named for the chart version, adds Helm chart artifacts to the release,
5158
and creates or updates an `index.yaml` file with metadata about those releases,
52-
which is then hosted on GitHub Pages at https://helm.packit.dev.
59+
which is then hosted on GitHub Pages at [helm.packit.dev](https://helm.packit.dev).

ocp-deployments/packit-service-validation-prod.yaml

Lines changed: 0 additions & 55 deletions
This file was deleted.
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
DEPLOYMENT ?= production
2+
3+
install:
4+
helm upgrade $(EXTRA_OPTIONS) --install --cleanup-on-fail packit-$(DEPLOYMENT)-validation ../../ocp-helm-charts/packit-service-validation/ --set secrets.sentry=${SENTRY} --set secrets.github=${GITHUB} --values $(DEPLOYMENT).yaml
5+
6+
dryrun:
7+
make install EXTRA_OPTIONS="--debug --dry-run"
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
deployment: production
2+
3+
image:
4+
tag: 2c35a8a
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
deployment: staging
2+
3+
image:
4+
tag: 2c35a8a

ocp-helm-charts/packit-service-validation/Chart.yaml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,13 @@ apiVersion : v2
22
name : packit-service-validation
33
description : Helm chart for deploying packit-service-validation app
44
type : application
5-
version : 1.0.0
6-
appVersion : "1.0.0"
5+
version : 1.1.0
76

87
keywords:
98
- python
109
- unified
1110
- deployment
1211

1312
maintainers:
14-
- name : Serhii Turivnyi
15-
13+
- name: The Packit team
14+
url: https://packit.dev
Lines changed: 13 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,32 @@
1+
# https://docs.openshift.com/container-platform/4.11/rest_api/workloads_apis/cronjob-batch-v1.html
12
apiVersion: batch/v1
23
kind: CronJob
34
metadata:
4-
name: {{ .Values.cronjob_name }}
5+
name: {{ .Release.Name }}
56
spec:
6-
schedule: "{{ .Values.cron.schedule }}"
7-
concurrencyPolicy: {{ .Values.cron.concurrencyPolicy }}
8-
startingDeadlineSeconds: {{ .Values.cron.startingDeadlineSeconds }}
9-
suspend: {{ .Values.cron.suspend }}
10-
successfulJobsHistoryLimit: {{ .Values.cron.successfulJobsHistoryLimit }}
11-
failedJobsHistoryLimit: {{ .Values.cron.failedJobsHistoryLimit }}
7+
schedule: {{ .Values.cronjob.schedule | quote }}
128
jobTemplate:
13-
metadata:
14-
annotations:
15-
timestamp: {{ now | quote }}
16-
creationTimestamp: null
17-
labels:
18-
app: {{ .Values.app_name }}
19-
deploymentconfig: {{ .Values.app_name }}
209
spec:
10+
activeDeadlineSeconds: {{ .Values.cronjob.activeDeadlineSeconds }}
2111
template:
22-
metadata:
23-
annotations:
24-
timestamp: {{ now | quote }}
25-
creationTimestamp: null
26-
labels:
27-
app: {{ .Values.app_name }}
28-
deploymentconfig: {{ .Values.app_name }}
2912
spec:
3013
containers:
31-
- name: {{ .Values.container.name }}
32-
image: {{ .Values.image.repo }}:{{ .Values.image.tag }}
33-
command: ["python3", "/usr/bin/packit-service-validation.py"]
14+
- name: run-validation
15+
image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}"
3416
imagePullPolicy: IfNotPresent
3517
env:
3618
- name: GITHUB_TOKEN
3719
valueFrom:
3820
secretKeyRef:
39-
name: {{ .Values.env_variables.github_token.name }}
40-
key: {{ .Values.env_variables.github_token.key }}
21+
name: {{ .Release.Name }}-github
22+
key: token
4123
- name: SENTRY_SECRET
4224
valueFrom:
4325
secretKeyRef:
44-
name: {{ .Values.env_variables.sentry_secret.name }}
45-
key: {{ .Values.env_variables.sentry_secret.key }}
26+
name: {{ .Release.Name }}-sentry
27+
key: dsn
4628
- name: DEPLOYMENT
47-
value: {{ .Values.env_variables.deployment.value }}
29+
value: {{ .Values.deployment }}
30+
resources:
31+
{{- toYaml .Values.resources | nindent 14 }}
4832
restartPolicy: OnFailure
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v1
22
kind: Secret
33
metadata:
4-
name: packit-github-token
5-
namespace: {{ .Values.namespace }}
4+
name: {{ .Release.Name }}-github
5+
namespace: {{ .Release.Namespace }}
66
type: Opaque
77
data:
88
token: "{{ .Values.secrets.github }}"
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
apiVersion: v1
22
kind: Secret
33
metadata:
4-
name: packit-sentry
5-
namespace: {{ .Values.namespace }}
4+
name: {{ .Release.Name }}-sentry
5+
namespace: {{ .Release.Namespace }}
66
type: Opaque
77
data:
8-
sentry: "{{ .Values.secrets.sentry }}"
8+
dsn: "{{ .Values.secrets.sentry }}"

0 commit comments

Comments
 (0)