Skip to content

middlewaregruppen/harbor-operator

Repository files navigation

Go Release

harbor-operator

Manage Harbor registries with Kubernetes

Description

harbor-operator lets admins and developers manage resources in Harbor using Kubernetes through CRD's, such as Projects & Registries.

Getting Started

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).

Running on the cluster

  1. Install CRD's and the controller onto the clusters
kubectl apply -k config/crd
kubectl apply -k config/default
  1. Create secret holding credentials to the Harbor server
kubectl create secret generic harbor-credentials --from-literal="username=admin" --from-literal="password=Harbor12345"
  1. 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
  1. Start creating resources, such as Project with a reference to your HarborService
cat <<EOF | kubectl apply -f -
apiVersion: harbor.mdlwr.com/v1alpha1
kind: HarborProject
metadata:
  name: project-01
spec:
  harbor: harbor-default
EOF

Running locally (for contributors)

  1. Install CRD's
make install
  1. Run the controller
make run

Uninstall CRDs

To delete the CRDs from the cluster:

make uninstall

Undeploy controller

UnDeploy the controller to the cluster:

make undeploy

Contributing

You are welcome to contribute to this project by opening PR's. Create an Issue if you have feedback