Manage Harbor registries with Kubernetes
harbor-operator lets admins and developers manage resources in Harbor using Kubernetes through CRD's, such as Projects & Registries.
You’ll need a Kubernetes cluster to run against. You can use KIND to get a local cluster for testing, or run against a remote cluster.
Note: Your controller will automatically use the current context in your kubeconfig file (i.e. whatever cluster kubectl cluster-info
shows).
- Install CRD's and the controller onto the clusters
kubectl apply -k config/crd
kubectl apply -k config/default
- Create secret holding credentials to the Harbor server
kubectl create secret generic harbor-credentials --from-literal="username=admin" --from-literal="password=Harbor12345"
- Create a
HarborService
cat <<EOF | kubectl apply -f -
apiVersion: harbor.mdlwr.com/v1alpha1
kind: HarborService
metadata:
name: harbor-default
spec:
insecure: true
scheme: https
externalBackend:
host: harbor.my.company.com
port: 443
secretRef:
name: harbor-credentials
EOF
- Start creating resources, such as
Project
with a reference to yourHarborService
cat <<EOF | kubectl apply -f -
apiVersion: harbor.mdlwr.com/v1alpha1
kind: HarborProject
metadata:
name: project-01
spec:
harbor: harbor-default
EOF
- Install CRD's
make install
- Run the controller
make run
To delete the CRDs from the cluster:
make uninstall
UnDeploy the controller to the cluster:
make undeploy
You are welcome to contribute to this project by opening PR's. Create an Issue if you have feedback