Harbor Operator
A Kubernetes operator for managing Goharbor instances


This project is still under development and not stable yet - breaking changes may happen at any time and without notice
Features
Easy Harbor deployment & scaling:
- Every Harbor instance is bound only to the deployed Custom Resource.
The operator utilizes a helm client library for the management of these instances
Custom chart repositories:
- If you need to install a customized or private Harbor helm chart, the
InstanceChartRepository resource allows you to do so. The official Harbor Helm chart can be found here
Harbor resource reconciliation:
- This operator automatically manages Harbor components by utilizing
a custom harbor client.
CRDs
registries.mittwald.de/v1alpha2:
To get an overview of the individual resources that come with this operator,
take a look at the samples directory.
Installation
Helm
The helm chart of this operator can be found under ./deploy/helm-chart/harbor-operator.
Alternatively, you can use the the Mittwald Kubernetes Helm Charts repository:
helm repo add mittwald https://helm.mittwald.de
helm repo update
helm install harbor-operator mittwald/harbor-operator --namespace my-namespace
Documentation
For more specific documentation, please refer to the godoc of this repository.
Web UI
For a trouble-free experience with created instances, a valid TLS certificate is required.
However, local installations can be accessed via http://.
Automatic certificate creation can be configured via the Instance resource:
.spec.helmChart.valuesYaml.expose.ingress.annotations.
Example annotation value using cert-manager as the cluster-issuer:
cert-manager.io/cluster-issuer: "letsencrypt-issuer"
Local Development
To start the operator locally, run:
make run
To start a debug session using delve, run:
make debug
This will start a debugging server with the listen address localhost:2345.
When making changes to API definitions (located in ./api/v1alpha2),
make sure to re-generate manifests via:
make manifests
Testing
To test the operator, simply run:
make test
This will spin up a local envtest
environment and execute the provided tests.
Alternatively, you can run tests by ginkgo via:
ginkgo test ./...
Or via the go test suite:
go test -v ./...
Some unit tests require a mocked controller-runtime client.
This mock is generated using: make mock-runtime-client.
Deploying example resources
Note: When using the provided examples and running the operator locally, an entry to your /etc/hosts is
needed:
127.0.0.1 core.harbor.domain
Example resources can be deployed using the files provided in the samples directory.
To start testing, simply apply these after starting the operator:
k create -f config/samples/
After a successful installation, the Harbor portal may be accessed either by localhost:30002 or core.harbor.domain:30002.