@@ -437,36 +437,82 @@ That is, for most helm charts, you'll need to set an individual value.
437437
438438# ## Proper test
439439
440- * Start cluster:
440+ ** Some hints before getting started**
441+
442+ * Follow these steps in order
443+ * Important: Harbor has to be set up after initializing the cluster, but before installing GOP.
444+ Otherwise GOP deploys its own registry, leading to port conflicts:
445+ ` Service " harbor" is invalid: spec.ports[0].nodePort: Invalid value: 30000: provided port is already allocated`
446+ * By default, ` docker run` relies on the ` gitops-playground:dev` image.
447+ See [here](# Local-development) how to build it, or change `GOP_IMAGE` bellow to e.g. `ghcr.io/cloudogu/gitops-playground`
448+
449+ ** Setup**
450+
451+ * Start cluster and deploy harbor (same setup as [above](# external-registry-for-development), but with Port `30000`)
452+
441453` ` ` shell
442454scripts/init-cluster.sh
455+ helm repo add harbor https://helm.goharbor.io
456+ helm upgrade -i my-harbor harbor/harbor --version 1.14.2 --namespace harbor --create-namespace --values - << EOF
457+ expose:
458+ type: nodePort
459+ nodePort:
460+ ports:
461+ http:
462+ nodePort: 30000
463+ tls:
464+ enabled: false
465+ externalURL: http://localhost:30000
466+ internalTLS:
467+ enabled: false
468+ chartMuseum:
469+ enabled: false
470+ clair:
471+ enabled: false
472+ trivy:
473+ enabled: false
474+ notary:
475+ enabled: false
476+ EOF
443477` ` `
444- * Setup harbor as stated [above](# external-registry-for-development), but with Port `30000`.
445- Wait for harbor to startup: ` kubectl get pod -n harbor`
446- Don' t care about crashing harbor `jobservice`
478+
447479* Create registries and base image:
448480
449481` ` ` bash
482+ # Hit the API to see when harbor is ready
483+ until curl -s -o /dev/null -w " %{http_code}" http://localhost:30000/api/v2.0/projects | grep -q " 200" ; do
484+ echo " Waiting for harbor"
485+ sleep 1
486+ done
487+
488+ declare -A roles
489+ roles[' maintainer' ]=' 4'
490+ roles[' limited-guest' ]=' 5'
491+
450492operations=(" Proxy" " Registry" )
493+ readOnlyUser=' RegistryRead'
451494
452495for operation in " ${operations[@]} " ; do
453496
454497 # Convert the operation to lowercase for the project name and email
455498 lower_operation=$( echo " $operation " | tr ' [:upper:]' ' [:lower:]' )
456499
457- echo creating project $lower_operation
458- projectId=$(curl -is --fail ' http://localhost:30000/api/v2.0/projects' -X POST -u admin:Harbor12345 -H ' Content-Type: application/json' --data-raw "{\"project_name\":\"$lower_operation\",\"metadata\":{\"public\":\"false\"},\"storage_limit\":-1,\"registry_id\":null}" | grep -i ' Location:' | awk ' {print $2 }' | awk -F ' /' ' {print $NF }' | tr -d ' [:space:]' )
500+ echo " creating project ${ lower_operation} "
501+ projectId=$( curl -is --fail ' http://localhost:30000/api/v2.0/projects' -X POST -u admin:Harbor12345 -H ' Content-Type: application/json' --data-raw " {\" project_name\" :\" $lower_operation \" ,\" metadata\" :{\" public\" :\" false\" },\" storage_limit\" :-1,\" registry_id\" :null}" | grep -i ' Location:' | awk ' {print $2}' | awk -F ' /' ' {print $NF}' | tr -d ' [:space:]' )
459502
460- echo creating user $operation with PW ${operation}12345
503+ echo creating user ${ operation} with PW ${operation} 12345
461504 curl -s --fail ' http://localhost:30000/api/v2.0/users' -X POST -u admin:Harbor12345 -H ' Content-Type: application/json' --data-raw " {\" username\" :\" $operation \" ,\" email\" :\" $operation @example.com\" ,\" realname\" :\" $operation example\" ,\" password\" :\" ${operation} 12345\" ,\" comment\" :null}"
462505
463- echo "Adding member $operation to project $lower_operation; ID=${projectId}"
464-
465- curl --fail "http://localhost:30000/api/v2.0/projects/${projectId}/members" -X POST -u admin:Harbor12345 -H ' Content-Type: application/json' --data-raw "{\"role_id\":4,\"member_user\":{\"username\":\"$operation\"}}"
506+ echo " Adding member ${operation} to project ${lower_operation} ; ID=${projectId} "
507+ curl --fail " http://localhost:30000/api/v2.0/projects/${projectId} /members" -X POST -u admin:Harbor12345 -H ' Content-Type: application/json' --data-raw " {\" role_id\" :${roles['maintainer']} ,\" member_user\" :{\" username\" :\" $operation \" }}"
466508done
467509
510+ echo " creating user ${readOnlyUser} with PW ${readOnlyUser} 12345"
511+ curl -s --fail ' http://localhost:30000/api/v2.0/users' -X POST -u admin:Harbor12345 -H ' Content-Type: application/json' --data-raw " {\" username\" :\" $readOnlyUser \" ,\" email\" :\" $readOnlyUser @example.com\" ,\" realname\" :\" $readOnlyUser example\" ,\" password\" :\" ${readOnlyUser} 12345\" ,\" comment\" :null}"
512+ echo " Adding member ${readOnlyUser} to project proxy; ID=${projectId} "
513+ curl --fail " http://localhost:30000/api/v2.0/projects/${projectId} /members" -X POST -u admin:Harbor12345 -H ' Content-Type: application/json' --data-raw " {\" role_id\" :${roles['limited-guest']} ,\" member_user\" :{\" username\" :\" ${readOnlyUser} \" }}"
514+
468515# When updating the container image versions note that all images of a chart are listed at artifact hub on the right hand side under "Containers Images"
469- skopeo copy docker://eclipse-temurin:11-jre-alpine --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/eclipse-temurin:11-jre-alpine
470516skopeo copy docker://ghcr.io/cloudogu/mailhog:v1.0.1 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/mailhog
471517skopeo copy docker://ghcr.io/external-secrets/external-secrets:v0.9.16 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/external-secrets
472518skopeo copy docker://hashicorp/vault:1.14.0 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/vault
@@ -484,26 +530,35 @@ skopeo copy docker://quay.io/kiwigrid/k8s-sidecar:1.27.4 --dest-creds Proxy:Prox
484530skopeo copy docker://quay.io/jetstack/cert-manager-controller:v1.16.1 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/cert-manager-controller
485531skopeo copy docker://quay.io/jetstack/cert-manager-cainjector:v1.16.1 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/cert-manager-cainjector
486532skopeo copy docker://quay.io/jetstack/cert-manager-webhook:v1.16.1 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/cert-manager-webhook
487-
533+ # Needed for the builds to work with proxy-registry
534+ skopeo copy docker://bitnami/kubectl:1.29 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/bitnami/kubectl:1.29
535+ skopeo copy docker://eclipse-temurin:11-jre-alpine --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/eclipse-temurin:11-jre-alpine
536+ skopeo copy docker://ghcr.io/cloudogu/helm:3.16.1-1 --dest-creds Proxy:Proxy12345 --dest-tls-verify=false docker://localhost:30000/proxy/helm:latest
488537` ` `
489538
490539* Deploy playground:
491540
492541` ` ` bash
493- docker run --rm -t -u $(id -u) \
494- -v ~/.config/k3d/kubeconfig-gitops-playground.yaml:/home/.kube/config \
495- --net=host \
496- gitops-playground:dev -x \
542+ GOP_IMAGE=gitops-playground:dev # Non-local alternative: ghcr.io/cloudogu/gitops-playground
543+
544+ docker run --rm -t -u $(id -u) \
545+ -v ~/.config/k3d/kubeconfig-gitops-playground.yaml:/home/.kube/config \
546+ --net=host \
547+ ${GOP_IMAGE} -x \
497548 --yes --argocd --ingress-nginx --base-url=http://localhost \
498- --vault=dev --monitoring --mailhog \
549+ --vault=dev --monitoring --mailhog --cert-manager \
499550 --create-image-pull-secrets \
500551 --registry-url=localhost:30000 \
501552 --registry-path=registry \
502- --registry-username=Registry \
553+ --registry-username=Registry \
503554 --registry-password=Registry12345 \
504555 --registry-proxy-url=localhost:30000 \
505556 --registry-proxy-username=Proxy \
506557 --registry-proxy-password=Proxy12345 \
558+ --registry-username-read-only=RegistryRead \
559+ --registry-password-read-only=RegistryRead12345 \
560+ --kubectl-image=localhost:30000/proxy/bitnami/kubectl:1.29 \
561+ --helm-image=localhost:30000/proxy/helm:latest \
507562 --petclinic-image=localhost:30000/proxy/eclipse-temurin:11-jre-alpine \
508563 --mailhog-image=localhost:30000/proxy/mailhog:latest \
509564 --vault-image=localhost:30000/proxy/vault:latest \
@@ -512,11 +567,14 @@ docker run --rm -t -u $(id -u) \
512567 --external-secrets-webhook-image=localhost:30000/proxy/external-secrets:latest \
513568 --nginx-image=localhost:30000/proxy/nginx:latest \
514569 --ingress-nginx-image=localhost:30000/proxy/ingress-nginx:latest \
570+ --cert-manager-image=localhost:30000/proxy/cert-manager-controller:latest \
571+ --cert-manager-webhook-image=localhost:30000/proxy/cert-manager-webhook:latest \
572+ --cert-manager-cainjector-image=localhost:30000/proxy/cert-manager-cainjector:latest \
515573 --prometheus-image=localhost:30000/proxy/prometheus:v2.51.2 \
516574 --prometheus-operator-image=localhost:30000/proxy/prometheus-operator:latest \
517575 --prometheus-config-reloader-image=localhost:30000/proxy/prometheus-config-reloader:latest \
518576 --grafana-image=localhost:30000/proxy/grafana:latest \
519- --grafana-sidecar-image=localhost:30000/proxy/k8s-sidecar:latest
577+ --grafana-sidecar-image=localhost:30000/proxy/k8s-sidecar:latest \
520578# Or with config file --config-file=/config/gitops-playground.yaml
521579` ` `
522580
@@ -531,7 +589,8 @@ That's why we need to initialize our local cluster with some netpols for everyth
531589After the cluster is initialized and before GOP is applied, do the following:
532590
533591```bash
534- k apply --namespace " $ns " -f- << EOF
592+ # When using harbor, do the same for namespace harbor
593+ k apply -f- <<EOF
535594kind: NetworkPolicy
536595apiVersion: networking.k8s.io/v1
537596metadata:
0 commit comments