-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #10 from jpopelka/import-images
Helm Chart for import-images cron job
- Loading branch information
Showing
24 changed files
with
253 additions
and
66 deletions.
There are no files selected for viewing
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,38 @@ | ||
name: Deploy import-images cron job | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- main | ||
paths: | ||
- 'helm-charts/import-images/**/*.yaml' | ||
- 'values/import-images/*.yaml' | ||
|
||
jobs: | ||
deploy: | ||
# To not run in forks | ||
if: github.repository_owner == 'packit' | ||
runs-on: ubuntu-latest | ||
environment: prod | ||
env: | ||
OC_SERVER: https://api.auto-prod.gi0n.p1.openshiftapps.com:6443 | ||
strategy: | ||
matrix: | ||
project: [packit-prod, stream-prod, fedora-source-git-prod] | ||
|
||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Deploy | ||
run: | | ||
if [ ${{ matrix.project }} == 'packit-prod' ]; then | ||
TOKEN=${{ secrets.PACKIT_PROD_TOKEN }} | ||
elif [ ${{ matrix.project }} == 'stream-prod' ]; then | ||
TOKEN=${{ secrets.STREAM_PROD_TOKEN }} | ||
elif [ ${{ matrix.project }} == 'fedora-source-git-prod' ]; then | ||
TOKEN=${{ secrets.FEDORA_SOURCE_GIT_PROD_TOKEN }} | ||
fi | ||
oc login --token=$TOKEN --server=$OC_SERVER | ||
make -C values/import-images/ install PROJECT=${{ matrix.project }} |
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 |
---|---|---|
|
@@ -7,10 +7,12 @@ on: | |
|
||
jobs: | ||
release: | ||
# To not run in forks | ||
if: github.repository_owner == 'packit' | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
|
||
|
@@ -19,14 +21,9 @@ jobs: | |
git config user.name "$GITHUB_ACTOR" | ||
git config user.email "[email protected]" | ||
- name: Install Helm | ||
uses: azure/setup-helm@v3 | ||
with: | ||
token: ${{ secrets.GITHUB_TOKEN }} | ||
|
||
- name: Run chart-releaser | ||
uses: helm/chart-releaser-action@v1 | ||
with: | ||
charts_dir: ocp-helm-charts | ||
charts_dir: helm-charts | ||
env: | ||
CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" |
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
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
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,17 @@ | ||
# 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 | ||
# Common backup files | ||
*.swp | ||
*.tmp | ||
*.orig | ||
*~ | ||
# Various IDEs | ||
.project | ||
.idea/ | ||
*.tmproj | ||
.vscode/ |
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,8 @@ | ||
apiVersion: v2 | ||
name: import-images | ||
description: A Helm chart for import-images CronJob | ||
type: application | ||
|
||
# Increment each time you make changes | ||
# to the chart and its templates. | ||
version: 0.1.0 |
31 changes: 31 additions & 0 deletions
31
helm-charts/import-images/templates/job-import-images.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,31 @@ | ||
# https://docs.openshift.com/container-platform/latest/rest_api/workloads_apis/cronjob-batch-v1.html | ||
apiVersion: batch/v1 | ||
kind: CronJob | ||
metadata: | ||
name: {{ .Release.Name }} | ||
spec: | ||
schedule: {{ .Values.cronjob.schedule | quote }} | ||
jobTemplate: | ||
spec: | ||
template: | ||
spec: | ||
containers: | ||
- name: import-images | ||
image: "{{ .Values.image.repo }}:{{ .Values.image.tag }}" | ||
env: | ||
- name: KUBECONFIG | ||
value: /tmp/.kube/config | ||
- name: HOST | ||
value: {{ .Values.host }} | ||
- name: TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: {{ .Values.secret.name }} | ||
key: {{ .Values.secret.key }} | ||
- name: SERVICE | ||
value: {{ .Values.service }} | ||
- name: DEPLOYMENT | ||
value: {{ .Values.deployment }} | ||
resources: | ||
{{- toYaml .Values.resources | nindent 16 }} | ||
restartPolicy: OnFailure |
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,34 @@ | ||
# Cron job parameters | ||
cronjob: | ||
# At 02:00 on Tuesday | ||
schedule: "0 2 * * 2" | ||
|
||
# Container image | ||
image: | ||
# Image repository without a tag | ||
repo: quay.io/packit/import-images | ||
# Image tag | ||
tag: ~ | ||
|
||
# Openshift cluster | ||
host: ~ | ||
|
||
# name of the secret with token of a service account used to login to the cluster | ||
secret: | ||
name: ~ | ||
key: token | ||
|
||
# packit / stream / fedora-source-git | ||
service: packit | ||
|
||
# prod / stg | ||
deployment: prod | ||
|
||
# Pod resources maximum | ||
resources: | ||
limits: | ||
cpu: "100m" | ||
memory: "80Mi" | ||
requests: | ||
cpu: "100m" | ||
memory: "80Mi" |
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file was deleted.
Oops, something went wrong.
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,8 @@ | ||
PROJECT ?= packit-prod | ||
|
||
install: | ||
oc project $(PROJECT) | ||
helm upgrade $(EXTRA_OPTIONS) --install --cleanup-on-fail import-images ../../helm-charts/import-images/ --values $(PROJECT).yaml | ||
|
||
dryrun: | ||
make install EXTRA_OPTIONS="--debug --dry-run" |
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,25 @@ | ||
## Install | ||
|
||
Login to the Openshift cluster: | ||
|
||
oc login --token=sha256~.... --server= .... | ||
|
||
### Install from this repo | ||
|
||
make install PROJECT=packit-prod | ||
|
||
### Install from chart repository | ||
|
||
If you're going to use the chart from outside (without having this repo cloned), | ||
you can install the chart from our chart repository. You just need to have a file | ||
with keys overriding those defined in `values.yaml` with `~` value. | ||
|
||
helm repo add packit https://helm.packit.dev | ||
helm repo update | ||
helm upgrade --install --cleanup-on-fail import-images packit/import-images --values your-values-file.yaml | ||
|
||
### Render templates | ||
|
||
If you just want to see how the rendered templates would look like: | ||
|
||
make dryrun PROJECT=packit-prod |
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,9 @@ | ||
image: | ||
tag: "4050635" | ||
|
||
host: https://api.auto-prod.gi0n.p1.openshiftapps.com:6443 | ||
|
||
secret: | ||
name: pipeline-token-m8z9n | ||
|
||
service: fedora-source-git |
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,9 @@ | ||
image: | ||
tag: "4050635" | ||
|
||
host: https://api.auto-prod.gi0n.p1.openshiftapps.com:6443 | ||
|
||
secret: | ||
name: pipeline-token-6mc7z | ||
|
||
service: packit |
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,9 @@ | ||
image: | ||
tag: "4050635" | ||
|
||
host: https://api.auto-prod.gi0n.p1.openshiftapps.com:6443 | ||
|
||
secret: | ||
name: pipeline-token-dw46p | ||
|
||
service: stream |
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,7 @@ | ||
DEPLOYMENT ?= production | ||
|
||
install: | ||
helm upgrade $(EXTRA_OPTIONS) --install --cleanup-on-fail packit-$(DEPLOYMENT)-validation ../../helm-charts/packit-service-validation/ --set secrets.sentry=${SENTRY} --set secrets.github=${GITHUB} --values $(DEPLOYMENT).yaml | ||
|
||
dryrun: | ||
make install EXTRA_OPTIONS="--debug --dry-run" |
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,33 @@ | ||
## Install | ||
|
||
Login to [PSI](https://ocp4.psi.redhat.com) and switch to `cyborg` project. | ||
|
||
oc login --token=sha256~.... --server= .... | ||
oc project cyborg | ||
|
||
Get secrets from Bitwarden. | ||
Sentry from `extra-vars.yml` in `secrets-packit-[prod|stg]` item and | ||
GitHub token from `Release/usercont bot` item. | ||
|
||
export SENTRY=$( echo -n 'token from bitwarden' | base64 ) | ||
export GITHUB=$( echo -n 'token from bitwarden' | base64 ) | ||
|
||
### Install from this repo | ||
|
||
make install DEPLOYMENT=[production|staging] | ||
|
||
### Install from chart repository | ||
|
||
If you're going to use the chart from outside (without having this repo cloned), | ||
you can install the chart from our chart repository. You just need to have a file | ||
with keys overriding those defined in `values.yaml` with `~` value. | ||
|
||
helm repo add packit https://helm.packit.dev | ||
helm repo update | ||
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 | ||
|
||
### Render templates | ||
|
||
If you just want to see how the rendered templates would look like: | ||
|
||
make dryrun DEPLOYMENT=[production|staging] |
File renamed without changes.
File renamed without changes.