harbor-operator

command module
v1.6.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 26, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

README

Harbor Operator

A Kubernetes operator for automated management of Goharbor instances

GitHub license Go Doc Release

Go Report Card Go

Table of contents

Installation

The helm chart of this operator can be found in this repository under ./deploy/chart Alternatively, you can use the helm.mittwald.de chart repository:

helm repo add mittwald https://helm.mittwald.de
helm repo update
helm install harbor-operator mittwald/harbor-operator --namespace my-namespace
Architecture
  • The operator manages the deployment of goharbor/harbor instances

  • Many components / features of Harbor can be accessed by creating Custom Resource Definitons. Resource changes are reconciled in the main controller loop.

    For a full list of Harbor's features, please refer to goharbor/harbor#features

  • The operator manages Harbor components by utilizing the mittwald/goharbor-client API client

  • Customized or private Harbor helm charts are supported via the InstanceChartRepository resource

    The official Harbor Helm chart can be found here

 0
/|\ User
/ \

 |
 |      creates         ┌───────────────────────────────┐
 ├────────────────────▶ |    InstanceChartRepository    |
 |                      |       (Custom Resource)       |
 |                      └───────────────────────────────┘
 |                                             ▲
 |      creates         ┌───────────────────┐  |
 ├────────────────────▶ |      Instance     |  |
 |                      | (Custom Resource) |  |
 |                      └───────────────────┘  | watches
 |                                    ▲        |
 |                                    |        |
 |                            watches |        |
 |                                    |        |           creates & updates
 |                                  ┌─┴────────┴──────┐      (via Instance)      
 |                                  │ Harbor Operator ├──────────────────────────┐
 |                                  └─────────┬─────┬─┘                          |
 |                                            ╎     |                            |
 |                                    watches ╎     |                            |
 |                                            ╎     |                            |
 |      creates         ┌─────────────────┐   ╎     |         ┌─────────┐  ┌─────┴──────┐
 ├────────────────────▶ |     Project     ├ - ┼ - - └─────── ▶| Harbor  ├──┤   Harbor   |
 |                      |(Custom Resource)|   ╎      perform  |   API   |  |Helm Release|
 |                      └─────────────────┘   ╎      CRUD     └─────────┘  └────────────┘
 |                              ▲             ╎      via the CRs on the left
 |                              |             ╎
 |           has access through |             ╎
 |               membership     |             ╎
 |                              |             ╎
 |      creates         ┌───────┴─────────┐   ╎
 ├────────────────────▶ |      User       ├ - ┤
 |                      |(Custom Resource)|   ╎
 |                      └─────────────────┘   ╎
 |      creates         ┌─────────────────┐   ╎
 ├────────────────────▶ |    Registry     ├ - ┤
 |                      |(Custom Resource)|   ╎
 |                      └─────────────────┘   ╎
 |                              ▲             ╎
 |                              |             ╎
 |                  is owned by |             ╎
 |                              |             ╎
 |      creates         ┌───────┴─────────┐   ╎
 └────────────────────▶ |    Replication  ├ - ┘
                        |(Custom Resource)|
                        └─────────────────┘
CRDs

The following Custom Resource Definitions can be used to create / configure Harbor components:

To get an overview of the individual resources that come with this operator, take a look at the samples directory.

Documentation

For more specific documentation, please refer to the godoc of this repository.

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.

Local installations can be accessed via http://

When making changes to API definitions (located in ./apis/registries/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.

Example Deployment

Note: If you want to test a local setup using an URL, you will need to append it to your /etc/hosts:

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 the operator has started:

kubectl create -f config/samples/

After a successful installation, the Harbor portal may be accessed either by localhost:30002 or core.harbor.domain:30002.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
api module
apipkg module
apis
registries/v1alpha2
Package v1alpha2 contains API Schema definitions for the registries v1alpha2 API group +kubebuilder:object:generate=true +groupName=registries.mittwald.de
Package v1alpha2 contains API Schema definitions for the registries v1alpha2 API group +kubebuilder:object:generate=true +groupName=registries.mittwald.de
controllers
pkg
apis Module

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL