Skip to content

Commit

Permalink
Bump up to harbor 2.6 (#970)
Browse files Browse the repository at this point in the history
Signed-off-by: He Weiwei <hweiwei@vmware.com>
  • Loading branch information
heww committed Nov 29, 2022
1 parent 30d6d29 commit 094e9a3
Show file tree
Hide file tree
Showing 27 changed files with 5,088 additions and 22 deletions.
13 changes: 8 additions & 5 deletions .github/scripts/apidb_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,25 +4,28 @@ sleep 10
kubectl -n ${NAMESPACE:-default} wait --for=condition=Ready -l job-type!=minio-init pod --all --timeout 600s


git clone https://github.com/goharbor/harbor -b release-2.5.0
git clone https://github.com/goharbor/harbor -b release-2.6.0

# run 'df -h' before test
sed -i '15i\ ${dfout}= Run df -h\n Log To Console ${dfout}' harbor/tests/resources/APITest-Util.robot

# increase the timeout of the docker client because the performance of pushing images to harbor with minio storage is very poor
# increase the timeout of the docker client because the performance of pushing images to harbor with minio storage is very poor
sed -i 's/timeout=30/timeout=300/g' harbor/tests/apitests/python/library/docker_api.py


EXCLUDES="--exclude metrics --exclude singularity --exclude proxy_cache --exclude push_cnab"
EXCLUDES="--exclude metrics --exclude singularity --exclude proxy_cache --exclude push_cnab --exclude scan_data_export --exclude log_forward"
ROBOT_FILES="/drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot"
CMD="robot -v DOCKER_USER:$DOCKER_USER -v DOCKER_PWD:$DOCKER_PWD -v ip:$CORE_HOST -v ip1: -v HARBOR_PASSWORD:Harbor12345 -v http_get_ca:true $EXCLUDES $ROBOT_FILES"

E2E_IMAGE="goharbor/harbor-e2e-engine:4.2.1-api"
E2E_IMAGE="goharbor/harbor-e2e-engine:4.3.0-api"

# mount dir in the host to the /var/lib/docker in the container to improve the performance of the docker deamon
DOCKER_DATA_DIR=`mktemp -d -t docker-XXXXXX`

docker run -i --rm --privileged -v `pwd`/harbor:/drone -v $DOCKER_DATA_DIR:/var/lib/docker -e NOTARY_URL=https://$NOTARY_HOST -w /drone $E2E_IMAGE $CMD
mkdir -p /var/log/harbor/

docker run -i --rm --privileged -v `pwd`/harbor:/drone -v /var/log/harbor/:/var/log/harbor/ -v $DOCKER_DATA_DIR:/var/lib/docker -e NOTARY_URL=https://$NOTARY_HOST -w /drone $E2E_IMAGE make swagger_client
docker run -i --rm --privileged -v `pwd`/harbor:/drone -v /var/log/harbor/:/var/log/harbor/ -v $DOCKER_DATA_DIR:/var/lib/docker -e NOTARY_URL=https://$NOTARY_HOST -w /drone $E2E_IMAGE $CMD

rc=$?

Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ config/webhook/manifests.yaml
charts/index.yaml
charts/*.tgz
charts/harbor-operator/charts/*.tgz
charts/postgres-operator/

## Mac file
.DS_Store
Expand Down
35 changes: 29 additions & 6 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -118,16 +118,39 @@ release-test: goreleaser
CHART_RELEASE_NAME ?= harbor-operator
CHART_HARBOR_CLASS ?=

helm-install: helm helm-generate
helm-minio-operator: helm
$(MAKE) kube-namespace
$(HELM) repo add minio https://operator.min.io/
$(HELM) repo update
$(HELM) upgrade --namespace "$(NAMESPACE)" --install minio-operator minio/operator --version 4.4.28

helm-redis-operator: helm
$(MAKE) kube-namespace
$(HELM) repo add spotahome https://spotahome.github.io/redis-operator
$(HELM) repo update
$(HELM) upgrade --namespace "$(NAMESPACE)" --install redis-operator spotahome/redis-operator --version 3.1.4

$(CHARTS_DIRECTORY)/postgres-operator/values.yaml:
mkdir -p $(CHARTS_DIRECTORY)/postgres-operator
echo "configKubernetes:" > '$@'
echo ' secret_name_template: "{username}.{cluster}.credentials"' >> '$@'

helm-postgres-operator: helm $(CHARTS_DIRECTORY)/postgres-operator/values.yaml
$(MAKE) kube-namespace
$(HELM) repo add zalando https://opensource.zalando.com/postgres-operator/charts/postgres-operator
$(HELM) repo update
$(HELM) upgrade --namespace "$(NAMESPACE)" --install postgres-operator zalando/postgres-operator --version 1.6.3 -f $(CHARTS_DIRECTORY)/postgres-operator/values.yaml

helm-install: helm helm-generate helm-minio-operator helm-redis-operator helm-postgres-operator
$(MAKE) kube-namespace
$(HELM) upgrade --namespace "$(NAMESPACE)" --install $(CHART_RELEASE_NAME) $(CHARTS_DIRECTORY)/harbor-operator-$(RELEASE_VERSION).tgz \
--set-string image.repository="$$(echo $(IMG) | sed 's/:.*//')" \
--set-string image.tag="$$(echo $(IMG) | sed 's/.*://')" \
--set-string harborClass='$(CHART_HARBOR_CLASS)' \
--set installCRDs=true \
--set minio-operator.enabled=true \
--set postgres-operator.enabled=true \
--set redis-operator.enabled=true
--set minio-operator.enabled=false \
--set postgres-operator.enabled=false \
--set redis-operator.enabled=false

CLUSTER_NAME := harbor-operator

Expand Down Expand Up @@ -372,7 +395,7 @@ $(CHART_HARBOR_OPERATOR)/README.md: helm-docs $(CHART_HARBOR_OPERATOR)/README.md
# Install CRDs into a cluster
.PHONY: install
install: go-generate
kubectl apply -f config/crd/bases
kubectl apply --server-side=true --force-conflicts -f config/crd/bases

# Uninstall CRDs from a cluster
.PHONY: uninstall
Expand Down Expand Up @@ -466,7 +489,7 @@ certmanager: helm jetstack
--version v1.4.3 \
--set installCRDs=true
kubectl wait --namespace $(CERTMANAGER_NAMESPACE) --for=condition=ready pod --timeout="60s" --all


.PHONY: jetstack
jetstack:
Expand Down
10 changes: 10 additions & 0 deletions apis/goharbor.io/v1beta1/harbor_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -388,6 +388,9 @@ type JobServiceComponentSpec struct {

// +kubebuilder:validation:Optional
Metrics *harbormetav1.MetricsSpec `json:"metrics,omitempty"`

// +kubebuilder:validation:Optional
Storage *HarborStorageJobServiceStorageSpec `json:"storage,omitempty"`
}

type RegistryComponentSpec struct {
Expand Down Expand Up @@ -508,6 +511,13 @@ type HarborStorageImageChartStorageSpec struct {
Gcs *HarborStorageImageChartStorageGcsSpec `json:"gcs,omitempty"`
}

type HarborStorageJobServiceStorageSpec struct {
// +kubebuilder:validation:Optional
// ScanDataExportsPersistentVolume specify the persistent volume used to store data exports.
// If empty, empty dir will be used.
ScanDataExportsPersistentVolume *HarborStoragePersistentVolumeSpec `json:"scanDataExportsPersistentVolume,omitempty"`
}

type HarborStorageTrivyStorageSpec struct {
// +kubebuilder:validation:Optional
// ReportsPersistentVolume specify the persistent volume used to store Trivy reports.
Expand Down
17 changes: 17 additions & 0 deletions apis/goharbor.io/v1beta1/jobservice_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,23 @@ type JobServiceSpec struct {

// +kubebuilder:validation:Optional
Trace *harbormetav1.TraceSpec `json:"trace,omitempty"`

// +kubebuilder:validation:Optional
Storage *JobServiceStorageSpec `json:"storage,omitempty"`
}

type JobServiceStorageSpec struct {
// +kubebuilder:validation:Required
ScanDataExports JobServiceStorageVolumeSpec `json:"scanDataExports"`
}

type JobServiceStorageVolumeSpec struct {
// +kubebuilder:validation:Optional
// +kubebuilder:default={"emptyDir":{"sizeLimit":"1Gi"}}
VolumeSource corev1.VolumeSource `json:"volumeSource,omitempty"`

// +kubebuilder:validation:Optional
Prefix string `json:"prefix,omitempty"`
}

type JobServiceTokenSpec struct {
Expand Down
62 changes: 62 additions & 0 deletions apis/goharbor.io/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 094e9a3

Please sign in to comment.