-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adds a working example for flux (#8)
Removes jobs for an initcontainer
- Loading branch information
Showing
26 changed files
with
362 additions
and
210 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,11 @@ | ||
# Flux | ||
|
||
|
||
## Introductie | ||
|
||
Flux is een gitops tool om automatisch de inhoud van een git repository te deployen op kubernetes. | ||
|
||
|
||
## Werking | ||
|
||
Flux heeft een repo nodig als bron. In ons geval is dat een `OCI` Helm repository |
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,45 @@ | ||
apiVersion: source.toolkit.fluxcd.io/v1beta2 | ||
kind: HelmRepository | ||
metadata: | ||
name: oci-repo | ||
namespace: zgw | ||
spec: | ||
interval: 5m | ||
type: oci | ||
url: oci://ghcr.io/vng-realisatie | ||
secretRef: | ||
name: ghcr-auth | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: zgw | ||
namespace: zgw-test | ||
spec: | ||
interval: 5m | ||
targetNamespace: zgw-test | ||
releaseName: zgw-test | ||
chart: | ||
spec: | ||
chart: ri-zgw-test | ||
sourceRef: | ||
kind: HelmRepository | ||
name: oci-repo | ||
namespace: zgw | ||
--- | ||
apiVersion: helm.toolkit.fluxcd.io/v2beta1 | ||
kind: HelmRelease | ||
metadata: | ||
name: zgw | ||
namespace: zgw | ||
spec: | ||
interval: 5m | ||
targetNamespace: zgw | ||
releaseName: zgw | ||
chart: | ||
spec: | ||
chart: ri-zgw | ||
sourceRef: | ||
kind: HelmRepository | ||
name: oci-repo | ||
namespace: zgw |
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,40 @@ | ||
#!/bin/bash | ||
|
||
SECRET_NAME="ghcr-auth" | ||
NAMESPACE="zgw" | ||
|
||
delete_secret() { | ||
local secret_name=$1 | ||
local namespace=$2 | ||
|
||
existing_secret=$(kubectl get secret $secret_name -n $namespace --no-headers=true --ignore-not-found=true) | ||
|
||
if [[ -n $existing_secret ]]; then | ||
echo "Deleting secret $secret_name in ns $namespace." | ||
kubectl delete secret $secret_name -n $namespace | ||
else | ||
echo "Secret $secret_name does not exist in ns $namespace. Nothing to do." | ||
fi | ||
} | ||
|
||
create_secret() { | ||
local secret_name=$1 | ||
local namespace=$2 | ||
local github_pat=$3 | ||
|
||
flux create secret oci $secret_name \ | ||
--namespace=$namespace \ | ||
--url=ghcr.io \ | ||
--username=flux \ | ||
--password=$github_pat | ||
} | ||
|
||
# Check if GITHUB_PAT is provided as an argument, otherwise fetch it from the environment | ||
if [[ -n $1 ]]; then | ||
GITHUB_PAT=$1 | ||
else | ||
GITHUB_PAT=$GITHUB_PAT_ENV | ||
fi | ||
|
||
delete_secret $SECRET_NAME $NAMESPACE | ||
create_secret $SECRET_NAME $NAMESPACE $GITHUB_PAT |
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 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
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 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
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 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
Oops, something went wrong.