Skip to content

Commit

Permalink
feat(samples):adjust the related samples (#622)
Browse files Browse the repository at this point in the history
* feat(samples):adjust the related samples

- adjust samples under config folder
- use hierarchical kustomization manifests to generate samples for minimal, standard and full stack
- rename manifest yamls under manifests/samples
- do necessary changes for the above changes

Signed-off-by: Steven Zou <szou@vmware.com>

also fix #607

* fix(action):update sample flow

Signed-off-by: Steven Zou <szou@vmware.com>

* Update tests.yml

* fix(samples):add image patch to kustomization

Signed-off-by: Steven Zou <szou@vmware.com>

Co-authored-by: Ziming <zziming@vmware.com>
  • Loading branch information
steven-zou and bitsf committed Apr 29, 2021
1 parent 2b24d02 commit ffcce57
Show file tree
Hide file tree
Showing 33 changed files with 370 additions and 372 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -155,9 +155,9 @@ jobs:
ingress:
- "0.35.0"

storage:
- "fs"
- "minio"
samples:
- "full_stack.yaml"
- "standard_stack_fs.yaml"

steps:
- uses: actions/checkout@v2
Expand Down Expand Up @@ -232,7 +232,7 @@ jobs:
echo "CORE_HOST=$CORE_HOST" >> $GITHUB_ENV
echo "NOTARY_HOST=$NOTARY_HOST" >> $GITHUB_ENV
echo "MINIO_HOST=$MINIO_HOST" >> $GITHUB_ENV
samplefile=harbor_full_${{ matrix.storage }}.yaml
samplefile=${{ matrix.samples }}
sed -i "s/core.harbor.domain/$CORE_HOST/g" manifests/samples/$samplefile
sed -i "s/notary.harbor.domain/$NOTARY_HOST/g" manifests/samples/$samplefile
sed -i "s/minio.harbor.domain/$MINIO_HOST/g" manifests/samples/$samplefile
Expand Down Expand Up @@ -316,7 +316,7 @@ jobs:
kubectl -n cluster-sample-ns logs -l "goharbor.io/operator-controller=$name" --all-containers > /tmp/harbor/$name.log ; \
done
kubectl -n cluster-sample-ns logs -l "application=spilo" --all-containers > /tmp/harbor/db.log
kubectl -n cluster-sample-ns logs -l "app.kubernetes.io/component=redis" > /tmp/harbor/redis.log
kubectl -n cluster-sample-ns logs -l "app.kubernetes.io/component=redis" --all-containers > /tmp/harbor/redis.log
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
Expand Down Expand Up @@ -435,11 +435,12 @@ jobs:
NOTARY_HOST=notary.$IP.nip.io
echo "CORE_HOST=$CORE_HOST" >> $GITHUB_ENV
echo "NOTARY_HOST=$NOTARY_HOST" >> $GITHUB_ENV
sed -i "s/core.harbor.domain/$CORE_HOST/g" config/samples/harborcluster/*.yaml
sed -i "s/notary.harbor.domain/$NOTARY_HOST/g" config/samples/harborcluster/*.yaml
sed -i "s/logLevel: info/logLevel: debug/g" config/samples/harborcluster/goharbor_v1alpha3_harborcluster.yaml
sed -i "s/core.harbor.domain/$CORE_HOST/g" config/samples/harborcluster-minimal/*.yaml
sed -i "s/notary.harbor.domain/$NOTARY_HOST/g" config/samples/harborcluster-minimal/*.yaml
sed -i "s/core.harbor.domain/$CORE_HOST/g" config/samples/harborcluster-standard/*.yaml
sed -i "s/notary.harbor.domain/$NOTARY_HOST/g" config/samples/harborcluster-standard/*.yaml
make sample-harborcluster
make sample-harborcluster-standard
for i in $(seq 1 7);do
sleep 30
Expand Down Expand Up @@ -485,7 +486,7 @@ jobs:
- name: apidb test
run: |
git clone https://github.com/goharbor/harbor -b v2.2.1
kubectl patch deploy harborcluster-sample-harbor-harbor-core -p '{"spec":{"template":{"spec":{"containers":[{"name":"core","env":[{"name":"GC_TIME_WINDOW_HOURS","value":"0"}]}]}}}}'
kubectl patch deploy sample-harbor-harbor-core -p '{"spec":{"template":{"spec":{"containers":[{"name":"core","env":[{"name":"GC_TIME_WINDOW_HOURS","value":"0"}]}]}}}}'
sleep 5
kubectl wait --for=condition=Ready -l job-type!=minio-init pod --all --timeout 600s
docker run --rm -t --privileged -v `pwd`/harbor:/drone -v /etc/docker/certs.d/$CORE_HOST/:/ca -v /etc/docker/certs.d/$CORE_HOST/:/root/.docker/tls/$NOTARY_HOST/ -e NOTARY_URL=https://$NOTARY_HOST -w /drone goharbor/harbor-e2e-engine:2.6.3 \
Expand All @@ -498,10 +499,10 @@ jobs:
run: |
mkdir -p /tmp/harbor
for name in core jobservice registry registryctl trivy chartmuseum notaryserver notarysigner portal; do \
kubectl -n cluster-sample-ns logs -l "goharbor.io/operator-controller=$name" --all-containers > /tmp/harbor/$name.log ; \
kubectl logs -l "goharbor.io/operator-controller=$name" --all-containers > /tmp/harbor/$name.log ; \
done
kubectl -n cluster-sample-ns logs -l "application=spilo" --all-containers > /tmp/harbor/db.log
kubectl -n cluster-sample-ns logs -l "app.kubernetes.io/component=redis" > /tmp/harbor/redis.log
kubectl logs -l "app.kubernetes.io/instance=harbor-database" --all-containers > /tmp/harbor/db.log
kubectl logs -l "release=harbor-redis" --all-containers > /tmp/harbor/redis.log
- uses: actions/upload-artifact@v2
if: ${{ failure() }}
Expand Down Expand Up @@ -566,9 +567,9 @@ jobs:
fail-fast: false
matrix:
path:
- harbor
- harbor-full
- harborcluster
- harborcluster-minimal
- harborcluster-standard
- harborcluster-fullstack
steps:
- uses: actions/checkout@v2
- uses: azure/k8s-bake@v1
Expand Down
17 changes: 0 additions & 17 deletions config/samples/harbor/internal_tls.yaml

This file was deleted.

36 changes: 0 additions & 36 deletions config/samples/harbor/kustomization.yaml

This file was deleted.

4 changes: 4 additions & 0 deletions config/samples/harborcluster-fullstack/certificate_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- op: add
path: "/spec/dnsNames/-"
value:
minio.harbor.domain
19 changes: 19 additions & 0 deletions config/samples/harborcluster-fullstack/incluster_cache_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
apiVersion: goharbor.io/v1alpha3
kind: HarborCluster
metadata:
name: sample
spec:
inClusterCache:
kind: Redis
redisSpec:
server:
replicas: 1
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 100m
memory: 250Mi
sentinel:
replicas: 1
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: goharbor.io/v1alpha3
kind: HarborCluster
metadata:
name: sample
spec:
inClusterDatabase:
kind: PostgresSQL
postgresSqlSpec:
storage: 1Gi
replicas: 1
resources:
limits:
cpu: 500m
memory: 500Mi
requests:
cpu: 100m
memory: 250Mi
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
apiVersion: goharbor.io/v1alpha3
kind: HarborCluster
metadata:
name: sample
spec:
inClusterStorage:
kind: MinIO
minIOSpec:
replicas: 2
secretRef: minio-access-secret
redirect:
enable: true
expose:
ingress:
host: minio.harbor.domain
tls:
certificateRef: sample-public-certificate
volumesPerServer: 2
volumeClaimTemplate:
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 10Gi
37 changes: 37 additions & 0 deletions config/samples/harborcluster-fullstack/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
commonLabels:
sample: "true"

bases:
- ../../kustomizeconfig
- ../harborcluster-standard/

secretGenerator:
- name: minio-access-secret
literals:
- accesskey=admin
- secretkey=minio123
type: Opaque
generatorOptions:
disableNameSuffixHash: true

patchesStrategicMerge:
- incluster_cache_patch.yaml
- incluster_database_patch.yaml
- incluster_storage_patch.yaml
- resources_patch.yaml

patchesJson6902:
- target:
kind: Certificate
name: sample-public-certificate
group: cert-manager.io
version: v1
path: certificate_patch.yaml
- target:
kind: HarborCluster
name: sample
group: goharbor.io
version: v1alpha3
path: spec_patch.yaml
11 changes: 11 additions & 0 deletions config/samples/harborcluster-fullstack/resources_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sample-harbor-chart
$patch: delete
---
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: sample-harbor-registry
$patch: delete
6 changes: 6 additions & 0 deletions config/samples/harborcluster-fullstack/spec_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
- op: remove
path: "/spec/database"
- op: remove
path: "/spec/imageChartStorage"
- op: remove
path: "/spec/redis"
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: goharbor.io/v1alpha3
kind: Harbor
kind: HarborCluster
metadata:
name: sample
spec:
Expand Down
File renamed without changes.
7 changes: 7 additions & 0 deletions config/samples/harborcluster-minimal/images_patch.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: goharbor.io/v1alpha3
kind: HarborCluster
metadata:
name: sample
spec:
imageSource:
repository: ghcr.io/goharbor
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,16 @@ resources:
- https.yaml
- service_token_issuer.yaml
- storage.yaml
- goharbor_v1alpha3_harborcluster.yaml
- goharbor_v1alpha3_harbor.yaml

secretGenerator:
- name: admin-core-secret
literals:
- secret=Harbor12345
type: "goharbor.io/single-secret"
- name: core-database-encryption
literals:
- secret=1234567890123456
type: "goharbor.io/single-secret"

bases:
- ../../kustomizeconfig
- ../../kustomizeconfig

patchesStrategicMerge:
- images_patch.yaml
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: goharbor.io/v1alpha3
kind: Harbor
kind: HarborCluster
metadata:
name: sample
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
apiVersion: goharbor.io/v1alpha3
kind: Harbor
kind: HarborCluster
metadata:
name: sample
spec:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
apiVersion: goharbor.io/v1alpha3
kind: Harbor
kind: HarborCluster
metadata:
name: sample
spec:
trivy:
skipUpdate: false
githubTokenRef: github-credentials
storage:
reportsPersistentVolume:
claimName: sample-harbor-trivy-reports
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resources:

bases:
- ../../kustomizeconfig
- ../harbor
- ../harborcluster-minimal

patchesStrategicMerge:
- harbor_chartmuseum_patch.yaml
Expand Down
File renamed without changes.

0 comments on commit ffcce57

Please sign in to comment.