Skip to content
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

feat: add valkey to harbor #3014

Merged
merged 4 commits into from
Jan 15, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions licenses.d2iq.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -657,3 +657,8 @@ resources:
- url: https://github.com/goharbor/harbor
ref: ${image_tag}
license_path: LICENSE
- container_image: bitnami/valkey:8.0.2-debian-12-r0
sources:
- url: https://github.com/valkey-io/valkey
ref: ${image_tag%%-debian-*}
license_path: COPYING
18 changes: 17 additions & 1 deletion services/harbor/1.16.0/defaults/harbor.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,23 @@ data:
traefik.ingress.kubernetes.io/router.tls: "true"

redis:
type: internal
type: external
external:
addr: "harbor-valkey:26379"
sentinelMasterSet: harbor
# The "coreDatabaseIndex" must be "0" as the library Harbor
# used doesn't support configuring it
# harborDatabaseIndex defaults to "0", but it can be configured to "6", this config is optional
# cacheLayerDatabaseIndex defaults to "0", but it can be configured to "7", this config is optional
coreDatabaseIndex: "0"
jobserviceDatabaseIndex: "1"
registryDatabaseIndex: "2"
trivyAdapterIndex: "5"
# harborDatabaseIndex: "6"
# cacheLayerDatabaseIndex: "7"
# username field can be an empty string, and it will be authenticated against the default user
username: ""
existingSecret: harbor-valkey-password

database:
type: external
Expand Down
1 change: 1 addition & 0 deletions services/harbor/1.16.0/defaults/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,4 @@ resources:
- harbor.yaml
- database.yaml
- cloudnative-pg.yaml
- valkey.yaml
18 changes: 18 additions & 0 deletions services/harbor/1.16.0/defaults/valkey.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
apiVersion: v1
kind: ConfigMap
metadata:
name: harbor-valkey-2.2.3-d2iq-defaults
namespace: ${releaseNamespace}
data:
values.yaml: |
---
sentinel:
enabled: true
primarySet: harbor
auth:
enabled: true
sentinel: false
existingSecret: harbor-valkey-password
# This key is required by Harbor helm chart
existingSecretPasswordKey: REDIS_PASSWORD
1 change: 1 addition & 0 deletions services/harbor/1.16.0/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,4 @@ resources:
- pre-install.yaml
- cloudnative-pg.yaml
- database.yaml
- valkey.yaml
27 changes: 25 additions & 2 deletions services/harbor/1.16.0/pre-install/pre-install-jobs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ spec:
restartPolicy: OnFailure
priorityClassName: dkp-high-priority
containers:
- name: generate-admin-password
- name: generate-harbor-admin-password
image: "${kubetoolsImageRepository:=bitnami/kubectl}:${kubetoolsImageTag:=1.30.5}"
command:
- bash
Expand All @@ -85,9 +85,32 @@ spec:
SECRET_NAME="harbor-admin-password"

if kubectl get secret -n ncr-system "$SECRET_NAME" ; then
echo "harbor-admin-password secret exists"
echo "$SECRET_NAME secret exists"
exit 0
fi

kubectl create secret generic -n ncr-system "$SECRET_NAME" -oyaml --dry-run=client --save-config \
--from-literal=HARBOR_ADMIN_PASSWORD=$(tr -dc 'A-Za-z0-9!?%=' < /dev/urandom | head -c 20) | kubectl apply -f -
- name: generate-valkey-password
image: "${kubetoolsImageRepository:=bitnami/kubectl}:${kubetoolsImageTag:=1.30.5}"
command:
- bash
- -c
- |
set -o nounset
set -o errexit
set -o pipefail

echo() {
command echo $(date) "$@"
}

SECRET_NAME="harbor-valkey-password"

if kubectl get secret -n ncr-system "$SECRET_NAME" ; then
echo "$SECRET_NAME secret exists"
exit 0
fi

kubectl create secret generic -n ncr-system "$SECRET_NAME" -oyaml --dry-run=client --save-config \
--from-literal=REDIS_PASSWORD=$(tr -dc 'A-Za-z0-9!?%=' < /dev/urandom | head -c 20) | kubectl apply -f -
1 change: 1 addition & 0 deletions services/harbor/1.16.0/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ spec:
- name: ncr-system-namespace
- name: harbor-pre-install
- name: harbor-database
- name: harbor-valkey
sourceRef:
kind: GitRepository
name: management
Expand Down
29 changes: 29 additions & 0 deletions services/harbor/1.16.0/valkey.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: kustomize.toolkit.fluxcd.io/v1
kind: Kustomization
metadata:
name: harbor-valkey
namespace: ${releaseNamespace}
spec:
force: false
prune: true
wait: true
interval: 6h
retryInterval: 1m
path: ./services/harbor/1.16.0/valkey
dependsOn:
- name: ncr-system-namespace
- name: harbor-pre-install
sourceRef:
kind: GitRepository
name: management
namespace: kommander-flux
timeout: 1m
postBuild:
substituteFrom:
- kind: ConfigMap
name: substitution-vars
healthChecks:
- apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
name: harbor-valkey
namespace: ${releaseNamespace}
4 changes: 4 additions & 0 deletions services/harbor/1.16.0/valkey/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
resources:
- valkey.yaml
33 changes: 33 additions & 0 deletions services/harbor/1.16.0/valkey/valkey.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2
kind: HelmRelease
metadata:
name: harbor-valkey
namespace: ${releaseNamespace}
spec:
chart:
spec:
chart: valkey
sourceRef:
kind: HelmRepository
name: mesosphere.github.io-charts-stable
namespace: kommander-flux
version: 2.2.3
interval: 15s
install:
crds: CreateReplace
remediation:
retries: 30
upgrade:
crds: CreateReplace
remediation:
retries: 30
timeout: 5m0s
releaseName: harbor-valkey
targetNamespace: ncr-system
valuesFrom:
- kind: ConfigMap
name: harbor-valkey-2.2.3-d2iq-defaults
- kind: ConfigMap
name: harbor-valkey-overrides
optional: true
1 change: 0 additions & 1 deletion services/harbor/metadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ type: platform
scope:
- workspace
licensing:
- Starter
- Pro
- Ultimate
- Essentials
Expand Down
Loading