author
int64 658
755k
| date
stringlengths 19
19
| timezone
int64 -46,800
43.2k
| hash
stringlengths 40
40
| message
stringlengths 5
490
| mods
list | language
stringclasses 20
values | license
stringclasses 3
values | repo
stringlengths 5
68
| original_message
stringlengths 12
491
|
|---|---|---|---|---|---|---|---|---|---|
254,875
|
03.11.2020 18:21:22
| -28,800
|
50137a6b4812ee6020817761002643616a7825e1
|
feat(ci) fix push docker images
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/build-dev.yml",
"new_path": ".github/workflows/build-dev.yml",
"diff": "-name: dev\n+name: Dev Image\non:\npush:\nbranches:\n- master\n+ - develop\n- release-*\njobs:\n@@ -11,16 +12,21 @@ jobs:\nruns-on: ubuntu-latest\nsteps:\n- uses: actions/checkout@v2\n+ - name: Build manager\n+ run: |\n+ mkdir ./target\n+ echo -n \"dev_${GITHUB_REF##refs/*/}\" > ./target/TAG_NAME\n+ make dist/harbor-operator_linux_amd64/manager\n- name: Docker Build & Push to Docker Hub\nuses: opspresso/action-docker@master\nwith:\nargs: --docker\nenv:\n- USERNAME: ${{ secrets.DOCKER_USER }}\n- PASSWORD: ${{ secrets.DOCKER_TOKEN }}\n+ BUILD_PATH: dist/harbor-operator_linux_amd64\nDOCKERFILE: Dockerfile\n+ USERNAME: '${{ secrets.DOCKER_USER }}'\n+ PASSWORD: '${{ secrets.DOCKER_TOKEN }}'\nIMAGE_NAME: goharbor/harbor-operator\n- TAG_NAME: dev\nLATEST: 'false'\ncharts:\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": ".github/workflows/release-docker.yml",
"diff": "+name: Release Image\n+\n+on:\n+ release:\n+ types:\n+ - created\n+ - published\n+\n+jobs:\n+ docker:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ # opspresso/action-docker use body of ./target/TAG_NAME as docker tag\n+ # https://github.com/opspresso/action-docker#common-env\n+ - name: Build manager\n+ run: |\n+ mkdir ./target\n+ echo -n \"${GITHUB_REF##refs/*/}\" > ./target/TAG_NAME\n+ make dist/harbor-operator_linux_amd64/manager\n+ - name: Docker Build & Push to Docker Hub\n+ uses: opspresso/action-docker@master\n+ with:\n+ args: --docker\n+ env:\n+ BUILD_PATH: dist/harbor-operator_linux_amd64\n+ DOCKERFILE: Dockerfile\n+ USERNAME: '${{ secrets.DOCKER_USER }}'\n+ PASSWORD: '${{ secrets.DOCKER_TOKEN }}'\n+ IMAGE_NAME: goharbor/harbor-operator\n+ LATEST: 'false'\n\\ No newline at end of file\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(ci) fix push docker images
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,875
|
03.11.2020 18:49:21
| -28,800
|
eb210c96c5132123e368dbf06326ad08ce7f07be
|
feat(ci) update go mod
|
[
{
"change_type": "MODIFY",
"old_path": "go.mod",
"new_path": "go.mod",
"diff": "@@ -14,7 +14,6 @@ require (\ngithub.com/imdario/mergo v0.3.10 // indirect\ngithub.com/jaegertracing/jaeger-lib v2.2.0+incompatible\ngithub.com/jetstack/cert-manager v0.15.2\n- github.com/markbates/pkger v0.15.1\ngithub.com/mitchellh/reflectwalk v1.0.1 // indirect\ngithub.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e // indirect\ngithub.com/onsi/ginkgo v1.14.0\n"
},
{
"change_type": "MODIFY",
"old_path": "vendor/modules.txt",
"new_path": "vendor/modules.txt",
"diff": "# cloud.google.com/go v0.58.0\n+## explicit\ncloud.google.com/go/compute/metadata\n# github.com/Masterminds/goutils v1.1.0\ngithub.com/Masterminds/goutils\n# github.com/Masterminds/semver v1.5.0\n+## explicit\ngithub.com/Masterminds/semver\n# github.com/Masterminds/sprig v2.22.0+incompatible\n+## explicit\ngithub.com/Masterminds/sprig\n# github.com/beorn7/perks v1.0.1\ngithub.com/beorn7/perks/quantile\n@@ -19,20 +22,21 @@ github.com/fsnotify/fsnotify\n# github.com/ghodss/yaml v1.0.0\ngithub.com/ghodss/yaml\n# github.com/go-kit/kit v0.10.0\n+## explicit\ngithub.com/go-kit/kit/log\ngithub.com/go-kit/kit/log/level\n# github.com/go-logfmt/logfmt v0.5.0\ngithub.com/go-logfmt/logfmt\n# github.com/go-logr/logr v0.1.0\n+## explicit\ngithub.com/go-logr/logr\n# github.com/go-logr/zapr v0.1.1\ngithub.com/go-logr/zapr\n-# github.com/gobuffalo/here v0.6.0\n-github.com/gobuffalo/here\n# github.com/gogo/protobuf v1.3.1\ngithub.com/gogo/protobuf/proto\ngithub.com/gogo/protobuf/sortkeys\n# github.com/goharbor/harbor/src v0.0.0-20200728051037-1d361a89a056\n+## explicit\ngithub.com/goharbor/harbor/src/common\ngithub.com/goharbor/harbor/src/common/config/metadata\ngithub.com/goharbor/harbor/src/lib/log\n@@ -59,15 +63,20 @@ github.com/googleapis/gnostic/OpenAPIv2\ngithub.com/googleapis/gnostic/compiler\ngithub.com/googleapis/gnostic/extensions\n# github.com/hashicorp/golang-lru v0.5.4\n+## explicit\ngithub.com/hashicorp/golang-lru\ngithub.com/hashicorp/golang-lru/simplelru\n# github.com/huandu/xstrings v1.3.2\n+## explicit\ngithub.com/huandu/xstrings\n# github.com/imdario/mergo v0.3.10\n+## explicit\ngithub.com/imdario/mergo\n# github.com/jaegertracing/jaeger-lib v2.2.0+incompatible\n+## explicit\ngithub.com/jaegertracing/jaeger-lib/client/log/go-kit\n# github.com/jetstack/cert-manager v0.15.2\n+## explicit\ngithub.com/jetstack/cert-manager/pkg/apis/acme\ngithub.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2\ngithub.com/jetstack/cert-manager/pkg/apis/certmanager\n@@ -78,25 +87,19 @@ github.com/jetstack/cert-manager/pkg/apis/meta/v1\ngithub.com/json-iterator/go\n# github.com/konsorten/go-windows-terminal-sequences v1.0.3\ngithub.com/konsorten/go-windows-terminal-sequences\n-# github.com/markbates/pkger v0.15.1\n-github.com/markbates/pkger\n-github.com/markbates/pkger/internal/maps\n-github.com/markbates/pkger/internal/takeon/github.com/markbates/hepa\n-github.com/markbates/pkger/internal/takeon/github.com/markbates/hepa/filters\n-github.com/markbates/pkger/pkging\n-github.com/markbates/pkger/pkging/embed\n-github.com/markbates/pkger/pkging/mem\n-github.com/markbates/pkger/pkging/stdos\n# github.com/matttproud/golang_protobuf_extensions v1.0.1\ngithub.com/matttproud/golang_protobuf_extensions/pbutil\n# github.com/mitchellh/copystructure v1.0.0\ngithub.com/mitchellh/copystructure\n# github.com/mitchellh/reflectwalk v1.0.1\n+## explicit\ngithub.com/mitchellh/reflectwalk\n# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd\ngithub.com/modern-go/concurrent\n# github.com/modern-go/reflect2 v1.0.1\ngithub.com/modern-go/reflect2\n+# github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e\n+## explicit\n# github.com/nxadm/tail v1.4.4\ngithub.com/nxadm/tail\ngithub.com/nxadm/tail/ratelimiter\n@@ -104,6 +107,7 @@ github.com/nxadm/tail/util\ngithub.com/nxadm/tail/watch\ngithub.com/nxadm/tail/winfile\n# github.com/onsi/ginkgo v1.14.0\n+## explicit\ngithub.com/onsi/ginkgo\ngithub.com/onsi/ginkgo/config\ngithub.com/onsi/ginkgo/extensions/table\n@@ -125,6 +129,7 @@ github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable\ngithub.com/onsi/ginkgo/reporters/stenographer/support/go-isatty\ngithub.com/onsi/ginkgo/types\n# github.com/onsi/gomega v1.10.1\n+## explicit\ngithub.com/onsi/gomega\ngithub.com/onsi/gomega/format\ngithub.com/onsi/gomega/gbytes\n@@ -142,16 +147,21 @@ github.com/onsi/gomega/matchers/support/goraph/node\ngithub.com/onsi/gomega/matchers/support/goraph/util\ngithub.com/onsi/gomega/types\n# github.com/opentracing-contrib/go-stdlib v1.0.0\n+## explicit\ngithub.com/opentracing-contrib/go-stdlib/nethttp\n# github.com/opentracing/opentracing-go v1.2.0\n+## explicit\ngithub.com/opentracing/opentracing-go\ngithub.com/opentracing/opentracing-go/ext\ngithub.com/opentracing/opentracing-go/log\n# github.com/ovh/configstore v0.3.2\n+## explicit\ngithub.com/ovh/configstore\n# github.com/pkg/errors v0.9.1\n+## explicit\ngithub.com/pkg/errors\n# github.com/prometheus/client_golang v1.7.0\n+## explicit\ngithub.com/prometheus/client_golang/prometheus\ngithub.com/prometheus/client_golang/prometheus/internal\ngithub.com/prometheus/client_golang/prometheus/promhttp\n@@ -166,12 +176,15 @@ github.com/prometheus/procfs\ngithub.com/prometheus/procfs/internal/fs\ngithub.com/prometheus/procfs/internal/util\n# github.com/sethvargo/go-password v0.1.3\n+## explicit\ngithub.com/sethvargo/go-password/password\n# github.com/sirupsen/logrus v1.6.0\n+## explicit\ngithub.com/sirupsen/logrus\n# github.com/spf13/pflag v1.0.5\ngithub.com/spf13/pflag\n# github.com/uber/jaeger-client-go v2.24.0+incompatible\n+## explicit\ngithub.com/uber/jaeger-client-go\ngithub.com/uber/jaeger-client-go/config\ngithub.com/uber/jaeger-client-go/internal/baggage\n@@ -191,6 +204,7 @@ github.com/uber/jaeger-client-go/thrift-gen/zipkincore\ngithub.com/uber/jaeger-client-go/transport\ngithub.com/uber/jaeger-client-go/utils\n# github.com/uber/jaeger-lib v2.2.0+incompatible\n+## explicit\ngithub.com/uber/jaeger-lib/metrics\ngithub.com/uber/jaeger-lib/metrics/prometheus\n# go.uber.org/atomic v1.6.0\n@@ -198,6 +212,7 @@ go.uber.org/atomic\n# go.uber.org/multierr v1.5.0\ngo.uber.org/multierr\n# go.uber.org/zap v1.15.0\n+## explicit\ngo.uber.org/zap\ngo.uber.org/zap/buffer\ngo.uber.org/zap/internal/bufferpool\n@@ -205,12 +220,14 @@ go.uber.org/zap/internal/color\ngo.uber.org/zap/internal/exit\ngo.uber.org/zap/zapcore\n# golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de\n+## explicit\ngolang.org/x/crypto/bcrypt\ngolang.org/x/crypto/blowfish\ngolang.org/x/crypto/pbkdf2\ngolang.org/x/crypto/scrypt\ngolang.org/x/crypto/ssh/terminal\n# golang.org/x/net v0.0.0-20200602114024-627f9648deb9\n+## explicit\ngolang.org/x/net/context\ngolang.org/x/net/context/ctxhttp\ngolang.org/x/net/html\n@@ -227,8 +244,10 @@ golang.org/x/oauth2/internal\ngolang.org/x/oauth2/jws\ngolang.org/x/oauth2/jwt\n# golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a\n+## explicit\ngolang.org/x/sync/errgroup\n# golang.org/x/sys v0.0.0-20200620081246-981b61492c35\n+## explicit\ngolang.org/x/sys/internal/unsafeheader\ngolang.org/x/sys/unix\ngolang.org/x/sys/windows\n@@ -254,11 +273,15 @@ golang.org/x/text/transform\ngolang.org/x/text/unicode/bidi\ngolang.org/x/text/unicode/norm\n# golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1\n+## explicit\ngolang.org/x/time/rate\n+# golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f\n+## explicit\n# golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543\ngolang.org/x/xerrors\ngolang.org/x/xerrors/internal\n# gomodules.xyz/jsonpatch/v2 v2.1.0\n+## explicit\ngomodules.xyz/jsonpatch/v2\n# google.golang.org/appengine v1.6.6\ngoogle.golang.org/appengine\n@@ -302,6 +325,8 @@ google.golang.org/protobuf/runtime/protoimpl\ngoogle.golang.org/protobuf/types/known/anypb\ngoogle.golang.org/protobuf/types/known/durationpb\ngoogle.golang.org/protobuf/types/known/timestamppb\n+# gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f\n+## explicit\n# gopkg.in/inf.v0 v0.9.1\ngopkg.in/inf.v0\n# gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7\n@@ -309,6 +334,7 @@ gopkg.in/tomb.v1\n# gopkg.in/yaml.v2 v2.3.0\ngopkg.in/yaml.v2\n# k8s.io/api v0.18.4\n+## explicit\nk8s.io/api/admission/v1beta1\nk8s.io/api/admissionregistration/v1\nk8s.io/api/admissionregistration/v1beta1\n@@ -351,6 +377,7 @@ k8s.io/api/storage/v1\nk8s.io/api/storage/v1alpha1\nk8s.io/api/storage/v1beta1\n# k8s.io/apiextensions-apiserver v0.18.4\n+## explicit\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1\n@@ -359,6 +386,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1\n# k8s.io/apimachinery v0.18.4\n+## explicit\nk8s.io/apimachinery/pkg/api/equality\nk8s.io/apimachinery/pkg/api/errors\nk8s.io/apimachinery/pkg/api/meta\n@@ -404,6 +432,7 @@ k8s.io/apimachinery/pkg/watch\nk8s.io/apimachinery/third_party/forked/golang/json\nk8s.io/apimachinery/third_party/forked/golang/reflect\n# k8s.io/client-go v0.18.4\n+## explicit\nk8s.io/client-go/discovery\nk8s.io/client-go/dynamic\nk8s.io/client-go/kubernetes\n@@ -486,11 +515,13 @@ k8s.io/klog/v2\n# k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6\nk8s.io/kube-openapi/pkg/util/proto\n# k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19\n+## explicit\nk8s.io/utils/buffer\nk8s.io/utils/integer\nk8s.io/utils/pointer\nk8s.io/utils/trace\n# sigs.k8s.io/controller-runtime v0.6.1-0.20200528151803-676c350bd1f3\n+## explicit\nsigs.k8s.io/controller-runtime\nsigs.k8s.io/controller-runtime/pkg/builder\nsigs.k8s.io/controller-runtime/pkg/cache\n@@ -533,8 +564,10 @@ sigs.k8s.io/controller-runtime/pkg/webhook/conversion\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/certwatcher\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics\n# sigs.k8s.io/kustomize/kstatus v0.0.2\n+## explicit\nsigs.k8s.io/kustomize/kstatus/status\n# sigs.k8s.io/structured-merge-diff/v3 v3.0.0\nsigs.k8s.io/structured-merge-diff/v3/value\n# sigs.k8s.io/yaml v1.2.0\n+## explicit\nsigs.k8s.io/yaml\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(ci) update go mod
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,865
|
03.11.2020 19:10:03
| -28,800
|
db357faff1ac79b23b2ad953f15b92fd686479bb
|
feat(vendor): update go.sum
1. update go.sum
|
[
{
"change_type": "MODIFY",
"old_path": "go.sum",
"new_path": "go.sum",
"diff": "@@ -657,8 +657,6 @@ github.com/mailru/easyjson v0.7.0 h1:aizVhC/NAAcKWb+5QsU1iNOZb4Yws5UO2I+aIprQITM\ngithub.com/mailru/easyjson v0.7.0/go.mod h1:KAzv3t3aY1NaHWoQz1+4F1ccyAH66Jk7yos7ldAVICs=\ngithub.com/markbates/pkger v0.15.1 h1:3MPelV53RnGSW07izx5xGxl4e/sdRD6zqseIk0rMASY=\ngithub.com/markbates/pkger v0.15.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI=\n-github.com/markbates/pkger v0.17.1 h1:/MKEtWqtc0mZvu9OinB9UzVN9iYCwLWuyUv4Bw+PCno=\n-github.com/markbates/pkger v0.17.1/go.mod h1:0JoVlrol20BSywW79rN3kdFFsE5xYM+rSCQDXbLhiuI=\ngithub.com/marstr/guid v1.1.0/go.mod h1:74gB1z2wpxxInTG6yaqA7KrtM0NZ+RbrcqDvYHefzho=\ngithub.com/mattbaird/jsonpatch v0.0.0-20171005235357-81af80346b1a/go.mod h1:M1qoD/MqPgTZIk0EWKB38wE28ACRfVcn+cU08jyArI0=\ngithub.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=\n"
},
{
"change_type": "MODIFY",
"old_path": "vendor/modules.txt",
"new_path": "vendor/modules.txt",
"diff": "# cloud.google.com/go v0.58.0\n-## explicit\ncloud.google.com/go/compute/metadata\n# github.com/Masterminds/goutils v1.1.0\ngithub.com/Masterminds/goutils\n# github.com/Masterminds/semver v1.5.0\n-## explicit\ngithub.com/Masterminds/semver\n# github.com/Masterminds/sprig v2.22.0+incompatible\n-## explicit\ngithub.com/Masterminds/sprig\n# github.com/beorn7/perks v1.0.1\ngithub.com/beorn7/perks/quantile\n@@ -24,13 +21,11 @@ github.com/fsnotify/fsnotify\n# github.com/ghodss/yaml v1.0.0\ngithub.com/ghodss/yaml\n# github.com/go-kit/kit v0.10.0\n-## explicit\ngithub.com/go-kit/kit/log\ngithub.com/go-kit/kit/log/level\n# github.com/go-logfmt/logfmt v0.5.0\ngithub.com/go-logfmt/logfmt\n# github.com/go-logr/logr v0.1.0\n-## explicit\ngithub.com/go-logr/logr\n# github.com/go-logr/zapr v0.1.1\ngithub.com/go-logr/zapr\n@@ -38,7 +33,6 @@ github.com/go-logr/zapr\ngithub.com/gogo/protobuf/proto\ngithub.com/gogo/protobuf/sortkeys\n# github.com/goharbor/harbor/src v0.0.0-20200728051037-1d361a89a056\n-## explicit\ngithub.com/goharbor/harbor/src/common\ngithub.com/goharbor/harbor/src/common/config/metadata\ngithub.com/goharbor/harbor/src/lib/log\n@@ -65,20 +59,15 @@ github.com/googleapis/gnostic/OpenAPIv2\ngithub.com/googleapis/gnostic/compiler\ngithub.com/googleapis/gnostic/extensions\n# github.com/hashicorp/golang-lru v0.5.4\n-## explicit\ngithub.com/hashicorp/golang-lru\ngithub.com/hashicorp/golang-lru/simplelru\n# github.com/huandu/xstrings v1.3.2\n-## explicit\ngithub.com/huandu/xstrings\n# github.com/imdario/mergo v0.3.10\n-## explicit\ngithub.com/imdario/mergo\n# github.com/jaegertracing/jaeger-lib v2.2.0+incompatible\n-## explicit\ngithub.com/jaegertracing/jaeger-lib/client/log/go-kit\n# github.com/jetstack/cert-manager v0.15.2\n-## explicit\ngithub.com/jetstack/cert-manager/pkg/apis/acme\ngithub.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2\ngithub.com/jetstack/cert-manager/pkg/apis/certmanager\n@@ -94,14 +83,11 @@ github.com/matttproud/golang_protobuf_extensions/pbutil\n# github.com/mitchellh/copystructure v1.0.0\ngithub.com/mitchellh/copystructure\n# github.com/mitchellh/reflectwalk v1.0.1\n-## explicit\ngithub.com/mitchellh/reflectwalk\n# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd\ngithub.com/modern-go/concurrent\n# github.com/modern-go/reflect2 v1.0.1\ngithub.com/modern-go/reflect2\n-# github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e\n-## explicit\n# github.com/nxadm/tail v1.4.4\ngithub.com/nxadm/tail\ngithub.com/nxadm/tail/ratelimiter\n@@ -109,7 +95,6 @@ github.com/nxadm/tail/util\ngithub.com/nxadm/tail/watch\ngithub.com/nxadm/tail/winfile\n# github.com/onsi/ginkgo v1.14.0\n-## explicit\ngithub.com/onsi/ginkgo\ngithub.com/onsi/ginkgo/config\ngithub.com/onsi/ginkgo/extensions/table\n@@ -131,7 +116,6 @@ github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable\ngithub.com/onsi/ginkgo/reporters/stenographer/support/go-isatty\ngithub.com/onsi/ginkgo/types\n# github.com/onsi/gomega v1.10.1\n-## explicit\ngithub.com/onsi/gomega\ngithub.com/onsi/gomega/format\ngithub.com/onsi/gomega/gbytes\n@@ -149,21 +133,16 @@ github.com/onsi/gomega/matchers/support/goraph/node\ngithub.com/onsi/gomega/matchers/support/goraph/util\ngithub.com/onsi/gomega/types\n# github.com/opentracing-contrib/go-stdlib v1.0.0\n-## explicit\ngithub.com/opentracing-contrib/go-stdlib/nethttp\n# github.com/opentracing/opentracing-go v1.2.0\n-## explicit\ngithub.com/opentracing/opentracing-go\ngithub.com/opentracing/opentracing-go/ext\ngithub.com/opentracing/opentracing-go/log\n# github.com/ovh/configstore v0.3.2\n-## explicit\ngithub.com/ovh/configstore\n# github.com/pkg/errors v0.9.1\n-## explicit\ngithub.com/pkg/errors\n# github.com/prometheus/client_golang v1.7.0\n-## explicit\ngithub.com/prometheus/client_golang/prometheus\ngithub.com/prometheus/client_golang/prometheus/internal\ngithub.com/prometheus/client_golang/prometheus/promhttp\n@@ -178,15 +157,12 @@ github.com/prometheus/procfs\ngithub.com/prometheus/procfs/internal/fs\ngithub.com/prometheus/procfs/internal/util\n# github.com/sethvargo/go-password v0.1.3\n-## explicit\ngithub.com/sethvargo/go-password/password\n# github.com/sirupsen/logrus v1.6.0\n-## explicit\ngithub.com/sirupsen/logrus\n# github.com/spf13/pflag v1.0.5\ngithub.com/spf13/pflag\n# github.com/uber/jaeger-client-go v2.24.0+incompatible\n-## explicit\ngithub.com/uber/jaeger-client-go\ngithub.com/uber/jaeger-client-go/config\ngithub.com/uber/jaeger-client-go/internal/baggage\n@@ -206,7 +182,6 @@ github.com/uber/jaeger-client-go/thrift-gen/zipkincore\ngithub.com/uber/jaeger-client-go/transport\ngithub.com/uber/jaeger-client-go/utils\n# github.com/uber/jaeger-lib v2.2.0+incompatible\n-## explicit\ngithub.com/uber/jaeger-lib/metrics\ngithub.com/uber/jaeger-lib/metrics/prometheus\n# go.uber.org/atomic v1.6.0\n@@ -214,7 +189,6 @@ go.uber.org/atomic\n# go.uber.org/multierr v1.5.0\ngo.uber.org/multierr\n# go.uber.org/zap v1.15.0\n-## explicit\ngo.uber.org/zap\ngo.uber.org/zap/buffer\ngo.uber.org/zap/internal/bufferpool\n@@ -222,14 +196,12 @@ go.uber.org/zap/internal/color\ngo.uber.org/zap/internal/exit\ngo.uber.org/zap/zapcore\n# golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de\n-## explicit\ngolang.org/x/crypto/bcrypt\ngolang.org/x/crypto/blowfish\ngolang.org/x/crypto/pbkdf2\ngolang.org/x/crypto/scrypt\ngolang.org/x/crypto/ssh/terminal\n# golang.org/x/net v0.0.0-20200602114024-627f9648deb9\n-## explicit\ngolang.org/x/net/context\ngolang.org/x/net/context/ctxhttp\ngolang.org/x/net/html\n@@ -246,10 +218,8 @@ golang.org/x/oauth2/internal\ngolang.org/x/oauth2/jws\ngolang.org/x/oauth2/jwt\n# golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a\n-## explicit\ngolang.org/x/sync/errgroup\n# golang.org/x/sys v0.0.0-20200620081246-981b61492c35\n-## explicit\ngolang.org/x/sys/internal/unsafeheader\ngolang.org/x/sys/unix\ngolang.org/x/sys/windows\n@@ -275,15 +245,11 @@ golang.org/x/text/transform\ngolang.org/x/text/unicode/bidi\ngolang.org/x/text/unicode/norm\n# golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1\n-## explicit\ngolang.org/x/time/rate\n-# golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f\n-## explicit\n# golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543\ngolang.org/x/xerrors\ngolang.org/x/xerrors/internal\n# gomodules.xyz/jsonpatch/v2 v2.1.0\n-## explicit\ngomodules.xyz/jsonpatch/v2\n# google.golang.org/appengine v1.6.6\ngoogle.golang.org/appengine\n@@ -327,8 +293,6 @@ google.golang.org/protobuf/runtime/protoimpl\ngoogle.golang.org/protobuf/types/known/anypb\ngoogle.golang.org/protobuf/types/known/durationpb\ngoogle.golang.org/protobuf/types/known/timestamppb\n-# gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f\n-## explicit\n# gopkg.in/inf.v0 v0.9.1\ngopkg.in/inf.v0\n# gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7\n@@ -336,7 +300,6 @@ gopkg.in/tomb.v1\n# gopkg.in/yaml.v2 v2.3.0\ngopkg.in/yaml.v2\n# k8s.io/api v0.18.4\n-## explicit\nk8s.io/api/admission/v1beta1\nk8s.io/api/admissionregistration/v1\nk8s.io/api/admissionregistration/v1beta1\n@@ -379,7 +342,6 @@ k8s.io/api/storage/v1\nk8s.io/api/storage/v1alpha1\nk8s.io/api/storage/v1beta1\n# k8s.io/apiextensions-apiserver v0.18.4\n-## explicit\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1\n@@ -388,7 +350,6 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1\n# k8s.io/apimachinery v0.18.4\n-## explicit\nk8s.io/apimachinery/pkg/api/equality\nk8s.io/apimachinery/pkg/api/errors\nk8s.io/apimachinery/pkg/api/meta\n@@ -434,7 +395,6 @@ k8s.io/apimachinery/pkg/watch\nk8s.io/apimachinery/third_party/forked/golang/json\nk8s.io/apimachinery/third_party/forked/golang/reflect\n# k8s.io/client-go v0.18.4\n-## explicit\nk8s.io/client-go/discovery\nk8s.io/client-go/dynamic\nk8s.io/client-go/kubernetes\n@@ -517,13 +477,11 @@ k8s.io/klog/v2\n# k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6\nk8s.io/kube-openapi/pkg/util/proto\n# k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19\n-## explicit\nk8s.io/utils/buffer\nk8s.io/utils/integer\nk8s.io/utils/pointer\nk8s.io/utils/trace\n# sigs.k8s.io/controller-runtime v0.6.1-0.20200528151803-676c350bd1f3\n-## explicit\nsigs.k8s.io/controller-runtime\nsigs.k8s.io/controller-runtime/pkg/builder\nsigs.k8s.io/controller-runtime/pkg/cache\n@@ -566,10 +524,8 @@ sigs.k8s.io/controller-runtime/pkg/webhook/conversion\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/certwatcher\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics\n# sigs.k8s.io/kustomize/kstatus v0.0.2\n-## explicit\nsigs.k8s.io/kustomize/kstatus/status\n# sigs.k8s.io/structured-merge-diff/v3 v3.0.0\nsigs.k8s.io/structured-merge-diff/v3/value\n# sigs.k8s.io/yaml v1.2.0\n-## explicit\nsigs.k8s.io/yaml\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(vendor): update go.sum
1. update go.sum
Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
|
254,875
|
03.11.2020 19:12:33
| -28,800
|
1e218659168b1d554f76676ecbb8c9925f172243
|
feat(ci) sync generated files
|
[
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/templates/deployment.yaml",
"new_path": "charts/harbor-operator/templates/deployment.yaml",
"diff": "{{- /* Code generated by make. DO NOT EDIT. */ -}}\n-apiVersion: apps/v1\n-kind: Deployment\n-metadata:\n- labels: {{- include \"chart.labels\" . | nindent 4 }}\n- name: '{{ include \"chart.fullname\" . }}-controller-manager'\n- namespace: {{ .Release.Namespace | quote }}\n-spec:\n- selector:\n- matchLabels: {{- include \"chart.selectorLabels\" . | nindent 6 }}\n- template:\n- metadata:\n- annotations: {{- toYaml .Values.podAnnotations | nindent 8 }}\n- labels: {{- include \"chart.selectorLabels\" . | nindent 8 }}\n- spec:\n- affinity: {{- toYaml .Values.affinity | nindent 8 }}\n- containers:\n- - args:\n- - --enable-leader-election\n- - --metrics-addr=127.0.0.1:8080\n- command:\n- - /manager\n- env:\n- - name: CONFIGURATION_FROM\n- value: 'env:'\n- - name: CLASSNAME\n- value: {{ .Values.harborClass | quote }}\n- - name: LOG_LEVEL\n- value: {{ .Values.logLevel | quote }}\n- - name: NAMESPACE\n- valueFrom:\n- fieldRef:\n- fieldPath: metadata.namespace\n- image: '{{.Values.image.repository}}:{{.Values.image.tag|default .Chart.AppVersion}}'\n- imagePullPolicy: {{ .Values.image.pullPolicy | quote }}\n- livenessProbe:\n- httpGet:\n- path: /healthz\n- port: ready\n- name: manager\n- ports:\n- - containerPort: 9443\n- name: webhook-server\n- protocol: TCP\n- - containerPort: 8080\n- name: metrics\n- protocol: TCP\n- - containerPort: 5000\n- name: ready\n- protocol: TCP\n- readinessProbe:\n- httpGet:\n- path: /readyz\n- port: ready\n- resources: {{- toYaml .Values.resources | nindent 10 }}\n- volumeMounts:\n- - mountPath: /tmp/k8s-webhook-server/serving-certs\n- name: cert\n- readOnly: true\n- - mountPath: /etc/harbor-operator\n- name: configuration-templates\n- readOnly: true\n- nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }}\n- securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }}\n- serviceAccountName: {{ include \"chart.serviceAccountName\" . | quote }}\n- terminationGracePeriodSeconds: 10\n- tolerations: {{- toYaml .Values.tolerations | nindent 8 }}\n- volumes:\n- - name: cert\n- secret:\n- defaultMode: 420\n- secretName: '{{ include \"chart.fullname\" . }}-certificate'\n- - configMap:\n- name: '{{ include \"chart.fullname\" . }}-config-template'\n- name: configuration-templates\n{{- if not .Values.autoscaling.enabled }}\nreplicas: {{ .Values.replicaCount }}\n{{- end }}\n\\ No newline at end of file\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(ci) sync generated files
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,865
|
03.11.2020 19:43:17
| -28,800
|
2c16535e382f7f679c3fbdf9172a1efae5061640
|
feat(vendor): update modules.txt
|
[
{
"change_type": "MODIFY",
"old_path": "vendor/modules.txt",
"new_path": "vendor/modules.txt",
"diff": "# cloud.google.com/go v0.58.0\n+## explicit\ncloud.google.com/go/compute/metadata\n# github.com/Masterminds/goutils v1.1.0\ngithub.com/Masterminds/goutils\n# github.com/Masterminds/semver v1.5.0\n+## explicit\ngithub.com/Masterminds/semver\n# github.com/Masterminds/sprig v2.22.0+incompatible\n+## explicit\ngithub.com/Masterminds/sprig\n# github.com/beorn7/perks v1.0.1\ngithub.com/beorn7/perks/quantile\n# github.com/blang/semver v3.5.0+incompatible\n+## explicit\ngithub.com/blang/semver\n# github.com/cespare/xxhash/v2 v2.1.1\ngithub.com/cespare/xxhash/v2\n@@ -21,11 +25,13 @@ github.com/fsnotify/fsnotify\n# github.com/ghodss/yaml v1.0.0\ngithub.com/ghodss/yaml\n# github.com/go-kit/kit v0.10.0\n+## explicit\ngithub.com/go-kit/kit/log\ngithub.com/go-kit/kit/log/level\n# github.com/go-logfmt/logfmt v0.5.0\ngithub.com/go-logfmt/logfmt\n# github.com/go-logr/logr v0.1.0\n+## explicit\ngithub.com/go-logr/logr\n# github.com/go-logr/zapr v0.1.1\ngithub.com/go-logr/zapr\n@@ -33,6 +39,7 @@ github.com/go-logr/zapr\ngithub.com/gogo/protobuf/proto\ngithub.com/gogo/protobuf/sortkeys\n# github.com/goharbor/harbor/src v0.0.0-20200728051037-1d361a89a056\n+## explicit\ngithub.com/goharbor/harbor/src/common\ngithub.com/goharbor/harbor/src/common/config/metadata\ngithub.com/goharbor/harbor/src/lib/log\n@@ -59,15 +66,20 @@ github.com/googleapis/gnostic/OpenAPIv2\ngithub.com/googleapis/gnostic/compiler\ngithub.com/googleapis/gnostic/extensions\n# github.com/hashicorp/golang-lru v0.5.4\n+## explicit\ngithub.com/hashicorp/golang-lru\ngithub.com/hashicorp/golang-lru/simplelru\n# github.com/huandu/xstrings v1.3.2\n+## explicit\ngithub.com/huandu/xstrings\n# github.com/imdario/mergo v0.3.10\n+## explicit\ngithub.com/imdario/mergo\n# github.com/jaegertracing/jaeger-lib v2.2.0+incompatible\n+## explicit\ngithub.com/jaegertracing/jaeger-lib/client/log/go-kit\n# github.com/jetstack/cert-manager v0.15.2\n+## explicit\ngithub.com/jetstack/cert-manager/pkg/apis/acme\ngithub.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2\ngithub.com/jetstack/cert-manager/pkg/apis/certmanager\n@@ -83,11 +95,14 @@ github.com/matttproud/golang_protobuf_extensions/pbutil\n# github.com/mitchellh/copystructure v1.0.0\ngithub.com/mitchellh/copystructure\n# github.com/mitchellh/reflectwalk v1.0.1\n+## explicit\ngithub.com/mitchellh/reflectwalk\n# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd\ngithub.com/modern-go/concurrent\n# github.com/modern-go/reflect2 v1.0.1\ngithub.com/modern-go/reflect2\n+# github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e\n+## explicit\n# github.com/nxadm/tail v1.4.4\ngithub.com/nxadm/tail\ngithub.com/nxadm/tail/ratelimiter\n@@ -95,6 +110,7 @@ github.com/nxadm/tail/util\ngithub.com/nxadm/tail/watch\ngithub.com/nxadm/tail/winfile\n# github.com/onsi/ginkgo v1.14.0\n+## explicit\ngithub.com/onsi/ginkgo\ngithub.com/onsi/ginkgo/config\ngithub.com/onsi/ginkgo/extensions/table\n@@ -116,6 +132,7 @@ github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable\ngithub.com/onsi/ginkgo/reporters/stenographer/support/go-isatty\ngithub.com/onsi/ginkgo/types\n# github.com/onsi/gomega v1.10.1\n+## explicit\ngithub.com/onsi/gomega\ngithub.com/onsi/gomega/format\ngithub.com/onsi/gomega/gbytes\n@@ -133,16 +150,21 @@ github.com/onsi/gomega/matchers/support/goraph/node\ngithub.com/onsi/gomega/matchers/support/goraph/util\ngithub.com/onsi/gomega/types\n# github.com/opentracing-contrib/go-stdlib v1.0.0\n+## explicit\ngithub.com/opentracing-contrib/go-stdlib/nethttp\n# github.com/opentracing/opentracing-go v1.2.0\n+## explicit\ngithub.com/opentracing/opentracing-go\ngithub.com/opentracing/opentracing-go/ext\ngithub.com/opentracing/opentracing-go/log\n# github.com/ovh/configstore v0.3.2\n+## explicit\ngithub.com/ovh/configstore\n# github.com/pkg/errors v0.9.1\n+## explicit\ngithub.com/pkg/errors\n# github.com/prometheus/client_golang v1.7.0\n+## explicit\ngithub.com/prometheus/client_golang/prometheus\ngithub.com/prometheus/client_golang/prometheus/internal\ngithub.com/prometheus/client_golang/prometheus/promhttp\n@@ -157,12 +179,15 @@ github.com/prometheus/procfs\ngithub.com/prometheus/procfs/internal/fs\ngithub.com/prometheus/procfs/internal/util\n# github.com/sethvargo/go-password v0.1.3\n+## explicit\ngithub.com/sethvargo/go-password/password\n# github.com/sirupsen/logrus v1.6.0\n+## explicit\ngithub.com/sirupsen/logrus\n# github.com/spf13/pflag v1.0.5\ngithub.com/spf13/pflag\n# github.com/uber/jaeger-client-go v2.24.0+incompatible\n+## explicit\ngithub.com/uber/jaeger-client-go\ngithub.com/uber/jaeger-client-go/config\ngithub.com/uber/jaeger-client-go/internal/baggage\n@@ -182,6 +207,7 @@ github.com/uber/jaeger-client-go/thrift-gen/zipkincore\ngithub.com/uber/jaeger-client-go/transport\ngithub.com/uber/jaeger-client-go/utils\n# github.com/uber/jaeger-lib v2.2.0+incompatible\n+## explicit\ngithub.com/uber/jaeger-lib/metrics\ngithub.com/uber/jaeger-lib/metrics/prometheus\n# go.uber.org/atomic v1.6.0\n@@ -189,6 +215,7 @@ go.uber.org/atomic\n# go.uber.org/multierr v1.5.0\ngo.uber.org/multierr\n# go.uber.org/zap v1.15.0\n+## explicit\ngo.uber.org/zap\ngo.uber.org/zap/buffer\ngo.uber.org/zap/internal/bufferpool\n@@ -196,12 +223,14 @@ go.uber.org/zap/internal/color\ngo.uber.org/zap/internal/exit\ngo.uber.org/zap/zapcore\n# golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de\n+## explicit\ngolang.org/x/crypto/bcrypt\ngolang.org/x/crypto/blowfish\ngolang.org/x/crypto/pbkdf2\ngolang.org/x/crypto/scrypt\ngolang.org/x/crypto/ssh/terminal\n# golang.org/x/net v0.0.0-20200602114024-627f9648deb9\n+## explicit\ngolang.org/x/net/context\ngolang.org/x/net/context/ctxhttp\ngolang.org/x/net/html\n@@ -218,8 +247,10 @@ golang.org/x/oauth2/internal\ngolang.org/x/oauth2/jws\ngolang.org/x/oauth2/jwt\n# golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a\n+## explicit\ngolang.org/x/sync/errgroup\n# golang.org/x/sys v0.0.0-20200620081246-981b61492c35\n+## explicit\ngolang.org/x/sys/internal/unsafeheader\ngolang.org/x/sys/unix\ngolang.org/x/sys/windows\n@@ -245,11 +276,15 @@ golang.org/x/text/transform\ngolang.org/x/text/unicode/bidi\ngolang.org/x/text/unicode/norm\n# golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1\n+## explicit\ngolang.org/x/time/rate\n+# golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f\n+## explicit\n# golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543\ngolang.org/x/xerrors\ngolang.org/x/xerrors/internal\n# gomodules.xyz/jsonpatch/v2 v2.1.0\n+## explicit\ngomodules.xyz/jsonpatch/v2\n# google.golang.org/appengine v1.6.6\ngoogle.golang.org/appengine\n@@ -293,6 +328,8 @@ google.golang.org/protobuf/runtime/protoimpl\ngoogle.golang.org/protobuf/types/known/anypb\ngoogle.golang.org/protobuf/types/known/durationpb\ngoogle.golang.org/protobuf/types/known/timestamppb\n+# gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f\n+## explicit\n# gopkg.in/inf.v0 v0.9.1\ngopkg.in/inf.v0\n# gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7\n@@ -300,6 +337,7 @@ gopkg.in/tomb.v1\n# gopkg.in/yaml.v2 v2.3.0\ngopkg.in/yaml.v2\n# k8s.io/api v0.18.4\n+## explicit\nk8s.io/api/admission/v1beta1\nk8s.io/api/admissionregistration/v1\nk8s.io/api/admissionregistration/v1beta1\n@@ -342,6 +380,7 @@ k8s.io/api/storage/v1\nk8s.io/api/storage/v1alpha1\nk8s.io/api/storage/v1beta1\n# k8s.io/apiextensions-apiserver v0.18.4\n+## explicit\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1\nk8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1\n@@ -350,6 +389,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1\n# k8s.io/apimachinery v0.18.4\n+## explicit\nk8s.io/apimachinery/pkg/api/equality\nk8s.io/apimachinery/pkg/api/errors\nk8s.io/apimachinery/pkg/api/meta\n@@ -395,6 +435,7 @@ k8s.io/apimachinery/pkg/watch\nk8s.io/apimachinery/third_party/forked/golang/json\nk8s.io/apimachinery/third_party/forked/golang/reflect\n# k8s.io/client-go v0.18.4\n+## explicit\nk8s.io/client-go/discovery\nk8s.io/client-go/dynamic\nk8s.io/client-go/kubernetes\n@@ -477,11 +518,13 @@ k8s.io/klog/v2\n# k8s.io/kube-openapi v0.0.0-20200410145947-61e04a5be9a6\nk8s.io/kube-openapi/pkg/util/proto\n# k8s.io/utils v0.0.0-20200619165400-6e3d28b6ed19\n+## explicit\nk8s.io/utils/buffer\nk8s.io/utils/integer\nk8s.io/utils/pointer\nk8s.io/utils/trace\n# sigs.k8s.io/controller-runtime v0.6.1-0.20200528151803-676c350bd1f3\n+## explicit\nsigs.k8s.io/controller-runtime\nsigs.k8s.io/controller-runtime/pkg/builder\nsigs.k8s.io/controller-runtime/pkg/cache\n@@ -524,8 +567,10 @@ sigs.k8s.io/controller-runtime/pkg/webhook/conversion\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/certwatcher\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics\n# sigs.k8s.io/kustomize/kstatus v0.0.2\n+## explicit\nsigs.k8s.io/kustomize/kstatus/status\n# sigs.k8s.io/structured-merge-diff/v3 v3.0.0\nsigs.k8s.io/structured-merge-diff/v3/value\n# sigs.k8s.io/yaml v1.2.0\n+## explicit\nsigs.k8s.io/yaml\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(vendor): update modules.txt
Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
|
254,877
|
03.11.2020 16:42:39
| -3,600
|
43c120c4c224b7962fd38426274ba2567f43b24d
|
fix(makefile) kustomize install
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -562,7 +562,7 @@ kustomize:\nifeq (, $(shell which kustomize))\n$(MAKE) $(GOBIN)\n# https://github.com/kubernetes-sigs/kustomize/blob/master/docs/INSTALL.md\n- curl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/7eca29daeee6b583f5394a45d8edfd41c15dbe6d/hack/install_kustomize.sh | bash\n+ curl -s https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh | bash\nmv ./kustomize $(GOBIN)\nchmod u+x $(GOBIN)/kustomize\nKUSTOMIZE=$(GOBIN)/kustomize\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(makefile) kustomize install
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
254,875
|
05.11.2020 15:55:27
| -28,800
|
aad60492e1dc874d4992de2026d80c7c8e5ac99d
|
fix(trivy) permission failed
|
[
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/templates/clusterrole.yaml",
"new_path": "charts/harbor-operator/templates/clusterrole.yaml",
"diff": "@@ -57,6 +57,18 @@ rules:\n- patch\n- update\n- watch\n+- apiGroups:\n+ - cert-manager.io\n+ resources:\n+ - certificates\n+ verbs:\n+ - create\n+ - delete\n+ - get\n+ - list\n+ - patch\n+ - update\n+ - watch\n- apiGroups:\n- cert-manager.io\nresources:\n@@ -234,6 +246,22 @@ rules:\n- get\n- patch\n- update\n+- apiGroups:\n+ - goharbor.io\n+ resources:\n+ - trivies\n+ verbs:\n+ - get\n+ - list\n+ - watch\n+- apiGroups:\n+ - goharbor.io\n+ resources:\n+ - trivies/status\n+ verbs:\n+ - get\n+ - patch\n+ - update\n- apiGroups:\n- networking.k8s.io\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/trivy/trivy.go",
"new_path": "controllers/goharbor/trivy/trivy.go",
"diff": "@@ -27,6 +27,12 @@ type Reconciler struct {\n*commonCtrl.Controller\n}\n+// +kubebuilder:rbac:groups=goharbor.io,resources=trivies,verbs=get;list;watch\n+// +kubebuilder:rbac:groups=goharbor.io,resources=trivies/status,verbs=get;update;patch\n+// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete\n+// +kubebuilder:rbac:groups=\"\",resources=configmaps;services;secrets,verbs=get;list;watch;create;update;patch;delete\n+// +kubebuilder:rbac:groups=cert-manager.io,resources=certificates,verbs=get;list;watch;create;update;patch;delete\n+\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\nerr := r.Controller.SetupWithManager(ctx, mgr)\nif err != nil {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(trivy) permission failed
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,870
|
05.11.2020 17:01:22
| -28,800
|
4c8fee3a3086368b599e3556f77a1e6fd079d832
|
fix(database) add postgre-operator api file
add postgre-operator api file
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "controllers/goharbor/harborcluster/database/api/postgresql_type.go",
"diff": "+package api\n+\n+// Postgres CRD definition, please use CamelCase for field names.\n+\n+import (\n+ \"time\"\n+\n+ v1 \"k8s.io/api/core/v1\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+)\n+\n+// Postgresql defines PostgreSQL Custom Resource Definition Object.\n+type Postgresql struct {\n+ metav1.TypeMeta `json:\",inline\"`\n+ metav1.ObjectMeta `json:\"metadata,omitempty\"`\n+\n+ Spec PostgresSpec `json:\"spec\"`\n+ Status PostgresStatus `json:\"status\"`\n+ Error string `json:\"-\"`\n+}\n+\n+// PostgresSpec defines the specification for the PostgreSQL TPR.\n+type PostgresSpec struct {\n+ PostgresqlParam `json:\"postgresql\"`\n+ Volume `json:\"volume,omitempty\"`\n+ Patroni `json:\"patroni,omitempty\"`\n+ Resources `json:\"resources,omitempty\"`\n+\n+ EnableConnectionPooler *bool `json:\"enableConnectionPooler,omitempty\"`\n+ ConnectionPooler *ConnectionPooler `json:\"connectionPooler,omitempty\"`\n+\n+ TeamID string `json:\"teamId\"`\n+ DockerImage string `json:\"dockerImage,omitempty\"`\n+\n+ SpiloFSGroup *int64 `json:\"spiloFSGroup,omitempty\"`\n+\n+ // vars that enable load balancers are pointers because it is important to know if any of them is omitted from the Postgres manifest\n+ // in that case the var evaluates to nil and the value is taken from the operator config\n+ EnableMasterLoadBalancer *bool `json:\"enableMasterLoadBalancer,omitempty\"`\n+ EnableReplicaLoadBalancer *bool `json:\"enableReplicaLoadBalancer,omitempty\"`\n+\n+ // deprecated load balancer settings maintained for backward compatibility\n+ // see \"Load balancers\" operator docs\n+ UseLoadBalancer *bool `json:\"useLoadBalancer,omitempty\"`\n+ ReplicaLoadBalancer *bool `json:\"replicaLoadBalancer,omitempty\"`\n+\n+ // load balancers' source ranges are the same for master and replica services\n+ AllowedSourceRanges []string `json:\"allowedSourceRanges\"`\n+\n+ NumberOfInstances int32 `json:\"numberOfInstances\"`\n+ Users map[string]UserFlags `json:\"users\"`\n+ MaintenanceWindows []MaintenanceWindow `json:\"maintenanceWindows,omitempty\"`\n+ //Clone CloneDescription `json:\"clone\"`\n+ ClusterName string `json:\"-\"`\n+ Databases map[string]string `json:\"databases,omitempty\"`\n+ PreparedDatabases map[string]PreparedDatabase `json:\"preparedDatabases,omitempty\"`\n+ Tolerations []v1.Toleration `json:\"tolerations,omitempty\"`\n+ Sidecars []Sidecar `json:\"sidecars,omitempty\"`\n+ InitContainers []v1.Container `json:\"initContainers,omitempty\"`\n+ PodPriorityClassName string `json:\"podPriorityClassName,omitempty\"`\n+ ShmVolume *bool `json:\"enableShmVolume,omitempty\"`\n+ EnableLogicalBackup bool `json:\"enableLogicalBackup,omitempty\"`\n+ LogicalBackupSchedule string `json:\"logicalBackupSchedule,omitempty\"`\n+ //StandbyCluster *StandbyDescription `json:\"standby\"`\n+ //PodAnnotations map[string]string `json:\"podAnnotations\"`\n+ //ServiceAnnotations map[string]string `json:\"serviceAnnotations\"`\n+ //TLS *TLSDescription `json:\"tls\"`\n+ AdditionalVolumes []AdditionalVolume `json:\"additionalVolumes,omitempty\"`\n+\n+ // deprecated json tags\n+ InitContainersOld []v1.Container `json:\"init_containers,omitempty\"`\n+ PodPriorityClassNameOld string `json:\"pod_priority_class_name,omitempty\"`\n+}\n+\n+// PostgresqlList defines a list of PostgreSQL clusters.\n+type PostgresqlList struct {\n+ metav1.TypeMeta `json:\",inline\"`\n+ metav1.ListMeta `json:\"metadata\"`\n+\n+ Items []Postgresql `json:\"items\"`\n+}\n+\n+// PreparedDatabase describes elements to be bootstrapped\n+type PreparedDatabase struct {\n+ PreparedSchemas map[string]PreparedSchema `json:\"schemas,omitempty\"`\n+ DefaultUsers bool `json:\"defaultUsers,omitempty\" defaults:\"false\"`\n+ Extensions map[string]string `json:\"extensions,omitempty\"`\n+}\n+\n+// PreparedSchema describes elements to be bootstrapped per schema\n+type PreparedSchema struct {\n+ DefaultRoles *bool `json:\"defaultRoles,omitempty\" defaults:\"true\"`\n+ DefaultUsers bool `json:\"defaultUsers,omitempty\" defaults:\"false\"`\n+}\n+\n+// MaintenanceWindow describes the time window when the operator is allowed to do maintenance on a cluster.\n+type MaintenanceWindow struct {\n+ Everyday bool\n+ Weekday time.Weekday\n+ StartTime metav1.Time // Start time\n+ EndTime metav1.Time // End time\n+}\n+\n+// Volume describes a single volume in the manifest.\n+type Volume struct {\n+ Size string `json:\"size\"`\n+ StorageClass string `json:\"storageClass\"`\n+ SubPath string `json:\"subPath,omitempty\"`\n+}\n+\n+type AdditionalVolume struct {\n+ Name string `json:\"name\"`\n+ MountPath string `json:\"mountPath\"`\n+ SubPath string `json:\"subPath\"`\n+ TargetContainers []string `json:\"targetContainers\"`\n+ VolumeSource v1.VolumeSource `json:\"volumeSource\"`\n+}\n+\n+// PostgresqlParam describes PostgreSQL version and pairs of configuration parameter name - values.\n+type PostgresqlParam struct {\n+ PgVersion string `json:\"version\"`\n+ //Parameters map[string]string `json:\"parameters\"`\n+}\n+\n+// ResourceDescription describes CPU and memory resources defined for a cluster.\n+type ResourceDescription struct {\n+ CPU string `json:\"cpu\"`\n+ Memory string `json:\"memory\"`\n+}\n+\n+// Resources describes requests and limits for the cluster resouces.\n+type Resources struct {\n+ ResourceRequests ResourceDescription `json:\"requests,omitempty\"`\n+ ResourceLimits ResourceDescription `json:\"limits,omitempty\"`\n+}\n+\n+// Patroni contains Patroni-specific configuration\n+type Patroni struct {\n+ InitDB map[string]string `json:\"initdb\"`\n+ PgHba []string `json:\"pg_hba\"`\n+ //TTL uint32 `json:\"ttl\"`\n+ //LoopWait uint32 `json:\"loop_wait\"`\n+ //RetryTimeout uint32 `json:\"retry_timeout\"`\n+ //MaximumLagOnFailover float32 `json:\"maximum_lag_on_failover\"` // float32 because https://github.com/kubernetes/kubernetes/issues/30213\n+ //Slots map[string]map[string]string `json:\"slots\"`\n+ //SynchronousMode bool `json:\"synchronous_mode\"`\n+ //SynchronousModeStrict bool `json:\"synchronous_mode_strict\"`\n+}\n+\n+//StandbyCluster\n+type StandbyDescription struct {\n+ S3WalPath string `json:\"s3_wal_path,omitempty\"`\n+}\n+\n+type TLSDescription struct {\n+ SecretName string `json:\"secretName,omitempty\"`\n+ CertificateFile string `json:\"certificateFile,omitempty\"`\n+ PrivateKeyFile string `json:\"privateKeyFile,omitempty\"`\n+ CAFile string `json:\"caFile,omitempty\"`\n+ CASecretName string `json:\"caSecretName,omitempty\"`\n+}\n+\n+// CloneDescription describes which cluster the new should clone and up to which point in time\n+type CloneDescription struct {\n+ ClusterName string `json:\"cluster,omitempty\"`\n+ UID string `json:\"uid,omitempty\"`\n+ EndTimestamp string `json:\"timestamp,omitempty\"`\n+ S3WalPath string `json:\"s3_wal_path,omitempty\"`\n+ S3Endpoint string `json:\"s3_endpoint,omitempty\"`\n+ S3AccessKeyId string `json:\"s3_access_key_id,omitempty\"`\n+ S3SecretAccessKey string `json:\"s3_secret_access_key,omitempty\"`\n+ S3ForcePathStyle *bool `json:\"s3_force_path_style,omitempty\" defaults:\"false\"`\n+}\n+\n+// Sidecar defines a container to be run in the same pod as the Postgres container.\n+type Sidecar struct {\n+ Resources `json:\"resources,omitempty\"`\n+ Name string `json:\"name,omitempty\"`\n+ DockerImage string `json:\"image,omitempty\"`\n+ Ports []v1.ContainerPort `json:\"ports,omitempty\"`\n+ Env []v1.EnvVar `json:\"env,omitempty\"`\n+}\n+\n+// UserFlags defines flags (such as superuser, nologin) that could be assigned to individual users\n+type UserFlags []string\n+\n+// PostgresStatus contains status of the PostgreSQL cluster (running, creation failed etc.)\n+type PostgresStatus struct {\n+ PostgresClusterStatus string `json:\"PostgresClusterStatus\"`\n+}\n+\n+// Options for connection pooler\n+//\n+// TODO: prepared snippets of configuration, one can choose via type, e.g.\n+// pgbouncer-large (with higher resources) or odyssey-small (with smaller\n+// resources)\n+// Type string `json:\"type,omitempty\"`\n+//\n+// TODO: figure out what other important parameters of the connection pooler it\n+// makes sense to expose. E.g. pool size (min/max boundaries), max client\n+// connections etc.\n+type ConnectionPooler struct {\n+ NumberOfInstances *int32 `json:\"numberOfInstances,omitempty\"`\n+ Schema string `json:\"schema,omitempty\"`\n+ User string `json:\"user,omitempty\"`\n+ Mode string `json:\"mode,omitempty\"`\n+ DockerImage string `json:\"dockerImage,omitempty\"`\n+ MaxDBConnections *int32 `json:\"maxDBConnections,omitempty\"`\n+\n+ Resources `json:\"resources,omitempty\"`\n+}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "controllers/goharbor/harborcluster/database/api/zz_generated.deepcopy.go",
"diff": "+// +build !ignore_autogenerated\n+\n+/*\n+Copyright 2020 Compose, Zalando SE\n+\n+Permission is hereby granted, free of charge, to any person obtaining a copy\n+of this software and associated documentation files (the \"Software\"), to deal\n+in the Software without restriction, including without limitation the rights\n+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n+copies of the Software, and to permit persons to whom the Software is\n+furnished to do so, subject to the following conditions:\n+\n+The above copyright notice and this permission notice shall be included in all\n+copies or substantial portions of the Software.\n+\n+THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n+SOFTWARE.\n+*/\n+\n+// Code generated by deepcopy-gen. DO NOT EDIT.\n+\n+package api\n+\n+import (\n+ corev1 \"k8s.io/api/core/v1\"\n+ runtime \"k8s.io/apimachinery/pkg/runtime\"\n+)\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *AdditionalVolume) DeepCopyInto(out *AdditionalVolume) {\n+ *out = *in\n+ if in.TargetContainers != nil {\n+ in, out := &in.TargetContainers, &out.TargetContainers\n+ *out = make([]string, len(*in))\n+ copy(*out, *in)\n+ }\n+ in.VolumeSource.DeepCopyInto(&out.VolumeSource)\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new AdditionalVolume.\n+func (in *AdditionalVolume) DeepCopy() *AdditionalVolume {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(AdditionalVolume)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *ConnectionPooler) DeepCopyInto(out *ConnectionPooler) {\n+ *out = *in\n+ if in.NumberOfInstances != nil {\n+ in, out := &in.NumberOfInstances, &out.NumberOfInstances\n+ *out = new(int32)\n+ **out = **in\n+ }\n+ if in.MaxDBConnections != nil {\n+ in, out := &in.MaxDBConnections, &out.MaxDBConnections\n+ *out = new(int32)\n+ **out = **in\n+ }\n+ out.Resources = in.Resources\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ConnectionPooler.\n+func (in *ConnectionPooler) DeepCopy() *ConnectionPooler {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(ConnectionPooler)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *MaintenanceWindow) DeepCopyInto(out *MaintenanceWindow) {\n+ *out = *in\n+ in.StartTime.DeepCopyInto(&out.StartTime)\n+ in.EndTime.DeepCopyInto(&out.EndTime)\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new MaintenanceWindow.\n+func (in *MaintenanceWindow) DeepCopy() *MaintenanceWindow {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(MaintenanceWindow)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *PostgresSpec) DeepCopyInto(out *PostgresSpec) {\n+ *out = *in\n+ in.PostgresqlParam.DeepCopyInto(&out.PostgresqlParam)\n+ out.Volume = in.Volume\n+ out.Resources = in.Resources\n+ if in.EnableConnectionPooler != nil {\n+ in, out := &in.EnableConnectionPooler, &out.EnableConnectionPooler\n+ *out = new(bool)\n+ **out = **in\n+ }\n+ if in.ConnectionPooler != nil {\n+ in, out := &in.ConnectionPooler, &out.ConnectionPooler\n+ *out = new(ConnectionPooler)\n+ (*in).DeepCopyInto(*out)\n+ }\n+ if in.SpiloFSGroup != nil {\n+ in, out := &in.SpiloFSGroup, &out.SpiloFSGroup\n+ *out = new(int64)\n+ **out = **in\n+ }\n+ if in.EnableMasterLoadBalancer != nil {\n+ in, out := &in.EnableMasterLoadBalancer, &out.EnableMasterLoadBalancer\n+ *out = new(bool)\n+ **out = **in\n+ }\n+ if in.EnableReplicaLoadBalancer != nil {\n+ in, out := &in.EnableReplicaLoadBalancer, &out.EnableReplicaLoadBalancer\n+ *out = new(bool)\n+ **out = **in\n+ }\n+ if in.UseLoadBalancer != nil {\n+ in, out := &in.UseLoadBalancer, &out.UseLoadBalancer\n+ *out = new(bool)\n+ **out = **in\n+ }\n+ if in.ReplicaLoadBalancer != nil {\n+ in, out := &in.ReplicaLoadBalancer, &out.ReplicaLoadBalancer\n+ *out = new(bool)\n+ **out = **in\n+ }\n+ if in.AllowedSourceRanges != nil {\n+ in, out := &in.AllowedSourceRanges, &out.AllowedSourceRanges\n+ *out = make([]string, len(*in))\n+ copy(*out, *in)\n+ }\n+ if in.Users != nil {\n+ in, out := &in.Users, &out.Users\n+ *out = make(map[string]UserFlags, len(*in))\n+ for key, val := range *in {\n+ var outVal []string\n+ if val == nil {\n+ (*out)[key] = nil\n+ } else {\n+ in, out := &val, &outVal\n+ *out = make(UserFlags, len(*in))\n+ copy(*out, *in)\n+ }\n+ (*out)[key] = outVal\n+ }\n+ }\n+ if in.MaintenanceWindows != nil {\n+ in, out := &in.MaintenanceWindows, &out.MaintenanceWindows\n+ *out = make([]MaintenanceWindow, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ if in.Databases != nil {\n+ in, out := &in.Databases, &out.Databases\n+ *out = make(map[string]string, len(*in))\n+ for key, val := range *in {\n+ (*out)[key] = val\n+ }\n+ }\n+ if in.PreparedDatabases != nil {\n+ in, out := &in.PreparedDatabases, &out.PreparedDatabases\n+ *out = make(map[string]PreparedDatabase, len(*in))\n+ for key, val := range *in {\n+ (*out)[key] = *val.DeepCopy()\n+ }\n+ }\n+ if in.Tolerations != nil {\n+ in, out := &in.Tolerations, &out.Tolerations\n+ *out = make([]corev1.Toleration, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ if in.Sidecars != nil {\n+ in, out := &in.Sidecars, &out.Sidecars\n+ *out = make([]Sidecar, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ if in.InitContainers != nil {\n+ in, out := &in.InitContainers, &out.InitContainers\n+ *out = make([]corev1.Container, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ if in.ShmVolume != nil {\n+ in, out := &in.ShmVolume, &out.ShmVolume\n+ *out = new(bool)\n+ **out = **in\n+ }\n+ if in.AdditionalVolumes != nil {\n+ in, out := &in.AdditionalVolumes, &out.AdditionalVolumes\n+ *out = make([]AdditionalVolume, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ if in.InitContainersOld != nil {\n+ in, out := &in.InitContainersOld, &out.InitContainersOld\n+ *out = make([]corev1.Container, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresSpec.\n+func (in *PostgresSpec) DeepCopy() *PostgresSpec {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(PostgresSpec)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *PostgresStatus) DeepCopyInto(out *PostgresStatus) {\n+ *out = *in\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresStatus.\n+func (in *PostgresStatus) DeepCopy() *PostgresStatus {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(PostgresStatus)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *Postgresql) DeepCopyInto(out *Postgresql) {\n+ *out = *in\n+ out.TypeMeta = in.TypeMeta\n+ in.ObjectMeta.DeepCopyInto(&out.ObjectMeta)\n+ in.Spec.DeepCopyInto(&out.Spec)\n+ out.Status = in.Status\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Postgresql.\n+func (in *Postgresql) DeepCopy() *Postgresql {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(Postgresql)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.\n+func (in *Postgresql) DeepCopyObject() runtime.Object {\n+ if c := in.DeepCopy(); c != nil {\n+ return c\n+ }\n+ return nil\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *PostgresqlList) DeepCopyInto(out *PostgresqlList) {\n+ *out = *in\n+ out.TypeMeta = in.TypeMeta\n+ in.ListMeta.DeepCopyInto(&out.ListMeta)\n+ if in.Items != nil {\n+ in, out := &in.Items, &out.Items\n+ *out = make([]Postgresql, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresqlList.\n+func (in *PostgresqlList) DeepCopy() *PostgresqlList {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(PostgresqlList)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.\n+func (in *PostgresqlList) DeepCopyObject() runtime.Object {\n+ if c := in.DeepCopy(); c != nil {\n+ return c\n+ }\n+ return nil\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *PostgresqlParam) DeepCopyInto(out *PostgresqlParam) {\n+ *out = *in\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PostgresqlParam.\n+func (in *PostgresqlParam) DeepCopy() *PostgresqlParam {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(PostgresqlParam)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *PreparedDatabase) DeepCopyInto(out *PreparedDatabase) {\n+ *out = *in\n+ if in.PreparedSchemas != nil {\n+ in, out := &in.PreparedSchemas, &out.PreparedSchemas\n+ *out = make(map[string]PreparedSchema, len(*in))\n+ for key, val := range *in {\n+ (*out)[key] = *val.DeepCopy()\n+ }\n+ }\n+ if in.Extensions != nil {\n+ in, out := &in.Extensions, &out.Extensions\n+ *out = make(map[string]string, len(*in))\n+ for key, val := range *in {\n+ (*out)[key] = val\n+ }\n+ }\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreparedDatabase.\n+func (in *PreparedDatabase) DeepCopy() *PreparedDatabase {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(PreparedDatabase)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *PreparedSchema) DeepCopyInto(out *PreparedSchema) {\n+ *out = *in\n+ if in.DefaultRoles != nil {\n+ in, out := &in.DefaultRoles, &out.DefaultRoles\n+ *out = new(bool)\n+ **out = **in\n+ }\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new PreparedSchema.\n+func (in *PreparedSchema) DeepCopy() *PreparedSchema {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(PreparedSchema)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *ResourceDescription) DeepCopyInto(out *ResourceDescription) {\n+ *out = *in\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ResourceDescription.\n+func (in *ResourceDescription) DeepCopy() *ResourceDescription {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(ResourceDescription)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *Resources) DeepCopyInto(out *Resources) {\n+ *out = *in\n+ out.ResourceRequests = in.ResourceRequests\n+ out.ResourceLimits = in.ResourceLimits\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Resources.\n+func (in *Resources) DeepCopy() *Resources {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(Resources)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *Sidecar) DeepCopyInto(out *Sidecar) {\n+ *out = *in\n+ out.Resources = in.Resources\n+ if in.Ports != nil {\n+ in, out := &in.Ports, &out.Ports\n+ *out = make([]corev1.ContainerPort, len(*in))\n+ copy(*out, *in)\n+ }\n+ if in.Env != nil {\n+ in, out := &in.Env, &out.Env\n+ *out = make([]corev1.EnvVar, len(*in))\n+ for i := range *in {\n+ (*in)[i].DeepCopyInto(&(*out)[i])\n+ }\n+ }\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Sidecar.\n+func (in *Sidecar) DeepCopy() *Sidecar {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(Sidecar)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in UserFlags) DeepCopyInto(out *UserFlags) {\n+ {\n+ in := &in\n+ *out = make(UserFlags, len(*in))\n+ copy(*out, *in)\n+ return\n+ }\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new UserFlags.\n+func (in UserFlags) DeepCopy() UserFlags {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(UserFlags)\n+ in.DeepCopyInto(out)\n+ return *out\n+}\n+\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *Volume) DeepCopyInto(out *Volume) {\n+ *out = *in\n+ return\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Volume.\n+func (in *Volume) DeepCopy() *Volume {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(Volume)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/constants.go",
"new_path": "controllers/goharbor/harborcluster/database/constants.go",
"diff": "@@ -31,3 +31,13 @@ const (\nInClusterDatabaseName = \"postgres\"\nInClusterDatabasePasswordKey = \"password\"\n)\n+\n+const (\n+ PostgresCRDResourceKind = \"postgresql\"\n+ PostgresCRDResourcePlural = \"postgresqls\"\n+\n+ // GroupName is the group name for the operator CRDs\n+ GroupName = \"acid.zalan.do\"\n+\n+ APIVersion = \"v1\"\n+)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/generate.go",
"new_path": "controllers/goharbor/harborcluster/database/generate.go",
"diff": "@@ -3,8 +3,9 @@ package database\nimport (\n\"fmt\"\n- \"github.com/goharbor/harbor-cluster-operator/controllers/database/api\"\n- pg \"github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1\"\n+ \"k8s.io/apimachinery/pkg/runtime/schema\"\n+\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database/api\"\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n@@ -12,7 +13,8 @@ import (\n)\nvar (\n- databaseGVR = pg.SchemeGroupVersion.WithResource(pg.PostgresCRDResourcePlural)\n+ SchemeGroupVersion = schema.GroupVersion{Group: GroupName, Version: APIVersion}\n+ databaseGVR = SchemeGroupVersion.WithResource(PostgresCRDResourcePlural)\ndatabaseKind = \"postgresql\"\ndatabaseApi = \"acid.zalan.do/v1\"\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/update.go",
"new_path": "controllers/goharbor/harborcluster/database/update.go",
"diff": "@@ -3,7 +3,7 @@ package database\nimport (\n\"fmt\"\n- \"github.com/goharbor/harbor-cluster-operator/controllers/database/api\"\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database/api\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n\"github.com/google/go-cmp/cmp\"\ncorev1 \"k8s.io/api/core/v1\"\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/utils.go",
"new_path": "controllers/goharbor/harborcluster/database/utils.go",
"diff": "@@ -3,9 +3,7 @@ package database\nimport (\n\"fmt\"\n- \"github.com/goharbor/harbor-cluster-operator/controllers/database/api\"\n-\n- //pg \"github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1\"\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database/api\"\ncorev1 \"k8s.io/api/core/v1\"\n\"k8s.io/apimachinery/pkg/types\"\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "go.mod",
"new_path": "go.mod",
"diff": "@@ -11,8 +11,10 @@ require (\ngithub.com/go-logr/logr v0.2.1-0.20200730175230-ee2de8da5be6\ngithub.com/goharbor/harbor-cluster-operator v0.5.0 // indirect\ngithub.com/goharbor/harbor/src v0.0.0-20200728051037-1d361a89a056\n+ github.com/google/go-cmp v0.5.1\ngithub.com/huandu/xstrings v1.3.2 // indirect\ngithub.com/imdario/mergo v0.3.10 // indirect\n+ github.com/jackc/pgx/v4 v4.8.1\ngithub.com/jaegertracing/jaeger-lib v2.2.0+incompatible\ngithub.com/jetstack/cert-manager v0.16.1\ngithub.com/mitchellh/reflectwalk v1.0.1 // indirect\n"
},
{
"change_type": "MODIFY",
"old_path": "go.sum",
"new_path": "go.sum",
"diff": "@@ -336,6 +336,7 @@ github.com/go-logr/zapr v0.1.0 h1:h+WVe9j6HAA01niTJPA/kKH0i7e0rLZBCwauQFcRE54=\ngithub.com/go-logr/zapr v0.1.0/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk=\ngithub.com/go-logr/zapr v0.1.1 h1:qXBXPDdNncunGs7XeEpsJt8wCjYBygluzfdLO0G5baE=\ngithub.com/go-logr/zapr v0.1.1/go.mod h1:tabnROwaDl0UNxkVeFRbY8bwB37GwRv0P8lg6aAiEnk=\n+github.com/go-logr/zapr v0.2.0 h1:v6Ji8yBW77pva6NkJKQdHLAJKrIJKRHz0RXwPqCHSR4=\ngithub.com/go-logr/zapr v0.2.0/go.mod h1:qhKdvif7YF5GI9NWEpyxTSSBdGmzkNguibrdCNVPunU=\ngithub.com/go-openapi/analysis v0.0.0-20180825180245-b006789cd277/go.mod h1:k70tL6pCuVxPJOHXQ+wIac1FUrvNkHolPie/cLEU6hI=\ngithub.com/go-openapi/analysis v0.17.0/go.mod h1:IowGgpVeD0vNm45So8nr+IcQ3pxVtpRoBWb8PVZO0ik=\n@@ -1073,6 +1074,7 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de\ngithub.com/yvasiyarov/go-metrics v0.0.0-20140926110328-57bccd1ccd43/go.mod h1:aX5oPXxHm3bOH+xeAttToC8pqch2ScQN/JoXYupl6xs=\ngithub.com/yvasiyarov/gorelic v0.0.0-20141212073537-a9bba5b9ab50/go.mod h1:NUSPSUX/bi6SeDMUh6brw0nXpxHnc96TguQh0+r/ssA=\ngithub.com/yvasiyarov/newrelic_platform_go v0.0.0-20140908184405-b21fdbd4370f/go.mod h1:GlGEuHIJweS1mbCqG+7vt2nvWLzLLnRHbXz5JKd/Qbg=\n+github.com/zalando/postgres-operator v1.5.0 h1:qQfWG6qcOCBAQQnHzH7tXhNA/67R9/jH82PmzXrRtFM=\ngithub.com/zalando/postgres-operator v1.5.0/go.mod h1:AHgrNKjXeq+5TkzVfx5yBoqHBfM4MaGvFQvsDT7AZh4=\ngithub.com/zenazn/goji v0.9.0/go.mod h1:7S9M489iMyHBNxwZnk9/EHS098H4/F6TATF2mIxtB1Q=\ngitlab.com/nyarla/go-crypt v0.0.0-20160106005555-d9a5dc2b789b/go.mod h1:T3BPAOm2cqquPa0MKWeNkmOM5RQsRhkrwMWonFMN7fE=\n@@ -1596,6 +1598,7 @@ k8s.io/api v0.18.4/go.mod h1:lOIQAKYgai1+vz9J7YcDZwC26Z0zQewYOGWdyIPUUQ4=\nk8s.io/api v0.18.5/go.mod h1:tN+e/2nbdGKOAH55NMV8oGrMG+3uRlA9GaRfvnCCSNk=\nk8s.io/api v0.19.0-rc.3 h1:bq4HUeQmlDeIKZuvVNPAeaOAru+IVk/q/MsNQo634+k=\nk8s.io/api v0.19.0-rc.3/go.mod h1:hfDN4tL/yqfs4aVrlvx2vNMhKACfoiTyGSvVnygqSd4=\n+k8s.io/api v0.19.2 h1:q+/krnHWKsL7OBZg/rxnycsl9569Pud76UJ77MvKXms=\nk8s.io/api v0.19.3 h1:GN6ntFnv44Vptj/b+OnMW7FmzkpDoIDLZRvKX3XH9aU=\nk8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783 h1:V6ndwCPoao1yZ52agqOKaUAl7DYWVGiXjV7ePA2i610=\nk8s.io/apiextensions-apiserver v0.0.0-20190918161926-8f644eb6e783/go.mod h1:xvae1SZB3E17UpV59AWc271W/Ph25N+bjPyR63X6tPY=\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(database) add postgre-operator api file
add postgre-operator api file
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,865
|
06.11.2020 17:37:33
| -28,800
|
a161317adc085428ce97f900a29e432853d2f48a
|
feat(harborcluster): update lcm Controller interface
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/cache/redis.go",
"new_path": "controllers/goharbor/harborcluster/cache/redis.go",
"diff": "@@ -19,3 +19,7 @@ func (r *RedisController) Delete(harborcluster *v1alpha2.HarborCluster) (*lcm.CR\nfunc (r *RedisController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n+\n+func NewCacheController() lcm.Controller {\n+ return &RedisController{}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"new_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"diff": "@@ -19,3 +19,7 @@ func (p *PostgreSQLController) Delete(harborcluster *v1alpha2.HarborCluster) (*l\nfunc (p *PostgreSQLController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n+\n+func NewDatabaseController() lcm.Controller {\n+ return &PostgreSQLController{}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harbor/harbor.go",
"new_path": "controllers/goharbor/harborcluster/harbor/harbor.go",
"diff": "@@ -19,3 +19,7 @@ func (harbor *HarborController) Delete(harborcluster *v1alpha2.HarborCluster) (*\nfunc (harbor *HarborController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n+\n+func NewHarborController() lcm.Controller {\n+ return &HarborController{}\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"diff": "@@ -2,8 +2,12 @@ package harborcluster\nimport (\n\"context\"\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/cache\"\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database\"\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/harbor\"\n+ \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/storage\"\ncommonCtrl \"github.com/goharbor/harbor-operator/pkg/controller\"\n- \"github.com/goharbor/harbor-operator/pkg/k8s\"\n+ \"github.com/goharbor/harbor-operator/pkg/lcm\"\n\"github.com/ovh/configstore\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n@@ -14,7 +18,10 @@ import (\ntype Reconciler struct {\n*commonCtrl.Controller\n- ServiceGetter\n+ CacheCtrl lcm.Controller\n+ DatabaseCtrl lcm.Controller\n+ StorageCtrl lcm.Controller\n+ HarborCtrl lcm.Controller\n}\n// +kubebuilder:rbac:groups=goharbor.goharbor.io,resources=harborclusters,verbs=get;list;watch;create;update;patch;delete\n@@ -28,22 +35,20 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nfunc New(ctx context.Context, name string, configStore *configstore.Store) (commonCtrl.Reconciler, error) {\n- dClient, err := k8s.NewDynamicClient()\n- if err != nil {\n- return nil, err\n- }\n+ //dClient, err := k8s.NewDynamicClient()\n+ //if err != nil {\n+ // return nil, err\n+ //}\nr := &Reconciler{}\n- option := &GetOptions{\n- Client: k8s.WrapClient(ctx, r.Client),\n- Log: r.Log,\n- DClient: k8s.WrapDClient(dClient),\n- Scheme: r.Scheme,\n- }\n- r.ServiceGetter = NewServiceGetterImpl(option)\n-\nr.Controller = commonCtrl.NewController(ctx, name, r, configStore)\n+ // TODO add args to service controller\n+ r.CacheCtrl = cache.NewCacheController()\n+ r.DatabaseCtrl = database.NewDatabaseController()\n+ r.StorageCtrl = storage.NewMinIOController()\n+ r.HarborCtrl = harbor.NewHarborController()\n+\nreturn r, nil\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/resources.go",
"new_path": "controllers/goharbor/harborcluster/resources.go",
"diff": "@@ -25,7 +25,7 @@ func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resour\n}\ncomponentToStatus := r.DefaultComponentStatus()\n- cacheStatus, err := r.Cache().Apply(harborcluster)\n+ cacheStatus, err := r.CacheCtrl.Apply(harborcluster)\ncomponentToStatus[v1alpha2.ComponentCache] = cacheStatus\nif err != nil {\nr.Log.Error(err, \"error when reconcile cache component.\")\n@@ -36,7 +36,7 @@ func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resour\nreturn err\n}\n- dbStatus, err := r.Database().Apply(harborcluster)\n+ dbStatus, err := r.DatabaseCtrl.Apply(harborcluster)\ncomponentToStatus[v1alpha2.ComponentDatabase] = dbStatus\nif err != nil {\nr.Log.Error(err, \"error when reconcile database component.\")\n@@ -47,7 +47,7 @@ func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resour\nreturn err\n}\n- storageStatus, err := r.Storage().Apply(harborcluster)\n+ storageStatus, err := r.StorageCtrl.Apply(harborcluster)\ncomponentToStatus[v1alpha2.ComponentStorage] = storageStatus\nif err != nil {\nr.Log.Error(err, \"error when reconcile storage component.\")\n@@ -81,7 +81,7 @@ func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resour\n//}\n//r.option.ImageGetter = imageGetter\n- harborStatus, err := r.Harbor().Apply(harborcluster)\n+ harborStatus, err := r.HarborCtrl.Apply(harborcluster)\nif err != nil {\nr.Log.Error(err, \"error when reconcile harbor service.\")\nreturn err\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/service.go",
"new_path": "controllers/goharbor/harborcluster/service.go",
"diff": "package harborcluster\nimport (\n- \"github.com/go-logr/logr\"\n- \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/cache\"\n- \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database\"\n- \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/harbor\"\n- \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/storage\"\n- \"github.com/goharbor/harbor-operator/pkg/image\"\n- \"github.com/goharbor/harbor-operator/pkg/k8s\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n- \"k8s.io/apimachinery/pkg/runtime\"\n- \"k8s.io/client-go/tools/record\"\n)\ntype ServiceGetter interface {\n@@ -26,45 +17,3 @@ type ServiceGetter interface {\n// For harbor itself\nHarbor() lcm.Controller\n}\n-\n-type GetOptions struct {\n- Client k8s.Client\n- Recorder record.EventRecorder\n- Log logr.Logger\n- DClient k8s.DClient\n- Scheme *runtime.Scheme\n- ImageGetter image.Getter\n-}\n-\n-type ServiceGetterImpl struct {\n- redisReconciler *cache.RedisReconciler\n- databaseReconciler *database.PostgreSQLReconciler\n- storageReconciler *storage.MinIOReconciler\n- harborReconciler *harbor.HarborReconciler\n-}\n-\n-func NewServiceGetterImpl(options *GetOptions) ServiceGetter {\n- // TODO need update\n- return &ServiceGetterImpl{\n- redisReconciler: &cache.RedisReconciler{},\n- databaseReconciler: &database.PostgreSQLReconciler{},\n- storageReconciler: &storage.MinIOReconciler{},\n- harborReconciler: &harbor.HarborReconciler{},\n- }\n-}\n-\n-func (impl *ServiceGetterImpl) Harbor() lcm.Controller {\n- return impl.harborReconciler\n-}\n-\n-func (impl *ServiceGetterImpl) Cache() lcm.Controller {\n- return impl.redisReconciler\n-}\n-\n-func (impl *ServiceGetterImpl) Database() lcm.Controller {\n- return impl.databaseReconciler\n-}\n-\n-func (impl *ServiceGetterImpl) Storage() lcm.Controller {\n- return impl.storageReconciler\n-}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/storage/minio.go",
"new_path": "controllers/goharbor/harborcluster/storage/minio.go",
"diff": "@@ -19,3 +19,7 @@ func (m *MinIOController) Delete(harborcluster *v1alpha2.HarborCluster) (*lcm.CR\nfunc (m *MinIOController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n+\n+func NewMinIOController() lcm.Controller {\n+ return &MinIOController{}\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(harborcluster): update lcm Controller interface
Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
|
254,865
|
11.11.2020 16:42:50
| -28,800
|
0bcbcbba52f591afacdeb687beb4529f79ce2560
|
feat(harborcontroller): implement HarborController.
implement Apply method of HarborController
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "controllers/goharbor/harborcluster/harbor/errors.go",
"diff": "+package harbor\n+\n+const (\n+ GetHarborCRError = \"Get harbor.goharbor.io CR error\"\n+ CreateHarborCRError = \"Create harbor.goharbor.io CR error\"\n+ ScaleHarborCRError = \"Scale harbor.goharbor.io CR error\"\n+ UpdateHarborCRError = \"Update harbor.goharbor.io CR error\"\n+ EmptyHarborCRStatusError = \"Empty harbor.goharbor.io CR status error\"\n+ CreateRegistryCertError = \"Create Registry Cert error\"\n+ AutoGenerateAdminPasswordError = \"Auto generate admin password error\"\n+)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harbor/harbor.go",
"new_path": "controllers/goharbor/harborcluster/harbor/harbor.go",
"diff": "package harbor\nimport (\n+ \"fmt\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n+ \"github.com/goharbor/harbor-operator/pkg/k8s\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n+ corev1 \"k8s.io/api/core/v1\"\n+ \"k8s.io/apimachinery/pkg/api/errors\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+ \"k8s.io/apimachinery/pkg/types\"\n+ \"sigs.k8s.io/kustomize/kstatus/status\"\n)\ntype HarborController struct {\n+ k8s.Client\n}\nfunc (harbor *HarborController) Apply(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n- panic(\"implement me\")\n+ var harborCR *v1alpha2.Harbor\n+ err := harbor.Get(harbor.getHarborCRNamespacedName(harborcluster), harborCR)\n+ if err != nil {\n+ if errors.IsNotFound(err) {\n+ harborCR = harbor.getHarborCR(harborcluster)\n+ err = harbor.Create(harborCR)\n+ if err != nil {\n+ return harborClusterCRNotReadyStatus(CreateHarborCRError, err.Error()), err\n+ }\n+ } else {\n+ return harborClusterCRNotReadyStatus(GetHarborCRError, err.Error()), err\n+ }\n+ } else {\n+ harborCR = harbor.getHarborCR(harborcluster)\n+ err = harbor.Update(harborCR)\n+ if err != nil {\n+ return harborClusterCRNotReadyStatus(UpdateHarborCRError, err.Error()), err\n+ }\n+ }\n+\n+ return harborClusterCRStatus(harborCR), nil\n}\nfunc (harbor *HarborController) Delete(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n@@ -23,3 +52,93 @@ func (harbor *HarborController) Upgrade(harborcluster *v1alpha2.HarborCluster) (\nfunc NewHarborController() lcm.Controller {\nreturn &HarborController{}\n}\n+\n+// getHarborCR will get a Harbor CR from the harborcluster definition\n+func (harbor *HarborController) getHarborCR(harborcluster *v1alpha2.HarborCluster) *v1alpha2.Harbor {\n+ namespacedName := harbor.getHarborCRNamespacedName(harborcluster)\n+\n+ return &v1alpha2.Harbor{\n+ ObjectMeta: metav1.ObjectMeta{\n+ Name: namespacedName.Name,\n+ Namespace: namespacedName.Namespace,\n+ Labels: map[string]string{\n+ k8s.HarborClusterNameLabel: harborcluster.Name,\n+ },\n+ OwnerReferences: []metav1.OwnerReference{\n+ *metav1.NewControllerRef(harborcluster, v1alpha2.HarborClusterGVK),\n+ },\n+ },\n+ Spec: v1alpha2.HarborSpec{\n+ HarborComponentsSpec: v1alpha2.HarborComponentsSpec{\n+ Portal: harborcluster.Spec.Portal,\n+ Core: harborcluster.Spec.Core,\n+ JobService: harborcluster.Spec.JobService,\n+ Registry: harborcluster.Spec.Registry,\n+ ChartMuseum: harborcluster.Spec.ChartMuseum,\n+ Trivy: harborcluster.Spec.Trivy,\n+ Notary: harborcluster.Spec.Notary,\n+ // TODO to filled it\n+ Redis: v1alpha2.ExternalRedisSpec{\n+ RedisHostSpec: v1alpha1.RedisHostSpec{\n+ Host: \"\",\n+ Port: 0,\n+ },\n+ RedisCredentials: v1alpha1.RedisCredentials{\n+ PasswordRef: \"\",\n+ CertificateRef: \"\",\n+ },\n+ },\n+ // TODO to filled it\n+ Database: v1alpha2.HarborDatabaseSpec{\n+ PostgresCredentials: v1alpha1.PostgresCredentials{\n+ Username: \"\",\n+ PasswordRef: \"\",\n+ },\n+ Hosts: nil,\n+ SSLMode: \"\",\n+ Prefix: \"\",\n+ },\n+ },\n+ Expose: harborcluster.Spec.Expose,\n+ ExternalURL: harborcluster.Spec.ExternalURL,\n+ InternalTLS: harborcluster.Spec.InternalTLS,\n+ // TODO to filled it\n+ ImageChartStorage: v1alpha2.HarborStorageImageChartStorageSpec{\n+ Redirect: v1alpha2.RegistryStorageRedirectSpec{},\n+ FileSystem: nil,\n+ S3: nil,\n+ Swift: nil,\n+ },\n+ LogLevel: harborcluster.Spec.LogLevel,\n+ HarborAdminPasswordRef: harborcluster.Spec.HarborAdminPasswordRef,\n+ EncryptionKeyRef: harborcluster.Spec.EncryptionKeyRef,\n+ UpdateStrategyType: harborcluster.Spec.UpdateStrategyType,\n+ Proxy: harborcluster.Spec.Proxy,\n+ },\n+ }\n+}\n+\n+func harborClusterCRNotReadyStatus(reason, message string) *lcm.CRStatus {\n+ return lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionFalse).WithReason(reason).WithMessage(message)\n+}\n+\n+func harborClusterCRUnknownStatus(reason, message string) *lcm.CRStatus {\n+ return lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionUnknown).WithReason(reason).WithMessage(message)\n+}\n+\n+// harborClusterCRStatus will assembly the harbor cluster status according the v1alpha1.Harbor status\n+func harborClusterCRStatus(harbor *v1alpha2.Harbor) *lcm.CRStatus {\n+ for _, condition := range harbor.Status.Conditions {\n+ if condition.Type == status.ConditionInProgress {\n+ return lcm.New(v1alpha2.ServiceReady).WithStatus(condition.Status).WithMessage(condition.Message).WithReason(condition.Reason)\n+ }\n+ }\n+ return harborClusterCRUnknownStatus(EmptyHarborCRStatusError, \"The ready condition of harbor.goharbor.io is empty. Please wait for minutes.\")\n+}\n+\n+func (harbor *HarborController) getHarborCRNamespacedName(harborcluster *v1alpha2.HarborCluster) types.NamespacedName {\n+ return types.NamespacedName{\n+ Namespace: harborcluster.Namespace,\n+ Name: fmt.Sprintf(\"%s-harbor\", harborcluster.Name),\n+ }\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(harborcontroller): implement HarborController. (#186)
implement Apply method of HarborController
Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
|
254,870
|
13.11.2020 23:50:15
| -28,800
|
393163adf83f52f2ce02a3c38c6e44eece7f66c9
|
feat(CtrlOptions) support CtrlOptions for lcm controllers
support CtrlOptions for lcm controllers
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"new_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"diff": "@@ -79,12 +79,19 @@ func (p *PostgreSQLController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*\npanic(\"implement me\")\n}\n-func NewDatabaseController(options *k8s.GetOptions) lcm.Controller {\n+func NewDatabaseController(ctx context.Context, options ...k8s.Option) lcm.Controller {\n+\n+ o := &k8s.CtrlOptions{}\n+\n+ for _, option := range options {\n+ option(o)\n+ }\n+\nreturn &PostgreSQLController{\n- Ctx: options.CXT,\n- Client: options.Client,\n- Log: options.Log,\n- DClient: options.DClient,\n- Scheme: options.Scheme,\n+ Ctx: ctx,\n+ Client: o.Client,\n+ Log: o.Log,\n+ DClient: o.DClient,\n+ Scheme: o.Scheme,\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"diff": "@@ -3,11 +3,6 @@ package harborcluster\nimport (\n\"context\"\n- \"github.com/go-logr/logr\"\n- clientgoscheme \"k8s.io/client-go/kubernetes/scheme\"\n-\n- \"k8s.io/apimachinery/pkg/runtime\"\n-\n\"github.com/goharbor/harbor-operator/pkg/k8s\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/cache\"\n@@ -36,52 +31,33 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=goharbor.goharbor.io,resources=harborclusters/status,verbs=get;update;patch\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\n- return ctrl.NewControllerManagedBy(mgr).\n- For(&goharborv1alpha2.HarborCluster{}).\n- Complete(r)\n-}\n-\n-func New(ctx context.Context, name string, configStore *configstore.Store) (commonCtrl.Reconciler, error) {\n- scheme := newScheme()\ndClient, err := k8s.NewDynamicClient()\nif err != nil {\n- return nil, err\n- }\n-\n- client, err := k8s.NewClient(scheme)\n- if err != nil {\n- return nil, err\n+ r.Log.Error(err, \"unable to create dynamic client\")\n+ return err\n}\n- option := &k8s.GetOptions{\n- CXT: ctx,\n- Client: k8s.WrapClient(ctx, client),\n- Log: newLog(),\n- DClient: k8s.WrapDClient(dClient),\n- Scheme: scheme,\n- }\n-\n- r := &Reconciler{}\n-\n- r.Controller = commonCtrl.NewController(ctx, name, r, configStore)\n-\n- // TODO add args to service controller\nr.CacheCtrl = cache.NewCacheController()\n- r.DatabaseCtrl = database.NewDatabaseController(option)\n+ r.DatabaseCtrl = database.NewDatabaseController(ctx,\n+ k8s.WithLog(r.Log),\n+ k8s.WithScheme(mgr.GetScheme()),\n+ k8s.WithDClient(k8s.WrapDClient(dClient)),\n+ k8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())),\n+ )\nr.StorageCtrl = storage.NewMinIOController()\nr.HarborCtrl = harbor.NewHarborController()\n- return r, nil\n+ return ctrl.NewControllerManagedBy(mgr).\n+ For(&goharborv1alpha2.HarborCluster{}).\n+ Complete(r)\n}\n-func newScheme() *runtime.Scheme {\n- scheme := runtime.NewScheme()\n- _ = clientgoscheme.AddToScheme(scheme)\n+func New(ctx context.Context, name string, configStore *configstore.Store) (commonCtrl.Reconciler, error) {\n- return scheme\n-}\n+ r := &Reconciler{}\n-func newLog() logr.Logger {\n- return ctrl.Log.WithName(\"controllers\").WithName(\"HarborCluster\")\n+ r.Controller = commonCtrl.NewController(ctx, name, r, configStore)\n+\n+ return r, nil\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/k8s/option.go",
"new_path": "pkg/k8s/option.go",
"diff": "@@ -7,10 +7,36 @@ import (\n\"k8s.io/apimachinery/pkg/runtime\"\n)\n-type GetOptions struct {\n- CXT context.Context\n+type CtrlOptions struct {\n+ CTX context.Context\nClient Client\nLog logr.Logger\nDClient DClient\nScheme *runtime.Scheme\n}\n+\n+type Option func(ops *CtrlOptions)\n+\n+func WithClient(client Client) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.Client = client\n+ }\n+}\n+\n+func WithDClient(dClient DClient) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.DClient = dClient\n+ }\n+}\n+\n+func WithScheme(scheme *runtime.Scheme) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.Scheme = scheme\n+ }\n+}\n+\n+func WithLog(log logr.Logger) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.Log = log\n+ }\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(CtrlOptions) support CtrlOptions for lcm controllers
support CtrlOptions for lcm controllers
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,870
|
14.11.2020 00:00:37
| -28,800
|
cb8929834e9fcbbc6f94e26093af2500ca208b43
|
feat(options) support ctrl options for lcm controllers
upport ctrl options for lcm controllers
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"new_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"diff": "package database\nimport (\n+ \"context\"\n+\n+ \"github.com/go-logr/logr\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/pkg/k8s\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n+ \"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n+ \"k8s.io/apimachinery/pkg/runtime\"\n)\ntype PostgreSQLController struct {\n+ HarborCluster *goharborv1alpha2.HarborCluster\n+ Ctx context.Context\n+ Client k8s.Client\n+ Log logr.Logger\n+ DClient k8s.DClient\n+ Scheme *runtime.Scheme\n+ ExpectCR *unstructured.Unstructured\n+ ActualCR *unstructured.Unstructured\n}\nfunc (p *PostgreSQLController) Apply(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n@@ -20,6 +35,19 @@ func (p *PostgreSQLController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*\npanic(\"implement me\")\n}\n-func NewDatabaseController() lcm.Controller {\n- return &PostgreSQLController{}\n+func NewDatabaseController(ctx context.Context, options ...k8s.Option) lcm.Controller {\n+\n+ o := &k8s.CtrlOptions{}\n+\n+ for _, option := range options {\n+ option(o)\n+ }\n+\n+ return &PostgreSQLController{\n+ Ctx: ctx,\n+ Client: o.Client,\n+ Log: o.Log,\n+ DClient: o.DClient,\n+ Scheme: o.Scheme,\n+ }\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"diff": "@@ -2,10 +2,13 @@ package harborcluster\nimport (\n\"context\"\n+\n\"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/cache\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/harbor\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/storage\"\n+ \"github.com/goharbor/harbor-operator/pkg/k8s\"\n+\ncommonCtrl \"github.com/goharbor/harbor-operator/pkg/controller\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n\"github.com/ovh/configstore\"\n@@ -28,6 +31,23 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=goharbor.goharbor.io,resources=harborclusters/status,verbs=get;update;patch\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\n+\n+ dClient, err := k8s.NewDynamicClient()\n+ if err != nil {\n+ r.Log.Error(err, \"unable to create dynamic client\")\n+ return err\n+ }\n+\n+ r.CacheCtrl = cache.NewCacheController()\n+ r.DatabaseCtrl = database.NewDatabaseController(ctx,\n+ k8s.WithLog(r.Log),\n+ k8s.WithScheme(mgr.GetScheme()),\n+ k8s.WithDClient(k8s.WrapDClient(dClient)),\n+ k8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())),\n+ )\n+ r.StorageCtrl = storage.NewMinIOController()\n+ r.HarborCtrl = harbor.NewHarborController()\n+\nreturn ctrl.NewControllerManagedBy(mgr).\nFor(&goharborv1alpha2.HarborCluster{}).\nComplete(r)\n@@ -35,20 +55,8 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nfunc New(ctx context.Context, name string, configStore *configstore.Store) (commonCtrl.Reconciler, error) {\n- //dClient, err := k8s.NewDynamicClient()\n- //if err != nil {\n- // return nil, err\n- //}\n-\nr := &Reconciler{}\n-\nr.Controller = commonCtrl.NewController(ctx, name, r, configStore)\n- // TODO add args to service controller\n- r.CacheCtrl = cache.NewCacheController()\n- r.DatabaseCtrl = database.NewDatabaseController()\n- r.StorageCtrl = storage.NewMinIOController()\n- r.HarborCtrl = harbor.NewHarborController()\n-\nreturn r, nil\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/k8s/option.go",
"diff": "+package k8s\n+\n+import (\n+ \"context\"\n+\n+ \"github.com/go-logr/logr\"\n+ \"k8s.io/apimachinery/pkg/runtime\"\n+)\n+\n+type CtrlOptions struct {\n+ CTX context.Context\n+ Client Client\n+ Log logr.Logger\n+ DClient DClient\n+ Scheme *runtime.Scheme\n+}\n+\n+type Option func(ops *CtrlOptions)\n+\n+func WithClient(client Client) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.Client = client\n+ }\n+}\n+\n+func WithDClient(dClient DClient) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.DClient = dClient\n+ }\n+}\n+\n+func WithScheme(scheme *runtime.Scheme) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.Scheme = scheme\n+ }\n+}\n+\n+func WithLog(log logr.Logger) Option {\n+ return func(ops *CtrlOptions) {\n+ ops.Log = log\n+ }\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(options) support ctrl options for lcm controllers
upport ctrl options for lcm controllers
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,870
|
16.11.2020 11:32:47
| -28,800
|
42f5c570be8e32b6e11cadb9dd3d67189ed25f59
|
feat(database) change databse conroller dir to the pkg
change databse conroller dir to the pkg
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"new_path": "controllers/goharbor/harborcluster/database/postgresql.go",
"diff": "@@ -3,12 +3,6 @@ package database\nimport (\n\"context\"\n- \"fmt\"\n-\n- \"k8s.io/apimachinery/pkg/api/errors\"\n- metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n- \"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil\"\n-\n\"github.com/go-logr/logr\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n@@ -29,47 +23,8 @@ type PostgreSQLController struct {\nActualCR *unstructured.Unstructured\n}\n-type Connect struct {\n- Host string\n- Port string\n- Password string\n- Username string\n- Database string\n-}\n-\nfunc (p *PostgreSQLController) Apply(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n-\n- p.Client.WithContext(p.Ctx)\n- p.DClient.WithContext(p.Ctx)\n- p.HarborCluster = harborcluster\n-\n- crdClient := p.DClient.WithResource(databaseGVR).WithNamespace(p.HarborCluster.Namespace)\n- name := fmt.Sprintf(\"%s-%s\", p.HarborCluster.Namespace, p.HarborCluster.Name)\n-\n- actualCR, err := crdClient.Get(name, metav1.GetOptions{})\n- if errors.IsNotFound(err) {\n- return p.Deploy()\n- } else if err != nil {\n- return databaseNotReadyStatus(GetDatabaseCrError, err.Error()), err\n- }\n-\n- expectCR, err := p.GetPostgresCR()\n- if err != nil {\n- return databaseNotReadyStatus(GenerateDatabaseCrError, err.Error()), err\n- }\n-\n- if err := controllerutil.SetControllerReference(p.HarborCluster, expectCR, p.Scheme); err != nil {\n- return databaseNotReadyStatus(SetOwnerReferenceError, err.Error()), err\n- }\n-\n- p.ActualCR = actualCR\n- p.ExpectCR = expectCR\n-\n- if _, err := p.Update(); err != nil {\n- return databaseNotReadyStatus(CheckDatabaseHealthError, err.Error()), err\n- }\n-\n- return p.Readiness()\n+ panic(\"implement me\")\n}\nfunc (p *PostgreSQLController) Delete(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n"
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/api/postgresql_type.go",
"new_path": "pkg/cluster/database/api/postgresql_type.go",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/api/zz_generated.deepcopy.go",
"new_path": "pkg/cluster/database/api/zz_generated.deepcopy.go",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/constants.go",
"new_path": "pkg/cluster/database/constants.go",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/generate.go",
"new_path": "pkg/cluster/database/generate.go",
"diff": "@@ -4,10 +4,10 @@ import (\n\"fmt\"\nharbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/database/api\"\n\"k8s.io/apimachinery/pkg/runtime/schema\"\n- \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database/api\"\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cluster/database/postgresql.go",
"diff": "+package database\n+\n+import (\n+ \"context\"\n+\n+ \"fmt\"\n+\n+ \"k8s.io/apimachinery/pkg/api/errors\"\n+ metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n+ \"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil\"\n+\n+ \"github.com/go-logr/logr\"\n+ \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/pkg/k8s\"\n+ \"github.com/goharbor/harbor-operator/pkg/lcm\"\n+ \"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n+ \"k8s.io/apimachinery/pkg/runtime\"\n+)\n+\n+type PostgreSQLController struct {\n+ HarborCluster *goharborv1alpha2.HarborCluster\n+ Ctx context.Context\n+ Client k8s.Client\n+ Log logr.Logger\n+ DClient k8s.DClient\n+ Scheme *runtime.Scheme\n+ ExpectCR *unstructured.Unstructured\n+ ActualCR *unstructured.Unstructured\n+}\n+\n+type Connect struct {\n+ Host string\n+ Port string\n+ Password string\n+ Username string\n+ Database string\n+}\n+\n+func (p *PostgreSQLController) Apply(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+\n+ p.Client.WithContext(p.Ctx)\n+ p.DClient.WithContext(p.Ctx)\n+ p.HarborCluster = harborcluster\n+\n+ crdClient := p.DClient.WithResource(databaseGVR).WithNamespace(p.HarborCluster.Namespace)\n+ name := fmt.Sprintf(\"%s-%s\", p.HarborCluster.Namespace, p.HarborCluster.Name)\n+\n+ actualCR, err := crdClient.Get(name, metav1.GetOptions{})\n+ if errors.IsNotFound(err) {\n+ return p.Deploy()\n+ } else if err != nil {\n+ return databaseNotReadyStatus(GetDatabaseCrError, err.Error()), err\n+ }\n+\n+ expectCR, err := p.GetPostgresCR()\n+ if err != nil {\n+ return databaseNotReadyStatus(GenerateDatabaseCrError, err.Error()), err\n+ }\n+\n+ if err := controllerutil.SetControllerReference(p.HarborCluster, expectCR, p.Scheme); err != nil {\n+ return databaseNotReadyStatus(SetOwnerReferenceError, err.Error()), err\n+ }\n+\n+ p.ActualCR = actualCR\n+ p.ExpectCR = expectCR\n+\n+ if _, err := p.Update(); err != nil {\n+ return databaseNotReadyStatus(CheckDatabaseHealthError, err.Error()), err\n+ }\n+\n+ return p.Readiness()\n+}\n+\n+func (p *PostgreSQLController) Delete(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+ panic(\"implement me\")\n+}\n+\n+func (p *PostgreSQLController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+ panic(\"implement me\")\n+}\n+\n+func NewDatabaseController(ctx context.Context, options ...k8s.Option) lcm.Controller {\n+\n+ o := &k8s.CtrlOptions{}\n+\n+ for _, option := range options {\n+ option(o)\n+ }\n+\n+ return &PostgreSQLController{\n+ Ctx: ctx,\n+ Client: o.Client,\n+ Log: o.Log,\n+ DClient: o.DClient,\n+ Scheme: o.Scheme,\n+ }\n+}\n"
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/provision.go",
"new_path": "pkg/cluster/database/provision.go",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/readiness.go",
"new_path": "pkg/cluster/database/readiness.go",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/status.go",
"new_path": "pkg/cluster/database/status.go",
"diff": ""
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/update.go",
"new_path": "pkg/cluster/database/update.go",
"diff": "@@ -3,7 +3,7 @@ package database\nimport (\n\"fmt\"\n- \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database/api\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/database/api\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n\"github.com/google/go-cmp/cmp\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n"
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/database/utils.go",
"new_path": "pkg/cluster/database/utils.go",
"diff": "@@ -4,8 +4,8 @@ import (\n\"fmt\"\nharbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/database/api\"\n- \"github.com/goharbor/harbor-operator/controllers/goharbor/harborcluster/database/api\"\ncorev1 \"k8s.io/api/core/v1\"\n\"k8s.io/apimachinery/pkg/types\"\n)\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(database) change databse conroller dir to the pkg
change databse conroller dir to the pkg
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,875
|
16.11.2020 18:48:45
| -28,800
|
c2e809f06bff4b2ef7f98d099aa4b8f80c67490b
|
add a registry config
|
[
{
"change_type": "MODIFY",
"old_path": "config/samples/harbor/https.yaml",
"new_path": "config/samples/harbor/https.yaml",
"diff": "@@ -10,7 +10,7 @@ kind: Certificate\nmetadata:\nname: sample-public-certificate\nspec:\n- isCA: false\n+ isCA: true\nissuerRef:\nname: sample-public-certificate\nsecretName: sample-public-certificate\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"new_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"diff": "@@ -23,7 +23,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/chartmuseum-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/chartmuseum-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/chartmuseum-photon:v2.0.0\"\n)\n// Reconciler reconciles a Chartmuseum object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/core.go",
"new_path": "controllers/goharbor/core/core.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/core-config.conf.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/harbor-core:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-core:v2.0.0\"\n)\n// Reconciler reconciles a Core object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/jobservice/jobservice.go",
"new_path": "controllers/goharbor/jobservice/jobservice.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/jobservice-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/harbor-jobservice:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-jobservice:v2.0.0\"\n)\n// Reconciler reconciles a JobService object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notaryserver/deployments.go",
"new_path": "controllers/goharbor/notaryserver/deployments.go",
"diff": "@@ -136,7 +136,7 @@ func (r *Reconciler) GetDeployment(ctx context.Context, notary *goharborv1alpha2\nValue: \"notary_server\",\n}, corev1.EnvVar{\nName: \"MIGRATIONS_PATH\",\n- Value: \"/migrations/signer/postgresql\",\n+ Value: \"/migrations/server/postgresql\",\n})\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notaryserver/notaryserver.go",
"new_path": "controllers/goharbor/notaryserver/notaryserver.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/notaryserver-config.json.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/notary-server-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/notary-server-photon:v2.0.0\"\n)\n// Reconciler reconciles a NotaryServer object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notarysigner/notarysigner.go",
"new_path": "controllers/goharbor/notarysigner/notarysigner.go",
"diff": "@@ -23,7 +23,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/notarysigner-config.json.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/notary-signer-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/notary-signer-photon:v2.0.0\"\n)\n// Reconciler reconciles a NotarySigner object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/portal/portal.go",
"new_path": "controllers/goharbor/portal/portal.go",
"diff": "@@ -21,7 +21,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/portal-config.conf.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/harbor-portal:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-portal:v2.0.0\"\n)\n// Reconciler reconciles a Portal object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registry/registry.go",
"new_path": "controllers/goharbor/registry/registry.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/registry-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/registry-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/registry-photon:v2.0.0\"\n)\n// Reconciler reconciles a Registry object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registryctl/registryctl.go",
"new_path": "controllers/goharbor/registryctl/registryctl.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/registryctl-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/harbor-registryctl:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-registryctl:v2.0.0\"\n)\n// Reconciler reconciles a RegistryController object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/trivy/trivy.go",
"new_path": "controllers/goharbor/trivy/trivy.go",
"diff": "@@ -19,7 +19,7 @@ import (\nconst (\nDefaultRequeueWait = 2 * time.Second\nConfigImageKey = \"docker-image\"\n- DefaultImage = \"ap.cicd.harbor.vmwarecna.net/proxy/goharbor/trivy-adapter-photon:v2.0.1\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/trivy-adapter-photon:v2.0.1\"\n)\n// Reconciler reconciles a Trivy object.\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/config/config.go",
"new_path": "pkg/config/config.go",
"diff": "@@ -17,6 +17,7 @@ const (\nDefaultConcurrentReconcile = 1\nDefaultHarborClass = \"\"\n+ DefaultRegistry = \"\"\n)\nvar ErrNotReady = errors.New(\"configuration not ready\")\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
add a registry config
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,865
|
19.11.2020 10:16:17
| -28,800
|
037e8c80295843d40435e7acdc7348b949491f4e
|
feat(harborcluster): remove version
remove version from HarborCluster spec
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"diff": "@@ -35,12 +35,6 @@ type HarborClusterSpec struct {\n// Storage configuration for in-cluster storage service\n// +optional\nInClusterStorage *Storage `json:\"inClusterStorage,omitempty\"`\n-\n- // harbor version to be deployed, this version determines the image tags of harbor service components\n- // +kubebuilder:validation:Required\n- // https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string\n- // +kubebuilder:validation:Pattern=\"^(?P<major>0|[1-9]\\\\d*)\\\\.(?P<minor>0|[1-9]\\\\d*)\\\\.(?P<patch>0|[1-9]\\\\d*)(?:-(?P<prerelease>(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\\\\.(?:0|[1-9]\\\\d*|\\\\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\\\\+(?P<buildmetadata>[0-9a-zA-Z-]+(?:\\\\.[0-9a-zA-Z-]+)*))?$\"\n- Version string `json:\"version\"`\n}\ntype Cache struct {\n@@ -190,7 +184,6 @@ const (\n)\n// +kubebuilder:object:root=true\n-// +kubebuilder:printcolumn:name=\"Version\",type=string,JSONPath=`.spec.version`,description=\"The semver Harbor version\",priority=0\n// +kubebuilder:printcolumn:name=\"Public URL\",type=string,JSONPath=`.spec.externalURL`,description=\"The public URL to the Harbor application\",priority=0\n// +kubebuilder:printcolumn:name=\"Service Ready\", type=string,JSONPath=`.status.conditions[?(@.type==\"ServiceReady\")].status`,description=\"The current status of the new Harbor spec\",priority=10\n// +kubebuilder:printcolumn:name=\"Cache Ready\", type=string,JSONPath=`.status.conditions[?(@.type==\"CacheReady\")].status`,description=\"The current status of the new Cache spec\",priority=20\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(harborcluster): remove version
remove version from HarborCluster spec
Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
|
254,875
|
19.11.2020 09:21:20
| -28,800
|
f0d30b1e14768f2034aee5a25594f795a4296a15
|
fix(chart) remove dependencies
|
[
{
"change_type": "DELETE",
"old_path": "charts/harbor-operator/Chart.lock",
"new_path": null,
"diff": "-dependencies:\n-- name: cert-manager\n- repository: https://charts.jetstack.io\n- version: v0.16.0\n-- name: nginx-ingress\n- repository: https://kubernetes-charts.storage.googleapis.com\n- version: 1.41.2\n-- name: prometheus-operator\n- repository: https://kubernetes-charts.storage.googleapis.com\n- version: 9.3.1\n-digest: sha256:88875a9d07921a81170597706256817de4f91941859180332cb0771da2a834d5\n-generated: \"2020-10-29T10:24:26.068098594Z\"\n"
},
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/Chart.yaml",
"new_path": "charts/harbor-operator/Chart.yaml",
"diff": "@@ -18,25 +18,3 @@ appVersion: 0.0.0-dev\nhome: https://github.com/goharbor/harbor-operator\nicon: https://branding.cncf.io/img/projects/harbor/icon/color/harbor-icon-color.svg\n-\n-dependencies:\n-- name: cert-manager\n- repository: https://charts.jetstack.io\n- version: 0.16.0\n- condition: certmanager.enabled, global.certmanager.enabled\n- tags:\n- - certmanager\n-\n-- name: nginx-ingress\n- repository: https://kubernetes-charts.storage.googleapis.com\n- version: 1.41.2\n- condition: ingress.enabled, global.ingress.enabled\n- tags:\n- - ingress\n-\n-- name: prometheus-operator\n- repository: https://kubernetes-charts.storage.googleapis.com\n- version: 9.3.1\n- condition: prometheusOperator.enabled, global.prometheusOperator.enabled\n- tags:\n- - prometheusOperator\n"
},
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/README.md",
"new_path": "charts/harbor-operator/README.md",
"diff": "@@ -16,7 +16,6 @@ Deploy Harbor Operator\n| autoscaling.minReplicas | int | `1` | Minimum conroller replicas |\n| autoscaling.targetCPUUtilizationPercentage | int | `80` | CPU usage target for autoscaling |\n| autoscaling.targetMemoryUtilizationPercentage | int | No target | Memory usage target for autoscaling |\n-| certmanager.enabled | bool | `false` | Whether to install cert-manager Helm chart |\n| deploymentAnnotations | object | `{}` | Additional annotations to add to the controller Deployment |\n| extraEnv | list | `[{\"name\":\"HARBOR_CONTROLLER_MAX_RECONCILE\",\"value\":\"1\"},{\"name\":\"HARBOR_CONTROLLER_WATCH_CHILDREN\",\"value\":\"true\"}]` | Environment variables to inject in controller |\n| fullnameOverride | string | `\"\"` | |\n@@ -25,7 +24,6 @@ Deploy Harbor Operator\n| image.repository | string | `\"goharbor/harbor-operator\"` | The image repository whose default is the chart appVersion. |\n| image.tag | string | `\"dev\"` | The image tag whose default is the chart appVersion. |\n| imagePullSecrets | list | `[]` | Reference to one or more secrets to be used when pulling images <https://kubernetes.io/docs/tasks/configure-pod-container/pull-image-private-registry/> For example: `[ {\"name\":\"image-pull-secret\"} ]` |\n-| ingress.enabled | bool | `false` | Whether to install ingress controller Helm chart |\n| leaderElection.namespace | string | `\"kube-system\"` | The namespace used to store the ConfigMap for leader election |\n| logLevel | int | `4` | Set the verbosity of controller. Range of 0 - 6 with 6 being the most verbose. Info level is 4. |\n| nameOverride | string | `\"\"` | |\n@@ -34,7 +32,6 @@ Deploy Harbor Operator\n| podLabels | object | `{}` | Additional labels to add to the controller Pods |\n| podSecurityContext | object | `{}` | Expects input structure as per specification <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#podsecuritycontext-v1-core> For example: `{ \"fsGroup\": 2000, \"runAsUser\": 1000, \"runAsNonRoot\": true }` |\n| priorityClassName | string | `\"\"` | priority class to be used for the harbor-operator pods |\n-| prometheusOperator.enabled | bool | `false` | Whether to install prometheus operator Helm chart |\n| rbac.create | bool | `true` | Whether to install Role Based Access Control |\n| replicaCount | int | `1` | Number of replicas for the controller |\n| resources | object | `{\"limits\":{\"cpu\":\"500m\",\"memory\":\"300Mi\"},\"requests\":{\"cpu\":\"300m\",\"memory\":\"200Mi\"}}` | Expects input structure as per specification <https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.18/#resourcerequirements-v1-core> |\n"
},
{
"change_type": "DELETE",
"old_path": "charts/harbor-operator/charts/cert-manager-v0.16.0.tgz",
"new_path": "charts/harbor-operator/charts/cert-manager-v0.16.0.tgz",
"diff": "Binary files a/charts/harbor-operator/charts/cert-manager-v0.16.0.tgz and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "charts/harbor-operator/charts/nginx-ingress-1.41.2.tgz",
"new_path": "charts/harbor-operator/charts/nginx-ingress-1.41.2.tgz",
"diff": "Binary files a/charts/harbor-operator/charts/nginx-ingress-1.41.2.tgz and /dev/null differ\n"
},
{
"change_type": "DELETE",
"old_path": "charts/harbor-operator/charts/prometheus-operator-9.3.1.tgz",
"new_path": "charts/harbor-operator/charts/prometheus-operator-9.3.1.tgz",
"diff": "Binary files a/charts/harbor-operator/charts/prometheus-operator-9.3.1.tgz and /dev/null differ\n"
},
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/templates/NOTES.txt",
"new_path": "charts/harbor-operator/templates/NOTES.txt",
"diff": "1. Get the application URL by running these commands:\n-{{- if .Values.ingress.enabled }}\n-{{- range $host := .Values.ingress.hosts }}\n- {{- range .paths }}\n- http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ . }}\n- {{- end }}\n-{{- end }}\n-{{- else if contains \"NodePort\" .Values.service.type }}\n+{{- if contains \"NodePort\" .Values.service.type }}\nexport NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath=\"{.spec.ports[0].nodePort}\" services {{ include \"chart.fullname\" . }})\nexport NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath=\"{.items[0].status.addresses[0].address}\")\necho http://$NODE_IP:$NODE_PORT\n"
},
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/values.yaml",
"new_path": "charts/harbor-operator/values.yaml",
"diff": "@@ -187,15 +187,3 @@ tolerations: []\n# }\n# }`\naffinity: {}\n-\n-certmanager:\n- # certmanager.enabled -- Whether to install cert-manager Helm chart\n- enabled: false\n-\n-ingress:\n- # ingress.enabled -- Whether to install ingress controller Helm chart\n- enabled: false\n-\n-prometheusOperator:\n- # prometheusOperator.enabled -- Whether to install prometheus operator Helm chart\n- enabled: false\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(chart) remove dependencies
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,881
|
23.11.2020 17:43:41
| -28,800
|
1d7a328d0144e42b9af12510d50b07fe54730806
|
fix: adjust lcm controller interface, first params use ctx
|
[
{
"change_type": "MODIFY",
"old_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"new_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"diff": "@@ -16,7 +16,6 @@ spec:\nusername: postgres\npasswordRef: harbor-database-password\nsslMode: disable\n- version: \"1.10.0\"\nexpose:\ncore:\ningress:\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/cache/redis.go",
"new_path": "pkg/cluster/cache/redis.go",
"diff": "@@ -51,9 +51,9 @@ type RedisController struct {\n}\n// Apply creates/updates/scales the resources, like kubernetes apply operation.\n-func (rc *RedisController) Apply(cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n- rc.Client.WithContext(rc.Ctx)\n- rc.DClient.WithContext(rc.Ctx)\n+func (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+ rc.Client.WithContext(ctx)\n+ rc.DClient.WithContext(ctx)\ncrdClient := rc.DClient.WithResource(redisFailoversGVR).WithNamespace(cluster.Namespace)\n@@ -82,11 +82,11 @@ func (rc *RedisController) Apply(cluster *v1alpha2.HarborCluster) (*lcm.CRStatus\n}\n// Delete\n-func (rc *RedisController) Delete(*v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (rc *RedisController) Delete(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nreturn nil, fmt.Errorf(\"not implemented\")\n}\n-func (rc *RedisController) Upgrade(*v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (rc *RedisController) Upgrade(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nreturn nil, fmt.Errorf(\"not implemented\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/database/postgresql.go",
"new_path": "pkg/cluster/database/postgresql.go",
"diff": "@@ -37,10 +37,10 @@ type Connect struct {\nDatabase string\n}\n-func (p *PostgreSQLController) Apply(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (p *PostgreSQLController) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n- p.Client.WithContext(p.Ctx)\n- p.DClient.WithContext(p.Ctx)\n+ p.Client.WithContext(ctx)\n+ p.DClient.WithContext(ctx)\np.HarborCluster = harborcluster\ncrdClient := p.DClient.WithResource(databaseGVR).WithNamespace(p.HarborCluster.Namespace)\n@@ -72,11 +72,11 @@ func (p *PostgreSQLController) Apply(harborcluster *v1alpha2.HarborCluster) (*lc\nreturn p.Readiness()\n}\n-func (p *PostgreSQLController) Delete(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (p *PostgreSQLController) Delete(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n-func (p *PostgreSQLController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (p *PostgreSQLController) Upgrade(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/harbor/harbor.go",
"new_path": "pkg/cluster/harbor/harbor.go",
"diff": "@@ -3,6 +3,7 @@ package harbor\nimport (\n\"context\"\n\"fmt\"\n+\n\"github.com/go-logr/logr\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/goharbor/harbor-operator/pkg/k8s\"\n@@ -23,7 +24,7 @@ type HarborController struct {\nComponentToCRStatus map[v1alpha2.Component]*lcm.CRStatus\n}\n-func (harbor *HarborController) Apply(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (harbor *HarborController) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nvar harborCR *v1alpha2.Harbor\nerr := harbor.KubeClient.Get(harbor.getHarborCRNamespacedName(harborcluster), harborCR)\nif err != nil {\n@@ -47,11 +48,11 @@ func (harbor *HarborController) Apply(harborcluster *v1alpha2.HarborCluster) (*l\nreturn harborClusterCRStatus(harborCR), nil\n}\n-func (harbor *HarborController) Delete(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (harbor *HarborController) Delete(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n-func (harbor *HarborController) Upgrade(harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (harbor *HarborController) Upgrade(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/storage/delete.go",
"new_path": "pkg/cluster/storage/delete.go",
"diff": "package storage\nimport (\n+ \"context\"\n+\ngoharborv1 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n)\n-func (m *MinIOController) Delete(harborcluster *goharborv1.HarborCluster) (*lcm.CRStatus, error) {\n+func (m *MinIOController) Delete(ctx context.Context, harborcluster *goharborv1.HarborCluster) (*lcm.CRStatus, error) {\nminioCR := m.generateMinIOCR()\nerr := m.KubeClient.Delete(minioCR)\nif err != nil {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/storage/minio.go",
"new_path": "pkg/cluster/storage/minio.go",
"diff": "@@ -72,7 +72,7 @@ func NewMinIOController(ctx context.Context, options ...k8s.Option) lcm.Controll\n}\n// Reconciler implements the reconcile logic of minIO service\n-func (m *MinIOController) Apply(harborcluster *goharborv1.HarborCluster) (*lcm.CRStatus, error) {\n+func (m *MinIOController) Apply(ctx context.Context, harborcluster *goharborv1.HarborCluster) (*lcm.CRStatus, error) {\nvar minioCR minio.Tenant\nm.HarborCluster = harborcluster\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/storage/upgrade.go",
"new_path": "pkg/cluster/storage/upgrade.go",
"diff": "package storage\nimport (\n+ \"context\"\n+\ngoharborv1 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/goharbor/harbor-operator/pkg/lcm\"\n)\n-func (m *MinIOController) Upgrade(harborcluster *goharborv1.HarborCluster) (*lcm.CRStatus, error) {\n+func (m *MinIOController) Upgrade(ctx context.Context, harborcluster *goharborv1.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/lcm/lcm.go",
"new_path": "pkg/lcm/lcm.go",
"diff": "package lcm\nimport (\n+ \"context\"\n+\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n@@ -14,16 +16,16 @@ type Controller interface {\n// - scale the resources if the replica is changed\n//\n// Equal to the previous method \"Reconcile()\" of lcm Controller\n- Apply(harborcluster *v1alpha2.HarborCluster) (*CRStatus, error)\n+ Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*CRStatus, error)\n// Delete the related resources if the resource configuration is removed from the spec.\n// As we support connecting to the external or incluster provisioned dependent services,\n// the dependent service may switch from incluster to external mode and then the incluster\n// services may need to be unloaded.\n- Delete(harborcluster *v1alpha2.HarborCluster) (*CRStatus, error)\n+ Delete(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*CRStatus, error)\n// Upgrade the specified resource to the given version.\n- Upgrade(harborcluster *v1alpha2.HarborCluster) (*CRStatus, error)\n+ Upgrade(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*CRStatus, error)\n}\ntype CRStatus struct {\n"
},
{
"change_type": "MODIFY",
"old_path": "vendor/modules.txt",
"new_path": "vendor/modules.txt",
"diff": "# cloud.google.com/go v0.58.0\n+## explicit\ncloud.google.com/go/compute/metadata\n# github.com/Masterminds/goutils v1.1.0\ngithub.com/Masterminds/goutils\n# github.com/Masterminds/semver v1.5.0\n+## explicit\ngithub.com/Masterminds/semver\n# github.com/Masterminds/sprig v2.22.0+incompatible\n+## explicit\ngithub.com/Masterminds/sprig\n# github.com/beorn7/perks v1.0.1\ngithub.com/beorn7/perks/quantile\n# github.com/blang/semver v3.5.0+incompatible\n+## explicit\ngithub.com/blang/semver\n# github.com/cespare/xxhash/v2 v2.1.1\ngithub.com/cespare/xxhash/v2\n@@ -21,15 +25,18 @@ github.com/fsnotify/fsnotify\n# github.com/ghodss/yaml v1.0.0\ngithub.com/ghodss/yaml\n# github.com/go-kit/kit v0.10.0\n+## explicit\ngithub.com/go-kit/kit/log\ngithub.com/go-kit/kit/log/level\n# github.com/go-logfmt/logfmt v0.5.0\ngithub.com/go-logfmt/logfmt\n# github.com/go-logr/logr v0.2.1-0.20200730175230-ee2de8da5be6\n+## explicit\ngithub.com/go-logr/logr\n# github.com/go-logr/zapr v0.2.0\ngithub.com/go-logr/zapr\n# github.com/go-redis/redis v6.15.9+incompatible\n+## explicit\ngithub.com/go-redis/redis\ngithub.com/go-redis/redis/internal\ngithub.com/go-redis/redis/internal/consistenthash\n@@ -41,8 +48,10 @@ github.com/go-redis/redis/internal/util\ngithub.com/gogo/protobuf/proto\ngithub.com/gogo/protobuf/sortkeys\n# github.com/goharbor/harbor-cluster-operator v0.5.0\n+## explicit\ngithub.com/goharbor/harbor-cluster-operator/controllers/common\n# github.com/goharbor/harbor/src v0.0.0-20200728051037-1d361a89a056\n+## explicit\ngithub.com/goharbor/harbor/src/common\ngithub.com/goharbor/harbor/src/common/config/metadata\ngithub.com/goharbor/harbor/src/lib/log\n@@ -55,6 +64,7 @@ github.com/golang/protobuf/ptypes/any\ngithub.com/golang/protobuf/ptypes/duration\ngithub.com/golang/protobuf/ptypes/timestamp\n# github.com/google/go-cmp v0.5.1\n+## explicit\ngithub.com/google/go-cmp/cmp\ngithub.com/google/go-cmp/cmp/internal/diff\ngithub.com/google/go-cmp/cmp/internal/flags\n@@ -72,8 +82,10 @@ github.com/googleapis/gnostic/openapiv2\ngithub.com/hashicorp/golang-lru\ngithub.com/hashicorp/golang-lru/simplelru\n# github.com/huandu/xstrings v1.3.2\n+## explicit\ngithub.com/huandu/xstrings\n# github.com/imdario/mergo v0.3.10\n+## explicit\ngithub.com/imdario/mergo\n# github.com/jackc/chunkreader/v2 v2.0.1\ngithub.com/jackc/chunkreader/v2\n@@ -92,11 +104,14 @@ github.com/jackc/pgservicefile\n# github.com/jackc/pgtype v1.4.2\ngithub.com/jackc/pgtype\n# github.com/jackc/pgx/v4 v4.8.1\n+## explicit\ngithub.com/jackc/pgx/v4\ngithub.com/jackc/pgx/v4/internal/sanitize\n# github.com/jaegertracing/jaeger-lib v2.2.0+incompatible\n+## explicit\ngithub.com/jaegertracing/jaeger-lib/client/log/go-kit\n# github.com/jetstack/cert-manager v0.16.1\n+## explicit\ngithub.com/jetstack/cert-manager/pkg/apis/acme\ngithub.com/jetstack/cert-manager/pkg/apis/acme/v1alpha2\ngithub.com/jetstack/cert-manager/pkg/apis/certmanager\n@@ -114,6 +129,7 @@ github.com/matttproud/golang_protobuf_extensions/pbutil\n# github.com/minio/md5-simd v1.1.0\ngithub.com/minio/md5-simd\n# github.com/minio/minio-go/v6 v6.0.57\n+## explicit\ngithub.com/minio/minio-go/v6\ngithub.com/minio/minio-go/v6/pkg/credentials\ngithub.com/minio/minio-go/v6/pkg/encrypt\n@@ -128,11 +144,14 @@ github.com/mitchellh/copystructure\n# github.com/mitchellh/go-homedir v1.1.0\ngithub.com/mitchellh/go-homedir\n# github.com/mitchellh/reflectwalk v1.0.1\n+## explicit\ngithub.com/mitchellh/reflectwalk\n# github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd\ngithub.com/modern-go/concurrent\n# github.com/modern-go/reflect2 v1.0.1\ngithub.com/modern-go/reflect2\n+# github.com/niemeyer/pretty v0.0.0-20200227124842-a10e7caefd8e\n+## explicit\n# github.com/nxadm/tail v1.4.4\ngithub.com/nxadm/tail\ngithub.com/nxadm/tail/ratelimiter\n@@ -140,6 +159,7 @@ github.com/nxadm/tail/util\ngithub.com/nxadm/tail/watch\ngithub.com/nxadm/tail/winfile\n# github.com/onsi/ginkgo v1.14.0\n+## explicit\ngithub.com/onsi/ginkgo\ngithub.com/onsi/ginkgo/config\ngithub.com/onsi/ginkgo/extensions/table\n@@ -161,6 +181,7 @@ github.com/onsi/ginkgo/reporters/stenographer/support/go-colorable\ngithub.com/onsi/ginkgo/reporters/stenographer/support/go-isatty\ngithub.com/onsi/ginkgo/types\n# github.com/onsi/gomega v1.10.1\n+## explicit\ngithub.com/onsi/gomega\ngithub.com/onsi/gomega/format\ngithub.com/onsi/gomega/gbytes\n@@ -178,16 +199,21 @@ github.com/onsi/gomega/matchers/support/goraph/node\ngithub.com/onsi/gomega/matchers/support/goraph/util\ngithub.com/onsi/gomega/types\n# github.com/opentracing-contrib/go-stdlib v1.0.0\n+## explicit\ngithub.com/opentracing-contrib/go-stdlib/nethttp\n# github.com/opentracing/opentracing-go v1.2.0\n+## explicit\ngithub.com/opentracing/opentracing-go\ngithub.com/opentracing/opentracing-go/ext\ngithub.com/opentracing/opentracing-go/log\n# github.com/ovh/configstore v0.3.2\n+## explicit\ngithub.com/ovh/configstore\n# github.com/pkg/errors v0.9.1\n+## explicit\ngithub.com/pkg/errors\n# github.com/prometheus/client_golang v1.7.1\n+## explicit\ngithub.com/prometheus/client_golang/prometheus\ngithub.com/prometheus/client_golang/prometheus/internal\ngithub.com/prometheus/client_golang/prometheus/promhttp\n@@ -202,15 +228,19 @@ github.com/prometheus/procfs\ngithub.com/prometheus/procfs/internal/fs\ngithub.com/prometheus/procfs/internal/util\n# github.com/sethvargo/go-password v0.1.3\n+## explicit\ngithub.com/sethvargo/go-password/password\n# github.com/sirupsen/logrus v1.6.0\n+## explicit\ngithub.com/sirupsen/logrus\n# github.com/spf13/pflag v1.0.5\ngithub.com/spf13/pflag\n# github.com/spotahome/redis-operator v1.0.0\n+## explicit\ngithub.com/spotahome/redis-operator/api/redisfailover\ngithub.com/spotahome/redis-operator/api/redisfailover/v1\n# github.com/uber/jaeger-client-go v2.24.0+incompatible\n+## explicit\ngithub.com/uber/jaeger-client-go\ngithub.com/uber/jaeger-client-go/config\ngithub.com/uber/jaeger-client-go/internal/baggage\n@@ -230,6 +260,7 @@ github.com/uber/jaeger-client-go/thrift-gen/zipkincore\ngithub.com/uber/jaeger-client-go/transport\ngithub.com/uber/jaeger-client-go/utils\n# github.com/uber/jaeger-lib v2.2.0+incompatible\n+## explicit\ngithub.com/uber/jaeger-lib/metrics\ngithub.com/uber/jaeger-lib/metrics/prometheus\n# go.uber.org/atomic v1.6.0\n@@ -237,6 +268,7 @@ go.uber.org/atomic\n# go.uber.org/multierr v1.5.0\ngo.uber.org/multierr\n# go.uber.org/zap v1.15.0\n+## explicit\ngo.uber.org/zap\ngo.uber.org/zap/buffer\ngo.uber.org/zap/internal/bufferpool\n@@ -244,6 +276,7 @@ go.uber.org/zap/internal/color\ngo.uber.org/zap/internal/exit\ngo.uber.org/zap/zapcore\n# golang.org/x/crypto v0.0.0-20200728195943-123391ffb6de\n+## explicit\ngolang.org/x/crypto/argon2\ngolang.org/x/crypto/bcrypt\ngolang.org/x/crypto/blake2b\n@@ -269,6 +302,7 @@ golang.org/x/oauth2/internal\ngolang.org/x/oauth2/jws\ngolang.org/x/oauth2/jwt\n# golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a\n+## explicit\ngolang.org/x/sync/errgroup\n# golang.org/x/sys v0.0.0-20200622214017-ed371f2e16b4\ngolang.org/x/sys/cpu\n@@ -301,11 +335,15 @@ golang.org/x/text/unicode/bidi\ngolang.org/x/text/unicode/norm\ngolang.org/x/text/width\n# golang.org/x/time v0.0.0-20200416051211-89c76fbcd5d1\n+## explicit\ngolang.org/x/time/rate\n+# golang.org/x/tools v0.0.0-20200626171337-aa94e735be7f\n+## explicit\n# golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543\ngolang.org/x/xerrors\ngolang.org/x/xerrors/internal\n# gomodules.xyz/jsonpatch/v2 v2.1.0\n+## explicit\ngomodules.xyz/jsonpatch/v2\n# google.golang.org/appengine v1.6.6\ngoogle.golang.org/appengine\n@@ -349,6 +387,8 @@ google.golang.org/protobuf/runtime/protoimpl\ngoogle.golang.org/protobuf/types/known/anypb\ngoogle.golang.org/protobuf/types/known/durationpb\ngoogle.golang.org/protobuf/types/known/timestamppb\n+# gopkg.in/check.v1 v1.0.0-20200227125254-8fa46927fb4f\n+## explicit\n# gopkg.in/inf.v0 v0.9.1\ngopkg.in/inf.v0\n# gopkg.in/ini.v1 v1.52.0\n@@ -358,6 +398,7 @@ gopkg.in/tomb.v1\n# gopkg.in/yaml.v2 v2.3.0\ngopkg.in/yaml.v2\n# k8s.io/api v0.19.0-rc.3\n+## explicit\nk8s.io/api/admission/v1beta1\nk8s.io/api/admissionregistration/v1\nk8s.io/api/admissionregistration/v1beta1\n@@ -409,6 +450,7 @@ k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/scheme\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1\nk8s.io/apiextensions-apiserver/pkg/client/clientset/clientset/typed/apiextensions/v1beta1\n# k8s.io/apimachinery v0.19.0-rc.3\n+## explicit\nk8s.io/apimachinery/pkg/api/equality\nk8s.io/apimachinery/pkg/api/errors\nk8s.io/apimachinery/pkg/api/meta\n@@ -454,6 +496,7 @@ k8s.io/apimachinery/pkg/watch\nk8s.io/apimachinery/third_party/forked/golang/json\nk8s.io/apimachinery/third_party/forked/golang/reflect\n# k8s.io/client-go v11.0.0+incompatible => k8s.io/client-go v0.0.0-20200813012017-e7a1d9ada0d5\n+## explicit\nk8s.io/client-go/discovery\nk8s.io/client-go/dynamic\nk8s.io/client-go/kubernetes\n@@ -540,6 +583,7 @@ k8s.io/utils/integer\nk8s.io/utils/pointer\nk8s.io/utils/trace\n# sigs.k8s.io/controller-runtime v0.6.1-0.20200804124940-17eebbff0d48\n+## explicit\nsigs.k8s.io/controller-runtime\nsigs.k8s.io/controller-runtime/pkg/builder\nsigs.k8s.io/controller-runtime/pkg/cache\n@@ -582,8 +626,10 @@ sigs.k8s.io/controller-runtime/pkg/webhook/conversion\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/certwatcher\nsigs.k8s.io/controller-runtime/pkg/webhook/internal/metrics\n# sigs.k8s.io/kustomize/kstatus v0.0.2\n+## explicit\nsigs.k8s.io/kustomize/kstatus/status\n# sigs.k8s.io/structured-merge-diff/v3 v3.0.1-0.20200706213357-43c19bbb7fba\nsigs.k8s.io/structured-merge-diff/v3/value\n# sigs.k8s.io/yaml v1.2.0\n+## explicit\nsigs.k8s.io/yaml\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: adjust lcm controller interface, first params use ctx
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,881
|
24.11.2020 13:02:07
| -28,800
|
3c2016424777ceb26ebfa4128f3dac43bf3abdb9
|
fix(redis-controller): fix npe issue and some logic error
|
[
{
"change_type": "MODIFY",
"old_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"new_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"diff": "@@ -54,6 +54,7 @@ spec:\ninClusterCache:\nkind: Redis\nredisSpec:\n+ schema: redis\nserver:\nreplicas: 1\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/readiness.go",
"new_path": "pkg/cluster/controllers/cache/readiness.go",
"diff": "@@ -199,6 +199,8 @@ func (rc *RedisController) GetInClusterRedisInfo(cluster *v1alpha2.HarborCluster\n}\nrc.RedisConnect = connect\nclient = connect.NewRedisClient()\n+ default:\n+ return nil, errors.New(\"not supported schema\")\n}\nreturn client, nil\n@@ -235,7 +237,7 @@ func (rc *RedisController) GetSentinelServiceUrl(name, namespace string, pods []\nrandomPod := pods[rand.Intn(len(pods))]\nurl = randomPod.Status.PodIP\n} else {\n- url = fmt.Sprintf(\"%s-%s.%s.svc\", \"rfs\", name, namespace)\n+ url = fmt.Sprintf(\"%s-%s.%s.svc.cluster.local\", \"rfs\", name, namespace)\n}\nreturn url\n@@ -249,7 +251,7 @@ func (rc *RedisController) GetRedisServiceUrl(name, namespace string, pods []cor\nif err != nil {\nurl = randomPod.Status.PodIP\n} else {\n- url = fmt.Sprintf(\"%s-%s.%s.svc\", \"cluster\", name, namespace)\n+ url = fmt.Sprintf(\"%s.%s.svc.cluster.local\", rc.ResourceManager.GetServiceName(), namespace)\n}\nreturn url\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/redis.go",
"new_path": "pkg/cluster/controllers/cache/redis.go",
"diff": "@@ -47,13 +47,14 @@ type RedisController struct {\nScheme *runtime.Scheme\nRedisConnect *RedisConnect\nResourceManager ResourceManager\n- expectCR, actualCR *redisOp.RedisFailover\n+ expectCR, actualCR runtime.Object\n}\n// Apply creates/updates/scales the resources, like kubernetes apply operation.\nfunc (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nrc.Client.WithContext(ctx)\nrc.DClient.WithContext(ctx)\n+ rc.ResourceManager = &RedisResourceManager{cluster: cluster}\ncrdClient := rc.DClient.WithResource(redisFailoversGVR).WithNamespace(cluster.Namespace)\n@@ -63,6 +64,7 @@ func (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCl\n} else if err != nil {\nreturn cacheNotReadyStatus(ErrorGetRedisClient, err.Error()), err\n}\n+ rc.actualCR = actualCR\nexpectCR := rc.ResourceManager.GetCacheCR()\nif err := controllerutil.SetControllerReference(cluster, expectCR.(metav1.Object), rc.Scheme); err != nil {\n@@ -72,7 +74,8 @@ func (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCl\nif err = runtime.DefaultUnstructuredConverter.FromUnstructured(actualCR.UnstructuredContent(), rc.actualCR); err != nil {\nreturn cacheNotReadyStatus(ErrorDefaultUnstructuredConverter, err.Error()), err\n}\n- rc.expectCR = expectCR.(*redisOp.RedisFailover)\n+\n+ rc.expectCR = expectCR\ncrStatus, err := rc.Update(cluster)\nif err != nil {\nreturn crStatus, err\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/resource_manager.go",
"new_path": "pkg/cluster/controllers/cache/resource_manager.go",
"diff": "@@ -77,7 +77,7 @@ func (rm *RedisResourceManager) GetCacheCR() runtime.Object {\nRequests: resource,\n},\n},\n- Auth: redisOp.AuthSettings{SecretPath: rm.cluster.Name},\n+ Auth: redisOp.AuthSettings{SecretPath: rm.GetSecretName()},\n},\n}\n}\n@@ -136,6 +136,7 @@ func (rm *RedisResourceManager) GetSecret() *corev1.Secret {\n},\nStringData: map[string]string{\n\"redis-password\": passStr,\n+ \"password\": passStr,\n},\n}\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(redis-controller): fix npe issue and some logic error
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,893
|
25.11.2020 17:12:29
| -28,800
|
522c2738f7ae11ec83b4241e4ed58f946adb41e1
|
feat(services): add health checker interface
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/redis.go",
"new_path": "pkg/cluster/controllers/cache/redis.go",
"diff": "@@ -50,6 +50,10 @@ type RedisController struct {\nexpectCR, actualCR *redisOp.RedisFailover\n}\n+func (rc *RedisController) HealthChecker() lcm.HealthChecker {\n+ panic(\"implement me\")\n+}\n+\n// Apply creates/updates/scales the resources, like kubernetes apply operation.\nfunc (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nrc.Client.WithContext(ctx)\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/postgresql.go",
"new_path": "pkg/cluster/controllers/database/postgresql.go",
"diff": "@@ -37,6 +37,10 @@ type Connect struct {\nDatabase string\n}\n+func (p *PostgreSQLController) HealthChecker() lcm.HealthChecker {\n+ panic(\"implement me\")\n+}\n+\nfunc (p *PostgreSQLController) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\np.Client.WithContext(ctx)\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/minio.go",
"new_path": "pkg/cluster/controllers/storage/minio.go",
"diff": "@@ -49,6 +49,10 @@ type MinIOController struct {\nMinioClient Minio\n}\n+func (m *MinIOController) HealthChecker() lcm.HealthChecker {\n+ panic(\"implement me\")\n+}\n+\nvar (\nHarborClusterMinIOGVK = schema.GroupVersionKind{\nGroup: minio.SchemeGroupVersion.Group,\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cluster/lcm/health.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package lcm\n+\n+import \"context\"\n+\n+const (\n+ Healthy HealthStatus = \"healthy\"\n+ UnHealthy HealthStatus = \"unhealthy\"\n+ Unknown HealthStatus = \"unknown\"\n+)\n+\n+type HealthStatus string\n+\n+// HealthChecker defines health check methods to check the health status of the related services\n+type HealthChecker interface {\n+ // CheckHealth checks the health of the specified service, including:\n+ // database postgresql /\n+ // cache redis /\n+ // storage minIO /\n+ CheckHealth(ctx context.Context, svc *ServiceConfig, options ...Option) (*CheckResponse, error)\n+}\n+\n+// ServiceConfig contains the relevant service configurations that can be used to do health check\n+type ServiceConfig struct {\n+ // Endpoint of the service\n+ // Required\n+ Endpoint *Endpoint\n+ // Credentials used to connect service\n+ Credentials *Credentials\n+}\n+\n+// Endpoint of the service\n+type Endpoint struct {\n+ Host string\n+ Port uint\n+}\n+\n+// Credentials for connecting to the services\n+type Credentials struct {\n+ // Access key or username\n+ // Optional\n+ AccessKey string\n+ // Access secret or password\n+ AccessSecret string\n+}\n+\n+// CheckResponse represents the response returned by the health check method\n+type CheckResponse struct {\n+ Status HealthStatus\n+\n+ // Extra message if needed\n+ // Optional\n+ Message string\n+}\n+\n+// CheckOptions keep options for doing health checking\n+type CheckOptions struct {\n+ // Enable SSL mode\n+ // Applicable for Postgresql\n+ SSLMode bool\n+\n+ // Whether connecting to Redis with sentinel mode\n+ // Applicable for Redis\n+ Sentinel bool\n+\n+ // Name of the storage driver\n+ // Applicable for minIO\n+ StorageDriver string\n+}\n+\n+// Option with function way\n+type Option func(options *CheckOptions)\n+\n+// WithSSL sets ssl mode option\n+func WithSSL(sslMode bool) Option {\n+ return func(options *CheckOptions) {\n+ options.SSLMode = sslMode\n+ }\n+}\n+\n+// WithSentinel sets sentinel mode\n+func WithSentinel(sentinel bool) Option {\n+ return func(options *CheckOptions) {\n+ options.Sentinel = sentinel\n+ }\n+}\n+\n+// WithStorage sets the storage driver\n+func WithStorage(driver string) Option {\n+ return func(options *CheckOptions) {\n+ options.StorageDriver = driver\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/lcm/lcm.go",
"new_path": "pkg/cluster/lcm/lcm.go",
"diff": "@@ -26,6 +26,10 @@ type Controller interface {\n// Upgrade the specified resource to the given version.\nUpgrade(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*CRStatus, error)\n+\n+ // HealthChecker returns a health checker implementation for checking the health status of the service managed\n+ // by this controller.\n+ HealthChecker() HealthChecker\n}\ntype CRStatus struct {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(services): add health checker interface
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
27.11.2020 12:58:16
| -28,800
|
bec74946eaf3f09e698ec01f9e5a8a9d1651ed36
|
sample(harbor):add sample deployment manifests
|
[
{
"change_type": "MODIFY",
"old_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"new_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"diff": "@@ -2,9 +2,10 @@ apiVersion: goharbor.io/v1alpha2\nkind: HarborCluster\nmetadata:\nname: harborcluster-sample\n+ namespace: cluster-sample-ns\nspec:\nharborAdminPasswordRef: admin-core-secret\n- externalURL: https://core.harbor.domain\n+ externalURL: https://sample.harbor.domain\nredis:\nhost: harbor-redis-master\nport: 6379\n@@ -19,7 +20,7 @@ spec:\nexpose:\ncore:\ningress:\n- host: core.harbor.domain\n+ host: sample.harbor.domain\ntls:\ncertificateRef: sample-public-certificate\nencryptionKeyRef: core-database-encryption\n@@ -49,8 +50,27 @@ spec:\nrequests:\ncpu: 100m\nmemory: 250Mi\n-# inClusterStorage:\n-# kind: minIO\n+ inClusterStorage:\n+ kind: MinIO\n+ minIOSpec:\n+ replicas: 2\n+ volumesPerServer: 2\n+ version: RELEASE.2020-08-13T02-39-50Z\n+ volumeClaimTemplate:\n+ spec:\n+ storageClassName: standard\n+ accessModes:\n+ - ReadWriteOnce\n+ resources:\n+ requests:\n+ storage: 10Gi\n+ resources:\n+ requests:\n+ memory: 1Gi\n+ cpu: 500m\n+ limits:\n+ memory: 1Gi\n+ cpu: 1000m\ninClusterCache:\nkind: Redis\nredisSpec:\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/README.md",
"new_path": "manifests/README.md",
"diff": "@@ -6,3 +6,5 @@ then provide the capabilities of deploying Harbor cluster.\n[harbor](./harbor) contains the kustomization templates and the manifests generated by the kustomization templates,\nwhich can be used to deploy only the Harbor operator.\n+\n+[samples](./samples) contains the manifest yaml files for deploying sample Harbor.\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "manifests/samples/full_stack.yaml",
"diff": "+# Sample namespace\n+apiVersion: v1\n+kind: Namespace\n+metadata:\n+ name: cluster-sample-ns\n+---\n+# A secret of harbor admin password.\n+apiVersion: v1\n+kind: Secret\n+metadata:\n+ name: admin-core-secret\n+ namespace: cluster-sample-ns\n+data:\n+ password: SGFyYm9yMTIzNDU=\n+type: Opaque\n+---\n+# Cert issuer\n+apiVersion: cert-manager.io/v1alpha2\n+kind: Issuer\n+metadata:\n+ name: selfsigned-issuer\n+ namespace: cluster-sample-ns\n+spec:\n+ selfSigned: {}\n+---\n+# Certificates of ingress\n+apiVersion: cert-manager.io/v1alpha2\n+kind: Certificate\n+metadata:\n+ name: public-certificate\n+ namespace: cluster-sample-ns\n+spec:\n+ secretName: public-certificate\n+ dnsNames:\n+ - sample.goharbor.io\n+ - notary.goharbor.io\n+ issuerRef:\n+ name: selfsigned-issuer\n+ kind: Issuer\n+---\n+# Full stack Harbor\n+apiVersion: goharbor.io/v1alpha2\n+kind: HarborCluster\n+metadata:\n+ name: harborcluster-sample\n+ namespace: cluster-sample-ns\n+spec:\n+ harborAdminPasswordRef: admin-core-secret\n+ externalURL: https://sample.harbor.domain\n+ redis:\n+ host: harbor-redis-master\n+ port: 6379\n+ passwordRef: harbor-redis\n+ database:\n+ hosts:\n+ - host: harbor-database-postgresql\n+ port: 5432\n+ username: postgres\n+ passwordRef: harbor-database-password\n+ sslMode: disable\n+ expose:\n+ core:\n+ ingress:\n+ host: sample.harbor.domain\n+ tls:\n+ certificateRef: sample-public-certificate\n+ encryptionKeyRef: core-database-encryption\n+ internalTLS:\n+ enabled: true\n+ portal: {}\n+ registry: {}\n+ core:\n+ tokenIssuer:\n+ name: service-token\n+ kind: Issuer\n+ imageChartStorage:\n+ filesystem:\n+ registryPersistentVolume:\n+ claimName: sample-harbor-registry\n+ inClusterDatabase:\n+ kind: PostgresSQL\n+ postgresSqlSpec:\n+ storage: 1Gi\n+ replicas: 2\n+ version: \"12\"\n+ storageClassName: default\n+ resources:\n+ limits:\n+ cpu: 500m\n+ memory: 500Mi\n+ requests:\n+ cpu: 100m\n+ memory: 250Mi\n+ inClusterStorage:\n+ kind: MinIO\n+ minIOSpec:\n+ replicas: 2\n+ volumesPerServer: 2\n+ version: RELEASE.2020-08-13T02-39-50Z\n+ volumeClaimTemplate:\n+ spec:\n+ storageClassName: standard\n+ accessModes:\n+ - ReadWriteOnce\n+ resources:\n+ requests:\n+ storage: 10Gi\n+ resources:\n+ requests:\n+ memory: 1Gi\n+ cpu: 500m\n+ limits:\n+ memory: 1Gi\n+ cpu: 1000m\n+ inClusterCache:\n+ kind: Redis\n+ redisSpec:\n+ schema: redis\n+ server:\n+ replicas: 1\n+ resources:\n+ limits:\n+ cpu: 500m\n+ memory: 500Mi\n+ requests:\n+ cpu: 100m\n+ memory: 250Mi\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
sample(harbor):add sample deployment manifests
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
27.11.2020 13:29:39
| -28,800
|
c66fa2acfc3c72fc07bb45c0f0efa6b8673712bd
|
fix(Makefile):remove certmanager from target run
avoid cert-manager deploymemt conflicts
add new target run-with-cm to support install cert-manager before calling run
fix
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -60,9 +60,12 @@ test: go-test go-dependencies-test\n# Run against the configured Kubernetes cluster in ~/.kube/config\n.PHONY: run\n-run: go-generate vendor certmanager $(TMPDIR)k8s-webhook-server/serving-certs/tls.crt\n+run: go-generate vendor $(TMPDIR)k8s-webhook-server/serving-certs/tls.crt\ngo run *.go\n+# Install cert-manager before run\n+run-with-cm: certmanager run\n+\n# Run linters against all files\n.PHONY: lint\nlint: \\\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(Makefile):remove certmanager from target run
- avoid cert-manager deploymemt conflicts
- add new target run-with-cm to support install cert-manager before calling run
fix #216
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,881
|
27.11.2020 14:06:30
| -28,800
|
6ece58e716dbaeed1268071d56c9fb0098a68b57
|
feat(cache): add healthchecker for redis controller
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cluster/controllers/cache/healthchecker.go",
"diff": "+package cache\n+\n+import (\n+ \"context\"\n+ \"fmt\"\n+ \"strconv\"\n+\n+ rediscli \"github.com/go-redis/redis\"\n+\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n+)\n+\n+var _ lcm.HealthChecker = &RedisHealthChecker{}\n+\n+// RedisHealthChecker check health for redis service.\n+type RedisHealthChecker struct{}\n+\n+// CheckHealth implements lcm.HealthChecker\n+func (c *RedisHealthChecker) CheckHealth(ctx context.Context, svc *lcm.ServiceConfig, options ...lcm.Option) (*lcm.CheckResponse, error) {\n+ if svc == nil || svc.Endpoint == nil {\n+ return nil, fmt.Errorf(\"serviceConfig or endpoint can not be nil\")\n+ }\n+ // apply options\n+ checkOpts := &lcm.CheckOptions{}\n+ for _, o := range options {\n+ o(checkOpts)\n+ }\n+\n+ var client *rediscli.Client\n+ // build redis client\n+ redisConn := &RedisConnect{\n+ Endpoints: []string{svc.Endpoint.Host},\n+ Port: strconv.Itoa(int(svc.Endpoint.Port)),\n+ }\n+ // check password\n+ if svc.Credentials != nil {\n+ redisConn.Password = svc.Credentials.AccessSecret\n+ }\n+ // check mode\n+ if checkOpts.Sentinel {\n+ redisConn.GroupName = RedisSentinelConnGroup\n+ client = redisConn.NewRedisPool()\n+ } else {\n+ client = redisConn.NewRedisClient()\n+ }\n+\n+ resp := &lcm.CheckResponse{}\n+ defer client.Close()\n+ err := client.Ping().Err()\n+ if err != nil {\n+ resp.Status = lcm.UnHealthy\n+ resp.Message = err.Error()\n+ return resp, err\n+ }\n+\n+ resp.Status = lcm.Healthy\n+ return resp, nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/readiness.go",
"new_path": "pkg/cluster/controllers/cache/readiness.go",
"diff": "package cache\nimport (\n+ \"context\"\n\"errors\"\n\"fmt\"\n\"math/rand\"\nharbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n- rediscli \"github.com/go-redis/redis\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\nappsv1 \"k8s.io/api/apps/v1\"\n@@ -23,24 +23,10 @@ import (\n// - create redis connection pool\n// - ping redis server\n// - return redis properties if redis has available\n-func (rc *RedisController) Readiness(cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n- var (\n- client *rediscli.Client\n- err error\n- )\n-\n- client, err = rc.GetInClusterRedisInfo(cluster)\n- if err != nil {\n- rc.Log.Error(err, \"Fail to create redis client.\",\n- \"namespace\", cluster.Namespace, \"name\", cluster.Name)\n- return cacheNotReadyStatus(ErrorGetRedisClient, err.Error()), err\n- }\n-\n- defer client.Close()\n-\n- if err := client.Ping().Err(); err != nil {\n+func (rc *RedisController) Readiness(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+ if checkResp, err := rc.CheckInClusterRedisHealth(ctx, cluster); err != nil {\nrc.Log.Error(err, \"Fail to check Redis.\",\n- \"namespace\", cluster.Namespace, \"name\", cluster.Name)\n+ \"namespace\", cluster.Namespace, \"name\", cluster.Name, \"checkResp\", checkResp)\nreturn cacheNotReadyStatus(ErrorCheckRedisHealth, err.Error()), err\n}\n@@ -138,11 +124,8 @@ func (rc *RedisController) GetStatefulSetPods(name, namespace string) (*appsv1.S\nreturn sts, pod, nil\n}\n-// GetInClusterRedisInfo returns inCluster redis sentinel pool client\n-func (rc *RedisController) GetInClusterRedisInfo(cluster *v1alpha2.HarborCluster) (*rediscli.Client, error) {\n-\n- var client *rediscli.Client\n-\n+// CheckInClusterRedisHealth checks in cluster redis health.\n+func (rc *RedisController) CheckInClusterRedisHealth(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CheckResponse, error) {\nsecret := rc.ResourceManager.GetSecret()\npassword, err := rc.GetRedisPassword(secret.Name, secret.Namespace)\nif err != nil {\n@@ -175,14 +158,17 @@ func (rc *RedisController) GetInClusterRedisInfo(cluster *v1alpha2.HarborCluster\nreturn nil, errors.New(\"need to requeue\")\n}\nendpoint := rc.GetSentinelServiceUrl(cluster.Name, cluster.Namespace, currentSentinelPods)\n- connect := &RedisConnect{\n- Endpoints: []string{endpoint},\n+ config := &lcm.ServiceConfig{\n+ Endpoint: &lcm.Endpoint{\n+ Host: endpoint,\nPort: RedisSentinelConnPort,\n- Password: password,\n- GroupName: RedisSentinelConnGroup,\n+ },\n+ Credentials: &lcm.Credentials{\n+ AccessSecret: password,\n+ },\n}\n- rc.RedisConnect = connect\n- client = connect.NewRedisPool()\n+ return rc.HealthChecker().CheckHealth(ctx, config, lcm.WithSentinel(true))\n+\ncase SchemaRedisServer:\nredisPodArray := redisPodList.Items\n_, currentRedisPods := rc.GetPodsStatus(redisPodArray)\n@@ -190,20 +176,20 @@ func (rc *RedisController) GetInClusterRedisInfo(cluster *v1alpha2.HarborCluster\nreturn nil, errors.New(\"need to requeue\")\n}\nendpoint := rc.GetRedisServiceUrl(cluster.Name, cluster.Namespace, currentRedisPods)\n- connect := &RedisConnect{\n- Endpoints: []string{endpoint},\n+ config := &lcm.ServiceConfig{\n+ Endpoint: &lcm.Endpoint{\n+ Host: endpoint,\nPort: RedisRedisConnPort,\n- Password: password,\n- GroupName: spec.GroupName,\n- Schema: SchemaRedisServer,\n+ },\n+ Credentials: &lcm.Credentials{\n+ AccessSecret: password,\n+ },\n}\n- rc.RedisConnect = connect\n- client = connect.NewRedisClient()\n+ return rc.HealthChecker().CheckHealth(ctx, config)\n+\ndefault:\n- return nil, errors.New(\"not supported schema\")\n+ return nil, fmt.Errorf(\"not supported schema: %s\", spec.Schema)\n}\n-\n- return client, nil\n}\n// GetPodsStatus returns deleting and current pod list\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/redis.go",
"new_path": "pkg/cluster/controllers/cache/redis.go",
"diff": "@@ -51,7 +51,7 @@ type RedisController struct {\n}\nfunc (rc *RedisController) HealthChecker() lcm.HealthChecker {\n- panic(\"implement me\")\n+ return &RedisHealthChecker{}\n}\n// Apply creates/updates/scales the resources, like kubernetes apply operation.\n@@ -85,7 +85,7 @@ func (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCl\nreturn crStatus, err\n}\n- return rc.Readiness(cluster)\n+ return rc.Readiness(ctx, cluster)\n}\n// Delete\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/redis_connect.go",
"new_path": "pkg/cluster/controllers/cache/redis_connect.go",
"diff": "@@ -20,8 +20,8 @@ const (\nMessageRedisUpScaling = \"Redis upscale from %d to %d\"\nMessageRedisRollingUpgrades = \"Redis resource from %s to %s\"\n- RedisSentinelConnPort = \"26379\"\n- RedisRedisConnPort = \"6379\"\n+ RedisSentinelConnPort = 26379\n+ RedisRedisConnPort = 6379\nRedisSentinelConnGroup = \"mymaster\"\n)\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(cache): add healthchecker for redis controller
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,893
|
27.11.2020 14:05:12
| -28,800
|
954c461d36f3c5a19a3528c6fd01e7189fcc4925
|
refactor(main): refactor main.go to reduce duplicate code
fix typo func name `WabhooksWithManager()`
fix
|
[
{
"change_type": "MODIFY",
"old_path": "main.go",
"new_path": "main.go",
"diff": "@@ -24,75 +24,45 @@ const (\nexitCodeFailure = 1\n)\n-var exitCode = 0\n-\n-func SetExitCode(value int) {\n- exitCode = value\n-}\n-\n-func GetExitCode() int {\n- return exitCode\n-}\n-\nfunc main() {\n- defer func() { os.Exit(GetExitCode()) }()\n-\nsetupLog := ctrl.Log.WithName(\"setup\")\nctx := logger.Context(setupLog)\n- err := setup.Logger(ctx, name, version)\n+ // Check non-nil error then log and exit with non-zero code\n+ fail := func(err error, msg string) {\n+ // If err is non-nil, then exit with non-zero code,\n+ // otherwise move on\nif err != nil {\n- setupLog.Error(err, \"unable to create logger\")\n- SetExitCode(exitCodeFailure)\n-\n- return\n+ setupLog.Error(err, msg)\n+ os.Exit(exitCodeFailure)\n+ }\n}\n+ err := setup.Logger(ctx, name, version)\n+ fail(err, \"unable to create logger\")\n+\nconfigstore.InitFromEnvironment()\napplication.SetName(&ctx, name)\napplication.SetVersion(&ctx, version)\nscheme, err := scheme.New(ctx)\n- if err != nil {\n- setupLog.Error(err, \"unable to create scheme\")\n- SetExitCode(exitCodeFailure)\n-\n- return\n- }\n+ fail(err, \"unable to create scheme\")\nmgr, err := manager.New(ctx, scheme)\n- if err != nil {\n- setupLog.Error(err, \"unable to create manager\")\n- SetExitCode(exitCodeFailure)\n-\n- return\n- }\n+ fail(err, \"unable to create manager\")\ntraCon, err := tracing.New(ctx)\n- if err != nil {\n- setupLog.Error(err, \"unable to create tracer\")\n- SetExitCode(exitCodeFailure)\n-\n- return\n- }\n+ fail(err, \"unable to create tracer\")\ndefer traCon.Close()\n- if err := (setup.WithManager(ctx, mgr)); err != nil {\n- setupLog.Error(err, \"unable to setup controllers\")\n- SetExitCode(exitCodeFailure)\n-\n- return\n- }\n+ err = setup.WithManager(ctx, mgr)\n+ fail(err, \"unable to setup controllers\")\n// +kubebuilder:scaffold:builder\n+ // Log\nsetupLog.Info(\"starting manager\", \"version\", version, \"commit\", commit)\n-\n- if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {\n- setupLog.Error(err, \"cannot start manager\")\n- SetExitCode(exitCodeFailure)\n-\n- return\n- }\n+ err = mgr.Start(ctrl.SetupSignalHandler())\n+ fail(err, \"cannot start manager\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/setup/setup.go",
"new_path": "pkg/setup/setup.go",
"diff": "@@ -17,7 +17,7 @@ func WithManager(ctx context.Context, mgr manager.Manager) error {\n})\ng.Go(func() error {\n- return WabhooksWithManager(ctx, mgr)\n+ return WebhooksWithManager(ctx, mgr)\n})\nreturn g.Wait()\n@@ -52,7 +52,7 @@ func ControllersWithManager(ctx context.Context, mgr manager.Manager) error {\nreturn g.Wait()\n}\n-func WabhooksWithManager(ctx context.Context, mgr manager.Manager) error {\n+func WebhooksWithManager(ctx context.Context, mgr manager.Manager) error {\nvar g errgroup.Group\nfor name, object := range webhooksBuilder {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
refactor(main): refactor main.go to reduce duplicate code
- fix typo func name `WabhooksWithManager()`
fix #223
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
27.11.2020 16:27:23
| -28,800
|
8b06af21aa02144721aab5dc3190ef38962eb25c
|
feat(webhook):add validating hook for Cluster
fix
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"diff": "@@ -56,7 +56,9 @@ type HarborSpec struct {\n// +kubebuilder:validation:Optional\nInternalTLS HarborInternalTLSSpec `json:\"internalTLS\"`\n- // +kubebuilder:validation:Required\n+ // Skip OpenAPI schema validation\n+ // Use validating webhook to do verification (field required)\n+ // +kubebuilder:validation:Optional\nImageChartStorage HarborStorageImageChartStorageSpec `json:\"imageChartStorage\"`\n// +kubebuilder:validation:Optional\n@@ -102,11 +104,15 @@ type HarborComponentsSpec struct {\n// +kubebuilder:validation:Optional\nNotary *NotaryComponentSpec `json:\"notary,omitempty\"`\n- // +kubebuilder:validation:Required\n- Redis ExternalRedisSpec `json:\"redis\"`\n+ // Skip OpenAPI schema validation\n+ // Use validating webhook to do verification (field required)\n+ // +kubebuilder:validation:Optional\n+ Redis *ExternalRedisSpec `json:\"redis\"`\n- // +kubebuilder:validation:Required\n- Database HarborDatabaseSpec `json:\"database\"`\n+ // Skip OpenAPI schema validation\n+ // Use validating webhook to do verification (field required)\n+ // +kubebuilder:validation:Optional\n+ Database *HarborDatabaseSpec `json:\"database\"`\n}\ntype HarborDatabaseSpec struct {\n"
},
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harbor_webhook.go",
"new_path": "apis/goharbor.io/v1alpha2/harbor_webhook.go",
"diff": "@@ -52,11 +52,7 @@ func (h *Harbor) Validate() error {\nerr := h.Spec.ImageChartStorage.Validate()\nif err != nil {\n- allErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"persistence\").Child(\"imageChartStorage\"), h.Spec.ImageChartStorage, err.Error()))\n- }\n-\n- if len(allErrs) == 0 {\n- return nil\n+ allErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"imageChartStorage\"), h.Spec.ImageChartStorage, err.Error()))\n}\n_, err = url.Parse(h.Spec.ExternalURL)\n@@ -64,6 +60,14 @@ func (h *Harbor) Validate() error {\nallErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"externalURL\"), h.Spec.ExternalURL, err.Error()))\n}\n+ if h.Spec.Database == nil {\n+ allErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"database\"), h.Spec.Database, \"field is required\"))\n+ }\n+\n+ if h.Spec.Redis == nil {\n+ allErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"redis\"), h.Spec.Redis, \"field is required\"))\n+ }\n+\nif len(allErrs) == 0 {\nreturn nil\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_webhook.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package v1alpha2\n+\n+import (\n+ \"context\"\n+\n+ apierrors \"k8s.io/apimachinery/pkg/api/errors\"\n+ \"k8s.io/apimachinery/pkg/runtime\"\n+ \"k8s.io/apimachinery/pkg/runtime/schema\"\n+ \"k8s.io/apimachinery/pkg/util/validation/field\"\n+ ctrl \"sigs.k8s.io/controller-runtime\"\n+ logf \"sigs.k8s.io/controller-runtime/pkg/log\"\n+ \"sigs.k8s.io/controller-runtime/pkg/webhook\"\n+)\n+\n+// Log used this webhook\n+var clog = logf.Log.WithName(\"harborcluster-resource\")\n+\n+// SetupWebhookWithManager sets up validating webhook of HarborCluster\n+func (hc *HarborCluster) SetupWebhookWithManager(ctx context.Context, mgr ctrl.Manager) error {\n+ return ctrl.NewWebhookManagedBy(mgr).\n+ For(hc).\n+ Complete()\n+}\n+\n+// +kubebuilder:webhook:verbs=create;update,path=/validate-goharbor-io-v1alpha2-harborcluster,mutating=false,failurePolicy=fail,groups=goharbor.io,resources=harborclusters,versions=v1alpha2,name=vharborcluster.kb.io\n+\n+var _ webhook.Validator = &HarborCluster{}\n+\n+func (hc *HarborCluster) ValidateCreate() error {\n+ clog.Info(\"validate creation\", \"name\", hc.Name, \"namespace\", hc.Namespace)\n+\n+ return hc.validate()\n+}\n+\n+func (hc *HarborCluster) ValidateUpdate(old runtime.Object) error {\n+ clog.Info(\"validate updating\", \"name\", hc.Name, \"namespace\", hc.Namespace)\n+\n+ return hc.validate()\n+}\n+\n+func (hc *HarborCluster) ValidateDelete() error {\n+ clog.Info(\"validate deletion\", \"name\", hc.Name, \"namespace\", hc.Namespace)\n+\n+ return nil\n+}\n+\n+func (hc *HarborCluster) validate() error {\n+ var allErrs field.ErrorList\n+\n+ // For database(psql), cache(Redis) and storage, either external services or in-cluster services MUST be configured\n+\n+ // Storage\n+ // External is not configured\n+ if err := hc.Spec.ImageChartStorage.Validate(); err != nil {\n+ // And in-cluster minIO is not configured\n+ if hc.Spec.InClusterStorage == nil {\n+ // Invalid and not acceptable\n+ allErrs = append(\n+ allErrs,\n+ field.Invalid(\n+ field.NewPath(\"spec\").\n+ Child(\"imageChartStorage\", \"inClusterStorage\"),\n+ hc.Spec.ImageChartStorage,\n+ \"both storage and in-cluster storage are not correctly configured\",\n+ ),\n+ )\n+ }\n+ }\n+\n+ // Database\n+ // External is not configured\n+ // And also in-cluster psql is not specified\n+ if hc.Spec.Database == nil && hc.Spec.InClusterDatabase == nil {\n+ // Invalid and not acceptable\n+ allErrs = append(\n+ allErrs,\n+ field.Invalid(\n+ field.NewPath(\"spec\").Child(\"database\", \"inClusterDatabase\"),\n+ hc.Spec.Database,\n+ \"both database or in-cluster database are not correctly configured\",\n+ ),\n+ )\n+ }\n+\n+ // Cache\n+ // External is not configured\n+ if hc.Spec.Redis == nil && hc.Spec.InClusterCache == nil {\n+ // Invalid and not acceptable\n+ allErrs = append(\n+ allErrs,\n+ field.Invalid(\n+ field.NewPath(\"spec\").Child(\"redis\", \"inClusterCache\"),\n+ hc.Spec.Database,\n+ \"both redis or in-cluster redis are not correctly configured\",\n+ ),\n+ )\n+ }\n+\n+ if len(allErrs) == 0 {\n+ return nil\n+ }\n+\n+ return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: \"HarborCluster\"}, hc.Name, allErrs)\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go",
"new_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go",
"diff": "@@ -1059,8 +1059,16 @@ func (in *HarborComponentsSpec) DeepCopyInto(out *HarborComponentsSpec) {\n*out = new(NotaryComponentSpec)\n(*in).DeepCopyInto(*out)\n}\n- out.Redis = in.Redis\n- in.Database.DeepCopyInto(&out.Database)\n+ if in.Redis != nil {\n+ in, out := &in.Redis, &out.Redis\n+ *out = new(ExternalRedisSpec)\n+ **out = **in\n+ }\n+ if in.Database != nil {\n+ in, out := &in.Database, &out.Database\n+ *out = new(HarborDatabaseSpec)\n+ (*in).DeepCopyInto(*out)\n+ }\n}\n// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new HarborComponentsSpec.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor_test.go",
"new_path": "controllers/goharbor/harbor_test.go",
"diff": "@@ -148,7 +148,7 @@ func setupValidHarbor(ctx context.Context, ns string) (Resource, client.ObjectKe\nName: tokenIssuerName,\n},\n},\n- Database: goharborv1alpha2.HarborDatabaseSpec{\n+ Database: &goharborv1alpha2.HarborDatabaseSpec{\nPostgresCredentials: database.PostgresCredentials,\nHosts: database.Hosts,\nSSLMode: harbormetav1.PostgresSSLMode(database.Parameters[harbormetav1.PostgresSSLModeKey]),\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -90,11 +90,11 @@ func (harbor *HarborController) getHarborCR(harborcluster *v1alpha2.HarborCluste\n// use incluster spec in first priority\nif harborcluster.Spec.InClusterDatabase != nil {\n- harborcluster.Spec.Database = *harbor.getDatabaseSpec()\n+ harborcluster.Spec.Database = harbor.getDatabaseSpec()\n}\nif harborcluster.Spec.InClusterCache != nil {\n- harborcluster.Spec.Redis = *harbor.getCacheSpec()\n+ harborcluster.Spec.Redis = harbor.getCacheSpec()\n}\nif harborcluster.Spec.InClusterStorage != nil {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(webhook):add validating hook for Cluster
fix #201
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,881
|
27.11.2020 17:19:10
| -28,800
|
4b9230e3b5840c4c4d1bd255dd96f0f68cf90557
|
fix: add log name for lcm controller
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"diff": "@@ -39,22 +39,22 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\n}\nr.CacheCtrl = cache.NewRedisController(ctx,\n- k8s.WithLog(r.Log),\n+ k8s.WithLog(r.Log.WithName(\"cache\")),\nk8s.WithScheme(mgr.GetScheme()),\nk8s.WithDClient(k8s.WrapDClient(dClient)),\nk8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())))\nr.DatabaseCtrl = database.NewDatabaseController(ctx,\n- k8s.WithLog(r.Log),\n+ k8s.WithLog(r.Log.WithName(\"database\")),\nk8s.WithScheme(mgr.GetScheme()),\nk8s.WithDClient(k8s.WrapDClient(dClient)),\nk8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())))\nr.StorageCtrl = storage.NewMinIOController(ctx,\n- k8s.WithLog(r.Log),\n+ k8s.WithLog(r.Log.WithName(\"storage\")),\nk8s.WithScheme(mgr.GetScheme()),\nk8s.WithDClient(k8s.WrapDClient(dClient)),\nk8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())))\nr.HarborCtrl = harbor.NewHarborController(ctx,\n- k8s.WithLog(r.Log),\n+ k8s.WithLog(r.Log.WithName(\"harbor\")),\nk8s.WithScheme(mgr.GetScheme()),\nk8s.WithDClient(k8s.WrapDClient(dClient)),\nk8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())))\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: add log name for lcm controller
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,893
|
27.11.2020 19:19:43
| -28,800
|
41b8eda21653994f466cf9d92879e4cb77c65ac3
|
fix(config):update config manifests
|
[
{
"change_type": "MODIFY",
"old_path": "config/default/manager_auth_proxy_patch.yaml",
"new_path": "config/default/manager_auth_proxy_patch.yaml",
"diff": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n- name: controller-manager\n+ name: harbor-operator\nspec:\ntemplate:\nspec:\n"
},
{
"change_type": "MODIFY",
"old_path": "config/default/manager_prometheus_metrics_patch.yaml",
"new_path": "config/default/manager_prometheus_metrics_patch.yaml",
"diff": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n- name: controller-manager\n+ name: harbor-operator\nspec:\ntemplate:\nspec:\n"
},
{
"change_type": "MODIFY",
"old_path": "config/default/manager_webhook_patch.yaml",
"new_path": "config/default/manager_webhook_patch.yaml",
"diff": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n- name: controller-manager\n+ name: harbor-operator\nspec:\ntemplate:\nspec:\n"
},
{
"change_type": "MODIFY",
"old_path": "config/manager/manager.yaml",
"new_path": "config/manager/manager.yaml",
"diff": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n- name: controller-manager\n+ name: harbor-operator\nlabels:\n- control-plane: controller-manager\n+ control-plane: harbor-operator\nspec:\nselector:\nmatchLabels:\n- control-plane: controller-manager\n+ control-plane: harbor-operator\ntemplate:\nmetadata:\nlabels:\n- control-plane: controller-manager\n+ control-plane: harbor-operator\nspec:\ncontainers:\n- command:\n"
},
{
"change_type": "MODIFY",
"old_path": "config/manager/patches-configuration.yaml",
"new_path": "config/manager/patches-configuration.yaml",
"diff": "apiVersion: apps/v1\nkind: Deployment\nmetadata:\n- name: controller-manager\n+ name: harbor-operator\nspec:\ntemplate:\nspec:\n"
},
{
"change_type": "MODIFY",
"old_path": "config/webhook/service.yaml",
"new_path": "config/webhook/service.yaml",
"diff": "@@ -8,4 +8,4 @@ spec:\n- port: 443\ntargetPort: 9443\nselector:\n- control-plane: controller-manager\n+ control-plane: harbor-operator\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -2042,6 +2042,7 @@ spec:\ntype: array\ntype: object\ndatabase:\n+ description: Skip OpenAPI schema validation Use validating webhook to do verification (field required)\nproperties:\nhosts:\nitems:\n@@ -2170,6 +2171,7 @@ spec:\npattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'\ntype: string\nimageChartStorage:\n+ description: Skip OpenAPI schema validation Use validating webhook to do verification (field required)\nproperties:\nfilesystem:\ndescription: 'FileSystem is an implementation of the storagedriver.StorageDriver interface which uses the local filesystem. The local filesystem can be a remote volume. See: https://docs.docker.com/registry/storage-drivers/filesystem/'\n@@ -2944,6 +2946,7 @@ spec:\n- url\ntype: object\nredis:\n+ description: Skip OpenAPI schema validation Use validating webhook to do verification (field required)\nproperties:\ncertificateRef:\ndescription: Secret containing the client certificate to authenticate with.\n@@ -3163,13 +3166,10 @@ spec:\ndefault: RollingUpdate\ntype: string\nrequired:\n- - database\n- encryptionKeyRef\n- expose\n- externalURL\n- harborAdminPasswordRef\n- - imageChartStorage\n- - redis\ntype: object\nstatus:\ndescription: HarborClusterStatus defines the observed state of HarborCluster\n@@ -3435,6 +3435,7 @@ spec:\ntype: array\ntype: object\ndatabase:\n+ description: Skip OpenAPI schema validation Use validating webhook to do verification (field required)\nproperties:\nhosts:\nitems:\n@@ -3563,6 +3564,7 @@ spec:\npattern: '[a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*'\ntype: string\nimageChartStorage:\n+ description: Skip OpenAPI schema validation Use validating webhook to do verification (field required)\nproperties:\nfilesystem:\ndescription: 'FileSystem is an implementation of the storagedriver.StorageDriver interface which uses the local filesystem. The local filesystem can be a remote volume. See: https://docs.docker.com/registry/storage-drivers/filesystem/'\n@@ -4050,6 +4052,7 @@ spec:\n- url\ntype: object\nredis:\n+ description: Skip OpenAPI schema validation Use validating webhook to do verification (field required)\nproperties:\ncertificateRef:\ndescription: Secret containing the client certificate to authenticate with.\n@@ -4269,13 +4272,10 @@ spec:\ndefault: RollingUpdate\ntype: string\nrequired:\n- - database\n- encryptionKeyRef\n- expose\n- externalURL\n- harborAdminPasswordRef\n- - imageChartStorage\n- - redis\ntype: object\nstatus:\ndescription: ComponentStatus represents the current status of the resource. https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties\n@@ -15441,7 +15441,7 @@ spec:\n- port: 443\ntargetPort: 9443\nselector:\n- control-plane: controller-manager\n+ control-plane: harbor-operator\n---\napiVersion: apps/v1\nkind: Deployment\n@@ -15451,13 +15451,13 @@ metadata:\ngoharbor.io/deploy-mode: cluster\ngoharbor.io/operator-version: v1.0.0\nlabels:\n- control-plane: controller-manager\n- name: controller-manager\n+ control-plane: harbor-operator\n+ name: harbor-operator\nnamespace: harbor-operator-ns\nspec:\nselector:\nmatchLabels:\n- control-plane: controller-manager\n+ control-plane: harbor-operator\ntemplate:\nmetadata:\nannotations:\n@@ -15465,7 +15465,7 @@ spec:\ngoharbor.io/deploy-mode: cluster\ngoharbor.io/operator-version: v1.0.0\nlabels:\n- control-plane: controller-manager\n+ control-plane: harbor-operator\nspec:\ncontainers:\n- args:\n@@ -15708,6 +15708,24 @@ webhooks:\n- UPDATE\nresources:\n- harbors\n+- clientConfig:\n+ caBundle: Cg==\n+ service:\n+ name: webhook-service\n+ namespace: harbor-operator-ns\n+ path: /validate-goharbor-io-v1alpha2-harborcluster\n+ failurePolicy: Fail\n+ name: vharborcluster.kb.io\n+ rules:\n+ - apiGroups:\n+ - goharbor.io\n+ apiVersions:\n+ - v1alpha2\n+ operations:\n+ - CREATE\n+ - UPDATE\n+ resources:\n+ - harborclusters\n- clientConfig:\ncaBundle: Cg==\nservice:\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/setup/webhooks.go",
"new_path": "pkg/setup/webhooks.go",
"diff": "@@ -20,6 +20,7 @@ var webhooksBuilder = map[controllers.Controller]WebHook{\ncontrollers.Registry: &goharborv1alpha2.Registry{},\ncontrollers.NotaryServer: &goharborv1alpha2.NotaryServer{},\ncontrollers.NotarySigner: &goharborv1alpha2.NotarySigner{},\n+ controllers.HarborCluster: &goharborv1alpha2.HarborCluster{},\n}\ntype WebHook interface {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(config):update config manifests
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
27.11.2020 20:33:02
| -28,800
|
aac44976c8a9d3e6aacee1b910d8b9220d46f899
|
fix(rbac):fix rbac issue of harborcluster cr
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"diff": "@@ -26,8 +26,8 @@ type Reconciler struct {\nHarborCtrl *harbor.HarborController\n}\n-// +kubebuilder:rbac:groups=goharbor.goharbor.io,resources=harborclusters,verbs=get;list;watch;create;update;patch;delete\n-// +kubebuilder:rbac:groups=goharbor.goharbor.io,resources=harborclusters/status,verbs=get;update;patch\n+// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters,verbs=get;list;watch;create;update;patch;delete\n+// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters/status,verbs=get;update;patch\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\nr.Client = mgr.GetClient()\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -14373,26 +14373,6 @@ rules:\n- patch\n- update\n- watch\n-- apiGroups:\n- - goharbor.goharbor.io\n- resources:\n- - harborclusters\n- verbs:\n- - create\n- - delete\n- - get\n- - list\n- - patch\n- - update\n- - watch\n-- apiGroups:\n- - goharbor.goharbor.io\n- resources:\n- - harborclusters/status\n- verbs:\n- - get\n- - patch\n- - update\n- apiGroups:\n- goharbor.io\nresources:\n@@ -14445,6 +14425,26 @@ rules:\n- get\n- patch\n- update\n+- apiGroups:\n+ - goharbor.io\n+ resources:\n+ - harborclusters\n+ verbs:\n+ - create\n+ - delete\n+ - get\n+ - list\n+ - patch\n+ - update\n+ - watch\n+- apiGroups:\n+ - goharbor.io\n+ resources:\n+ - harborclusters/status\n+ verbs:\n+ - get\n+ - patch\n+ - update\n- apiGroups:\n- goharbor.io\nresources:\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(rbac):fix rbac issue of harborcluster cr
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,881
|
27.11.2020 22:10:07
| -28,800
|
03949392c8dc2e418617ac4baae83695fd594b21
|
fix: add suffix name redis for cache cr
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/readiness.go",
"new_path": "pkg/cluster/controllers/cache/readiness.go",
"diff": "@@ -42,7 +42,7 @@ func (rc *RedisController) generateRedisSpec() *v1alpha2.ExternalRedisSpec {\nreturn &v1alpha2.ExternalRedisSpec{\nRedisHostSpec: harbormetav1.RedisHostSpec{\nHost: rc.ResourceManager.GetServiceName(),\n- Port: 6379,\n+ Port: RedisRedisConnPort,\n},\nRedisCredentials: harbormetav1.RedisCredentials{\nPasswordRef: rc.ResourceManager.GetSecretName(),\n@@ -132,13 +132,13 @@ func (rc *RedisController) CheckInClusterRedisHealth(ctx context.Context, cluste\nreturn nil, err\n}\n- _, sentinelPodList, err := rc.GetDeploymentPods(cluster.Name, cluster.Namespace)\n+ _, sentinelPodList, err := rc.GetDeploymentPods(rc.ResourceManager.GetCacheCRName(), cluster.Namespace)\nif err != nil {\nrc.Log.Error(err, \"Fail to get deployment pods.\")\nreturn nil, err\n}\n- _, redisPodList, err := rc.GetStatefulSetPods(cluster.Name, cluster.Namespace)\n+ _, redisPodList, err := rc.GetStatefulSetPods(rc.ResourceManager.GetCacheCRName(), cluster.Namespace)\nif err != nil {\nrc.Log.Error(err, \"Fail to get deployment pods.\")\nreturn nil, err\n@@ -157,7 +157,7 @@ func (rc *RedisController) CheckInClusterRedisHealth(ctx context.Context, cluste\nif len(currentSentinelPods) == 0 {\nreturn nil, errors.New(\"need to requeue\")\n}\n- endpoint := rc.GetSentinelServiceUrl(cluster.Name, cluster.Namespace, currentSentinelPods)\n+ endpoint := rc.GetSentinelServiceUrl(rc.ResourceManager.GetCacheCRName(), cluster.Namespace, currentSentinelPods)\nconfig := &lcm.ServiceConfig{\nEndpoint: &lcm.Endpoint{\nHost: endpoint,\n@@ -175,7 +175,7 @@ func (rc *RedisController) CheckInClusterRedisHealth(ctx context.Context, cluste\nif len(currentRedisPods) == 0 {\nreturn nil, errors.New(\"need to requeue\")\n}\n- endpoint := rc.GetRedisServiceUrl(cluster.Name, cluster.Namespace, currentRedisPods)\n+ endpoint := rc.GetRedisServiceUrl(rc.ResourceManager.GetCacheCRName(), cluster.Namespace, currentRedisPods)\nconfig := &lcm.ServiceConfig{\nEndpoint: &lcm.Endpoint{\nHost: endpoint,\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/redis.go",
"new_path": "pkg/cluster/controllers/cache/redis.go",
"diff": "@@ -62,7 +62,7 @@ func (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCl\ncrdClient := rc.DClient.WithResource(redisFailoversGVR).WithNamespace(cluster.Namespace)\n- actualCR, err := crdClient.Get(cluster.Name, metav1.GetOptions{})\n+ actualCR, err := crdClient.Get(rc.ResourceManager.GetCacheCRName(), metav1.GetOptions{})\nif errors.IsNotFound(err) {\nreturn rc.Deploy(cluster)\n} else if err != nil {\n@@ -75,10 +75,6 @@ func (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCl\nreturn cacheNotReadyStatus(ErrorSetOwnerReference, err.Error()), err\n}\n- if err = runtime.DefaultUnstructuredConverter.FromUnstructured(actualCR.UnstructuredContent(), rc.actualCR); err != nil {\n- return cacheNotReadyStatus(ErrorDefaultUnstructuredConverter, err.Error()), err\n- }\n-\nrc.expectCR = expectCR\ncrStatus, err := rc.Update(cluster)\nif err != nil {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/resource_manager.go",
"new_path": "pkg/cluster/controllers/cache/resource_manager.go",
"diff": "@@ -20,6 +20,7 @@ type ResourceManager interface {\n// ResourceGetter gets resources.\ntype ResourceGetter interface {\nGetCacheCR() runtime.Object\n+ GetCacheCRName() string\nGetResourceList() corev1.ResourceList\nGetServiceName() string\nGetService() *corev1.Service\n@@ -30,6 +31,8 @@ type ResourceGetter interface {\nGetStorageSize() string\n}\n+var _ ResourceManager = &RedisResourceManager{}\n+\ntype RedisResourceManager struct {\ncluster *v1alpha2.HarborCluster\n}\n@@ -55,7 +58,7 @@ func (rm *RedisResourceManager) GetCacheCR() runtime.Object {\nAPIVersion: \"databases.spotahome.com/v1\",\n},\nObjectMeta: metav1.ObjectMeta{\n- Name: rm.cluster.Name,\n+ Name: rm.GetCacheCRName(),\nNamespace: rm.cluster.Namespace,\nLabels: rm.GetLabels(),\n},\n@@ -82,9 +85,14 @@ func (rm *RedisResourceManager) GetCacheCR() runtime.Object {\n}\n}\n+// GetCacheCRName gets cache cr name.\n+func (rm *RedisResourceManager) GetCacheCRName() string {\n+ return fmt.Sprintf(\"%s-%s\", rm.cluster.Name, \"redis\")\n+}\n+\n// GetServiceName gets service name.\nfunc (rm *RedisResourceManager) GetServiceName() string {\n- return fmt.Sprintf(\"%s-%s\", \"redis\", rm.cluster.Name)\n+ return rm.GetCacheCRName()\n}\n// GetService gets service.\n@@ -121,7 +129,7 @@ func (rm *RedisResourceManager) GetService() *corev1.Service {\n// GetSecretName gets secret name.\nfunc (rm *RedisResourceManager) GetSecretName() string {\n- return fmt.Sprintf(\"%s-%s\", \"redis\", rm.cluster.Name)\n+ return rm.GetCacheCRName()\n}\n// GetSecret gets redis secret.\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/update.go",
"new_path": "pkg/cluster/controllers/cache/update.go",
"diff": "@@ -16,13 +16,16 @@ import (\n// - update RedisFailovers CR resource\nfunc (rc *RedisController) RollingUpgrades(cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\ncrdClient := rc.DClient.WithResource(redisFailoversGVR).WithNamespace(cluster.Namespace)\n- if rc.expectCR == nil {\n+ if rc.expectCR == nil || rc.actualCR == nil {\nreturn cacheUnknownStatus(), nil\n}\n- var (\n- actualCR, expectCR redisOp.RedisFailover\n- )\n+ expectCR := rc.expectCR.(*redisOp.RedisFailover)\n+ unstructuredActualCR := rc.actualCR.(*unstructured.Unstructured)\n+ actualCR := &redisOp.RedisFailover{}\n+ if err := runtime.DefaultUnstructuredConverter.FromUnstructured(unstructuredActualCR.UnstructuredContent(), actualCR); err != nil {\n+ return cacheNotReadyStatus(ErrorDefaultUnstructuredConverter, err.Error()), err\n+ }\nif !IsEqual(actualCR.DeepCopy().Spec, expectCR.DeepCopy().Spec) {\n//msg := fmt.Sprintf(UpdateMessageRedisCluster, cluster.Name)\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: add suffix name redis for cache cr
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,893
|
28.11.2020 10:56:56
| -28,800
|
c43e1786d06d6c82937ae3672529a1c6f10c21f6
|
fix(rbac): fix rbac issue of cluster ctrl
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"diff": "@@ -28,6 +28,10 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters/status,verbs=get;update;patch\n+// +kubebuilder:rbac:groups=acid.zalan.do,resources=postgresqls;operatorconfigurations,verbs=get;list;watch;create;update;patch;delete;deletecollection\n+// +kubebuilder:rbac:groups=acid.zalan.do,resources=postgresqls/status,verbs=get;update;patch\n+// +kubebuilder:rbac:groups=databases.spotahome.com,resources=redisfailovers,verbs=*\n+// +kubebuilder:rbac:groups=minio.min.io,resources=*,verbs=*\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\nr.Client = mgr.GetClient()\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(rbac): fix rbac issue of cluster ctrl
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
28.11.2020 15:41:02
| -28,800
|
ff824c85991f01cc2dc3973ea06e7123c3e0f24a
|
fix(webhook):refactor cluster webhook check and update cluster deployment manifest
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_webhook.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_webhook.go",
"diff": "@@ -62,57 +62,103 @@ func (hc *HarborCluster) validate() error {\nvar allErrs field.ErrorList\n// For database(psql), cache(Redis) and storage, either external services or in-cluster services MUST be configured\n+ if err := hc.validateStorage(); err != nil {\n+ allErrs = append(allErrs, err)\n+ }\n+\n+ if err := hc.validateDatabase(); err != nil {\n+ allErrs = append(allErrs, err)\n+ }\n+\n+ if err := hc.validateCache(); err != nil {\n+ allErrs = append(allErrs, err)\n+ }\n+\n+ if len(allErrs) == 0 {\n+ return nil\n+ }\n+ return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: \"HarborCluster\"}, hc.Name, allErrs)\n+}\n+\n+func (hc *HarborCluster) validateStorage() *field.Error {\n// Storage\n// External is not configured\nif err := hc.Spec.ImageChartStorage.Validate(); err != nil {\n+ clog.Error(err, \"validate spec.imageChartStorage\")\n+\n// And in-cluster minIO is not configured\nif hc.Spec.InClusterStorage == nil {\n// Invalid and not acceptable\n- allErrs = append(\n- allErrs,\n- field.Invalid(\n+ return field.Invalid(\nfield.NewPath(\"spec\").\nChild(\"imageChartStorage\", \"inClusterStorage\"),\nhc.Spec.ImageChartStorage,\n\"both storage and in-cluster storage are not correctly configured\",\n- ),\n+ )\n+ }\n+ } else {\n+ if hc.Spec.InClusterStorage != nil {\n+ // Both are configured, conflict\n+ return field.Invalid(\n+ field.NewPath(\"spec\").\n+ Child(\"imageChartStorage\", \"inClusterStorage\"),\n+ hc.Spec.InClusterStorage,\n+ \"conflicts: both storage and in-cluster storage are configured, only one is required to set\",\n)\n}\n}\n+ return nil\n+}\n+\n+func (hc *HarborCluster) validateDatabase() *field.Error {\n// Database\n// External is not configured\n// And also in-cluster psql is not specified\nif hc.Spec.Database == nil && hc.Spec.InClusterDatabase == nil {\n// Invalid and not acceptable\n- allErrs = append(\n- allErrs,\n- field.Invalid(\n+ return field.Invalid(\nfield.NewPath(\"spec\").Child(\"database\", \"inClusterDatabase\"),\nhc.Spec.Database,\n\"both database or in-cluster database are not correctly configured\",\n- ),\n)\n}\n+ // Both are configured then conflict\n+ if hc.Spec.Database != nil && hc.Spec.InClusterDatabase != nil {\n+ // Conflict and not acceptable\n+ return field.Invalid(\n+ field.NewPath(\"spec\").Child(\"database\", \"inClusterDatabase\"),\n+ hc.Spec.InClusterDatabase,\n+ \"conflicts: both database or in-cluster database are configured, only one is required to set\",\n+ )\n+ }\n+\n+ return nil\n+}\n+\n+func (hc *HarborCluster) validateCache() *field.Error {\n// Cache\n// External is not configured\nif hc.Spec.Redis == nil && hc.Spec.InClusterCache == nil {\n// Invalid and not acceptable\n- allErrs = append(\n- allErrs,\n- field.Invalid(\n+ return field.Invalid(\nfield.NewPath(\"spec\").Child(\"redis\", \"inClusterCache\"),\n- hc.Spec.Database,\n+ hc.Spec.Redis,\n\"both redis or in-cluster redis are not correctly configured\",\n- ),\n)\n}\n- if len(allErrs) == 0 {\n- return nil\n+ // Both are configured and then conflict\n+ if hc.Spec.Redis != nil && hc.Spec.InClusterCache != nil {\n+ // Conflict and not acceptable\n+ return field.Invalid(\n+ field.NewPath(\"spec\").Child(\"redis\", \"inClusterCache\"),\n+ hc.Spec.InClusterCache,\n+ \"conflicts: both redis or in-cluster redis are configured, only one is required to set\",\n+ )\n}\n- return apierrors.NewInvalid(schema.GroupKind{Group: GroupVersion.Group, Kind: \"HarborCluster\"}, hc.Name, allErrs)\n+ return nil\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -14348,6 +14348,28 @@ rules:\n- patch\n- update\n- watch\n+- apiGroups:\n+ - acid.zalan.do\n+ resources:\n+ - operatorconfigurations\n+ - postgresqls\n+ verbs:\n+ - create\n+ - delete\n+ - deletecollection\n+ - get\n+ - list\n+ - patch\n+ - update\n+ - watch\n+- apiGroups:\n+ - acid.zalan.do\n+ resources:\n+ - postgresqls/status\n+ verbs:\n+ - get\n+ - patch\n+ - update\n- apiGroups:\n- apps\nresources:\n@@ -14373,6 +14395,12 @@ rules:\n- patch\n- update\n- watch\n+- apiGroups:\n+ - databases.spotahome.com\n+ resources:\n+ - redisfailovers\n+ verbs:\n+ - '*'\n- apiGroups:\n- goharbor.io\nresources:\n@@ -14557,6 +14585,12 @@ rules:\n- get\n- patch\n- update\n+- apiGroups:\n+ - minio.min.io\n+ resources:\n+ - '*'\n+ verbs:\n+ - '*'\n- apiGroups:\n- networking.k8s.io\nresources:\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(webhook):refactor cluster webhook check and update cluster deployment manifest
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,870
|
28.11.2020 18:56:04
| -28,800
|
70d583bf9154c4691652d0fbb7f47240ab2a134b
|
feat(database) add healthchecker for postgresql controller
add healthchecker for postgresql controller
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cluster/controllers/database/healthchecker.go",
"diff": "+package database\n+\n+import (\n+ \"context\"\n+ \"fmt\"\n+ \"strconv\"\n+\n+ \"github.com/jackc/pgx/v4\"\n+\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n+)\n+\n+var _ lcm.HealthChecker = &PostgreSQLHealthChecker{}\n+\n+// PostgreSQLHealthChecker check health for postgresql service.\n+type PostgreSQLHealthChecker struct{}\n+\n+// CheckHealth implements lcm.HealthChecker\n+func (p *PostgreSQLHealthChecker) CheckHealth(ctx context.Context, svc *lcm.ServiceConfig, options ...lcm.Option) (*lcm.CheckResponse, error) {\n+ if svc == nil || svc.Endpoint == nil {\n+ return nil, fmt.Errorf(\"serviceConfig or endpoint can not be nil\")\n+ }\n+ // apply options\n+ checkOpts := &lcm.CheckOptions{}\n+ for _, o := range options {\n+ o(checkOpts)\n+ }\n+\n+ var (\n+ client *pgx.Conn\n+ err error\n+ )\n+ conn := Connect{\n+ Host: svc.Endpoint.Host,\n+ Port: strconv.Itoa(int(svc.Endpoint.Port)),\n+ Database: InClusterDatabaseName,\n+ }\n+\n+ if svc.Credentials != nil {\n+ conn.Password = svc.Credentials.AccessSecret\n+ conn.Username = svc.Credentials.AccessKey\n+ }\n+\n+ url := conn.GenDatabaseUrl()\n+ resp := &lcm.CheckResponse{}\n+\n+ client, err = pgx.Connect(ctx, url)\n+ if err != nil {\n+ return nil, err\n+ }\n+\n+ defer client.Close(ctx)\n+\n+ if err := client.Ping(ctx); err != nil {\n+ resp.Status = lcm.UnHealthy\n+ resp.Message = err.Error()\n+ return resp, err\n+ }\n+\n+ resp.Status = lcm.Healthy\n+ return resp, nil\n+\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/postgresql.go",
"new_path": "pkg/cluster/controllers/database/postgresql.go",
"diff": "@@ -38,7 +38,7 @@ type Connect struct {\n}\nfunc (p *PostgreSQLController) HealthChecker() lcm.HealthChecker {\n- panic(\"implement me\")\n+ return &PostgreSQLHealthChecker{}\n}\nfunc (p *PostgreSQLController) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(database) add healthchecker for postgresql controller
add healthchecker for postgresql controller
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,875
|
29.11.2020 20:23:02
| -28,800
|
38ccdce120914e93f4ef5b610ef45c1717b552b3
|
fix(notary) signer alias key should use upper case envrionment
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/notarysigner.go",
"new_path": "controllers/goharbor/harbor/notarysigner.go",
"diff": "@@ -2,6 +2,7 @@ package harbor\nimport (\n\"context\"\n+ \"strings\"\n\"time\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n@@ -131,8 +132,7 @@ func (r *Reconciler) GetNotarySignerEncryptionKey(ctx context.Context, harbor *g\n},\nType: harbormetav1.SecretTypeNotarySignerAliases,\nStringData: map[string]string{\n- harbormetav1.DefaultAliasSecretKey: \"defaultalias\",\n- \"defaultalias\": secret,\n+ strings.ToUpper(harbormetav1.DefaultAliasSecretKey): secret,\n},\n}, nil\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(notary) signer alias key should use upper case envrionment
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,875
|
29.11.2020 23:09:46
| -28,800
|
c3f07d6fc8686a883c3b69766aaf4288b2f724ff
|
fix(notary) not shown marker
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/core.go",
"new_path": "controllers/goharbor/harbor/core.go",
"diff": "@@ -359,6 +359,18 @@ func (r *Reconciler) GetCore(ctx context.Context, harbor *goharborv1alpha2.Harbo\n}\n}\n+ var notary *goharborv1alpha2.CoreComponentsNotaryServerSpec\n+\n+ if harbor.Spec.Notary != nil {\n+ notaryURL := (&url.URL{\n+ Scheme: harbor.Spec.InternalTLS.GetScheme(),\n+ Host: r.NormalizeName(ctx, harbor.GetName(), controllers.NotaryServer.String()),\n+ }).String()\n+ notary = &goharborv1alpha2.CoreComponentsNotaryServerSpec{\n+ URL: notaryURL,\n+ }\n+ }\n+\nadminPasswordRef := harbor.Spec.HarborAdminPasswordRef\nif len(adminPasswordRef) == 0 {\nadminPasswordRef = r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String(), \"admin-password\")\n@@ -425,6 +437,7 @@ func (r *Reconciler) GetCore(ctx context.Context, harbor *goharborv1alpha2.Harbo\nURL: tokenServiceURL,\nCertificateRef: tokenCertificateRef,\n},\n+ NotaryServer: notary,\nTrivy: trivy,\nTLS: tls,\n},\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(notary) not shown marker
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,893
|
30.11.2020 15:46:43
| -28,800
|
919c802edf013ee7f91650626bea735191313ffd
|
refactor(reconciler): update harbor cluster ctrl
define a status object to handle the status updates
add fields to the HarborClusterStatus object
concurently provisioning/checking the dependent services
update the overall cluster reconciler logic
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"diff": "@@ -133,10 +133,21 @@ type MinIOSpec struct {\ntype HarborClusterStatus struct {\n// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster\n// Important: Run \"make\" to regenerate code after modifying this file\n+ // Status indicates the overall status of the Harbor cluster\n+ // Status can be \"unknown\", \"creating\", \"healthy\" and \"unhealthy\"\n+ Status ClusterStatus `json:\"status\"`\n+ // Revision of the status\n+ // Use unix nano\n+ Revision int64 `json:\"revision\"`\n+\n+ // Conditions of each components\nConditions []HarborClusterCondition `json:\"conditions,omitempty\"`\n}\n+// ClusterStatus is a type for cluster status\n+type ClusterStatus string\n+\n// HarborClusterConditionType is a valid value for HarborClusterConditionType.Type\ntype HarborClusterConditionType string\n@@ -152,6 +163,14 @@ const (\nStorageReady HarborClusterConditionType = \"StorageReady\"\n// ServiceReady means the Service of Harbor is ready.\nServiceReady HarborClusterConditionType = \"ServiceReady\"\n+ // StatusUnknown is the status of unknown\n+ StatusUnknown ClusterStatus = \"unknown\"\n+ // StatusCreating is the status of creating\n+ StatusCreating ClusterStatus = \"creating\"\n+ // StatusHealthy is the status of healthy\n+ StatusHealthy ClusterStatus = \"healthy\"\n+ // StatusUnHealthy is the status of unhealthy\n+ StatusUnHealthy ClusterStatus = \"unhealthy\"\n)\n// HarborClusterCondition contains details for the current condition of this pod.\n@@ -185,6 +204,7 @@ const (\n// +kubebuilder:object:root=true\n// +kubebuilder:printcolumn:name=\"Public URL\",type=string,JSONPath=`.spec.externalURL`,description=\"The public URL to the Harbor application\",priority=0\n+// +kubebuilder:printcolumn:name=\"Status\", type=string,JSONPath=`.status.status`,description=\"The overall status of the Harbor cluster\",priority=0\n// +kubebuilder:printcolumn:name=\"Service Ready\", type=string,JSONPath=`.status.conditions[?(@.type==\"ServiceReady\")].status`,description=\"The current status of the new Harbor spec\",priority=10\n// +kubebuilder:printcolumn:name=\"Cache Ready\", type=string,JSONPath=`.status.conditions[?(@.type==\"CacheReady\")].status`,description=\"The current status of the new Cache spec\",priority=20\n// +kubebuilder:printcolumn:name=\"Database Ready\", type=string,JSONPath=`.status.conditions[?(@.type==\"DatabaseReady\")].status`,description=\"The current status of the new Database spec\",priority=20\n"
},
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_webhook.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_webhook.go",
"diff": "@@ -85,7 +85,7 @@ func (hc *HarborCluster) validateStorage() *field.Error {\n// Storage\n// External is not configured\nif err := hc.Spec.ImageChartStorage.Validate(); err != nil {\n- clog.Error(err, \"validate spec.imageChartStorage\")\n+ clog.Info(\"validate spec.imageChartStorage\", \"cause\", err.Error())\n// And in-cluster minIO is not configured\nif hc.Spec.InClusterStorage == nil {\n"
},
{
"change_type": "RENAME",
"old_path": "controllers/goharbor/harborcluster/harborcluster_controller.go",
"new_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"diff": "@@ -3,27 +3,39 @@ package harborcluster\nimport (\n\"context\"\n+ \"github.com/go-logr/logr\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/controllers/cache\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/controllers/database\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/controllers/harbor\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/controllers/storage\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\ncommonCtrl \"github.com/goharbor/harbor-operator/pkg/controller\"\n+ \"github.com/goharbor/harbor-operator/pkg/factories/application\"\n\"github.com/goharbor/harbor-operator/pkg/k8s\"\n\"github.com/ovh/configstore\"\n+ \"k8s.io/apimachinery/pkg/runtime\"\n+ ctrl \"sigs.k8s.io/controller-runtime\"\n+ \"sigs.k8s.io/controller-runtime/pkg/client\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n- ctrl \"sigs.k8s.io/controller-runtime\"\n)\n+// TODO: Refactor to inherit the common reconciler in future\n// Reconciler reconciles a HarborCluster object\ntype Reconciler struct {\n- *commonCtrl.Controller\n+ client.Client\n+ Log logr.Logger\n+ Scheme *runtime.Scheme\n+\n+ // In case\n+ ConfigStore *configstore.Store\n+ Name string\n+ Version string\nCacheCtrl lcm.Controller\nDatabaseCtrl lcm.Controller\nStorageCtrl lcm.Controller\n- HarborCtrl *harbor.HarborController\n+ HarborCtrl *harbor.Controller\n}\n// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters,verbs=get;list;watch;create;update;patch;delete\n@@ -36,6 +48,7 @@ type Reconciler struct {\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\nr.Client = mgr.GetClient()\nr.Scheme = mgr.GetScheme()\n+\ndClient, err := k8s.NewDynamicClient()\nif err != nil {\nr.Log.Error(err, \"unable to create dynamic client\")\n@@ -68,10 +81,11 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nComplete(r)\n}\n+// New HarborCluster reconciler\nfunc New(ctx context.Context, name string, configStore *configstore.Store) (commonCtrl.Reconciler, error) {\n-\n- r := &Reconciler{}\n- r.Controller = commonCtrl.NewController(ctx, name, r, configStore)\n-\n- return r, nil\n+ return &Reconciler{\n+ Name: name,\n+ Version: application.GetVersion(ctx),\n+ Log: ctrl.Log.WithName(application.GetName(ctx)).WithName(\"controller\").WithValues(\"controller\", name),\n+ }, nil\n}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "controllers/goharbor/harborcluster/harborcluster.go",
"diff": "+package harborcluster\n+\n+import (\n+ \"context\"\n+ \"fmt\"\n+ \"time\"\n+\n+ \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"golang.org/x/sync/errgroup\"\n+ apierrors \"k8s.io/apimachinery/pkg/api/errors\"\n+ ctrl \"sigs.k8s.io/controller-runtime\"\n+)\n+\n+const (\n+ defaultWaitCycle = 10 * time.Second\n+)\n+\n+// Reconcile logic of the HarborCluster\n+func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\n+ ctx := context.TODO()\n+ log := r.Log.WithValues(\"resource\", req.NamespacedName)\n+\n+ // Get the harborcluster first\n+ harborcluster := &v1alpha2.HarborCluster{}\n+ if err := r.Client.Get(ctx, req.NamespacedName, harborcluster); err != nil {\n+ if apierrors.IsNotFound(err) {\n+ // The resource may have be deleted after reconcile request coming in\n+ // Reconcile is done\n+ return ctrl.Result{}, nil\n+ }\n+\n+ return ctrl.Result{}, fmt.Errorf(\"get harbor cluster CR error: %w\", err)\n+ }\n+\n+ // Check if it is being deleted\n+ if !harborcluster.ObjectMeta.DeletionTimestamp.IsZero() {\n+ log.Info(\"harbor cluster is being deleted\", \"name\", req.NamespacedName)\n+ return ctrl.Result{}, nil\n+ }\n+\n+ // For tracking status\n+ st := NewStatus(harborcluster).\n+ WithContext(ctx).\n+ WithClient(r.Client).\n+ WithLog(log)\n+\n+ defer func() {\n+ // Execute the status update operation\n+ if er := st.Update(); er != nil {\n+ sec, wait := apierrors.SuggestsClientDelay(err)\n+ if wait {\n+ res.RequeueAfter = time.Duration(sec) * time.Second\n+ r.Log.Info(\"suggest client delay\", \"seconds\", sec)\n+ }\n+\n+ er = fmt.Errorf(\"defer: update status error: %s\", er)\n+ if err != nil {\n+ err = fmt.Errorf(\"%s, upstreaming error: %w\", er.Error(), err)\n+ } else {\n+ err = er\n+ }\n+ }\n+ }()\n+\n+ // Deploy or check dependent services concurrently and fail earlier\n+ g, _ := errgroup.WithContext(ctx)\n+ g.Go(func() error {\n+ cacheStatus, err := r.CacheCtrl.Apply(ctx, harborcluster)\n+ if cacheStatus != nil {\n+ st.UpdateCache(cacheStatus.Condition)\n+ r.HarborCtrl.WithDependency(v1alpha2.ComponentCache, cacheStatus)\n+ }\n+\n+ return err\n+ })\n+\n+ g.Go(func() error {\n+ dbStatus, err := r.DatabaseCtrl.Apply(ctx, harborcluster)\n+ if dbStatus != nil {\n+ st.UpdateDatabase(dbStatus.Condition)\n+ r.HarborCtrl.WithDependency(v1alpha2.ComponentDatabase, dbStatus)\n+ }\n+\n+ return err\n+ })\n+\n+ g.Go(func() error {\n+ storageStatus, err := r.StorageCtrl.Apply(ctx, harborcluster)\n+ if storageStatus != nil {\n+ st.UpdateStorage(storageStatus.Condition)\n+ r.HarborCtrl.WithDependency(v1alpha2.ComponentStorage, storageStatus)\n+ }\n+\n+ return err\n+ })\n+\n+ if err := g.Wait(); err != nil {\n+ return ctrl.Result{}, fmt.Errorf(\"reconcile dependent services error: %w\", err)\n+ }\n+\n+ if !st.DependsReady() {\n+ r.Log.Info(\"not all the dependent services are ready\")\n+ return ctrl.Result{\n+ RequeueAfter: defaultWaitCycle,\n+ }, nil\n+ }\n+\n+ // Create Harbor instance now\n+ harborStatus, err := r.HarborCtrl.Apply(ctx, harborcluster)\n+ if harborStatus != nil {\n+ st.UpdateHarbor(harborStatus.Condition)\n+ }\n+ if err != nil {\n+ return ctrl.Result{}, fmt.Errorf(\"reconcile harbor service error: %w\", err)\n+ }\n+\n+ // Reconcile done\n+ r.Log.Info(\"reconcile is completed\")\n+ return ctrl.Result{}, nil\n+}\n"
},
{
"change_type": "DELETE",
"old_path": "controllers/goharbor/harborcluster/resources.go",
"new_path": null,
"diff": "-package harborcluster\n-\n-import (\n- \"context\"\n- \"fmt\"\n- \"time\"\n-\n- \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n- \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n- serrors \"github.com/goharbor/harbor-operator/pkg/controller/errors\"\n- \"github.com/goharbor/harbor-operator/pkg/resources\"\n- \"github.com/pkg/errors\"\n- corev1 \"k8s.io/api/core/v1\"\n- metav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n- \"sigs.k8s.io/controller-runtime/pkg/reconcile\"\n-)\n-\n-func (r *Reconciler) NewEmpty(_ context.Context) resources.Resource {\n- return &v1alpha2.HarborCluster{}\n-}\n-\n-func (r *Reconciler) AddResources(ctx context.Context, resource resources.Resource) error {\n- harborcluster, ok := resource.(*v1alpha2.HarborCluster)\n- if !ok {\n- return serrors.UnrecoverrableError(errors.Errorf(\"%+v\", resource), serrors.OperatorReason, \"unable to add resource\")\n- }\n-\n- componentToStatus := r.DefaultComponentStatus()\n- cacheStatus, err := r.CacheCtrl.Apply(ctx, harborcluster)\n- componentToStatus[v1alpha2.ComponentCache] = cacheStatus\n- if err != nil {\n- r.Log.Error(err, \"error when reconcile cache component.\")\n- updateErr := r.UpdateHarborClusterStatus(ctx, harborcluster, componentToStatus)\n- if updateErr != nil {\n- r.Log.Error(updateErr, \"update harbor cluster status\")\n- }\n- return err\n- }\n-\n- dbStatus, err := r.DatabaseCtrl.Apply(ctx, harborcluster)\n- componentToStatus[v1alpha2.ComponentDatabase] = dbStatus\n- if err != nil {\n- r.Log.Error(err, \"error when reconcile database component.\")\n- updateErr := r.UpdateHarborClusterStatus(ctx, harborcluster, componentToStatus)\n- if updateErr != nil {\n- r.Log.Error(updateErr, \"update harbor cluster status\")\n- }\n- return err\n- }\n-\n- storageStatus, err := r.StorageCtrl.Apply(ctx, harborcluster)\n- componentToStatus[v1alpha2.ComponentStorage] = storageStatus\n- if err != nil {\n- r.Log.Error(err, \"error when reconcile storage component.\")\n- updateErr := r.UpdateHarborClusterStatus(ctx, harborcluster, componentToStatus)\n- if updateErr != nil {\n- r.Log.Error(updateErr, \"update harbor cluster status\")\n- }\n- return err\n- }\n-\n- // if components is not all ready, requeue the HarborCluster\n- if !r.ComponentsAreAllReady(componentToStatus) {\n- r.Log.Info(\"components not all ready.\",\n- string(v1alpha2.ComponentCache), cacheStatus,\n- string(v1alpha2.ComponentDatabase), dbStatus,\n- string(v1alpha2.ComponentStorage), storageStatus)\n- err = r.UpdateHarborClusterStatus(ctx, harborcluster, componentToStatus)\n- return err\n- }\n-\n- // in order to set the ComponentToCRStatus, using HarborController instead of lcm.Controller\n- r.HarborCtrl.ComponentToCRStatus = componentToStatus\n- harborStatus, err := r.HarborCtrl.Apply(ctx, harborcluster)\n- if err != nil {\n- r.Log.Error(err, \"error when reconcile harbor service.\")\n- return err\n- }\n- componentToStatus[v1alpha2.ComponentHarbor] = harborStatus\n-\n- err = r.UpdateHarborClusterStatus(ctx, harborcluster, componentToStatus)\n- if err != nil {\n- r.Log.Error(err, \"error when update harbor cluster status.\")\n- return err\n- }\n- // wait to resync to update status.\n- return nil\n-}\n-\n-func (r *Reconciler) DefaultComponentStatus() map[v1alpha2.Component]*lcm.CRStatus {\n- return map[v1alpha2.Component]*lcm.CRStatus{\n- v1alpha2.ComponentCache: lcm.New(v1alpha2.CacheReady).WithStatus(corev1.ConditionUnknown),\n- v1alpha2.ComponentDatabase: lcm.New(v1alpha2.DatabaseReady).WithStatus(corev1.ConditionUnknown),\n- v1alpha2.ComponentStorage: lcm.New(v1alpha2.CacheReady).WithStatus(corev1.ConditionUnknown),\n- v1alpha2.ComponentHarbor: lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionUnknown),\n- }\n-}\n-\n-// ServicesAreAllReady check whether these components(includes cache, db, storage) are all ready.\n-func (r *Reconciler) ComponentsAreAllReady(serviceToMap map[v1alpha2.Component]*lcm.CRStatus) bool {\n- for _, status := range serviceToMap {\n- if status == nil {\n- return false\n- }\n-\n- if status.Condition.Type == v1alpha2.ServiceReady {\n- continue\n- }\n- if status.Condition.Status != corev1.ConditionTrue {\n- return false\n- }\n- }\n- return true\n-}\n-\n-// UpdateHarborClusterStatus will Update HarborCluster CR status, according the services reconcile result.\n-func (r *Reconciler) UpdateHarborClusterStatus(\n- ctx context.Context,\n- harborCluster *v1alpha2.HarborCluster,\n- componentToCRStatus map[v1alpha2.Component]*lcm.CRStatus) error {\n- for component, status := range componentToCRStatus {\n- if status == nil {\n- continue\n- }\n- var conditionType v1alpha2.HarborClusterConditionType\n- var ok bool\n- if conditionType, ok = ComponentToConditionType[component]; !ok {\n- r.Log.Info(fmt.Sprintf(\"can not found the condition type for %s\", component))\n- }\n- harborClusterCondition, defaulted := r.getHarborClusterCondition(harborCluster, conditionType)\n- r.updateHarborClusterCondition(harborClusterCondition, status)\n- if defaulted {\n- harborCluster.Status.Conditions = append(harborCluster.Status.Conditions, *harborClusterCondition)\n- }\n- }\n- r.Log.Info(\"update harbor cluster.\", \"harborcluster\", harborCluster)\n- return r.Update(ctx, harborCluster)\n-}\n-\n-// updateHarborClusterCondition update condition according to status.\n-func (r *Reconciler) updateHarborClusterCondition(condition *v1alpha2.HarborClusterCondition, crStatus *lcm.CRStatus) {\n- if condition.Type != crStatus.Condition.Type {\n- return\n- }\n-\n- if condition.Status != crStatus.Condition.Status ||\n- condition.Message != crStatus.Condition.Message ||\n- condition.Reason != crStatus.Condition.Reason {\n- condition.Status = crStatus.Condition.Status\n- condition.Message = crStatus.Condition.Message\n- condition.Reason = crStatus.Condition.Reason\n- condition.LastTransitionTime = metav1.Now()\n- }\n-}\n-\n-// getHarborClusterCondition will get HarborClusterCondition by conditionType\n-func (r *Reconciler) getHarborClusterCondition(\n- harborCluster *v1alpha2.HarborCluster,\n- conditionType v1alpha2.HarborClusterConditionType) (condition *v1alpha2.HarborClusterCondition, defaulted bool) {\n- for i := range harborCluster.Status.Conditions {\n- condition = &harborCluster.Status.Conditions[i]\n- if condition.Type == conditionType {\n- return condition, false\n- }\n- }\n- return &v1alpha2.HarborClusterCondition{\n- Type: conditionType,\n- LastTransitionTime: metav1.Now(),\n- Status: corev1.ConditionUnknown,\n- }, true\n-}\n-\n-var (\n- ComponentToConditionType = map[v1alpha2.Component]v1alpha2.HarborClusterConditionType{\n- v1alpha2.ComponentHarbor: v1alpha2.ServiceReady,\n- v1alpha2.ComponentCache: v1alpha2.CacheReady,\n- v1alpha2.ComponentStorage: v1alpha2.StorageReady,\n- v1alpha2.ComponentDatabase: v1alpha2.DatabaseReady,\n- }\n- ReconcileWaitResult = reconcile.Result{RequeueAfter: 30 * time.Second}\n-)\n"
},
{
"change_type": "DELETE",
"old_path": "controllers/goharbor/harborcluster/service.go",
"new_path": null,
"diff": "-package harborcluster\n-\n-import (\n- \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n-)\n-\n-type ServiceGetter interface {\n- // For Redis\n- Cache() lcm.Controller\n-\n- // For database\n- Database() lcm.Controller\n-\n- // For storage\n- Storage() lcm.Controller\n-\n- // For harbor itself\n- Harbor() lcm.Controller\n-}\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "controllers/goharbor/harborcluster/status.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package harborcluster\n+\n+import (\n+ \"context\"\n+ \"errors\"\n+ \"sync\"\n+ \"time\"\n+\n+ \"github.com/go-logr/logr\"\n+ goharborv1 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ corev1 \"k8s.io/api/core/v1\"\n+ apierrors \"k8s.io/apimachinery/pkg/api/errors\"\n+ \"sigs.k8s.io/controller-runtime/pkg/client\"\n+)\n+\n+// status is designed to track the status and conditions of the deploying Harbor cluster\n+type status struct {\n+ client.Client\n+ log logr.Logger\n+ context context.Context\n+\n+ cr *goharborv1.HarborCluster\n+ data *goharborv1.HarborClusterStatus\n+ sourceRevision int64\n+\n+ locker *sync.Mutex\n+}\n+\n+// NewStatus constructs a new status\n+func NewStatus(source *goharborv1.HarborCluster) *status {\n+ // New with default status and conditions\n+ s := &status{\n+ cr: source,\n+ locker: &sync.Mutex{},\n+ data: &goharborv1.HarborClusterStatus{\n+ Status: goharborv1.StatusUnknown,\n+ Revision: time.Now().UnixNano(),\n+ Conditions: make([]goharborv1.HarborClusterCondition, 0),\n+ },\n+ }\n+\n+ // Copy source status if it has been set before\n+ if source != nil && len(source.Status.Status) > 0 {\n+ s.data.Status = source.Status.Status\n+ s.data.Revision = source.Status.Revision\n+ for _, c := range source.Status.Conditions {\n+ s.data.Conditions = append(s.data.Conditions, c)\n+ }\n+\n+ s.sourceRevision = source.Status.Revision // for comparison later\n+ }\n+\n+ return s\n+}\n+\n+// Update the status\n+func (s *status) Update() error {\n+ // In case\n+ s.locker.Lock()\n+ defer s.locker.Unlock()\n+\n+ // If we need to do the status update\n+ if s.sourceRevision == s.data.Revision {\n+ // do nothing\n+ return nil\n+ }\n+\n+ s.log.Info(\"status revision changed\", \"original\", s.sourceRevision, \"current\", s.data.Revision)\n+\n+ // Validate client\n+ if err := s.validate(); err != nil {\n+ return err\n+ }\n+\n+ // Override status\n+ s.data.Status = s.overallStatus()\n+ s.cr.Status = *s.data\n+\n+ s.log.Info(\"update status of harbor cluster\", \"meta\", s.cr.ObjectMeta, \"status\", s.cr.Status)\n+\n+ if err := s.Client.Status().Update(s.context, s.cr); err != nil {\n+ if apierrors.IsConflict(err) {\n+ s.log.Error(err, \"failed to update status of harbor cluster\")\n+ return nil\n+ }\n+\n+ return err\n+ }\n+\n+ return nil\n+}\n+\n+// DependsReady judges if all the dependent services are ready\n+func (s *status) DependsReady() bool {\n+ // In case\n+ s.locker.Lock()\n+ defer s.locker.Unlock()\n+\n+ ready := 0\n+\n+ for _, c := range s.data.Conditions {\n+ if c.Type == goharborv1.CacheReady ||\n+ c.Type == goharborv1.DatabaseReady ||\n+ c.Type == goharborv1.StorageReady {\n+ if c.Status == corev1.ConditionTrue {\n+ ready++\n+ }\n+ }\n+ }\n+\n+ return ready == 3\n+}\n+\n+// For the harbor cluster CR\n+func (s *status) For(resource *goharborv1.HarborCluster) *status {\n+ s.cr = resource\n+\n+ return s\n+}\n+\n+// WithClient set client\n+func (s *status) WithClient(c client.Client) *status {\n+ s.Client = c\n+\n+ return s\n+}\n+\n+// WithContext set context\n+func (s *status) WithContext(ctx context.Context) *status {\n+ s.context = ctx\n+\n+ return s\n+}\n+\n+// WithLog set logger\n+func (s *status) WithLog(logger logr.Logger) *status {\n+ s.log = logger\n+\n+ return s\n+}\n+\n+// UpdateCache updates cache status\n+func (s *status) UpdateCache(c goharborv1.HarborClusterCondition) *status {\n+ s.updateCondition(goharborv1.CacheReady, c)\n+\n+ return s\n+}\n+\n+// UpdateDatabase updates database status\n+func (s *status) UpdateDatabase(c goharborv1.HarborClusterCondition) *status {\n+ s.updateCondition(goharborv1.DatabaseReady, c)\n+\n+ return s\n+}\n+\n+// UpdateStorage updates storage status\n+func (s *status) UpdateStorage(c goharborv1.HarborClusterCondition) *status {\n+ s.updateCondition(goharborv1.StorageReady, c)\n+\n+ return s\n+}\n+\n+// UpdateHarbor updates Harbor status\n+func (s *status) UpdateHarbor(c goharborv1.HarborClusterCondition) *status {\n+ s.updateCondition(goharborv1.ServiceReady, c)\n+\n+ return s\n+}\n+\n+func (s *status) updateCondition(ct goharborv1.HarborClusterConditionType, c goharborv1.HarborClusterCondition) {\n+ s.locker.Lock()\n+ defer s.locker.Unlock()\n+\n+ for i := range s.data.Conditions {\n+ cp := &s.data.Conditions[i]\n+\n+ if cp.Type == ct {\n+ if cp.Status != c.Status ||\n+ cp.LastTransitionTime != c.LastTransitionTime ||\n+ cp.Reason != c.Reason ||\n+ cp.Message != c.Message {\n+ // Override\n+ cp.Status = c.Status\n+ cp.LastTransitionTime = c.LastTransitionTime\n+ cp.Message = c.Message\n+ cp.Reason = c.Reason\n+\n+ s.data.Revision = time.Now().UnixNano()\n+ }\n+\n+ return\n+ }\n+ }\n+ // Append if not existing yet\n+ s.data.Conditions = append(s.data.Conditions, c)\n+ s.data.Revision = time.Now().UnixNano()\n+}\n+\n+func (s *status) overallStatus() goharborv1.ClusterStatus {\n+ var ready, unready = 0, 0\n+\n+ for _, c := range s.data.Conditions {\n+ switch c.Status {\n+ case corev1.ConditionTrue:\n+ ready++\n+ case corev1.ConditionFalse:\n+ unready++\n+ default:\n+ }\n+ }\n+\n+ // Totally ready\n+ if ready == 4 {\n+ return goharborv1.StatusHealthy\n+ }\n+\n+ // Any related components are unhealthy, cluster should be marked as unhealthy\n+ if unready > 1 {\n+ return goharborv1.StatusUnHealthy\n+ }\n+\n+ // Not all are completed yet\n+ if ready == len(s.data.Conditions) {\n+ return goharborv1.StatusCreating\n+ }\n+\n+ return goharborv1.StatusUnknown\n+}\n+\n+func (s *status) validate() error {\n+ if s.cr == nil {\n+ return errors.New(\"missing harbor cluster CR\")\n+ }\n+\n+ if s.Client == nil {\n+ return errors.New(\"client is not set\")\n+ }\n+\n+ if s.context == nil {\n+ return errors.New(\"missing context\")\n+ }\n+\n+ if s.log == nil {\n+ return errors.New(\"missing logger\")\n+ }\n+\n+ return nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -1848,6 +1848,10 @@ spec:\njsonPath: .spec.externalURL\nname: Public URL\ntype: string\n+ - description: The overall status of the Harbor cluster\n+ jsonPath: .status.status\n+ name: Status\n+ type: string\n- description: The current status of the new Harbor spec\njsonPath: .status.conditions[?(@.type==\"ServiceReady\")].status\nname: Service Ready\n@@ -3175,6 +3179,7 @@ spec:\ndescription: HarborClusterStatus defines the observed state of HarborCluster\nproperties:\nconditions:\n+ description: Conditions of each components\nitems:\ndescription: HarborClusterCondition contains details for the current condition of this pod.\nproperties:\n@@ -3199,6 +3204,16 @@ spec:\n- type\ntype: object\ntype: array\n+ revision:\n+ description: Revision of the status Use unix nano\n+ format: int64\n+ type: integer\n+ status:\n+ description: 'INSERT ADDITIONAL STATUS FIELD - define observed state of cluster Important: Run \"make\" to regenerate code after modifying this file Status indicates the overall status of the Harbor cluster Status can be \"unknown\", \"creating\", \"healthy\" and \"unhealthy\"'\n+ type: string\n+ required:\n+ - revision\n+ - status\ntype: object\ntype: object\nserved: true\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -3,6 +3,7 @@ package harbor\nimport (\n\"context\"\n\"fmt\"\n+ \"sync\"\n\"github.com/go-logr/logr\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n@@ -16,15 +17,15 @@ import (\n\"sigs.k8s.io/kustomize/kstatus/status\"\n)\n-type HarborController struct {\n+type Controller struct {\nKubeClient k8s.Client\nCtx context.Context\nLog logr.Logger\nScheme *runtime.Scheme\n- ComponentToCRStatus map[v1alpha2.Component]*lcm.CRStatus\n+ ComponentToCRStatus sync.Map\n}\n-func (harbor *HarborController) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nvar harborCR *v1alpha2.Harbor\nerr := harbor.KubeClient.Get(harbor.getHarborCRNamespacedName(harborcluster), harborCR)\nif err != nil {\n@@ -48,21 +49,26 @@ func (harbor *HarborController) Apply(ctx context.Context, harborcluster *v1alph\nreturn harborClusterCRStatus(harborCR), nil\n}\n-func (harbor *HarborController) Delete(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (harbor *Controller) Delete(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n-func (harbor *HarborController) Upgrade(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n+func (harbor *Controller) Upgrade(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\npanic(\"implement me\")\n}\n-func NewHarborController(ctx context.Context, options ...k8s.Option) *HarborController {\n+// WithDependency appends the related dependent service for deploying Harbor later\n+func (harbor *Controller) WithDependency(component v1alpha2.Component, svcCR *lcm.CRStatus) {\n+ harbor.ComponentToCRStatus.Store(component, svcCR)\n+}\n+\n+func NewHarborController(ctx context.Context, options ...k8s.Option) *Controller {\no := &k8s.CtrlOptions{}\nfor _, option := range options {\noption(o)\n}\n- return &HarborController{\n+ return &Controller{\nCtx: ctx,\nKubeClient: o.Client,\nLog: o.Log,\n@@ -71,7 +77,7 @@ func NewHarborController(ctx context.Context, options ...k8s.Option) *HarborCont\n}\n// getHarborCR will get a Harbor CR from the harborcluster definition\n-func (harbor *HarborController) getHarborCR(harborcluster *v1alpha2.HarborCluster) *v1alpha2.Harbor {\n+func (harbor *Controller) getHarborCR(harborcluster *v1alpha2.HarborCluster) *v1alpha2.Harbor {\nnamespacedName := harbor.getHarborCRNamespacedName(harborcluster)\nharborCR := &v1alpha2.Harbor{\n@@ -122,7 +128,7 @@ func harborClusterCRStatus(harbor *v1alpha2.Harbor) *lcm.CRStatus {\nreturn harborClusterCRUnknownStatus(EmptyHarborCRStatusError, \"The ready condition of harbor.goharbor.io is empty. Please wait for minutes.\")\n}\n-func (harbor *HarborController) getHarborCRNamespacedName(harborcluster *v1alpha2.HarborCluster) types.NamespacedName {\n+func (harbor *Controller) getHarborCRNamespacedName(harborcluster *v1alpha2.HarborCluster) types.NamespacedName {\nreturn types.NamespacedName{\nNamespace: harborcluster.Namespace,\nName: fmt.Sprintf(\"%s-harbor\", harborcluster.Name),\n@@ -130,7 +136,7 @@ func (harbor *HarborController) getHarborCRNamespacedName(harborcluster *v1alpha\n}\n// getCacheSpec will get a name of k8s secret which stores cache info\n-func (harbor *HarborController) getCacheSpec() *v1alpha2.ExternalRedisSpec {\n+func (harbor *Controller) getCacheSpec() *v1alpha2.ExternalRedisSpec {\np := harbor.getProperty(v1alpha2.ComponentCache, lcm.CachePropertyName)\nif p != nil {\nreturn p.Value.(*v1alpha2.ExternalRedisSpec)\n@@ -139,7 +145,7 @@ func (harbor *HarborController) getCacheSpec() *v1alpha2.ExternalRedisSpec {\n}\n// getDatabaseSecret will get a name of k8s secret which stores database info\n-func (harbor *HarborController) getDatabaseSpec() *v1alpha2.HarborDatabaseSpec {\n+func (harbor *Controller) getDatabaseSpec() *v1alpha2.HarborDatabaseSpec {\np := harbor.getProperty(v1alpha2.ComponentDatabase, lcm.DatabasePropertyName)\nif p != nil {\nreturn p.Value.(*v1alpha2.HarborDatabaseSpec)\n@@ -148,7 +154,7 @@ func (harbor *HarborController) getDatabaseSpec() *v1alpha2.HarborDatabaseSpec {\n}\n// getStorageSecretForChartMuseum will get the secret name of chart museum storage config.\n-func (harbor *HarborController) getStorageSpec() *v1alpha2.HarborStorageImageChartStorageSpec {\n+func (harbor *Controller) getStorageSpec() *v1alpha2.HarborStorageImageChartStorageSpec {\np := harbor.getProperty(v1alpha2.ComponentStorage, lcm.StoragePropertyName)\nif p != nil {\nreturn p.Value.(*v1alpha2.HarborStorageImageChartStorageSpec)\n@@ -156,13 +162,19 @@ func (harbor *HarborController) getStorageSpec() *v1alpha2.HarborStorageImageCha\nreturn nil\n}\n-func (harbor *HarborController) getProperty(component v1alpha2.Component, name string) *lcm.Property {\n- if harbor.ComponentToCRStatus == nil {\n- return nil\n- }\n- crStatus := harbor.ComponentToCRStatus[component]\n- if crStatus == nil || len(crStatus.Properties) == 0 {\n+func (harbor *Controller) getProperty(component v1alpha2.Component, name string) *lcm.Property {\n+ value, ok := harbor.ComponentToCRStatus.Load(component)\n+ if !ok {\nreturn nil\n}\n+\n+ if value != nil {\n+ if crStatus, y := value.(*lcm.CRStatus); y {\n+ if len(crStatus.Properties) != 0 {\nreturn crStatus.Properties.Get(name)\n}\n+ }\n+ }\n+\n+ return nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/scheme/scheme.go",
"new_path": "pkg/scheme/scheme.go",
"diff": "@@ -4,6 +4,7 @@ import (\n\"context\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ minio \"github.com/goharbor/harbor-operator/pkg/cluster/controllers/storage/minio/api/v1\"\ncertv1 \"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2\"\n\"github.com/pkg/errors\"\n\"k8s.io/apimachinery/pkg/runtime\"\n@@ -28,6 +29,11 @@ func New(ctx context.Context) (*runtime.Scheme, error) {\nreturn nil, errors.Wrap(err, \"unable to configure Harbor scheme\")\n}\n+ err = minio.AddToScheme(scheme)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"unable to configure minio scheme\")\n+ }\n+\n// +kubebuilder:scaffold:scheme\nreturn scheme, nil\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
refactor(reconciler): update harbor cluster ctrl
- define a status object to handle the status updates
- add fields to the HarborClusterStatus object
- concurently provisioning/checking the dependent services
- update the overall cluster reconciler logic
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
01.12.2020 09:17:54
| -28,800
|
89e9ed6f0596979bffcb49844e8d91da987e484b
|
feat(worker):implement go func group for concurrent funcs
fix(crd):add subresource status
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"diff": "@@ -203,6 +203,7 @@ const (\n)\n// +kubebuilder:object:root=true\n+// +kubebuilder:subresource:status\n// +kubebuilder:printcolumn:name=\"Public URL\",type=string,JSONPath=`.spec.externalURL`,description=\"The public URL to the Harbor application\",priority=0\n// +kubebuilder:printcolumn:name=\"Status\", type=string,JSONPath=`.status.status`,description=\"The overall status of the Harbor cluster\",priority=0\n// +kubebuilder:printcolumn:name=\"Service Ready\", type=string,JSONPath=`.status.conditions[?(@.type==\"ServiceReady\")].status`,description=\"The current status of the new Harbor spec\",priority=10\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster.go",
"diff": "@@ -6,7 +6,8 @@ import (\n\"time\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n- \"golang.org/x/sync/errgroup\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/gos\"\n+\napierrors \"k8s.io/apimachinery/pkg/api/errors\"\nctrl \"sigs.k8s.io/controller-runtime\"\n)\n@@ -63,9 +64,9 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\n}()\n// Deploy or check dependent services concurrently and fail earlier\n- g, _ := errgroup.WithContext(ctx)\n+ g, gtx := gos.NewGroup(ctx)\ng.Go(func() error {\n- cacheStatus, err := r.CacheCtrl.Apply(ctx, harborcluster)\n+ cacheStatus, err := r.CacheCtrl.Apply(gtx, harborcluster)\nif cacheStatus != nil {\nst.UpdateCache(cacheStatus.Condition)\nr.HarborCtrl.WithDependency(v1alpha2.ComponentCache, cacheStatus)\n@@ -75,7 +76,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\n})\ng.Go(func() error {\n- dbStatus, err := r.DatabaseCtrl.Apply(ctx, harborcluster)\n+ dbStatus, err := r.DatabaseCtrl.Apply(gtx, harborcluster)\nif dbStatus != nil {\nst.UpdateDatabase(dbStatus.Condition)\nr.HarborCtrl.WithDependency(v1alpha2.ComponentDatabase, dbStatus)\n@@ -85,7 +86,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\n})\ng.Go(func() error {\n- storageStatus, err := r.StorageCtrl.Apply(ctx, harborcluster)\n+ storageStatus, err := r.StorageCtrl.Apply(gtx, harborcluster)\nif storageStatus != nil {\nst.UpdateStorage(storageStatus.Condition)\nr.HarborCtrl.WithDependency(v1alpha2.ComponentStorage, storageStatus)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/status.go",
"new_path": "controllers/goharbor/harborcluster/status.go",
"diff": "@@ -90,8 +90,6 @@ func (s *status) Update() error {\ns.data.Status = s.overallStatus()\ns.cr.Status = *s.data\n- s.log.Info(\"update status of harbor cluster\", \"meta\", s.cr.ObjectMeta, \"status\", s.cr.Status)\n-\nif err := s.Client.Status().Update(s.context, s.cr); err != nil {\nif apierrors.IsConflict(err) {\ns.log.Error(err, \"failed to update status of harbor cluster\")\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -3218,7 +3218,8 @@ spec:\ntype: object\nserved: true\nstorage: true\n- subresources: {}\n+ subresources:\n+ status: {}\nstatus:\nacceptedNames:\nkind: \"\"\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cluster/gos/group.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package gos\n+\n+import (\n+ \"context\"\n+ \"fmt\"\n+ \"strings\"\n+ \"sync\"\n+)\n+\n+// Group for running goroutines\n+type Group struct {\n+ wait sync.WaitGroup\n+ cancel context.CancelFunc\n+\n+ // Collect all the errors\n+ errors []error\n+ locker *sync.Mutex\n+}\n+\n+// NewGroup creates a new group\n+func NewGroup(ctx context.Context) (*Group, context.Context) {\n+ gtx, cancel := context.WithCancel(ctx)\n+\n+ return &Group{\n+ cancel: cancel,\n+ errors: make([]error, 0),\n+ locker: &sync.Mutex{},\n+ }, gtx\n+}\n+\n+// Go to run a func\n+func (g *Group) Go(f func() error) {\n+ g.wait.Add(1)\n+\n+ go func() {\n+ defer g.wait.Done()\n+\n+ // Run and handle error\n+ if err := f(); err != nil {\n+ g.locker.Lock()\n+ defer g.locker.Unlock()\n+\n+ g.errors = append(g.errors, err)\n+ }\n+ }()\n+}\n+\n+// Wait until all the go functions are returned\n+// If errors occurred, they'll be combined with \":\" and returned\n+func (g *Group) Wait() error {\n+ g.wait.Wait()\n+\n+ defer func() {\n+ if g.cancel != nil {\n+ // Send signals to the downstream components\n+ g.cancel()\n+ }\n+ }()\n+\n+ errTexts := make([]string, 0)\n+ for _, e := range g.errors {\n+ errTexts = append(errTexts, e.Error())\n+ }\n+\n+ if len(errTexts) > 0 {\n+ return fmt.Errorf(\"gos.Group error: %s\", strings.Join(errTexts, \":\"))\n+ }\n+\n+ return nil\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(worker):implement go func group for concurrent funcs
Signed-off-by: Steven Zou <szou@vmware.com>
fix(crd):add subresource status
|
254,875
|
30.11.2020 18:44:35
| -28,800
|
98cbf1a249ac18864bf5f603967eea9a51dac17b
|
fix(trivy) failed pull image
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/deployments.go",
"new_path": "controllers/goharbor/core/deployments.go",
"diff": "@@ -119,9 +119,16 @@ func (r *Reconciler) GetDeployment(ctx context.Context, core *goharborv1alpha2.C\nscheme = \"https\"\n}\n+ host := r.NormalizeName(ctx, core.GetName())\n+ if core.Spec.Components.TLS.Enabled() {\n+ host += \":443\"\n+ } else {\n+ host += \":80\"\n+ }\n+\ncoreLocalURL := (&url.URL{\nScheme: scheme,\n- Host: r.NormalizeName(ctx, core.GetName()),\n+ Host: host,\n}).String()\n// Only one host is supported\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(trivy) failed pull image
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,893
|
01.12.2020 15:17:19
| -28,800
|
fe746f49d13943afa5f2ca87c5607c871c4ab1e8
|
fix(webhook):reduce duplicated code in webhook
use lib func field.Required and field.Required to instead of field.Invalid
update role and role-bindings of harborcluster ctrl
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_webhook.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_webhook.go",
"diff": "@@ -16,6 +16,7 @@ package v1alpha2\nimport (\n\"context\"\n+ \"fmt\"\napierrors \"k8s.io/apimachinery/pkg/api/errors\"\n\"k8s.io/apimachinery/pkg/runtime\"\n@@ -82,6 +83,9 @@ func (hc *HarborCluster) validate() error {\n}\nfunc (hc *HarborCluster) validateStorage() *field.Error {\n+ // in cluster storage has high priority\n+ fp := field.NewPath(\"spec\").Child(\"inClusterStorage\")\n+\n// Storage\n// External is not configured\nif err := hc.Spec.ImageChartStorage.Validate(); err != nil {\n@@ -90,22 +94,13 @@ func (hc *HarborCluster) validateStorage() *field.Error {\n// And in-cluster minIO is not configured\nif hc.Spec.InClusterStorage == nil {\n// Invalid and not acceptable\n- return field.Invalid(\n- field.NewPath(\"spec\").\n- Child(\"imageChartStorage\", \"inClusterStorage\"),\n- hc.Spec.ImageChartStorage,\n- \"both storage and in-cluster storage are not correctly configured\",\n- )\n+ return required(fp)\n}\n} else {\nif hc.Spec.InClusterStorage != nil {\n// Both are configured, conflict\n- return field.Invalid(\n- field.NewPath(\"spec\").\n- Child(\"imageChartStorage\", \"inClusterStorage\"),\n- hc.Spec.InClusterStorage,\n- \"conflicts: both storage and in-cluster storage are configured, only one is required to set\",\n- )\n+ p := field.NewPath(\"spec\").Child(\"imageChartStorage\")\n+ return forbidden(fp, p)\n}\n}\n@@ -113,52 +108,52 @@ func (hc *HarborCluster) validateStorage() *field.Error {\n}\nfunc (hc *HarborCluster) validateDatabase() *field.Error {\n+ // in cluster database has high priority\n+ fp := field.NewPath(\"spec\").Child(\"database\", \"inClusterDatabase\")\n+\n// Database\n// External is not configured\n// And also in-cluster psql is not specified\nif hc.Spec.Database == nil && hc.Spec.InClusterDatabase == nil {\n// Invalid and not acceptable\n- return field.Invalid(\n- field.NewPath(\"spec\").Child(\"database\", \"inClusterDatabase\"),\n- hc.Spec.Database,\n- \"both database or in-cluster database are not correctly configured\",\n- )\n+ return required(fp)\n}\n// Both are configured then conflict\nif hc.Spec.Database != nil && hc.Spec.InClusterDatabase != nil {\n+ p := field.NewPath(\"spec\").Child(\"database\")\n// Conflict and not acceptable\n- return field.Invalid(\n- field.NewPath(\"spec\").Child(\"database\", \"inClusterDatabase\"),\n- hc.Spec.InClusterDatabase,\n- \"conflicts: both database or in-cluster database are configured, only one is required to set\",\n- )\n+ return forbidden(fp, p)\n}\nreturn nil\n}\nfunc (hc *HarborCluster) validateCache() *field.Error {\n+ // in cluster cache has high priority\n+ fp := field.NewPath(\"spec\").Child(\"inClusterCache\")\n+\n// Cache\n// External is not configured\nif hc.Spec.Redis == nil && hc.Spec.InClusterCache == nil {\n// Invalid and not acceptable\n- return field.Invalid(\n- field.NewPath(\"spec\").Child(\"redis\", \"inClusterCache\"),\n- hc.Spec.Redis,\n- \"both redis or in-cluster redis are not correctly configured\",\n- )\n+ return required(fp)\n}\n// Both are configured and then conflict\nif hc.Spec.Redis != nil && hc.Spec.InClusterCache != nil {\n+ p := field.NewPath(\"spec\").Child(\"redis\")\n// Conflict and not acceptable\n- return field.Invalid(\n- field.NewPath(\"spec\").Child(\"redis\", \"inClusterCache\"),\n- hc.Spec.InClusterCache,\n- \"conflicts: both redis or in-cluster redis are configured, only one is required to set\",\n- )\n+ return forbidden(fp, p)\n}\nreturn nil\n}\n+\n+func forbidden(mainPath *field.Path, conflictPath *field.Path) *field.Error {\n+ return field.Forbidden(conflictPath, fmt.Sprintf(\"conflicts: %s should not be configured as %s has been configured already\", conflictPath.String(), mainPath.String()))\n+}\n+\n+func required(mainPath *field.Path) *field.Error {\n+ return field.Required(mainPath, fmt.Sprintf(\"%s should be configured\", mainPath.String()))\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"new_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"diff": "@@ -44,6 +44,8 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=acid.zalan.do,resources=postgresqls/status,verbs=get;update;patch\n// +kubebuilder:rbac:groups=databases.spotahome.com,resources=redisfailovers,verbs=*\n// +kubebuilder:rbac:groups=minio.min.io,resources=*,verbs=*\n+// +kubebuilder:rbac:groups=\"\",resources=pods,verbs=get;list;watch;create;update;patch;delete\n+// +kubebuilder:rbac:groups=apps,resources=statefulsets;deployments,verbs=get;list;watch;create;update;patch;delete\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\nr.Client = mgr.GetClient()\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster.go",
"diff": "@@ -69,6 +69,9 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\ncacheStatus, err := r.CacheCtrl.Apply(gtx, harborcluster)\nif cacheStatus != nil {\nst.UpdateCache(cacheStatus.Condition)\n+ }\n+\n+ if err == nil {\nr.HarborCtrl.WithDependency(v1alpha2.ComponentCache, cacheStatus)\n}\n@@ -79,6 +82,9 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\ndbStatus, err := r.DatabaseCtrl.Apply(gtx, harborcluster)\nif dbStatus != nil {\nst.UpdateDatabase(dbStatus.Condition)\n+ }\n+\n+ if err == nil {\nr.HarborCtrl.WithDependency(v1alpha2.ComponentDatabase, dbStatus)\n}\n@@ -89,6 +95,9 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\nstorageStatus, err := r.StorageCtrl.Apply(gtx, harborcluster)\nif storageStatus != nil {\nst.UpdateStorage(storageStatus.Condition)\n+ }\n+\n+ if err == nil {\nr.HarborCtrl.WithDependency(v1alpha2.ComponentStorage, storageStatus)\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(webhook):reduce duplicated code in webhook
- use lib func field.Required and field.Required to instead of field.Invalid
- update role and role-bindings of harborcluster ctrl
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
01.12.2020 15:42:31
| -28,800
|
8183495691510e7e47657eefa6b46b57837e358f
|
fix(webhook):update harbor cr webhook
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harbor_webhook.go",
"new_path": "apis/goharbor.io/v1alpha2/harbor_webhook.go",
"diff": "@@ -61,11 +61,11 @@ func (h *Harbor) Validate() error {\n}\nif h.Spec.Database == nil {\n- allErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"database\"), h.Spec.Database, \"field is required\"))\n+ allErrs = append(allErrs, required(field.NewPath(\"spec\").Child(\"database\")))\n}\nif h.Spec.Redis == nil {\n- allErrs = append(allErrs, field.Invalid(field.NewPath(\"spec\").Child(\"redis\"), h.Spec.Redis, \"field is required\"))\n+ allErrs = append(allErrs, required(field.NewPath(\"spec\").Child(\"redis\")))\n}\nif len(allErrs) == 0 {\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -14352,6 +14352,18 @@ rules:\n- patch\n- update\n- watch\n+- apiGroups:\n+ - \"\"\n+ resources:\n+ - pods\n+ verbs:\n+ - create\n+ - delete\n+ - get\n+ - list\n+ - patch\n+ - update\n+ - watch\n- apiGroups:\n- \"\"\nresources:\n@@ -14398,6 +14410,19 @@ rules:\n- patch\n- update\n- watch\n+- apiGroups:\n+ - apps\n+ resources:\n+ - deployments\n+ - statefulsets\n+ verbs:\n+ - create\n+ - delete\n+ - get\n+ - list\n+ - patch\n+ - update\n+ - watch\n- apiGroups:\n- cert-manager.io\nresources:\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(webhook):update harbor cr webhook
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,875
|
01.12.2020 18:01:50
| -28,800
|
95c7dfd450175eb931ff8560cebb2dc1d7a39805
|
sync generate files
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -205,7 +205,7 @@ dist/harbor-operator_linux_amd64/manager:\n# Run go linters\n.PHONY: go-lint\ngo-lint: golangci-lint vet go-generate\n- $(GOLANGCI_LINT) run --verbose\n+ $(GOLANGCI_LINT) run --verbose --max-same-issues 0 --sort-results -D wrapcheck -D exhaustivestruct -D errorlint -D goerr113 -D gomnd -D nestif -D funlen -D gosec\n# Run go fmt against code\n.PHONY: fmt\n@@ -536,8 +536,8 @@ endif\n.PHONY: golangci-lint\ngolangci-lint:\nifeq (, $(shell which golangci-lint))\n- # https://github.com/golangci/golangci-lint#install\n- curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN)/bin v1.33.0\n+ curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b $(GOBIN) v1.33.0\n+GOLANGCI_LINT=$(GOBIN)/golangci-lint\nelse\nGOLANGCI_LINT=$(shell which golangci-lint)\nendif\n"
},
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/templates/clusterrole.yaml",
"new_path": "charts/harbor-operator/templates/clusterrole.yaml",
"diff": "@@ -33,6 +33,18 @@ rules:\n- patch\n- update\n- watch\n+- apiGroups:\n+ - \"\"\n+ resources:\n+ - pods\n+ verbs:\n+ - create\n+ - delete\n+ - get\n+ - list\n+ - patch\n+ - update\n+ - watch\n- apiGroups:\n- \"\"\nresources:\n@@ -46,22 +58,31 @@ rules:\n- update\n- watch\n- apiGroups:\n- - apps\n+ - acid.zalan.do\nresources:\n- - deployments\n+ - operatorconfigurations\n+ - postgresqls\nverbs:\n- create\n- delete\n+ - deletecollection\n- get\n- list\n- patch\n- update\n- watch\n- apiGroups:\n- - cert-manager.io\n+ - acid.zalan.do\nresources:\n- - certificates\n- - issuers\n+ - postgresqls/status\n+ verbs:\n+ - get\n+ - patch\n+ - update\n+- apiGroups:\n+ - apps\n+ resources:\n+ - deployments\nverbs:\n- create\n- delete\n@@ -71,9 +92,10 @@ rules:\n- update\n- watch\n- apiGroups:\n- - goharbor.goharbor.io\n+ - apps\nresources:\n- - harborclusters\n+ - deployments\n+ - statefulsets\nverbs:\n- create\n- delete\n@@ -83,13 +105,24 @@ rules:\n- update\n- watch\n- apiGroups:\n- - goharbor.goharbor.io\n+ - cert-manager.io\nresources:\n- - harborclusters/status\n+ - certificates\n+ - issuers\nverbs:\n+ - create\n+ - delete\n- get\n+ - list\n- patch\n- update\n+ - watch\n+- apiGroups:\n+ - databases.spotahome.com\n+ resources:\n+ - redisfailovers\n+ verbs:\n+ - '*'\n- apiGroups:\n- goharbor.io\nresources:\n@@ -142,6 +175,26 @@ rules:\n- get\n- patch\n- update\n+- apiGroups:\n+ - goharbor.io\n+ resources:\n+ - harborclusters\n+ verbs:\n+ - create\n+ - delete\n+ - get\n+ - list\n+ - patch\n+ - update\n+ - watch\n+- apiGroups:\n+ - goharbor.io\n+ resources:\n+ - harborclusters/status\n+ verbs:\n+ - get\n+ - patch\n+ - update\n- apiGroups:\n- goharbor.io\nresources:\n@@ -254,6 +307,12 @@ rules:\n- get\n- patch\n- update\n+- apiGroups:\n+ - minio.min.io\n+ resources:\n+ - '*'\n+ verbs:\n+ - '*'\n- apiGroups:\n- networking.k8s.io\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/templates/deployment.yaml",
"new_path": "charts/harbor-operator/templates/deployment.yaml",
"diff": "{{- /* Code generated by make. DO NOT EDIT. */ -}}\n-apiVersion: apps/v1\n-kind: Deployment\n-metadata:\n- labels: {{- include \"chart.labels\" . | nindent 4 }}\n- name: '{{ include \"chart.fullname\" . }}-controller-manager'\n- namespace: {{ .Release.Namespace | quote }}\n-spec:\n- selector:\n- matchLabels: {{- include \"chart.selectorLabels\" . | nindent 6 }}\n- template:\n- metadata:\n- annotations: {{- toYaml .Values.podAnnotations | nindent 8 }}\n- labels: {{- include \"chart.selectorLabels\" . | nindent 8 }}\n- spec:\n- affinity: {{- toYaml .Values.affinity | nindent 8 }}\n- containers:\n- - args:\n- - --enable-leader-election\n- - --metrics-addr=127.0.0.1:8080\n- command:\n- - /manager\n- env:\n- - name: CONFIGURATION_FROM\n- value: 'env:'\n- - name: CLASSNAME\n- value: {{ .Values.harborClass | quote }}\n- - name: LOG_LEVEL\n- value: {{ .Values.logLevel | quote }}\n- - name: NAMESPACE\n- valueFrom:\n- fieldRef:\n- fieldPath: metadata.namespace\n- image: '{{.Values.image.repository}}:{{.Values.image.tag|default .Chart.AppVersion}}'\n- imagePullPolicy: {{ .Values.image.pullPolicy | quote }}\n- livenessProbe:\n- httpGet:\n- path: /healthz\n- port: ready\n- name: manager\n- ports:\n- - containerPort: 9443\n- name: webhook-server\n- protocol: TCP\n- - containerPort: 8080\n- name: metrics\n- protocol: TCP\n- - containerPort: 5000\n- name: ready\n- protocol: TCP\n- readinessProbe:\n- httpGet:\n- path: /readyz\n- port: ready\n- resources: {{- toYaml .Values.resources | nindent 10 }}\n- volumeMounts:\n- - mountPath: /tmp/k8s-webhook-server/serving-certs\n- name: cert\n- readOnly: true\n- - mountPath: /etc/harbor-operator\n- name: configuration-templates\n- readOnly: true\n- nodeSelector: {{- toYaml .Values.nodeSelector | nindent 8 }}\n- securityContext: {{- toYaml .Values.podSecurityContext | nindent 8 }}\n- serviceAccountName: {{ include \"chart.serviceAccountName\" . | quote }}\n- terminationGracePeriodSeconds: 10\n- tolerations: {{- toYaml .Values.tolerations | nindent 8 }}\n- volumes:\n- - name: cert\n- secret:\n- defaultMode: 420\n- secretName: '{{ include \"chart.fullname\" . }}-certificate'\n- - configMap:\n- name: '{{ include \"chart.fullname\" . }}-config-template'\n- name: configuration-templates\n{{- if not .Values.autoscaling.enabled }}\nreplicas: {{ .Values.replicaCount }}\n{{- end }}\n"
},
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/templates/validatingwebhookconfiguration.yaml",
"new_path": "charts/harbor-operator/templates/validatingwebhookconfiguration.yaml",
"diff": "@@ -63,6 +63,24 @@ webhooks:\n- UPDATE\nresources:\n- registries\n+- clientConfig:\n+ caBundle: Cg==\n+ service:\n+ name: '{{ include \"chart.fullname\" . }}-webhook-service'\n+ namespace: {{ .Release.Namespace | quote }}\n+ path: /validate-goharbor-io-v1alpha2-harborcluster\n+ failurePolicy: Fail\n+ name: vharborcluster.kb.io\n+ rules:\n+ - apiGroups:\n+ - goharbor.io\n+ apiVersions:\n+ - v1alpha2\n+ operations:\n+ - CREATE\n+ - UPDATE\n+ resources:\n+ - harborclusters\n- clientConfig:\ncaBundle: Cg==\nservice:\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
sync generate files
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,870
|
01.12.2020 22:00:58
| -28,800
|
6e2122fcf8c9554cd1e5663843850fa1b5bd8bab
|
fix(database) fix postgres health check ping operation was canceled
fix postgres health check ping operation was canceled
fix
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/postgresql.go",
"new_path": "pkg/cluster/controllers/database/postgresql.go",
"diff": "@@ -73,7 +73,7 @@ func (p *PostgreSQLController) Apply(ctx context.Context, harborcluster *v1alpha\nreturn databaseNotReadyStatus(CheckDatabaseHealthError, err.Error()), err\n}\n- return p.Readiness()\n+ return p.Readiness(ctx)\n}\nfunc (p *PostgreSQLController) Delete(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/readiness.go",
"new_path": "pkg/cluster/controllers/database/readiness.go",
"diff": "package database\nimport (\n+ \"context\"\n\"errors\"\n\"fmt\"\n@@ -41,7 +42,7 @@ const (\n// - create postgre connection pool\n// - ping postgre server\n// - return postgre properties if postgre has available\n-func (p *PostgreSQLController) Readiness() (*lcm.CRStatus, error) {\n+func (p *PostgreSQLController) Readiness(ctx context.Context) (*lcm.CRStatus, error) {\nvar (\nconn *Connect\nclient *pgx.Conn\n@@ -50,14 +51,14 @@ func (p *PostgreSQLController) Readiness() (*lcm.CRStatus, error) {\nname := p.HarborCluster.Name\n- conn, client, err = p.GetInClusterDatabaseInfo()\n+ conn, client, err = p.GetInClusterDatabaseInfo(ctx)\nif err != nil {\nreturn nil, err\n}\n- defer client.Close(p.Ctx)\n+ defer client.Close(ctx)\n- if err := client.Ping(p.Ctx); err != nil {\n+ if err := client.Ping(ctx); err != nil {\np.Log.Error(err, \"Fail to check Database.\",\n\"namespace\", p.HarborCluster.Namespace,\n\"name\", p.HarborCluster.Name)\n@@ -136,7 +137,7 @@ func (p *PostgreSQLController) DeployComponentSecret(conn *Connect, secretName s\n}\n// GetInClusterDatabaseInfo returns inCluster database connection client\n-func (p *PostgreSQLController) GetInClusterDatabaseInfo() (*Connect, *pgx.Conn, error) {\n+func (p *PostgreSQLController) GetInClusterDatabaseInfo(ctx context.Context) (*Connect, *pgx.Conn, error) {\nvar (\nconnect *Connect\nclient *pgx.Conn\n@@ -153,8 +154,9 @@ func (p *PostgreSQLController) GetInClusterDatabaseInfo() (*Connect, *pgx.Conn,\n}\nurl := connect.GenDatabaseUrl()\n+ fmt.Println(url)\n- client, err = pgx.Connect(p.Ctx, url)\n+ client, err = pgx.Connect(ctx, url)\nif err != nil {\np.Log.Error(err, \"Unable to connect to database\")\nreturn connect, client, err\n@@ -180,7 +182,7 @@ func (p *PostgreSQLController) GetInClusterDatabaseConn(name, pw string) (*Conne\n}\nfunc GenInClusterPasswordSecretName(teamID, name string) string {\n- return fmt.Sprintf(\"postgres.%s-%s.credentials\", teamID, name)\n+ return fmt.Sprintf(\"postgres.%s-%s.credentials.postgresql.acid.zalan.do\", teamID, name)\n}\n// GetInClusterHost returns the Database master pod ip or service name\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(database) fix postgres health check ping operation was canceled
fix postgres health check ping operation was canceled
fix #225
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,870
|
02.12.2020 11:34:27
| -28,800
|
9d8e3dcd0b672cc3f9265d0297e34fffb59a1dc5
|
fix(database) fix golint issue
fix golint issue
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/readiness.go",
"new_path": "pkg/cluster/controllers/database/readiness.go",
"diff": "@@ -39,7 +39,7 @@ const (\n// It does:\n// - create postgre connection pool\n// - ping postgre server\n-// - return postgre properties if postgre has available\n+// - return postgre properties if postgre has available.\nfunc (p *PostgreSQLController) Readiness(ctx context.Context) (*lcm.CRStatus, error) {\nvar (\nconn *Connect\n@@ -133,7 +133,7 @@ func (p *PostgreSQLController) DeployComponentSecret(conn *Connect, secretName s\nreturn nil\n}\n-// GetInClusterDatabaseInfo returns inCluster database connection client\n+// GetInClusterDatabaseInfo returns inCluster database connection client.\nfunc (p *PostgreSQLController) GetInClusterDatabaseInfo(ctx context.Context) (*Connect, *pgx.Conn, error) {\nvar (\nconnect *Connect\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(database) fix golint issue
fix golint issue
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,875
|
02.12.2020 15:50:49
| -28,800
|
ea6e7f3b6510a65a6285e674fe6d794d1bfcd10e
|
fix release docker for tag
|
[
{
"change_type": "DELETE",
"old_path": ".github/workflows/release-docker.yml",
"new_path": null,
"diff": "-name: Release Image\n-\n-on:\n- release:\n- types:\n- - created\n- - published\n-\n-jobs:\n- docker:\n- runs-on: ubuntu-latest\n- steps:\n- - uses: actions/checkout@v2\n- # opspresso/action-docker use body of ./target/TAG_NAME as docker tag\n- # https://github.com/opspresso/action-docker#common-env\n- - name: Build manager\n- run: |\n- mkdir ./target\n- echo -n \"${GITHUB_REF##refs/*/}\" > ./target/TAG_NAME\n- make dist/harbor-operator_linux_amd64/manager\n- - name: Docker Build & Push to Docker Hub\n- uses: opspresso/action-docker@master\n- with:\n- args: --docker\n- env:\n- BUILD_PATH: dist/harbor-operator_linux_amd64\n- DOCKERFILE: Dockerfile\n- USERNAME: '${{ secrets.DOCKER_USER }}'\n- PASSWORD: '${{ secrets.DOCKER_TOKEN }}'\n- IMAGE_NAME: goharbor/harbor-operator\n- LATEST: 'false'\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": ".github/workflows/release.yml",
"new_path": ".github/workflows/release.yml",
"diff": "@@ -39,3 +39,23 @@ jobs:\nGITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\nGPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}\n+ docker:\n+ runs-on: ubuntu-latest\n+ steps:\n+ - uses: actions/checkout@v2\n+ - name: Build manager\n+ run: |\n+ mkdir ./target\n+ echo -n \"${GITHUB_REF##refs/*/}\" > ./target/TAG_NAME\n+ make dist/harbor-operator_linux_amd64/manager\n+ - name: Docker Build & Push to Docker Hub\n+ uses: opspresso/action-docker@master\n+ with:\n+ args: --docker\n+ env:\n+ BUILD_PATH: dist/harbor-operator_linux_amd64\n+ DOCKERFILE: Dockerfile\n+ USERNAME: '${{ secrets.DOCKER_USER }}'\n+ PASSWORD: '${{ secrets.DOCKER_TOKEN }}'\n+ IMAGE_NAME: goharbor/harbor-operator\n+ LATEST: 'false'\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix release docker for tag
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,893
|
02.12.2020 15:05:16
| -28,800
|
457647e231be30c3b90550571128c2de0bda4d26
|
fix(controller):use context from cluster reconciler
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"new_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"diff": "@@ -70,12 +70,10 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nr.StorageCtrl = storage.NewMinIOController(ctx,\nk8s.WithLog(r.Log.WithName(\"storage\")),\nk8s.WithScheme(mgr.GetScheme()),\n- k8s.WithDClient(k8s.WrapDClient(dClient)),\nk8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())))\nr.HarborCtrl = harbor.NewHarborController(ctx,\nk8s.WithLog(r.Log.WithName(\"harbor\")),\nk8s.WithScheme(mgr.GetScheme()),\n- k8s.WithDClient(k8s.WrapDClient(dClient)),\nk8s.WithClient(k8s.WrapClient(ctx, mgr.GetClient())))\nreturn ctrl.NewControllerManagedBy(mgr).\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/redis.go",
"new_path": "pkg/cluster/controllers/cache/redis.go",
"diff": "@@ -29,18 +29,19 @@ func NewRedisController(ctx context.Context, opts ...k8s.Option) lcm.Controller\nreturn &RedisController{\nCtx: ctx,\n- Client: ctrlOpts.Client,\nDClient: ctrlOpts.DClient,\n+ Client: ctrlOpts.Client,\nLog: ctrlOpts.Log,\nScheme: ctrlOpts.Scheme,\n+ ResourceManager: NewResourceManager(),\n}\n}\n// RedisController implements lcm.Controller interface.\ntype RedisController struct {\nCtx context.Context\n- Client k8s.Client\nDClient k8s.DClient\n+ Client k8s.Client\nRecorder record.EventRecorder\nLog logr.Logger\nScheme *runtime.Scheme\n@@ -55,9 +56,10 @@ func (rc *RedisController) HealthChecker() lcm.HealthChecker {\n// Apply creates/updates/scales the resources, like kubernetes apply operation.\nfunc (rc *RedisController) Apply(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n- rc.Client.WithContext(ctx)\nrc.DClient.WithContext(ctx)\n- rc.ResourceManager = &RedisResourceManager{cluster: cluster}\n+ rc.Client.WithContext(ctx)\n+\n+ rc.ResourceManager.WithCluster(cluster)\ncrdClient := rc.DClient.WithResource(redisFailoversGVR).WithNamespace(cluster.Namespace)\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/resource_manager.go",
"new_path": "pkg/cluster/controllers/cache/resource_manager.go",
"diff": "@@ -15,6 +15,8 @@ import (\n// ResourceManager defines the common interface of resources.\ntype ResourceManager interface {\nResourceGetter\n+ // With the specified cluster\n+ WithCluster(cluster *v1alpha2.HarborCluster) ResourceManager\n}\n// ResourceGetter gets resources.\n@@ -31,9 +33,9 @@ type ResourceGetter interface {\nGetStorageSize() string\n}\n-var _ ResourceManager = &RedisResourceManager{}\n+var _ ResourceManager = &redisResourceManager{}\n-type RedisResourceManager struct {\n+type redisResourceManager struct {\ncluster *v1alpha2.HarborCluster\n}\n@@ -48,8 +50,20 @@ const (\nlabelApp = \"goharbor.io/harbor-cluster\"\n)\n+// NewResourceManager constructs a new cache resource manager.\n+func NewResourceManager() ResourceManager {\n+ return &redisResourceManager{}\n+}\n+\n+// WithCluster get resources based on the specified cluster spec.\n+func (rm *redisResourceManager) WithCluster(cluster *v1alpha2.HarborCluster) ResourceManager {\n+ rm.cluster = cluster\n+\n+ return rm\n+}\n+\n// GetCacheCR gets cache cr instance.\n-func (rm *RedisResourceManager) GetCacheCR() runtime.Object {\n+func (rm *redisResourceManager) GetCacheCR() runtime.Object {\nresource := rm.GetResourceList()\npvc, _ := GenerateStoragePVC(rm.cluster.Name, rm.GetStorageSize(), rm.GetLabels())\n@@ -87,17 +101,17 @@ func (rm *RedisResourceManager) GetCacheCR() runtime.Object {\n}\n// GetCacheCRName gets cache cr name.\n-func (rm *RedisResourceManager) GetCacheCRName() string {\n+func (rm *redisResourceManager) GetCacheCRName() string {\nreturn fmt.Sprintf(\"%s-%s\", rm.cluster.Name, \"redis\")\n}\n// GetServiceName gets service name.\n-func (rm *RedisResourceManager) GetServiceName() string {\n+func (rm *redisResourceManager) GetServiceName() string {\nreturn rm.GetCacheCRName()\n}\n// GetService gets service.\n-func (rm *RedisResourceManager) GetService() *corev1.Service {\n+func (rm *redisResourceManager) GetService() *corev1.Service {\nname := rm.GetServiceName()\nreturn &corev1.Service{\n@@ -130,12 +144,12 @@ func (rm *RedisResourceManager) GetService() *corev1.Service {\n}\n// GetSecretName gets secret name.\n-func (rm *RedisResourceManager) GetSecretName() string {\n+func (rm *redisResourceManager) GetSecretName() string {\nreturn rm.GetCacheCRName()\n}\n// GetSecret gets redis secret.\n-func (rm *RedisResourceManager) GetSecret() *corev1.Secret {\n+func (rm *redisResourceManager) GetSecret() *corev1.Secret {\nname := rm.GetSecretName()\npassStr := common.RandomString(8, \"a\")\n@@ -153,7 +167,7 @@ func (rm *RedisResourceManager) GetSecret() *corev1.Secret {\n}\n// GetLabels gets labels merged from cluster labels.\n-func (rm *RedisResourceManager) GetLabels() map[string]string {\n+func (rm *redisResourceManager) GetLabels() map[string]string {\ndynLabels := map[string]string{\n\"app.kubernetes.io/name\": \"cache\",\n\"app.kubernetes.io/instance\": rm.cluster.Namespace,\n@@ -164,7 +178,7 @@ func (rm *RedisResourceManager) GetLabels() map[string]string {\n}\n// GetResourceList gets redis resources.\n-func (rm *RedisResourceManager) GetResourceList() corev1.ResourceList {\n+func (rm *redisResourceManager) GetResourceList() corev1.ResourceList {\nresources := corev1.ResourceList{}\nif rm.cluster.Spec.InClusterCache.RedisSpec.Server == nil {\nresources, _ = GenerateResourceList(defaultResourceCPU, defaultResourceMemory)\n@@ -184,7 +198,7 @@ func (rm *RedisResourceManager) GetResourceList() corev1.ResourceList {\n}\n// GetServerReplica gets deployment replica.\n-func (rm *RedisResourceManager) GetServerReplica() int {\n+func (rm *redisResourceManager) GetServerReplica() int {\nif rm.cluster.Spec.InClusterCache.RedisSpec.Server == nil || rm.cluster.Spec.InClusterCache.RedisSpec.Server.Replicas == 0 {\nreturn defaultResourceReplica\n}\n@@ -193,7 +207,7 @@ func (rm *RedisResourceManager) GetServerReplica() int {\n}\n// GetClusterServerReplica gets deployment replica of sentinel mode.\n-func (rm *RedisResourceManager) GetClusterServerReplica() int {\n+func (rm *redisResourceManager) GetClusterServerReplica() int {\nif rm.cluster.Spec.InClusterCache.RedisSpec.Sentinel == nil || rm.cluster.Spec.InClusterCache.RedisSpec.Sentinel.Replicas == 0 {\nreturn defaultResourceReplica\n}\n@@ -202,7 +216,7 @@ func (rm *RedisResourceManager) GetClusterServerReplica() int {\n}\n// GetStorageSize gets storage size.\n-func (rm *RedisResourceManager) GetStorageSize() string {\n+func (rm *redisResourceManager) GetStorageSize() string {\nif rm.cluster.Spec.InClusterCache.RedisSpec.Server == nil || rm.cluster.Spec.InClusterCache.RedisSpec.Server.Storage == \"\" {\nreturn defaultStorageSize\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/postgresql.go",
"new_path": "pkg/cluster/controllers/database/postgresql.go",
"diff": "@@ -18,9 +18,9 @@ import (\ntype PostgreSQLController struct {\nHarborCluster *goharborv1alpha2.HarborCluster\nCtx context.Context\n- Client k8s.Client\nLog logr.Logger\nDClient k8s.DClient\n+ Client k8s.Client\nScheme *runtime.Scheme\nExpectCR *unstructured.Unstructured\nActualCR *unstructured.Unstructured\n@@ -39,8 +39,8 @@ func (p *PostgreSQLController) HealthChecker() lcm.HealthChecker {\n}\nfunc (p *PostgreSQLController) Apply(ctx context.Context, harborcluster *goharborv1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n- p.Client.WithContext(ctx)\np.DClient.WithContext(ctx)\n+ p.Client.WithContext(ctx)\np.HarborCluster = harborcluster\ncrdClient := p.DClient.WithResource(databaseGVR).WithNamespace(p.HarborCluster.Namespace)\n@@ -89,9 +89,9 @@ func NewDatabaseController(ctx context.Context, options ...k8s.Option) lcm.Contr\nreturn &PostgreSQLController{\nCtx: ctx,\n- Client: o.Client,\nLog: o.Log,\nDClient: o.DClient,\n+ Client: o.Client,\nScheme: o.Scheme,\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -28,6 +28,9 @@ type Controller struct {\nfunc (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nvar harborCR *v1alpha2.Harbor\n+ // Use the ctx from the parameter\n+ harbor.KubeClient.WithContext(ctx)\n+\nerr := harbor.KubeClient.Get(harbor.getHarborCRNamespacedName(harborcluster), harborCR)\nif err != nil {\nif errors.IsNotFound(err) {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/minio.go",
"new_path": "pkg/cluster/controllers/storage/minio.go",
"diff": "@@ -77,6 +77,9 @@ func NewMinIOController(ctx context.Context, options ...k8s.Option) lcm.Controll\nfunc (m *MinIOController) Apply(ctx context.Context, harborcluster *goharborv1.HarborCluster) (*lcm.CRStatus, error) {\nvar minioCR minio.Tenant\n+ // Use the ctx from the parameter\n+ m.KubeClient.WithContext(ctx)\n+\nm.HarborCluster = harborcluster\nm.DesiredMinIOCR = m.generateMinIOCR()\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(controller):use context from cluster reconciler
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,881
|
02.12.2020 16:27:59
| -28,800
|
f6127dfc61486c6c32f18c5cee4e504e175f32f9
|
fix(lcm): fix redis controller service labels
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/resource_manager.go",
"new_path": "pkg/cluster/controllers/cache/resource_manager.go",
"diff": "@@ -128,7 +128,7 @@ func (rm *redisResourceManager) GetService() *corev1.Service {\nType: corev1.ServiceTypeClusterIP,\nSelector: map[string]string{\n\"app.kubernetes.io/component\": \"redis\",\n- \"app.kubernetes.io/name\": rm.cluster.Name,\n+ \"app.kubernetes.io/name\": rm.GetCacheCRName(),\n\"app.kubernetes.io/part-of\": \"redis-failover\",\n},\nPorts: []corev1.ServicePort{\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(lcm): fix redis controller service labels
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,893
|
02.12.2020 18:09:09
| -28,800
|
4f5c2060fe3de9f04e8503120d5ab03e7f1f2d20
|
feat(kustomize):use released versions of related service kustomization yamls
fix
|
[
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -1875,7 +1875,7 @@ spec:\nname: v1alpha2\nschema:\nopenAPIV3Schema:\n- description: HarborCluster is the Schema for the harborclusters API\n+ description: HarborCluster is the Schema for the harborclusters API.\nproperties:\napiVersion:\ndescription: 'APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'\n@@ -1886,7 +1886,7 @@ spec:\nmetadata:\ntype: object\nspec:\n- description: HarborClusterSpec defines the desired state of HarborCluster\n+ description: HarborClusterSpec defines the desired state of HarborCluster.\nproperties:\nchartmuseum:\nproperties:\n@@ -3176,7 +3176,7 @@ spec:\n- harborAdminPasswordRef\ntype: object\nstatus:\n- description: HarborClusterStatus defines the observed state of HarborCluster\n+ description: HarborClusterStatus defines the observed state of HarborCluster.\nproperties:\nconditions:\ndescription: Conditions of each components\n@@ -14751,14 +14751,6 @@ rules:\n- patch\n- update\n- watch\n-- apiGroups:\n- - acid.zalan.do\n- resources:\n- - postgresteams\n- verbs:\n- - get\n- - list\n- - watch\n- apiGroups:\n- apiextensions.k8s.io\nresources:\n@@ -14823,8 +14815,6 @@ rules:\n- delete\n- get\n- list\n- - patch\n- - update\n- apiGroups:\n- \"\"\nresources:\n@@ -15419,14 +15409,13 @@ data:\ncluster_history_entries: \"1000\"\ncluster_labels: application:spilo\ncluster_name_label: cluster-name\n- connection_pooler_image: registry.opensource.zalan.do/acid/pgbouncer:master-11\n+ connection_pooler_image: registry.opensource.zalan.do/acid/pgbouncer:master-7\ndb_hosted_zone: db.example.com\ndebug_logging: \"true\"\n- docker_image: registry.opensource.zalan.do/acid/spilo-12:1.6-p5\n+ docker_image: registry.opensource.zalan.do/acid/spilo-12:1.6-p3\nenable_master_load_balancer: \"false\"\nenable_replica_load_balancer: \"false\"\nenable_teams_api: \"false\"\n- external_traffic_policy: Cluster\nlogical_backup_docker_image: registry.opensource.zalan.do/acid/logical-backup\nlogical_backup_s3_bucket: my-bucket-url\nlogical_backup_s3_sse: AES256\n@@ -15450,10 +15439,9 @@ data:\nring_log_lines: \"100\"\nsecret_name_template: '{username}.{cluster}.credentials'\nspilo_privileged: \"false\"\n- storage_resize_mode: pvc\nsuper_username: postgres\nwatched_namespace: '*'\n- workers: \"8\"\n+ workers: \"4\"\nkind: ConfigMap\nmetadata:\nannotations:\n@@ -15522,9 +15510,9 @@ apiVersion: apps/v1\nkind: Deployment\nmetadata:\nannotations:\n- goharbor.io/deploy-engine: Kustomization\n- goharbor.io/deploy-mode: cluster\n- goharbor.io/operator-version: v1.0.0\n+ cache.goharbor.io/version: v1.0.0\n+ database.goharbor.io/version: v1.5.0\n+ storage.goharbor.io/version: v3.0.13\nlabels:\ncontrol-plane: harbor-operator\nname: harbor-operator\n@@ -15640,8 +15628,6 @@ metadata:\ngoharbor.io/deploy-engine: Kustomization\ngoharbor.io/deploy-mode: cluster\ngoharbor.io/operator-version: v1.0.0\n- labels:\n- application: postgres-operator\nname: postgres-operator\nnamespace: harbor-operator-ns\nspec:\n@@ -15649,8 +15635,6 @@ spec:\nselector:\nmatchLabels:\nname: postgres-operator\n- strategy:\n- type: Recreate\ntemplate:\nmetadata:\nannotations:\n@@ -15708,7 +15692,7 @@ spec:\napp: redisoperator\nspec:\ncontainers:\n- - image: quay.io/spotahome/redis-operator:latest\n+ - image: quay.io/spotahome/redis-operator:v1.0.0\nimagePullPolicy: IfNotPresent\nname: app\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/kustomization.yaml",
"new_path": "manifests/cluster/kustomization.yaml",
"diff": "@@ -11,11 +11,12 @@ commonAnnotations:\ngoharbor.io/deploy-engine: \"Kustomization\"\n# All the referred deployment manifests\n+# NOTES: when doing changes to the ref versions, please also do same changes in the patch/annotation.yaml file\nresources:\n- ../../config/default # harbor operator\n- - https://raw.githubusercontent.com/spotahome/redis-operator/master/example/operator/all-redis-operator-resources.yaml # reids operator\n- - github.com/zalando/postgres-operator/manifests # postgresql operator\n- - github.com/minio/operator?ref=60bf757aac607a914b414e554188a77a4760aa0e # minIO storage operator\n+ - https://raw.githubusercontent.com/spotahome/redis-operator/master/example/operator/all-redis-operator-resources.yaml?ref=v1.0.0 # redis operator\n+ - github.com/zalando/postgres-operator/manifests?ref=v1.5.0 # postgresql operator\n+ - github.com/minio/operator?ref=v3.0.13 # minIO storage operator\npatchesJson6902:\n- target:\n@@ -23,8 +24,17 @@ patchesJson6902:\nname: minio-operator\nversion: v1\npath: patch/namespace.yaml\n+ - target:\n+ kind: Deployment\n+ name: harbor-operator\n+ group: apps\n+ version: v1\n+ path: patch/annotations.yaml # add version annotations to the harbor operator ctrl\nimages:\n+ - name: quay.io/spotahome/redis-operator\n+ newName: quay.io/spotahome/redis-operator\n+ newTag: v1.0.0\n- name: goharbor/harbor-operator\nnewName: goharbor/harbor-operator\nnewTag: latest\n\\ No newline at end of file\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "manifests/cluster/patch/annotations.yaml",
"diff": "+- op: add\n+ path: \"/metadata/annotations\"\n+ value:\n+ cache.goharbor.io/version: v1.0.0\n+ database.goharbor.io/version: v1.5.0\n+ storage.goharbor.io/version: v3.0.13\n\\ No newline at end of file\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(kustomize):use released versions of related service kustomization yamls
Signed-off-by: Steven Zou <szou@vmware.com>
fix #261
|
254,893
|
03.12.2020 14:19:23
| -28,800
|
524813133145100c28f72974d4f94fc440bfa655
|
fix(minio):fix operator exit issue
remove all the log.Fatal()
add context as 1st param to the minio interface
fix #258,close
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/client.go",
"new_path": "pkg/cluster/controllers/storage/client.go",
"diff": "package storage\nimport (\n- \"log\"\n+ \"context\"\n+ \"fmt\"\nminv6 \"github.com/minio/minio-go/v6\"\n)\n+// Minio defines related operations of minio.\ntype Minio interface {\n- IsBucketExists(bucket string) (bool, error)\n- CreateBucket(bucket string) error\n+ IsBucketExists(ctx context.Context, bucket string) (bool, error)\n+ CreateBucket(ctx context.Context, bucket string) error\n}\n-type MinioClient struct {\n- Client *minv6.Client\n+// MinioEndpoint contains the related access info of a minio server.\n+type MinioEndpoint struct {\n+ Endpoint string\n+ AccessKeyID string\n+ SecretAccessKey string\n+ // Optional\nLocation string\n+ UseSSL bool\n}\n-func GetMinioClient(endpoint, accessKeyID, secretAccessKey, location string, useSSL bool) (*MinioClient, error) {\n- client, err := minv6.New(endpoint, accessKeyID, secretAccessKey, useSSL)\n- if err != nil {\n- log.Fatalln(err)\n-\n- return nil, err\n- }\n-\n- return &MinioClient{\n- Client: client,\n- Location: location,\n- }, nil\n+// MinioClient is an implementation of Minio.\n+type MinioClient struct {\n+ client *minv6.Client\n+ location string\n}\n-func (m MinioClient) IsBucketExists(bucket string) (bool, error) {\n- exists, err := m.Client.BucketExists(bucket)\n+// NewMinioClient constructs a new minio client.\n+func NewMinioClient(endpoint *MinioEndpoint) (Minio, error) {\n+ client, err := minv6.New(\n+ endpoint.Endpoint,\n+ endpoint.AccessKeyID,\n+ endpoint.SecretAccessKey,\n+ endpoint.UseSSL,\n+ )\nif err != nil {\n- log.Fatalln(err)\n-\n- return exists, err\n+ return nil, fmt.Errorf(\"create minv6 client error: %w\", err)\n}\n- return exists, nil\n+ return &MinioClient{\n+ client: client,\n+ location: endpoint.Location,\n+ }, nil\n}\n-func (m MinioClient) CreateBucket(bucket string) error {\n- err := m.Client.MakeBucket(bucket, m.Location)\n- if err != nil {\n- log.Fatalln(err)\n-\n- return err\n+// IsBucketExists checks if the bucket existing.\n+func (m MinioClient) IsBucketExists(ctx context.Context, bucket string) (bool, error) {\n+ return m.client.BucketExistsWithContext(ctx, bucket)\n}\n- return nil\n+// CreateBucket creates a bucket.\n+func (m MinioClient) CreateBucket(ctx context.Context, bucket string) error {\n+ return m.client.MakeBucketWithContext(ctx, bucket, m.location)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/minio.go",
"new_path": "pkg/cluster/controllers/storage/minio.go",
"diff": "@@ -22,9 +22,6 @@ const (\nStorage = \"storage\"\ns3Storage = \"s3\"\n- DefaultExternalSecretSuffix = \"harbor-cluster-storage\"\n- ChartMuseumExternalSecretSuffix = \"chart-museum-storage\"\n-\nDefaultCredsSecret = \"creds\"\nDefaultPrefix = \"minio-\"\n@@ -85,6 +82,8 @@ func (m *MinIOController) Apply(ctx context.Context, harborcluster *goharborv1.H\nerr := m.KubeClient.Get(m.getMinIONamespacedName(), &minioCR)\nif k8serror.IsNotFound(err) {\n+ m.Log.Info(\"create minio service\")\n+\nreturn m.Provision()\n} else if err != nil {\nreturn minioNotReadyStatus(GetMinIOError, err.Error()), err\n@@ -111,19 +110,25 @@ func (m *MinIOController) Apply(ctx context.Context, harborcluster *goharborv1.H\nreturn minioNotReadyStatus(GetMinIOError, err.Error()), err\n}\n- if isReady {\n- err := m.minioInit()\n- if err != nil {\n+ if !isReady {\n+ return minioUnknownStatus(), nil\n+ }\n+\n+ if err := m.minioInit(ctx); err != nil {\nreturn minioNotReadyStatus(CreateDefaultBucketError, err.Error()), err\n}\n- return m.ProvisionMinIOProperties(&minioCR)\n+ crs, err := m.ProvisionMinIOProperties(&minioCR)\n+ if err != nil {\n+ return crs, err\n}\n- return minioUnknownStatus(), nil\n+ m.Log.Info(\"minio is ready\")\n+\n+ return crs, nil\n}\n-func (m *MinIOController) minioInit() error {\n+func (m *MinIOController) minioInit(ctx context.Context) error {\naccessKey, secretKey, err := m.getCredsFromSecret()\nif err != nil {\nreturn err\n@@ -131,19 +136,24 @@ func (m *MinIOController) minioInit() error {\nendpoint := m.getServiceName() + \".\" + m.HarborCluster.Namespace + \":9000\"\n- m.MinioClient, err = GetMinioClient(endpoint, string(accessKey), string(secretKey), DefaultRegion, false)\n+ edp := &MinioEndpoint{\n+ Endpoint: endpoint,\n+ AccessKeyID: string(accessKey),\n+ SecretAccessKey: string(secretKey),\n+ Location: DefaultRegion,\n+ }\n+\n+ m.MinioClient, err = NewMinioClient(edp)\nif err != nil {\nreturn err\n}\n- exists, err := m.MinioClient.IsBucketExists(DefaultBucket)\n+ exists, err := m.MinioClient.IsBucketExists(ctx, DefaultBucket)\nif err != nil || exists {\nreturn err\n}\n- err = m.MinioClient.CreateBucket(DefaultBucket)\n-\n- return err\n+ return m.MinioClient.CreateBucket(ctx, DefaultBucket)\n}\nfunc (m *MinIOController) checkMinIOUpdate() bool {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(minio):fix operator exit issue
- remove all the log.Fatal()
- add context as 1st param to the minio interface
fix #258,close #258
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
03.12.2020 16:33:10
| -28,800
|
c725314b7271831937bd19fa5a4bdbfa7a7102f0
|
fix(webhook):register webhook in single thread
remove errorgroup in the `WebhooksWithManager` func
fix
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/setup/setup.go",
"new_path": "pkg/setup/setup.go",
"diff": "@@ -53,10 +53,7 @@ func ControllersWithManager(ctx context.Context, mgr manager.Manager) error {\n}\nfunc WebhooksWithManager(ctx context.Context, mgr manager.Manager) error {\n- var g errgroup.Group\n-\nfor name, object := range webhooksBuilder {\n- name := name\nwh := &webHook{\nName: name,\nwebhook: object,\n@@ -73,10 +70,13 @@ func WebhooksWithManager(ctx context.Context, mgr manager.Manager) error {\ncontinue\n}\n- g.Go(func() error {\n- return errors.Wrapf(wh.WithManager(ctx, mgr), \"webhook %s\", name)\n- })\n+ // Fail earlier.\n+ // 'controller-runtime' does not support webhook registrations concurrently.\n+ // Check issue: https://github.com/kubernetes-sigs/controller-runtime/issues/1285.\n+ if err := wh.WithManager(ctx, mgr); err != nil {\n+ return errors.Wrapf(err, \"webhook %s\", name)\n+ }\n}\n- return g.Wait()\n+ return nil\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(webhook):register webhook in single thread
- remove errorgroup in the `WebhooksWithManager` func
fix #202
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,875
|
03.12.2020 23:35:29
| -28,800
|
ded816d588ffab08cd1f7c0aa0a7086ca2738365
|
fix(controller) apply harborcluster fail
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -26,7 +26,7 @@ type Controller struct {\n}\nfunc (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n- var harborCR *v1alpha2.Harbor\n+ harborCR := &v1alpha2.Harbor{}\n// Use the ctx from the parameter\nharbor.KubeClient.WithContext(ctx)\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(controller) apply harborcluster fail
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,893
|
04.12.2020 12:17:20
| -28,800
|
51971df2e8c2c7737238c91e62b510741ade14ba
|
fix(storage):storage spec mismatch
update the HarborCluster CRD to add redirect.disable field
update the HarborCluster CRD to add min value validations to the 'Replicas' & 'VolumesPerServer' of minio spec
return HarborStorageImageChartStorageSpec instead of HarborStorageImageChartStorageS3Spec in CRStatus of minio
update the deployment manifests
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"diff": "@@ -106,24 +106,37 @@ type Storage struct {\nKind string `json:\"kind\"`\n// inCLuster options.\n+ // +kubebuilder:validation:Required\nMinIOSpec *MinIOSpec `json:\"minIOSpec,omitempty\"`\n}\n+// StorageRedirectSpec defines if the redirection is disabled.\n+type StorageRedirectSpec struct {\n+ // Disable the redirect.\n+ // Default is false\n+ // +optional\n+ Disable bool `json:\"disable\"`\n+}\n+\ntype MinIOSpec struct {\n+ // Determine if the redirection of minio storage is disabled.\n+ // +kubebuilder:validation:Optional\n+ Redirect StorageRedirectSpec `json:\"redirect\"`\n// Supply number of replicas.\n// For standalone mode, supply 1. For distributed mode, supply 4 to 16 drives (should be even).\n// Note that the operator does not support upgrading from standalone to distributed mode.\n- // +kubebuilder:validation:Required\n+ // +kubebuilder:validation:Minimum:=1\nReplicas int32 `json:\"replicas\"`\n// Number of persistent volumes that will be attached per server\n+ // +kubebuilder:validation:Minimum:=1\nVolumesPerServer int32 `json:\"volumesPerServer\"`\n// Version defines the MinIO Client (mc) Docker image version.\nVersion string `json:\"version,omitempty\"`\n// VolumeClaimTemplate allows a user to specify how volumes inside a MinIOInstance\n- // +optional\n+ // +kubebuilder:validation:Optional\nVolumeClaimTemplate corev1.PersistentVolumeClaim `json:\"volumeClaimTemplate,omitempty\"`\n// If provided, use these requests and limit for cpu/memory resource allocation\n- // +optional\n+ // +kubebuilder:validation:Optional\nResources corev1.ResourceRequirements `json:\"resources,omitempty\"`\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go",
"new_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go",
"diff": "@@ -1661,6 +1661,7 @@ func (in *JobServiceTokenSpec) DeepCopy() *JobServiceTokenSpec {\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *MinIOSpec) DeepCopyInto(out *MinIOSpec) {\n*out = *in\n+ out.Redirect = in.Redirect\nin.VolumeClaimTemplate.DeepCopyInto(&out.VolumeClaimTemplate)\nin.Resources.DeepCopyInto(&out.Resources)\n}\n@@ -3455,6 +3456,21 @@ func (in *Storage) DeepCopy() *Storage {\nreturn out\n}\n+// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\n+func (in *StorageRedirectSpec) DeepCopyInto(out *StorageRedirectSpec) {\n+ *out = *in\n+}\n+\n+// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StorageRedirectSpec.\n+func (in *StorageRedirectSpec) DeepCopy() *StorageRedirectSpec {\n+ if in == nil {\n+ return nil\n+ }\n+ out := new(StorageRedirectSpec)\n+ in.DeepCopyInto(out)\n+ return out\n+}\n+\n// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.\nfunc (in *Trivy) DeepCopyInto(out *Trivy) {\n*out = *in\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster.go",
"diff": "@@ -64,7 +64,8 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\n}\n}()\n- // Deploy or check dependent services concurrently and fail earlier\n+ // Deploy or check dependent services concurrently and fail earlier.\n+ // Only need to do check if they're configured.\ng, gtx := gos.NewGroup(ctx)\ng.Go(func() error {\ncacheStatus, err := r.CacheCtrl.Apply(gtx, harborcluster)\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -2460,9 +2460,17 @@ spec:\nminIOSpec:\ndescription: inCLuster options.\nproperties:\n+ redirect:\n+ description: Determine if the redirection of minio storage is disabled.\n+ properties:\n+ disable:\n+ description: Disable the redirect. Default is false\n+ type: boolean\n+ type: object\nreplicas:\ndescription: Supply number of replicas. For standalone mode, supply 1. For distributed mode, supply 4 to 16 drives (should be even). Note that the operator does not support upgrading from standalone to distributed mode.\nformat: int32\n+ minimum: 1\ntype: integer\nresources:\ndescription: If provided, use these requests and limit for cpu/memory resource allocation\n@@ -2621,6 +2629,7 @@ spec:\nvolumesPerServer:\ndescription: Number of persistent volumes that will be attached per server\nformat: int32\n+ minimum: 1\ntype: integer\nrequired:\n- replicas\n@@ -13766,15 +13775,15 @@ spec:\nport: ready\nname: manager\nports:\n- - containerPort: 5000\n- name: ready\n- protocol: TCP\n- containerPort: 9443\nname: webhook-server\nprotocol: TCP\n- containerPort: 8080\nname: metrics\nprotocol: TCP\n+ - containerPort: 5000\n+ name: ready\n+ protocol: TCP\nreadinessProbe:\nhttpGet:\npath: /readyz\n@@ -13787,21 +13796,21 @@ spec:\ncpu: 300m\nmemory: 200Mi\nvolumeMounts:\n- - mountPath: /etc/harbor-operator\n- name: configuration-templates\n- readOnly: true\n- mountPath: /tmp/k8s-webhook-server/serving-certs\nname: cert\nreadOnly: true\n+ - mountPath: /etc/harbor-operator\n+ name: configuration-templates\n+ readOnly: true\nterminationGracePeriodSeconds: 10\nvolumes:\n- - configMap:\n- name: config-template\n- name: configuration-templates\n- name: cert\nsecret:\ndefaultMode: 420\nsecretName: webhook-server-cert\n+ - configMap:\n+ name: config-template\n+ name: configuration-templates\n---\napiVersion: apps/v1\nkind: Deployment\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/provision.go",
"new_path": "pkg/cluster/controllers/storage/provision.go",
"diff": "@@ -33,7 +33,7 @@ func (m *MinIOController) ProvisionMinIOProperties(minioInstamnce *minio.Tenant)\nreturn minioReadyStatus(properties), nil\n}\n-func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goharborv1.RegistryStorageDriverS3Spec, error) {\n+func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goharborv1.HarborStorageImageChartStorageSpec, error) {\naccessKey, secretKey, err := m.getCredsFromSecret()\nif err != nil {\nreturn nil, err\n@@ -47,7 +47,7 @@ func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goha\n}\nvar endpoint string\n- if !m.HarborCluster.Spec.ImageChartStorage.Redirect.Disable {\n+ if !m.HarborCluster.Spec.InClusterStorage.MinIOSpec.Redirect.Disable {\n_, endpoint, err = GetMinIOHostAndSchema(m.HarborCluster.Spec.ExternalURL)\nif err != nil {\nreturn nil, err\n@@ -58,7 +58,10 @@ func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goha\nsecure := false\nv4Auth := false\n- s3 := &goharborv1.RegistryStorageDriverS3Spec{\n+\n+ storageSpec := &goharborv1.HarborStorageImageChartStorageSpec{\n+ S3: &goharborv1.HarborStorageImageChartStorageS3Spec{\n+ RegistryStorageDriverS3Spec: goharborv1.RegistryStorageDriverS3Spec{\nAccessKey: string(accessKey),\nSecretKeyRef: secretKeyRef.Name,\nRegion: DefaultRegion,\n@@ -66,9 +69,11 @@ func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goha\nBucket: DefaultBucket,\nSecure: &secure,\nV4Auth: &v4Auth,\n+ },\n+ },\n}\n- return s3, nil\n+ return storageSpec, nil\n}\nfunc (m *MinIOController) createSecretKeyRef(secretKey []byte, minioInstance *minio.Tenant) *corev1.Secret {\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(storage):storage spec mismatch
- update the HarborCluster CRD to add redirect.disable field
- update the HarborCluster CRD to add min value validations to the 'Replicas' & 'VolumesPerServer' of minio spec
- return HarborStorageImageChartStorageSpec instead of HarborStorageImageChartStorageS3Spec in CRStatus of minio
- update the deployment manifests
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
04.12.2020 14:23:38
| -28,800
|
e1f2d0b7fcb57805ecac805c257bca175d5bf627
|
fix(rbac):update rbac settings of harborcluster ctrl
add write permissions of harbors to harborcluster ctrl
fix
|
[
{
"change_type": "MODIFY",
"old_path": "charts/harbor-operator/templates/clusterrole.yaml",
"new_path": "charts/harbor-operator/templates/clusterrole.yaml",
"diff": "@@ -192,12 +192,8 @@ rules:\nresources:\n- harborclusters\nverbs:\n- - create\n- - delete\n- get\n- list\n- - patch\n- - update\n- watch\n- apiGroups:\n- goharbor.io\n@@ -212,8 +208,12 @@ rules:\nresources:\n- harbors\nverbs:\n+ - create\n+ - delete\n- get\n- list\n+ - patch\n+ - update\n- watch\n- apiGroups:\n- goharbor.io\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"new_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"diff": "@@ -37,7 +37,7 @@ type Reconciler struct {\nHarborCtrl *harbor.Controller\n}\n-// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters,verbs=get;list;watch;create;update;patch;delete\n+// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters,verbs=get;list;watch\n// +kubebuilder:rbac:groups=goharbor.io,resources=harborclusters/status,verbs=get;update;patch\n// +kubebuilder:rbac:groups=acid.zalan.do,resources=postgresqls;operatorconfigurations,verbs=get;list;watch;create;update;patch;delete;deletecollection\n// +kubebuilder:rbac:groups=acid.zalan.do,resources=postgresqls/status,verbs=get;update;patch\n@@ -45,6 +45,7 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=minio.min.io,resources=*,verbs=*\n// +kubebuilder:rbac:groups=\"\",resources=pods,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=apps,resources=statefulsets;deployments,verbs=get;list;watch;create;update;patch;delete\n+// +kubebuilder:rbac:groups=goharbor.io,resources=harbors,verbs=get;list;watch;create;update;patch;delete\nfunc (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) error {\nr.Client = mgr.GetClient()\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -12710,12 +12710,8 @@ rules:\nresources:\n- harborclusters\nverbs:\n- - create\n- - delete\n- get\n- list\n- - patch\n- - update\n- watch\n- apiGroups:\n- goharbor.io\n@@ -12730,8 +12726,12 @@ rules:\nresources:\n- harbors\nverbs:\n+ - create\n+ - delete\n- get\n- list\n+ - patch\n+ - update\n- watch\n- apiGroups:\n- goharbor.io\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(rbac):update rbac settings of harborcluster ctrl
- add write permissions of harbors to harborcluster ctrl
fix #273
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
04.12.2020 15:19:29
| -28,800
|
57461ef7411dc9455b0a57c47a2e0302265f1452
|
fix(ctrl):update harbor ctrl to fix
fix
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"diff": "@@ -59,7 +59,7 @@ type HarborSpec struct {\n// Skip OpenAPI schema validation\n// Use validating webhook to do verification (field required)\n// +kubebuilder:validation:Optional\n- ImageChartStorage HarborStorageImageChartStorageSpec `json:\"imageChartStorage\"`\n+ ImageChartStorage *HarborStorageImageChartStorageSpec `json:\"imageChartStorage\"`\n// +kubebuilder:validation:Optional\n// +kubebuilder:default=\"info\"\n"
},
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go",
"new_path": "apis/goharbor.io/v1alpha2/zz_generated.deepcopy.go",
"diff": "@@ -1223,7 +1223,11 @@ func (in *HarborSpec) DeepCopyInto(out *HarborSpec) {\nin.HarborComponentsSpec.DeepCopyInto(&out.HarborComponentsSpec)\nin.Expose.DeepCopyInto(&out.Expose)\nout.InternalTLS = in.InternalTLS\n- in.ImageChartStorage.DeepCopyInto(&out.ImageChartStorage)\n+ if in.ImageChartStorage != nil {\n+ in, out := &in.ImageChartStorage, &out.ImageChartStorage\n+ *out = new(HarborStorageImageChartStorageSpec)\n+ (*in).DeepCopyInto(*out)\n+ }\nif in.Proxy != nil {\nin, out := &in.Proxy, &out.Proxy\n*out = new(CoreProxySpec)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor_test.go",
"new_path": "controllers/goharbor/harbor_test.go",
"diff": "@@ -131,7 +131,7 @@ func setupValidHarbor(ctx context.Context, ns string) (Resource, client.ObjectKe\nExternalURL: publicURL.String(),\nHarborAdminPasswordRef: adminSecretName,\nEncryptionKeyRef: \"encryption-key\",\n- ImageChartStorage: goharborv1alpha2.HarborStorageImageChartStorageSpec{\n+ ImageChartStorage: &goharborv1alpha2.HarborStorageImageChartStorageSpec{\nFileSystem: &goharborv1alpha2.HarborStorageImageChartStorageFileSystemSpec{\nRegistryPersistentVolume: goharborv1alpha2.HarborStorageRegistryPersistentVolumeSpec{\nHarborStoragePersistentVolumeSpec: goharborv1alpha2.HarborStoragePersistentVolumeSpec{\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -22,7 +22,7 @@ type Controller struct {\nCtx context.Context\nLog logr.Logger\nScheme *runtime.Scheme\n- ComponentToCRStatus sync.Map\n+ ComponentToCRStatus *sync.Map\n}\nfunc (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n@@ -31,11 +31,15 @@ func (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.Har\n// Use the ctx from the parameter\nharbor.KubeClient.WithContext(ctx)\n- err := harbor.KubeClient.Get(harbor.getHarborCRNamespacedName(harborcluster), harborCR)\n+ nsdName := harbor.getHarborCRNamespacedName(harborcluster)\n+\n+ err := harbor.KubeClient.Get(nsdName, harborCR)\nif err != nil {\nif errors.IsNotFound(err) {\nharborCR = harbor.getHarborCR(harborcluster)\n+ harbor.Log.Info(\"create harbor service\", \"name\", nsdName)\n+\nerr = harbor.KubeClient.Create(harborCR)\nif err != nil {\nreturn harborClusterCRNotReadyStatus(CreateHarborCRError, err.Error()), err\n@@ -45,12 +49,18 @@ func (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.Har\n}\n} else {\nharborCR = harbor.getHarborCR(harborcluster)\n+\n+ // TODO: maybe we still need to do actual and desired status here to determine if we need to do update\n+ harbor.Log.Info(\"update harbor service\", \"name\", nsdName)\n+\nerr = harbor.KubeClient.Update(harborCR)\nif err != nil {\nreturn harborClusterCRNotReadyStatus(UpdateHarborCRError, err.Error()), err\n}\n}\n+ harbor.Log.Info(\"harbor service is ready\", \"name\", nsdName)\n+\nreturn harborClusterCRStatus(harborCR), nil\n}\n@@ -79,6 +89,7 @@ func NewHarborController(ctx context.Context, options ...k8s.Option) *Controller\nKubeClient: o.Client,\nLog: o.Log,\nScheme: o.Scheme,\n+ ComponentToCRStatus: &sync.Map{},\n}\n}\n@@ -100,17 +111,21 @@ func (harbor *Controller) getHarborCR(harborcluster *v1alpha2.HarborCluster) *v1\nSpec: harborcluster.Spec.HarborSpec,\n}\n- // use incluster spec in first priority\n- if harborcluster.Spec.InClusterDatabase != nil {\n- harborcluster.Spec.Database = harbor.getDatabaseSpec()\n+ // Use incluster spec in first priority.\n+ // Check based on the case that if the related dependent services are created\n+ if db := harbor.getDatabaseSpec(); db != nil {\n+ harbor.Log.Info(\"use incluster database\", \"database\", db.Hosts)\n+ harborCR.Spec.Database = db\n}\n- if harborcluster.Spec.InClusterCache != nil {\n- harborcluster.Spec.Redis = harbor.getCacheSpec()\n+ if cache := harbor.getCacheSpec(); cache != nil {\n+ harbor.Log.Info(\"use incluster cache\", \"cache\", cache.Host)\n+ harborCR.Spec.Redis = cache\n}\n- if harborcluster.Spec.InClusterStorage != nil {\n- harborcluster.Spec.ImageChartStorage = *harbor.getStorageSpec()\n+ if storage := harbor.getStorageSpec(); storage != nil {\n+ harbor.Log.Info(\"use incluster storage\", \"storage\", storage.S3.RegionEndpoint)\n+ harborCR.Spec.ImageChartStorage = storage\n}\nreturn harborCR\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(ctrl):update harbor ctrl to fix #275
fix #275
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,875
|
04.12.2020 18:43:46
| -28,800
|
377f5a038d44e7cb00d556a1d4df31141cf3a3ea
|
fix cluster sample yaml
|
[
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack.yaml",
"new_path": "manifests/samples/full_stack.yaml",
"diff": "@@ -47,17 +47,6 @@ metadata:\nspec:\nharborAdminPasswordRef: admin-core-secret\nexternalURL: https://sample.harbor.domain\n- redis:\n- host: harbor-redis-master\n- port: 6379\n- passwordRef: harbor-redis\n- database:\n- hosts:\n- - host: harbor-database-postgresql\n- port: 5432\n- username: postgres\n- passwordRef: harbor-database-password\n- sslMode: disable\nexpose:\ncore:\ningress:\n@@ -73,10 +62,6 @@ spec:\ntokenIssuer:\nname: service-token\nkind: Issuer\n- imageChartStorage:\n- filesystem:\n- registryPersistentVolume:\n- claimName: sample-harbor-registry\ninClusterDatabase:\nkind: PostgresSQL\npostgresSqlSpec:\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix cluster sample yaml
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,870
|
04.12.2020 23:29:17
| -28,800
|
e75c7d8e6864d878c31b426b362ccac3a5799fc8
|
fix(database) add psql- prefix to database pod name
add psql- prefix to database pod name
Fix
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/generate.go",
"new_path": "pkg/cluster/controllers/database/generate.go",
"diff": "@@ -17,6 +17,7 @@ var (\ndatabaseGVR = SchemeGroupVersion.WithResource(PostgresCRDResourcePlural)\ndatabaseKind = \"postgresql\"\ndatabaseAPI = \"acid.zalan.do/v1\"\n+ databasePrefix = \"psql\"\n)\n// GetPostgresCR returns PostgreSqls CRs.\n@@ -26,7 +27,8 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nstorageSize := p.GetPostgreStorageSize()\nversion := p.GetPostgreVersion()\ndatabases := p.GetDatabases()\n- name := fmt.Sprintf(\"%s-%s\", p.HarborCluster.Namespace, p.HarborCluster.Name)\n+ name := fmt.Sprintf(\"%s-%s-%s\", databasePrefix, p.HarborCluster.Namespace, p.HarborCluster.Name)\n+ team := fmt.Sprintf(\"%s-%s\", databasePrefix, p.HarborCluster.Namespace)\nconf := &api.Postgresql{\nTypeMeta: metav1.TypeMeta{\n@@ -41,7 +43,7 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nVolume: api.Volume{\nSize: storageSize,\n},\n- TeamID: p.HarborCluster.Namespace,\n+ TeamID: team,\nNumberOfInstances: replica,\nUsers: GetUsers(),\nPatroni: GetPatron(),\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(database) add psql- prefix to database pod name
add psql- prefix to database pod name
Fix #218
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,893
|
05.12.2020 16:51:52
| -28,800
|
154addb02125d532b6be5ab99757b28f11cdebc8
|
refactor(ctrl):update harbor CR ctrl
do comparasion before update
refactor status objects
introduce equality.Semantic to do k8s object spec comparasion
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cluster/controllers/harbor/cr_status.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package harbor\n+\n+import (\n+ \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n+ corev1 \"k8s.io/api/core/v1\"\n+)\n+\n+// harborReadyStatus indicates harbor (CR) is ready\n+var harborReadyStatus = lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionTrue)\n+\n+// harborNotReadyStatus indicates harbor (CR) is not ready\n+var harborNotReadyStatus = func(reason, message string) *lcm.CRStatus {\n+ return lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionFalse).WithReason(reason).WithMessage(message)\n+}\n+\n+// harborUnknownStatus indicates status of harbor (CR) is unknown\n+var harborUnknownStatus = func(reason, message string) *lcm.CRStatus {\n+ return lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionUnknown).WithReason(reason).WithMessage(message)\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -9,12 +9,11 @@ import (\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n\"github.com/goharbor/harbor-operator/pkg/k8s\"\n- corev1 \"k8s.io/api/core/v1\"\n+ \"k8s.io/apimachinery/pkg/api/equality\"\n\"k8s.io/apimachinery/pkg/api/errors\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/runtime\"\n\"k8s.io/apimachinery/pkg/types\"\n- \"sigs.k8s.io/kustomize/kstatus/status\"\n)\ntype Controller struct {\n@@ -38,30 +37,38 @@ func (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.Har\nif errors.IsNotFound(err) {\nharborCR = harbor.getHarborCR(harborcluster)\n- harbor.Log.Info(\"create harbor service\", \"name\", nsdName)\n-\n+ // Create a new one\nerr = harbor.KubeClient.Create(harborCR)\nif err != nil {\n- return harborClusterCRNotReadyStatus(CreateHarborCRError, err.Error()), err\n+ return harborNotReadyStatus(CreateHarborCRError, err.Error()), err\n}\n- } else {\n- return harborClusterCRNotReadyStatus(GetHarborCRError, err.Error()), err\n+\n+ harbor.Log.Info(\"harbor service is created\", \"name\", nsdName)\n+\n+ return harborReadyStatus, nil\n}\n- } else {\n- harborCR = harbor.getHarborCR(harborcluster)\n- // TODO: maybe we still need to do actual and desired status here to determine if we need to do update\n+ // We don't know why none 404 error is returned, return unknown status\n+ return harborUnknownStatus(GetHarborCRError, err.Error()), err\n+ }\n+\n+ // Found the existing one and check whether it needs to be updated\n+ desiredCR := harbor.getHarborCR(harborcluster)\n+\n+ same := equality.Semantic.DeepDerivative(desiredCR.Spec, harborCR.Spec)\n+ if !same {\n+ // Spec is changed, do update now\nharbor.Log.Info(\"update harbor service\", \"name\", nsdName)\n+ harborCR.Spec = desiredCR.Spec\n- err = harbor.KubeClient.Update(harborCR)\n- if err != nil {\n- return harborClusterCRNotReadyStatus(UpdateHarborCRError, err.Error()), err\n+ if err := harbor.KubeClient.Update(harborCR); err != nil {\n+ return harborNotReadyStatus(UpdateHarborCRError, err.Error()), err\n}\n}\n- harbor.Log.Info(\"harbor service is ready\", \"name\", nsdName)\n+ harbor.Log.Info(\"harbor service is ready\", \"name\", nsdName, \"updated\", !same)\n- return harborClusterCRStatus(harborCR), nil\n+ return harborReadyStatus, nil\n}\nfunc (harbor *Controller) Delete(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\n@@ -131,25 +138,6 @@ func (harbor *Controller) getHarborCR(harborcluster *v1alpha2.HarborCluster) *v1\nreturn harborCR\n}\n-func harborClusterCRNotReadyStatus(reason, message string) *lcm.CRStatus {\n- return lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionFalse).WithReason(reason).WithMessage(message)\n-}\n-\n-func harborClusterCRUnknownStatus(reason, message string) *lcm.CRStatus {\n- return lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionUnknown).WithReason(reason).WithMessage(message)\n-}\n-\n-// harborClusterCRStatus will assembly the harbor cluster status according the v1alpha1.Harbor status.\n-func harborClusterCRStatus(harbor *v1alpha2.Harbor) *lcm.CRStatus {\n- for _, condition := range harbor.Status.Conditions {\n- if condition.Type == status.ConditionInProgress {\n- return lcm.New(v1alpha2.ServiceReady).WithStatus(condition.Status).WithMessage(condition.Message).WithReason(condition.Reason)\n- }\n- }\n-\n- return harborClusterCRUnknownStatus(EmptyHarborCRStatusError, \"The ready condition of harbor.goharbor.io is empty. Please wait for minutes.\")\n-}\n-\nfunc (harbor *Controller) getHarborCRNamespacedName(harborcluster *v1alpha2.HarborCluster) types.NamespacedName {\nreturn types.NamespacedName{\nNamespace: harborcluster.Namespace,\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
refactor(ctrl):update harbor CR ctrl
- do comparasion before update
- refactor status objects
- introduce equality.Semantic to do k8s object spec comparasion
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
07.12.2020 13:35:44
| -28,800
|
debdc46e4a6e3bc2a37256fbdebbae64ac1515c9
|
refactor(reconciler):update the logic of cluster ctrl
introduce service manager to handle all the dependent services apply process
add service config getter func tenmplate for getting info to do health check
update the methods of cluster status handler
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"diff": "@@ -305,6 +305,10 @@ func (r *HarborStorageImageChartStorageSpec) ProviderName() string {\n}\nfunc (r *HarborStorageImageChartStorageSpec) Validate() error {\n+ if r == nil {\n+ return ErrNoStorageConfiguration\n+ }\n+\nfound := 0\nif r.FileSystem != nil {\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/harborcluster.go",
"new_path": "controllers/goharbor/harborcluster/harborcluster.go",
"diff": "@@ -11,8 +11,9 @@ import (\nctrl \"sigs.k8s.io/controller-runtime\"\n)\n-const (\n- defaultWaitCycle = 10 * time.Second\n+var (\n+ defaultWaitCycle = ctrl.Result{RequeueAfter: 10 * time.Second}\n+ errorWaitCycle = ctrl.Result{RequeueAfter: 5 * time.Second}\n)\n// Reconcile logic of the HarborCluster.\n@@ -68,64 +69,59 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\n// Only need to do check if they're configured.\ng, gtx := gos.NewGroup(ctx)\ng.Go(func() error {\n- cacheStatus, err := r.CacheCtrl.Apply(gtx, harborcluster)\n- if cacheStatus != nil {\n- st.UpdateCache(cacheStatus.Condition)\n- }\n-\n- if err == nil {\n- r.HarborCtrl.WithDependency(v1alpha2.ComponentCache, cacheStatus)\n- }\n-\n- return err\n+ mgr := NewServiceManager(v1alpha2.ComponentCache)\n+\n+ return mgr.WithContext(gtx).\n+ WithConfig(cacheConfigGetter).\n+ TrackedBy(st).\n+ From(harborcluster).\n+ Use(r.CacheCtrl).\n+ For(r.HarborCtrl).\n+ Apply()\n})\ng.Go(func() error {\n- dbStatus, err := r.DatabaseCtrl.Apply(gtx, harborcluster)\n- if dbStatus != nil {\n- st.UpdateDatabase(dbStatus.Condition)\n- }\n-\n- if err == nil {\n- r.HarborCtrl.WithDependency(v1alpha2.ComponentDatabase, dbStatus)\n- }\n-\n- return err\n+ mgr := NewServiceManager(v1alpha2.ComponentDatabase)\n+\n+ return mgr.WithContext(gtx).\n+ WithConfig(dbConfigGetter).\n+ TrackedBy(st).\n+ From(harborcluster).\n+ Use(r.DatabaseCtrl).\n+ For(r.HarborCtrl).\n+ Apply()\n})\ng.Go(func() error {\n- storageStatus, err := r.StorageCtrl.Apply(gtx, harborcluster)\n- if storageStatus != nil {\n- st.UpdateStorage(storageStatus.Condition)\n- }\n-\n- if err == nil {\n- r.HarborCtrl.WithDependency(v1alpha2.ComponentStorage, storageStatus)\n- }\n-\n- return err\n+ mgr := NewServiceManager(v1alpha2.ComponentStorage)\n+\n+ return mgr.WithContext(gtx).\n+ WithConfig(storageConfigGetter).\n+ TrackedBy(st).\n+ From(harborcluster).\n+ Use(r.StorageCtrl).\n+ For(r.HarborCtrl).\n+ Apply()\n})\nif err := g.Wait(); err != nil {\n- return ctrl.Result{}, fmt.Errorf(\"reconcile dependent services error: %w\", err)\n+ return errorWaitCycle, fmt.Errorf(\"reconcile dependent services error: %w\", err)\n}\nif !st.DependsReady() {\nr.Log.Info(\"not all the dependent services are ready\")\n- return ctrl.Result{\n- RequeueAfter: defaultWaitCycle,\n- }, nil\n+ return defaultWaitCycle, nil\n}\n// Create Harbor instance now\nharborStatus, err := r.HarborCtrl.Apply(ctx, harborcluster)\n- if err != nil {\n- return ctrl.Result{}, fmt.Errorf(\"reconcile harbor service error: %w\", err)\n+ if harborStatus != nil {\n+ st.UpdateCondition(v1alpha2.ServiceReady, harborStatus.Condition)\n}\n- if harborStatus != nil {\n- st.UpdateHarbor(harborStatus.Condition)\n+ if err != nil {\n+ return errorWaitCycle, fmt.Errorf(\"reconcile harbor service error: %w\", err)\n}\n// Reconcile done\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "controllers/goharbor/harborcluster/service_mgr.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package harborcluster\n+\n+import (\n+ \"context\"\n+ \"errors\"\n+ \"fmt\"\n+\n+ \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/controllers/harbor\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n+ v1 \"k8s.io/api/core/v1\"\n+)\n+\n+// ServiceManager is designed to maintain the dependent services of the cluster.\n+type ServiceManager struct {\n+ ctx context.Context\n+ cluster *v1alpha2.HarborCluster\n+ component v1alpha2.Component\n+ st *status\n+ ctrl lcm.Controller\n+ svcConfigGetter svcConfigGetter\n+ harborCtrl *harbor.Controller\n+}\n+\n+// NewServiceManager constructs a new service manager for the specified component.\n+func NewServiceManager(component v1alpha2.Component) *ServiceManager {\n+ return &ServiceManager{\n+ component: component,\n+ }\n+}\n+\n+// WithContext bind a context.\n+func (s *ServiceManager) WithContext(ctx context.Context) *ServiceManager {\n+ s.ctx = ctx\n+\n+ return s\n+}\n+\n+// From which spec.\n+func (s *ServiceManager) From(cluster *v1alpha2.HarborCluster) *ServiceManager {\n+ s.cluster = cluster\n+\n+ return s\n+}\n+\n+// For the harbor.\n+func (s *ServiceManager) For(harborCtrl *harbor.Controller) *ServiceManager {\n+ s.harborCtrl = harborCtrl\n+\n+ return s\n+}\n+\n+// TrackedBy by which status object.\n+func (s *ServiceManager) TrackedBy(st *status) *ServiceManager {\n+ s.st = st\n+\n+ return s\n+}\n+\n+// Use which ctrl.\n+func (s *ServiceManager) Use(ctrl lcm.Controller) *ServiceManager {\n+ s.ctrl = ctrl\n+\n+ return s\n+}\n+\n+// WithConfig bind service configuration getter func.\n+func (s *ServiceManager) WithConfig(svcCfgGetter svcConfigGetter) *ServiceManager {\n+ s.svcConfigGetter = svcCfgGetter\n+\n+ return s\n+}\n+\n+// Apply changes.\n+func (s *ServiceManager) Apply() error {\n+ if err := s.validate(); err != nil {\n+ return err\n+ }\n+\n+ var (\n+ status *lcm.CRStatus\n+ err error\n+ conditionType = s.conditionType()\n+ )\n+\n+ defer func() {\n+ // Add condition\n+ if status != nil {\n+ // Here just add condition update to the status, the real update happens outside\n+ s.st.UpdateCondition(conditionType, status.Condition)\n+ // Assign to harbor ctrl for the reconcile of cluster\n+ if err == nil {\n+ s.harborCtrl.WithDependency(s.component, status)\n+ }\n+ }\n+ }()\n+\n+ // The validating webhook validates the spec and either incluster or external can be configured.\n+ useInCluster := true\n+\n+ switch s.component {\n+ case v1alpha2.ComponentCache:\n+ if s.cluster.Spec.InClusterCache == nil {\n+ useInCluster = false\n+ }\n+ case v1alpha2.ComponentDatabase:\n+ if s.cluster.Spec.InClusterDatabase == nil {\n+ useInCluster = false\n+ }\n+ case v1alpha2.ComponentStorage:\n+ if s.cluster.Spec.InClusterStorage == nil {\n+ useInCluster = false\n+ }\n+ // Only for wsl check\n+ case v1alpha2.ComponentHarbor:\n+ return fmt.Errorf(\"%s is not supported\", s.component)\n+ default:\n+ // Should not happen, just in case\n+ return fmt.Errorf(\"unrecognized component: %s\", s.component)\n+ }\n+\n+ if s.ctx == nil {\n+ s.ctx = context.TODO()\n+ }\n+\n+ if useInCluster {\n+ // Use incluster\n+ status, err = s.ctrl.Apply(s.ctx, s.cluster)\n+ if err != nil {\n+ return err\n+ }\n+ } else {\n+ // Default is ready\n+ status = &lcm.CRStatus{\n+ Condition: v1alpha2.HarborClusterCondition{\n+ Type: conditionType,\n+ Status: v1.ConditionTrue,\n+ },\n+ }\n+\n+ // Use external\n+ svcCfg, options, err := s.svcConfigGetter(s.ctx, s.cluster)\n+ if err != nil {\n+ status.WithStatus(v1.ConditionFalse).\n+ WithMessage(\"failed to get service configuration\").\n+ WithReason(err.Error())\n+\n+ return err\n+ }\n+\n+ res, err := s.ctrl.HealthChecker().CheckHealth(s.ctx, svcCfg, options...)\n+ if err != nil {\n+ status.WithStatus(v1.ConditionFalse).\n+ WithMessage(\"failed to check service health\").\n+ WithReason(err.Error())\n+\n+ return err\n+ }\n+\n+ status.WithMessage(res.Message)\n+ }\n+\n+ return nil\n+}\n+\n+func (s *ServiceManager) validate() error {\n+ if s.component != v1alpha2.ComponentCache &&\n+ s.component != v1alpha2.ComponentStorage &&\n+ s.component != v1alpha2.ComponentDatabase {\n+ return fmt.Errorf(\"invalid service component: %s\", s.component)\n+ }\n+\n+ if s.cluster == nil {\n+ return errors.New(\"missing cluster spec\")\n+ }\n+\n+ if s.ctrl == nil {\n+ return errors.New(\"missing lcm controller\")\n+ }\n+\n+ if s.st == nil {\n+ return errors.New(\"missing status\")\n+ }\n+\n+ if s.svcConfigGetter == nil {\n+ return errors.New(\"missing svc config getter\")\n+ }\n+\n+ if s.harborCtrl == nil {\n+ return errors.New(\"missing harbor ctrl\")\n+ }\n+\n+ return nil\n+}\n+\n+func (s *ServiceManager) conditionType() v1alpha2.HarborClusterConditionType {\n+ switch s.component {\n+ case v1alpha2.ComponentStorage:\n+ return v1alpha2.StorageReady\n+ case v1alpha2.ComponentDatabase:\n+ return v1alpha2.DatabaseReady\n+ case v1alpha2.ComponentCache:\n+ return v1alpha2.CacheReady\n+ // Only for wsl check\n+ case v1alpha2.ComponentHarbor:\n+ return v1alpha2.ServiceReady\n+ default:\n+ // Should not reach here\n+ return \"\"\n+ }\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/status.go",
"new_path": "controllers/goharbor/harborcluster/status.go",
"diff": "@@ -149,35 +149,8 @@ func (s *status) WithLog(logger logr.Logger) *status {\nreturn s\n}\n-// UpdateCache updates cache status.\n-func (s *status) UpdateCache(c goharborv1.HarborClusterCondition) *status {\n- s.updateCondition(goharborv1.CacheReady, c)\n-\n- return s\n-}\n-\n-// UpdateDatabase updates database status.\n-func (s *status) UpdateDatabase(c goharborv1.HarborClusterCondition) *status {\n- s.updateCondition(goharborv1.DatabaseReady, c)\n-\n- return s\n-}\n-\n-// UpdateStorage updates storage status.\n-func (s *status) UpdateStorage(c goharborv1.HarborClusterCondition) *status {\n- s.updateCondition(goharborv1.StorageReady, c)\n-\n- return s\n-}\n-\n-// UpdateHarbor updates Harbor status.\n-func (s *status) UpdateHarbor(c goharborv1.HarborClusterCondition) *status {\n- s.updateCondition(goharborv1.ServiceReady, c)\n-\n- return s\n-}\n-\n-func (s *status) updateCondition(ct goharborv1.HarborClusterConditionType, c goharborv1.HarborClusterCondition) {\n+// UpdateCondition adds condition update of the specified service to the status object.\n+func (s *status) UpdateCondition(ct goharborv1.HarborClusterConditionType, c goharborv1.HarborClusterCondition) {\ns.locker.Lock()\ndefer s.locker.Unlock()\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "controllers/goharbor/harborcluster/svc_config.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package harborcluster\n+\n+import (\n+ \"context\"\n+\n+ \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n+)\n+\n+// svcConfigGetter is used to get the required access data from the cluster spec for health checking.\n+type svcConfigGetter func(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error)\n+\n+// cacheConfigGetter is for getting configurations of cache service.\n+func cacheConfigGetter(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n+ return nil, nil, nil\n+}\n+\n+// dbConfigGetter is for getting configurations of database service.\n+func dbConfigGetter(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n+ return nil, nil, nil\n+}\n+\n+// storageConfigGetter is for getting configurations of storage service.\n+func storageConfigGetter(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n+ return nil, nil, nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/cr_status.go",
"new_path": "pkg/cluster/controllers/harbor/cr_status.go",
"diff": "@@ -20,15 +20,15 @@ import (\ncorev1 \"k8s.io/api/core/v1\"\n)\n-// harborReadyStatus indicates harbor (CR) is ready\n+// harborReadyStatus indicates harbor (CR) is ready.\nvar harborReadyStatus = lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionTrue)\n-// harborNotReadyStatus indicates harbor (CR) is not ready\n+// harborNotReadyStatus indicates harbor (CR) is not ready.\nvar harborNotReadyStatus = func(reason, message string) *lcm.CRStatus {\nreturn lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionFalse).WithReason(reason).WithMessage(message)\n}\n-// harborUnknownStatus indicates status of harbor (CR) is unknown\n+// harborUnknownStatus indicates status of harbor (CR) is unknown.\nvar harborUnknownStatus = func(reason, message string) *lcm.CRStatus {\nreturn lcm.New(v1alpha2.ServiceReady).WithStatus(corev1.ConditionUnknown).WithReason(reason).WithMessage(message)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -24,6 +24,7 @@ type Controller struct {\nComponentToCRStatus *sync.Map\n}\n+// Apply Harbor instance.\nfunc (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.HarborCluster) (*lcm.CRStatus, error) {\nharborCR := &v1alpha2.Harbor{}\n@@ -59,8 +60,8 @@ func (harbor *Controller) Apply(ctx context.Context, harborcluster *v1alpha2.Har\nif !same {\n// Spec is changed, do update now\nharbor.Log.Info(\"update harbor service\", \"name\", nsdName)\n- harborCR.Spec = desiredCR.Spec\n+ harborCR.Spec = desiredCR.Spec\nif err := harbor.KubeClient.Update(harborCR); err != nil {\nreturn harborNotReadyStatus(UpdateHarborCRError, err.Error()), err\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
refactor(reconciler):update the logic of cluster ctrl
- introduce service manager to handle all the dependent services apply process
- add service config getter func tenmplate for getting info to do health check
- update the methods of cluster status handler
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
07.12.2020 17:07:20
| -28,800
|
802a926fb7a79dab4d89812fef3c6475a8fa6582
|
fix(psql):use consistent name for psql resources
fix
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/generate.go",
"new_path": "pkg/cluster/controllers/database/generate.go",
"diff": "@@ -17,7 +17,7 @@ var (\ndatabaseGVR = SchemeGroupVersion.WithResource(PostgresCRDResourcePlural)\ndatabaseKind = \"postgresql\"\ndatabaseAPI = \"acid.zalan.do/v1\"\n- databasePrefix = \"psql\"\n+ databasePrefix = \"postgresql\"\n)\n// GetPostgresCR returns PostgreSqls CRs.\n@@ -27,7 +27,6 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nstorageSize := p.GetPostgreStorageSize()\nversion := p.GetPostgreVersion()\ndatabases := p.GetDatabases()\n- name := fmt.Sprintf(\"%s-%s-%s\", databasePrefix, p.HarborCluster.Namespace, p.HarborCluster.Name)\nteam := fmt.Sprintf(\"%s-%s\", databasePrefix, p.HarborCluster.Namespace)\nconf := &api.Postgresql{\n@@ -36,7 +35,7 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nAPIVersion: databaseAPI,\n},\nObjectMeta: metav1.ObjectMeta{\n- Name: name,\n+ Name: p.resourceName(),\nNamespace: p.HarborCluster.Namespace,\n},\nSpec: api.PostgresSpec{\n@@ -111,3 +110,8 @@ func (p *PostgreSQLController) GetDatabaseSecret(conn *Connect, secretName strin\nreturn secret\n}\n+\n+// resourceName return the formatted name of the managed psql resource.\n+func (p *PostgreSQLController) resourceName() string {\n+ return fmt.Sprintf(\"%s-%s\", databasePrefix, p.HarborCluster.Name)\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/postgresql.go",
"new_path": "pkg/cluster/controllers/database/postgresql.go",
"diff": "@@ -2,7 +2,6 @@ package database\nimport (\n\"context\"\n- \"fmt\"\n\"github.com/go-logr/logr\"\ngoharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n@@ -44,9 +43,8 @@ func (p *PostgreSQLController) Apply(ctx context.Context, harborcluster *goharbo\np.HarborCluster = harborcluster\ncrdClient := p.DClient.WithResource(databaseGVR).WithNamespace(p.HarborCluster.Namespace)\n- name := fmt.Sprintf(\"%s-%s\", p.HarborCluster.Namespace, p.HarborCluster.Name)\n- actualCR, err := crdClient.Get(name, metav1.GetOptions{})\n+ actualCR, err := crdClient.Get(p.resourceName(), metav1.GetOptions{})\nif errors.IsNotFound(err) {\nreturn p.Deploy()\n} else if err != nil {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/provision.go",
"new_path": "pkg/cluster/controllers/database/provision.go",
"diff": "package database\nimport (\n- \"fmt\"\n-\n\"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n@@ -21,8 +19,6 @@ import (\nfunc (p *PostgreSQLController) Deploy() (*lcm.CRStatus, error) {\nvar expectCR *unstructured.Unstructured\n- name := fmt.Sprintf(\"%s-%s\", p.HarborCluster.Namespace, p.HarborCluster.Name)\n-\ncrdClient := p.DClient.WithResource(databaseGVR).WithNamespace(p.HarborCluster.Namespace)\nexpectCR, err := p.GetPostgresCR()\n@@ -34,14 +30,14 @@ func (p *PostgreSQLController) Deploy() (*lcm.CRStatus, error) {\nreturn databaseNotReadyStatus(SetOwnerReferenceError, err.Error()), err\n}\n- p.Log.Info(\"Creating Database.\", \"namespace\", p.HarborCluster.Namespace, \"name\", name)\n+ p.Log.Info(\"Creating Database.\", \"namespace\", p.HarborCluster.Namespace, \"name\", p.resourceName())\n_, err = crdClient.Create(expectCR, metav1.CreateOptions{})\nif err != nil {\nreturn databaseNotReadyStatus(CreateDatabaseCrError, err.Error()), err\n}\n- p.Log.Info(\"Database create complete.\", \"namespace\", p.HarborCluster.Namespace, \"name\", name)\n+ p.Log.Info(\"Database create complete.\", \"namespace\", p.HarborCluster.Namespace, \"name\", p.resourceName())\nreturn databaseUnknownStatus(), nil\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(psql):use consistent name for psql resources
fix #289
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
07.12.2020 17:28:05
| -28,800
|
ed639090710f1bd0b2773bb5c8bd2a5a30bbd953
|
fix(minio):fix storage redirect issue
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/generate.go",
"new_path": "pkg/cluster/controllers/database/generate.go",
"diff": "@@ -27,7 +27,6 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nstorageSize := p.GetPostgreStorageSize()\nversion := p.GetPostgreVersion()\ndatabases := p.GetDatabases()\n- team := fmt.Sprintf(\"%s-%s\", databasePrefix, p.HarborCluster.Namespace)\nconf := &api.Postgresql{\nTypeMeta: metav1.TypeMeta{\n@@ -42,7 +41,7 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nVolume: api.Volume{\nSize: storageSize,\n},\n- TeamID: team,\n+ TeamID: p.teamID(),\nNumberOfInstances: replica,\nUsers: GetUsers(),\nPatroni: GetPatron(),\n@@ -113,5 +112,10 @@ func (p *PostgreSQLController) GetDatabaseSecret(conn *Connect, secretName strin\n// resourceName return the formatted name of the managed psql resource.\nfunc (p *PostgreSQLController) resourceName() string {\n- return fmt.Sprintf(\"%s-%s\", databasePrefix, p.HarborCluster.Name)\n+ return fmt.Sprintf(\"%s-%s\", p.teamID(), p.HarborCluster.Name)\n+}\n+\n+// teamID return the team ID of the managed psql service.\n+func (p *PostgreSQLController) teamID() string {\n+ return fmt.Sprintf(\"%s-%s\", databasePrefix, p.HarborCluster.Namespace)\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/readiness.go",
"new_path": "pkg/cluster/controllers/database/readiness.go",
"diff": "@@ -146,7 +146,7 @@ func (p *PostgreSQLController) GetInClusterDatabaseInfo(ctx context.Context) (*C\nreturn connect, client, err\n}\n- if connect, err = p.GetInClusterDatabaseConn(p.GetDatabaseName(), pw); err != nil {\n+ if connect, err = p.GetInClusterDatabaseConn(p.resourceName(), pw); err != nil {\nreturn connect, client, err\n}\n@@ -180,8 +180,8 @@ func (p *PostgreSQLController) GetInClusterDatabaseConn(name, pw string) (*Conne\nreturn conn, nil\n}\n-func GenInClusterPasswordSecretName(teamID, name string) string {\n- return fmt.Sprintf(\"postgres.%s-%s.credentials\", teamID, name)\n+func GenInClusterPasswordSecretName(crName string) string {\n+ return fmt.Sprintf(\"postgres.%s.credentials\", crName)\n}\n// GetInClusterHost returns the Database master pod ip or service name.\n@@ -204,15 +204,11 @@ func (p *PostgreSQLController) GetInClusterHost(name string) (string, error) {\nreturn url, nil\n}\n-func (p *PostgreSQLController) GetDatabaseName() string {\n- return fmt.Sprintf(\"%s-%s\", p.HarborCluster.Namespace, p.HarborCluster.Name)\n-}\n-\n// GetInClusterDatabasePassword is get inCluster postgresql password.\nfunc (p *PostgreSQLController) GetInClusterDatabasePassword() (string, error) {\nvar pw string\n- secretName := GenInClusterPasswordSecretName(p.HarborCluster.Namespace, p.HarborCluster.Name)\n+ secretName := GenInClusterPasswordSecretName(p.resourceName())\nsecret, err := p.GetSecret(secretName)\nif err != nil {\n@@ -232,10 +228,9 @@ func (p *PostgreSQLController) GetInClusterDatabasePassword() (string, error) {\n// GetStatefulSetPods returns the postgresql master pod.\nfunc (p *PostgreSQLController) GetStatefulSetPods() (*corev1.PodList, error) {\n- name := p.GetDatabaseName()\nlabel := map[string]string{\n\"application\": \"spilo\",\n- \"cluster-name\": name,\n+ \"cluster-name\": p.resourceName(),\n\"spilo-role\": \"master\",\n}\n@@ -246,7 +241,7 @@ func (p *PostgreSQLController) GetStatefulSetPods() (*corev1.PodList, error) {\nif err := p.Client.List(opts, pod); err != nil {\np.Log.Error(err, \"fail to get pod.\",\n- \"namespace\", p.HarborCluster.Namespace, \"name\", name)\n+ \"namespace\", p.HarborCluster.Namespace, \"name\", p.resourceName())\nreturn nil, err\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -134,6 +134,7 @@ func (harbor *Controller) getHarborCR(harborcluster *v1alpha2.HarborCluster) *v1\nif storage := harbor.getStorageSpec(); storage != nil {\nharbor.Log.Info(\"use incluster storage\", \"storage\", storage.S3.RegionEndpoint)\nharborCR.Spec.ImageChartStorage = storage\n+ harborCR.Spec.ImageChartStorage.Redirect.Disable = harborcluster.Spec.InClusterStorage.MinIOSpec.Redirect.Disable\n}\nreturn harborCR\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/provision.go",
"new_path": "pkg/cluster/controllers/storage/provision.go",
"diff": "@@ -132,7 +132,7 @@ func (m *MinIOController) Provision() (*lcm.CRStatus, error) {\n}\n// if disable redirect docker registry, we will expose minIO access endpoint by ingress.\n- if !m.HarborCluster.Spec.ImageChartStorage.Redirect.Disable {\n+ if !m.HarborCluster.Spec.InClusterStorage.MinIOSpec.Redirect.Disable {\ningress := m.generateIngress()\nerr = m.KubeClient.Create(ingress)\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(minio):fix storage redirect issue
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,875
|
08.12.2020 22:10:54
| -28,800
|
624d377501bd7b53301d31da8709425496031fdd
|
fix full_stack.yaml
|
[
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack.yaml",
"new_path": "manifests/samples/full_stack.yaml",
"diff": "@@ -11,7 +11,7 @@ metadata:\nname: admin-core-secret\nnamespace: cluster-sample-ns\ndata:\n- password: SGFyYm9yMTIzNDU=\n+ secret: SGFyYm9yMTIzNDU=\ntype: Opaque\n---\n# Cert issuer\n@@ -52,7 +52,7 @@ spec:\ningress:\nhost: sample.harbor.domain\ntls:\n- certificateRef: sample-public-certificate\n+ certificateRef: public-certificate\nencryptionKeyRef: core-database-encryption\ninternalTLS:\nenabled: true\n@@ -60,7 +60,7 @@ spec:\nregistry: {}\ncore:\ntokenIssuer:\n- name: service-token\n+ name: selfsigned-issuer\nkind: Issuer\ninClusterDatabase:\nkind: PostgresSQL\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix full_stack.yaml
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,870
|
08.12.2020 21:07:42
| -28,800
|
704ec877bb3c6f0efc10172224d472955089ba98
|
feat(database) implement svc config getter
implement svc config getter
fix
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/service_mgr.go",
"new_path": "controllers/goharbor/harborcluster/service_mgr.go",
"diff": "@@ -153,7 +153,7 @@ func (s *ServiceManager) Apply() error {\n}\n// Use external\n- svcCfg, options, err := s.svcConfigGetter(s.ctx, s.cluster)\n+ svcCfg, options, err := s.svcConfigGetter(s.ctx, s.harborCtrl.KubeClient, s.cluster)\nif err != nil {\nstatus.WithStatus(v1.ConditionFalse).\nWithMessage(\"failed to get service configuration\").\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/svc_config.go",
"new_path": "controllers/goharbor/harborcluster/svc_config.go",
"diff": "@@ -16,25 +16,108 @@ package harborcluster\nimport (\n\"context\"\n+ \"errors\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ harbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n+ \"github.com/goharbor/harbor-operator/pkg/k8s\"\n+ corev1 \"k8s.io/api/core/v1\"\n+ \"k8s.io/apimachinery/pkg/types\"\n)\n// svcConfigGetter is used to get the required access data from the cluster spec for health checking.\n-type svcConfigGetter func(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error)\n+type svcConfigGetter func(ctx context.Context, kubeClient k8s.Client, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error)\n// cacheConfigGetter is for getting configurations of cache service.\n-func cacheConfigGetter(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n+func cacheConfigGetter(ctx context.Context, kubeClient k8s.Client, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\nreturn nil, nil, nil\n}\n// dbConfigGetter is for getting configurations of database service.\n-func dbConfigGetter(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n- return nil, nil, nil\n+func dbConfigGetter(ctx context.Context, kubeClient k8s.Client, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n+ var (\n+ host, accessKey, accessSecret, secret string\n+ port uint\n+ option []lcm.Option\n+ )\n+\n+ if cluster.Spec.HarborComponentsSpec.Database == nil {\n+ return nil, nil, errors.New(\"cluster.Spec.HarborComponentsSpec.Database invalid value\")\n+ }\n+\n+ db := cluster.Spec.HarborComponentsSpec.Database\n+\n+ host = db.Hosts[0].Host\n+ if len(host) == 0 {\n+ return nil, nil, errors.New(\"Database.Hosts invalid value\")\n+ }\n+\n+ port = uint(int(db.Hosts[0].Port))\n+ if port == 0 {\n+ return nil, nil, errors.New(\"Database.Port invalid value\")\n+ }\n+\n+ accessKey = db.Username\n+ if len(accessKey) == 0 {\n+ return nil, nil, errors.New(\"Database.Username invalid value\")\n+ }\n+\n+ secret = db.PasswordRef\n+ if len(secret) == 0 {\n+ return nil, nil, errors.New(\"Database.PasswordRef invalid value\")\n+ }\n+\n+ accessSecret, err := getAccessSecret(kubeClient, secret, cluster.GetNamespace())\n+ if err != nil {\n+ return nil, nil, err\n+ }\n+\n+ return &lcm.ServiceConfig{\n+ Endpoint: &lcm.Endpoint{\n+ Host: db.Hosts[0].Host,\n+ Port: port,\n+ },\n+ Credentials: &lcm.Credentials{\n+ AccessKey: accessKey,\n+ AccessSecret: accessSecret,\n+ },\n+ }, option, nil\n}\n// storageConfigGetter is for getting configurations of storage service.\n-func storageConfigGetter(ctx context.Context, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n+func storageConfigGetter(ctx context.Context, kubeClient k8s.Client, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\nreturn nil, nil, nil\n}\n+\n+// getAccessSecret is for getting component connection password.\n+func getAccessSecret(kubeClient k8s.Client, name, ns string) (string, error) {\n+ var accessSecret string\n+\n+ secret, err := getSecret(kubeClient, name, ns)\n+ if err != nil {\n+ return accessSecret, err\n+ }\n+\n+ for k, v := range secret {\n+ switch k {\n+ case harbormetav1.PostgresqlPasswordKey:\n+ accessSecret = string(v)\n+ case harbormetav1.RedisPasswordKey:\n+ accessSecret = string(v)\n+ }\n+ }\n+\n+ return accessSecret, nil\n+}\n+\n+// getSecret is for getting secret.\n+func getSecret(kubeClient k8s.Client, secretName, ns string) (map[string][]byte, error) {\n+ secret := &corev1.Secret{}\n+\n+ if err := kubeClient.Get(types.NamespacedName{Name: secretName, Namespace: ns}, secret); err != nil {\n+ return nil, err\n+ }\n+\n+ return secret.Data, nil\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(database) implement svc config getter
implement svc config getter
fix #297
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,881
|
09.12.2020 12:21:48
| -28,800
|
37ea86264487aad4ca05fb3ad115c5a10f299131
|
fix: add predicate for harbor cluster controller to resolve reconcile cycle
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"new_path": "controllers/goharbor/harborcluster/ctrl_setup.go",
"diff": "@@ -14,9 +14,12 @@ import (\n\"github.com/goharbor/harbor-operator/pkg/factories/application\"\n\"github.com/goharbor/harbor-operator/pkg/k8s\"\n\"github.com/ovh/configstore\"\n+ \"k8s.io/apimachinery/pkg/api/equality\"\n\"k8s.io/apimachinery/pkg/runtime\"\nctrl \"sigs.k8s.io/controller-runtime\"\n\"sigs.k8s.io/controller-runtime/pkg/client\"\n+ \"sigs.k8s.io/controller-runtime/pkg/event\"\n+ \"sigs.k8s.io/controller-runtime/pkg/predicate\"\n)\n// TODO: Refactor to inherit the common reconciler in future\n@@ -79,6 +82,7 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn ctrl.NewControllerManagedBy(mgr).\nFor(&goharborv1alpha2.HarborCluster{}).\n+ WithEventFilter(harborClusterPredicateFuncs).\nComplete(r)\n}\n@@ -90,3 +94,25 @@ func New(ctx context.Context, name string, configStore *configstore.Store) (comm\nLog: ctrl.Log.WithName(application.GetName(ctx)).WithName(\"controller\").WithValues(\"controller\", name),\n}, nil\n}\n+\n+// harborClusterPredicateFuncs do filter for events.\n+var harborClusterPredicateFuncs = predicate.Funcs{\n+ // we do not care other events\n+ UpdateFunc: func(event event.UpdateEvent) bool {\n+ old, ok := event.ObjectOld.(*goharborv1alpha2.HarborCluster)\n+ if !ok {\n+ return true\n+ }\n+\n+ new, ok := event.ObjectNew.(*goharborv1alpha2.HarborCluster)\n+ if !ok {\n+ return true\n+ }\n+ // when status was not changed and spec was not changed, not need reconcile\n+ if equality.Semantic.DeepDerivative(old.Spec, new.Spec) && old.Status.Status == new.Status.Status {\n+ return false\n+ }\n+\n+ return true\n+ },\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: add predicate for harbor cluster controller to resolve reconcile cycle
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,875
|
09.12.2020 17:08:58
| -28,800
|
27698e4ac9c8e2662f2ef417629d966426d59d21
|
fix database user
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/readiness.go",
"new_path": "pkg/cluster/controllers/database/readiness.go",
"diff": "@@ -93,7 +93,7 @@ func addProperties(name string, conn *Connect, properties *lcm.Properties) {\nfunc getHarborDatabaseSpec(name string, conn *Connect) *goharborv1alpha2.HarborDatabaseSpec {\nreturn &goharborv1alpha2.HarborDatabaseSpec{\nPostgresCredentials: harbormetav1.PostgresCredentials{\n- Username: \"zalando\",\n+ Username: \"postgres\",\nPasswordRef: getDatabasePasswordRefName(name),\n},\nHosts: []harbormetav1.PostgresHostSpec{\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix database user
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,881
|
09.12.2020 21:00:45
| -28,800
|
ff6516fb3b667dc3603f6f3055040cad41a2f6ab
|
feat: add redis svcConfigGetter
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/svc_config.go",
"new_path": "controllers/goharbor/harborcluster/svc_config.go",
"diff": "@@ -17,6 +17,7 @@ package harborcluster\nimport (\n\"context\"\n\"errors\"\n+ \"fmt\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\nharbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n@@ -31,7 +32,35 @@ type svcConfigGetter func(ctx context.Context, kubeClient k8s.Client, cluster *v\n// cacheConfigGetter is for getting configurations of cache service.\nfunc cacheConfigGetter(ctx context.Context, kubeClient k8s.Client, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n- return nil, nil, nil\n+ if cluster == nil {\n+ return nil, nil, fmt.Errorf(\"cluster can not be nil\")\n+ }\n+\n+ spec := cluster.Spec.HarborComponentsSpec.Redis\n+ if spec == nil {\n+ return nil, nil, fmt.Errorf(\"cluster redis spec can not be nil\")\n+ }\n+ // get out-cluster redis svc config\n+ svcConfig := &lcm.ServiceConfig{\n+ Endpoint: &lcm.Endpoint{\n+ Host: spec.Host,\n+ Port: uint(spec.Port),\n+ },\n+ }\n+\n+ if spec.PasswordRef != \"\" {\n+ secretName := spec.PasswordRef\n+ secretNamespace := cluster.Namespace\n+\n+ accessSecret, err := getAccessSecret(kubeClient, secretName, secretNamespace)\n+ if err != nil {\n+ return nil, nil, fmt.Errorf(\"get secret %s/%s failed, error: %w\", secretNamespace, secretName, err)\n+ }\n+ // add Credentials\n+ svcConfig.Credentials = &lcm.Credentials{AccessSecret: accessSecret}\n+ }\n+\n+ return svcConfig, nil, nil\n}\n// dbConfigGetter is for getting configurations of database service.\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat: add redis svcConfigGetter
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,875
|
09.12.2020 18:14:50
| -28,800
|
cb386760bf1f008d765a2dbc840c1f58251620ac
|
fix registry s3 secret
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/minio.go",
"new_path": "pkg/cluster/controllers/storage/minio.go",
"diff": "@@ -6,6 +6,7 @@ import (\n\"github.com/go-logr/logr\"\ngoharborv1 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n+ \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\nminio \"github.com/goharbor/harbor-operator/pkg/cluster/controllers/storage/minio/api/v1\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n\"github.com/goharbor/harbor-operator/pkg/k8s\"\n@@ -20,7 +21,7 @@ import (\nconst (\nStorage = \"storage\"\n- s3Storage = \"s3\"\n+ s3Storage = v1alpha1.SharedSecretKey\nDefaultCredsSecret = \"creds\"\nDefaultPrefix = \"minio-\"\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix registry s3 secret
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,893
|
10.12.2020 16:16:32
| -28,800
|
d3776a3dd40666275eb1d458dc44e7b1c353e17f
|
fix(minio):add an empty healthchecker for storage
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "pkg/cluster/controllers/storage/healthchecker.go",
"diff": "+// Copyright Project Harbor Authors\n+//\n+// Licensed under the Apache License, Version 2.0 (the \"License\");\n+// you may not use this file except in compliance with the License.\n+// You may obtain a copy of the License at\n+//\n+// http://www.apache.org/licenses/LICENSE-2.0\n+//\n+// Unless required by applicable law or agreed to in writing, software\n+// distributed under the License is distributed on an \"AS IS\" BASIS,\n+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n+// See the License for the specific language governing permissions and\n+// limitations under the License.\n+\n+package storage\n+\n+import (\n+ \"context\"\n+\n+ \"github.com/goharbor/harbor-operator/pkg/cluster/lcm\"\n+)\n+\n+// HealthChecker for doing health checking for storage.\n+type HealthChecker struct{}\n+\n+var _ lcm.HealthChecker = &HealthChecker{}\n+\n+// TODO: Implement me\n+// CheckHealth implements lcm.HealthChecker interface for checking health of the storage.\n+func (hc *HealthChecker) CheckHealth(ctx context.Context, svc *lcm.ServiceConfig, options ...lcm.Option) (*lcm.CheckResponse, error) {\n+ return &lcm.CheckResponse{\n+ Status: lcm.Healthy,\n+ }, nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/minio.go",
"new_path": "pkg/cluster/controllers/storage/minio.go",
"diff": "@@ -47,7 +47,7 @@ type MinIOController struct {\n}\nfunc (m *MinIOController) HealthChecker() lcm.HealthChecker {\n- panic(\"implement me\")\n+ return &HealthChecker{}\n}\nvar HarborClusterMinIOGVK = schema.GroupVersionKind{\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(minio):add an empty healthchecker for storage
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,870
|
10.12.2020 22:27:45
| -28,800
|
33e8b7e7193a92dd02598aabb11ec9912771f1bb
|
fix(database) failed to initialize database core
failed to initialize database core
fix
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/readiness.go",
"new_path": "pkg/cluster/controllers/database/readiness.go",
"diff": "@@ -28,6 +28,7 @@ const (\nClairDatabase = \"clair\"\nNotaryServerDatabase = \"notaryserver\"\nNotarySignerDatabase = \"notarysigner\"\n+ DefaultDatabaseName = \"postgres\"\nCoreSecretName = \"core\"\nClairSecretName = \"clair\"\n@@ -93,7 +94,7 @@ func addProperties(name string, conn *Connect, properties *lcm.Properties) {\nfunc getHarborDatabaseSpec(name string, conn *Connect) *goharborv1alpha2.HarborDatabaseSpec {\nreturn &goharborv1alpha2.HarborDatabaseSpec{\nPostgresCredentials: harbormetav1.PostgresCredentials{\n- Username: \"postgres\",\n+ Username: DefaultDatabaseName,\nPasswordRef: getDatabasePasswordRefName(name),\n},\nHosts: []harbormetav1.PostgresHostSpec{\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/utils.go",
"new_path": "pkg/cluster/controllers/database/utils.go",
"diff": "@@ -3,7 +3,6 @@ package database\nimport (\n\"fmt\"\n- harbormetav1 \"github.com/goharbor/harbor-operator/apis/meta/v1alpha1\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/controllers/database/api\"\ncorev1 \"k8s.io/api/core/v1\"\n\"k8s.io/apimachinery/pkg/types\"\n@@ -17,12 +16,12 @@ const (\nfunc (p *PostgreSQLController) GetDatabases() map[string]string {\ndatabases := map[string]string{\n- CoreDatabase: harbormetav1.CoreDatabase,\n+ CoreDatabase: DefaultDatabaseName,\n}\nif p.HarborCluster.Spec.Notary != nil {\n- databases[NotaryServerDatabase] = harbormetav1.NotaryServerDatabase\n- databases[NotarySignerDatabase] = harbormetav1.NotarySignerDatabase\n+ databases[NotaryServerDatabase] = DefaultDatabaseName\n+ databases[NotarySignerDatabase] = DefaultDatabaseName\n}\nreturn databases\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(database) failed to initialize database core
failed to initialize database core
fix #308
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,875
|
11.12.2020 15:52:28
| -28,800
|
3c17809bb81c602d0887847bc4e25d6e1fd860f8
|
fix spec.imageChartStorage.filesystem.chartPersistentVolume optional
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"diff": "@@ -335,7 +335,7 @@ func (r *HarborStorageImageChartStorageSpec) Validate() error {\ntype HarborStorageImageChartStorageFileSystemSpec struct {\n// +kubebuilder:validation:Optional\n- ChartPersistentVolume *HarborStoragePersistentVolumeSpec `json:\"chartPersistentVolume\"`\n+ ChartPersistentVolume *HarborStoragePersistentVolumeSpec `json:\"chartPersistentVolume,omitempty\"`\n// +kubebuilder:validation:Required\nRegistryPersistentVolume HarborStorageRegistryPersistentVolumeSpec `json:\"registryPersistentVolume\"`\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix spec.imageChartStorage.filesystem.chartPersistentVolume optional
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,870
|
12.12.2020 15:05:45
| -28,800
|
32049bc59284e81e78a9c11bad90768156776da8
|
fix(database) failed to initialize database core
fix failed to initialize database core
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -187,6 +187,7 @@ docker-build: dist/harbor-operator_linux_amd64/manager\ndocker-push:\ndocker push \"$(IMG)\"\n+.PHONY: dist/harbor-operator_linux_amd64/manager\ndist/harbor-operator_linux_amd64/manager:\nmkdir -p dist/harbor-operator_linux_amd64\nCGO_ENABLED=0 \\\n"
},
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harbor_types.go",
"diff": "@@ -335,7 +335,7 @@ func (r *HarborStorageImageChartStorageSpec) Validate() error {\ntype HarborStorageImageChartStorageFileSystemSpec struct {\n// +kubebuilder:validation:Optional\n- ChartPersistentVolume *HarborStoragePersistentVolumeSpec `json:\"chartPersistentVolume\"`\n+ ChartPersistentVolume *HarborStoragePersistentVolumeSpec `json:\"chartPersistentVolume,omitempty\"`\n// +kubebuilder:validation:Required\nRegistryPersistentVolume HarborStorageRegistryPersistentVolumeSpec `json:\"registryPersistentVolume\"`\n"
},
{
"change_type": "MODIFY",
"old_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"new_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"diff": "@@ -42,7 +42,6 @@ spec:\nstorage: 1Gi\nreplicas: 2\nversion: \"12\"\n- storageClassName: default\nresources:\nlimits:\ncpu: 500m\n@@ -58,7 +57,6 @@ spec:\nversion: RELEASE.2020-08-13T02-39-50Z\nvolumeClaimTemplate:\nspec:\n- storageClassName: standard\naccessModes:\n- ReadWriteOnce\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/generate.go",
"new_path": "pkg/cluster/controllers/database/generate.go",
"diff": "@@ -87,11 +87,10 @@ func GetInitDB() map[string]string {\nfunc GetUsers() map[string]api.UserFlags {\nreturn map[string]api.UserFlags{\n- \"zalando\": {\n+ DefaultDatabaseUser: {\n\"superuser\",\n\"createdb\",\n},\n- \"foo_user\": {},\n}\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/readiness.go",
"new_path": "pkg/cluster/controllers/database/readiness.go",
"diff": "@@ -28,7 +28,7 @@ const (\nClairDatabase = \"clair\"\nNotaryServerDatabase = \"notaryserver\"\nNotarySignerDatabase = \"notarysigner\"\n- DefaultDatabaseName = \"postgres\"\n+ DefaultDatabaseUser = \"harbor\"\nCoreSecretName = \"core\"\nClairSecretName = \"clair\"\n@@ -94,7 +94,7 @@ func addProperties(name string, conn *Connect, properties *lcm.Properties) {\nfunc getHarborDatabaseSpec(name string, conn *Connect) *goharborv1alpha2.HarborDatabaseSpec {\nreturn &goharborv1alpha2.HarborDatabaseSpec{\nPostgresCredentials: harbormetav1.PostgresCredentials{\n- Username: DefaultDatabaseName,\n+ Username: DefaultDatabaseUser,\nPasswordRef: getDatabasePasswordRefName(name),\n},\nHosts: []harbormetav1.PostgresHostSpec{\n@@ -174,15 +174,15 @@ func (p *PostgreSQLController) GetInClusterDatabaseConn(name, pw string) (*Conne\nHost: host,\nPort: InClusterDatabasePort,\nPassword: pw,\n- Username: InClusterDatabaseUserName,\n- Database: InClusterDatabaseName,\n+ Username: DefaultDatabaseUser,\n+ Database: CoreDatabase,\n}\nreturn conn, nil\n}\n-func GenInClusterPasswordSecretName(crName string) string {\n- return fmt.Sprintf(\"postgres.%s.credentials\", crName)\n+func GenInClusterPasswordSecretName(user, crName string) string {\n+ return fmt.Sprintf(\"%s.%s.credentials\", user, crName)\n}\n// GetInClusterHost returns the Database master pod ip or service name.\n@@ -209,7 +209,7 @@ func (p *PostgreSQLController) GetInClusterHost(name string) (string, error) {\nfunc (p *PostgreSQLController) GetInClusterDatabasePassword() (string, error) {\nvar pw string\n- secretName := GenInClusterPasswordSecretName(p.resourceName())\n+ secretName := GenInClusterPasswordSecretName(DefaultDatabaseUser, p.resourceName())\nsecret, err := p.GetSecret(secretName)\nif err != nil {\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/utils.go",
"new_path": "pkg/cluster/controllers/database/utils.go",
"diff": "@@ -16,12 +16,12 @@ const (\nfunc (p *PostgreSQLController) GetDatabases() map[string]string {\ndatabases := map[string]string{\n- CoreDatabase: DefaultDatabaseName,\n+ CoreDatabase: DefaultDatabaseUser,\n}\nif p.HarborCluster.Spec.Notary != nil {\n- databases[NotaryServerDatabase] = DefaultDatabaseName\n- databases[NotarySignerDatabase] = DefaultDatabaseName\n+ databases[NotaryServerDatabase] = DefaultDatabaseUser\n+ databases[NotarySignerDatabase] = DefaultDatabaseUser\n}\nreturn databases\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(database) failed to initialize database core
fix failed to initialize database core
Signed-off-by: zhuhuijun <zhuhuijunzhj@gmail.com>
|
254,875
|
11.12.2020 16:34:46
| -28,800
|
1fa74d11e5211b7b9188d0aa156c5b7896cce799
|
fix ci for cluster-operator
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/tests.yml",
"new_path": ".github/workflows/tests.yml",
"diff": "@@ -123,13 +123,11 @@ jobs:\n- name: install harbor-operator\nrun: |\nset -ex\n- kubectl create ns harbor-operator-ns\n- cd config/default\n+ cd manifests/cluster\nkustomize edit set image goharbor/harbor-operator=harbor-operator:dev_test\n+ git diff\nkustomize build | kubectl apply -f -\n- # make helm-install IMG=harbor-operator:dev_test\n-\nif ! time kubectl -n harbor-operator-ns wait --for=condition=Available deployment --all --timeout 300s; then\nkubectl get all -n harbor-operator-ns\nexit 1\n@@ -139,25 +137,25 @@ jobs:\nrun: |\nexport GITHUB_TOKEN=xxx\nset -ex\n- make sample\n+ kubectl apply -f manifests/samples/full_stack_fs.yaml\nfor i in $(seq 1 6);do\nsleep 30\necho $i\n- kubectl get all\n+ kubectl -n cluster-sample-ns get all\ndone\n- if ! time kubectl wait --for=condition=Ready pod --all --timeout 600s ;then\n+ if ! time kubectl -n cluster-sample-ns wait --for=condition=Ready pod --all --timeout 600s ;then\necho install harbor failed\n- kubectl get all\n+ kubectl get all -n cluster-sample-ns\n- for n in $(kubectl get po |grep -v Running|grep -v NAME|awk '{print $1}');do\n+ for n in $(kubectl -n cluster-sample-ns get po |grep -v Running|grep -v NAME|awk '{print $1}');do\necho describe $n\n- kubectl describe pod $n\n+ kubectl -n cluster-sample-ns describe pod $n\necho show log $n\n- kubectl logs --tail 100 $n || true\n+ kubectl -n cluster-sample-ns logs --tail 100 $n || true\ndone\nexit 1\nelse\n- kubectl get all\n+ kubectl -n cluster-sample-ns get all\nfi\nfree -h\n@@ -169,12 +167,12 @@ jobs:\nsleep 10\necho 127.0.0.1 core.harbor.domain | sudo tee -a /etc/hosts\ncurl https://core.harbor.domain/api/v2.0/systeminfo -i -k\n- sudo mkdir -p /etc/docker/certs.d/core.harbor.domain\n- kubectl get secret sample-public-certificate -o jsonpath='{.data.ca\\.crt}' \\\n+ mkdir -p ~/.docker/tls/core.harbor.domain\n+ kubectl -n cluster-sample-ns get secret sample-public-certificate -o jsonpath='{.data.ca\\.crt}' \\\n| base64 --decode \\\n- | sudo tee \"/etc/docker/certs.d/core.harbor.domain/ca.crt\"\n+ | sudo tee ~/.docker/tls/core.harbor.domain/ca.crt\n# docker login, create image, docker push, docker pull\n- docker login core.harbor.domain -u admin -p Harbor12345\n+ docker login core.harbor.domain -u admin -p Harbor12345 || (kubectl -n cluster-sample-ns get po;kubectl -n cluster-sample-ns logs -l goharbor.io/operator-controller=core;exit 1)\ndocker run busybox dd if=/dev/urandom of=test count=10 bs=1MB\nDOCKERID=`docker ps -l -q`\ndocker commit $DOCKERID core.harbor.domain/library/busybox:test\n@@ -233,19 +231,8 @@ jobs:\nmatrix:\n# https://github.com/jetstack/cert-manager/tags\npath:\n- - samples/chartmuseum\n- - samples/core\n- - samples/database\n- samples/harbor\n- samples/harbor-full\n- - samples/jobservice\n- - samples/notary\n- - samples/notary-server\n- - samples/notary-signer\n- - samples/portal\n- - samples/registry\n- - samples/registryctl\n-\nsteps:\n- uses: actions/checkout@v2\n- uses: azure/k8s-bake@v1\n@@ -261,23 +248,3 @@ jobs:\nsteps:\n- uses: actions/checkout@v2\n- run: make md-lint\n-\n-# # Go Releaser\n-# release:\n-# runs-on: ubuntu-latest\n-# name: 'release: snapshot'\n-# steps:\n-# - uses: actions/setup-go@v2\n-# with:\n-# go-version: 1.14\n-# - uses: actions/checkout@v2\n-# - name: Import GPG key\n-# id: import_gpg\n-# uses: crazy-max/ghaction-import-gpg@v3\n-# with:\n-# gpg-private-key: ${{ secrets.GPG_PRIVATE_KEY }}\n-# passphrase: ${{ secrets.GPG_PASSPHRASE }}\n-# - run: make release-test\n-# env:\n-# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}\n-# GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack.yaml",
"new_path": "manifests/samples/full_stack.yaml",
"diff": "@@ -27,13 +27,13 @@ spec:\napiVersion: cert-manager.io/v1alpha2\nkind: Certificate\nmetadata:\n- name: public-certificate\n+ name: sample-public-certificate\nnamespace: cluster-sample-ns\nspec:\n- secretName: public-certificate\n+ secretName: sample-public-certificate\ndnsNames:\n- - sample.goharbor.io\n- - notary.goharbor.io\n+ - core.harbor.domain\n+ - notary.harbor.domain\nissuerRef:\nname: selfsigned-issuer\nkind: Issuer\n@@ -46,13 +46,13 @@ metadata:\nnamespace: cluster-sample-ns\nspec:\nharborAdminPasswordRef: admin-core-secret\n- externalURL: https://sample.harbor.domain\n+ externalURL: https://core.harbor.domain\nexpose:\ncore:\ningress:\n- host: sample.harbor.domain\n+ host: core.harbor.domain\ntls:\n- certificateRef: public-certificate\n+ certificateRef: sample-public-certificate\nencryptionKeyRef: core-database-encryption\ninternalTLS:\nenabled: true\n"
},
{
"change_type": "ADD",
"old_path": null,
"new_path": "manifests/samples/full_stack_fs.yaml",
"diff": "+# Sample namespace\n+apiVersion: v1\n+kind: Namespace\n+metadata:\n+ name: cluster-sample-ns\n+---\n+# A secret of harbor admin password.\n+apiVersion: v1\n+kind: Secret\n+metadata:\n+ name: admin-core-secret\n+ namespace: cluster-sample-ns\n+data:\n+ secret: SGFyYm9yMTIzNDU=\n+type: Opaque\n+---\n+# Cert issuer\n+apiVersion: cert-manager.io/v1alpha2\n+kind: Issuer\n+metadata:\n+ name: selfsigned-issuer\n+ namespace: cluster-sample-ns\n+spec:\n+ selfSigned: {}\n+---\n+# Certificates of ingress\n+apiVersion: cert-manager.io/v1alpha2\n+kind: Certificate\n+metadata:\n+ name: sample-public-certificate\n+ namespace: cluster-sample-ns\n+spec:\n+ secretName: sample-public-certificate\n+ dnsNames:\n+ - core.harbor.domain\n+ - notary.harbor.domain\n+ issuerRef:\n+ name: selfsigned-issuer\n+ kind: Issuer\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ name: sample-harbor-registry\n+ namespace: cluster-sample-ns\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ volumeMode: Filesystem\n+ resources:\n+ requests:\n+ storage: 5Gi\n+---\n+# Full stack Harbor\n+apiVersion: goharbor.io/v1alpha2\n+kind: HarborCluster\n+metadata:\n+ name: harborcluster-sample\n+ namespace: cluster-sample-ns\n+spec:\n+ harborAdminPasswordRef: admin-core-secret\n+ externalURL: https://core.harbor.domain\n+ expose:\n+ core:\n+ ingress:\n+ host: core.harbor.domain\n+ tls:\n+ certificateRef: sample-public-certificate\n+ encryptionKeyRef: core-database-encryption\n+ internalTLS:\n+ enabled: true\n+ portal: {}\n+ registry: {}\n+ core:\n+ tokenIssuer:\n+ name: selfsigned-issuer\n+ kind: Issuer\n+ imageChartStorage:\n+ filesystem:\n+ registryPersistentVolume:\n+ claimName: sample-harbor-registry\n+ inClusterDatabase:\n+ kind: PostgresSQL\n+ postgresSqlSpec:\n+ storage: 1Gi\n+ replicas: 2\n+ version: \"12\"\n+ storageClassName: default\n+ resources:\n+ limits:\n+ cpu: 500m\n+ memory: 500Mi\n+ requests:\n+ cpu: 100m\n+ memory: 250Mi\n+ inClusterCache:\n+ kind: Redis\n+ redisSpec:\n+ schema: redis\n+ server:\n+ replicas: 1\n+ resources:\n+ limits:\n+ cpu: 500m\n+ memory: 500Mi\n+ requests:\n+ cpu: 100m\n+ memory: 250Mi\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix ci for cluster-operator
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,875
|
11.12.2020 18:15:28
| -28,800
|
6bce5c3af87c8040473c3eeed89e53f3b382ab39
|
update harbor version to 2.1.2
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"new_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"diff": "@@ -23,7 +23,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/chartmuseum-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/chartmuseum-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/chartmuseum-photon:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a Chartmuseum object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/core.go",
"new_path": "controllers/goharbor/core/core.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/core-config.conf.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/harbor-core:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-core:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a Core object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/jobservice/jobservice.go",
"new_path": "controllers/goharbor/jobservice/jobservice.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/jobservice-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/harbor-jobservice:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-jobservice:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a JobService object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notaryserver/notaryserver.go",
"new_path": "controllers/goharbor/notaryserver/notaryserver.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/notaryserver-config.json.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/notary-server-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/notary-server-photon:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a NotaryServer object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notarysigner/notarysigner.go",
"new_path": "controllers/goharbor/notarysigner/notarysigner.go",
"diff": "@@ -23,7 +23,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/notarysigner-config.json.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/notary-signer-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/notary-signer-photon:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a NotarySigner object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/portal/portal.go",
"new_path": "controllers/goharbor/portal/portal.go",
"diff": "@@ -21,7 +21,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/portal-config.conf.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/harbor-portal:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-portal:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a Portal object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registry/registry.go",
"new_path": "controllers/goharbor/registry/registry.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/registry-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/registry-photon:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/registry-photon:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a Registry object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registryctl/registryctl.go",
"new_path": "controllers/goharbor/registryctl/registryctl.go",
"diff": "@@ -26,7 +26,7 @@ const (\nDefaultConfigTemplatePath = \"/etc/harbor-operator/registryctl-config.yaml.tmpl\"\nConfigTemplateKey = \"template-content\"\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/harbor-registryctl:v2.0.0\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/harbor-registryctl:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a RegistryController object.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/trivy/trivy.go",
"new_path": "controllers/goharbor/trivy/trivy.go",
"diff": "@@ -19,7 +19,7 @@ import (\nconst (\nDefaultRequeueWait = 2 * time.Second\nConfigImageKey = \"docker-image\"\n- DefaultImage = config.DefaultRegistry + \"goharbor/trivy-adapter-photon:v2.0.1\"\n+ DefaultImage = config.DefaultRegistry + \"goharbor/trivy-adapter-photon:\" + config.DefaultHarborVersion\n)\n// Reconciler reconciles a Trivy object.\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/config/config.go",
"new_path": "pkg/config/config.go",
"diff": "@@ -18,6 +18,7 @@ const (\nDefaultConcurrentReconcile = 1\nDefaultHarborClass = \"\"\nDefaultRegistry = \"\"\n+ DefaultHarborVersion = \"v2.1.2\"\n)\nvar ErrNotReady = errors.New(\"configuration not ready\")\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
update harbor version to 2.1.2
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,893
|
14.12.2020 19:05:41
| -28,800
|
b1614df4e081c6ae45c809e20f53ec564957a8a3
|
fix(ctrl):update cluster ctrl for status timestamp
fix
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/status.go",
"new_path": "controllers/goharbor/harborcluster/status.go",
"diff": "@@ -24,6 +24,7 @@ import (\ngoharborv1 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\ncorev1 \"k8s.io/api/core/v1\"\napierrors \"k8s.io/apimachinery/pkg/api/errors\"\n+ v1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"sigs.k8s.io/controller-runtime/pkg/client\"\n)\n@@ -159,15 +160,16 @@ func (s *status) UpdateCondition(ct goharborv1.HarborClusterConditionType, c goh\nif cp.Type == ct {\nif cp.Status != c.Status ||\n- cp.LastTransitionTime != c.LastTransitionTime ||\ncp.Reason != c.Reason ||\ncp.Message != c.Message {\n// Override\ncp.Status = c.Status\n- cp.LastTransitionTime = c.LastTransitionTime\ncp.Message = c.Message\ncp.Reason = c.Reason\n+ // Update timestamp\n+ cp.LastTransitionTime = v1.Now()\n+ // Update revision for identifying the changes\ns.data.Revision = time.Now().UnixNano()\n}\n@@ -175,7 +177,9 @@ func (s *status) UpdateCondition(ct goharborv1.HarborClusterConditionType, c goh\n}\n}\n// Append if not existing yet\n- s.data.Conditions = append(s.data.Conditions, c)\n+ cc := c.DeepCopy()\n+ cc.LastTransitionTime = v1.Now()\n+ s.data.Conditions = append(s.data.Conditions, *cc)\ns.data.Revision = time.Now().UnixNano()\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(ctrl):update cluster ctrl for status timestamp
fix #325
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,893
|
15.12.2020 09:57:16
| -28,800
|
b9d05077b29fd16d69fdef19cd221c24e81e55c2
|
fix(minio):update svcconfig getter
handle health checking of filesystem storage driver
fix
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harborcluster/svc_config.go",
"new_path": "controllers/goharbor/harborcluster/svc_config.go",
"diff": "@@ -116,7 +116,8 @@ func dbConfigGetter(ctx context.Context, kubeClient k8s.Client, cluster *v1alpha\n// storageConfigGetter is for getting configurations of storage service.\nfunc storageConfigGetter(ctx context.Context, kubeClient k8s.Client, cluster *v1alpha2.HarborCluster) (*lcm.ServiceConfig, []lcm.Option, error) {\n- if cluster.Spec.ImageChartStorage.S3 != nil {\n+ switch {\n+ case cluster.Spec.ImageChartStorage.S3 != nil:\naccessSecret, err := getAccessSecret(kubeClient, cluster.Spec.ImageChartStorage.S3.SecretKeyRef, cluster.Namespace)\nif err != nil {\nreturn nil, nil, err\n@@ -133,23 +134,23 @@ func storageConfigGetter(ctx context.Context, kubeClient k8s.Client, cluster *v1\n}\nvar opts []lcm.Option\n- opts = append(opts, func(options *lcm.CheckOptions) {\n+ opts = append(opts,\n+ func(options *lcm.CheckOptions) {\noptions.S3Region = cluster.Spec.ImageChartStorage.S3.Region\noptions.BucketName = cluster.Spec.ImageChartStorage.S3.Bucket\n- })\n+ },\n+ lcm.WithStorage(v1alpha2.S3DriverName),\n+ )\nreturn svcConfig, opts, nil\n+ case cluster.Spec.ImageChartStorage.FileSystem != nil:\n+ return &lcm.ServiceConfig{}, []lcm.Option{lcm.WithStorage(v1alpha2.FileSystemDriverName)}, nil\n+ case cluster.Spec.ImageChartStorage.Swift != nil:\n+ // TODO: Implement me\n+ panic(\"implement me\")\n+ default:\n+ return nil, nil, errors.New(\"invalid storage configurations\")\n}\n-\n- if cluster.Spec.ImageChartStorage.FileSystem != nil {\n- return nil, nil, nil\n- }\n-\n- if cluster.Spec.ImageChartStorage.Swift != nil {\n- return nil, nil, nil\n- }\n-\n- return nil, nil, nil\n}\n// getAccessSecret is for getting component connection password.\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(minio):update svcconfig getter
handle health checking of filesystem storage driver
fix #333
Signed-off-by: Steven Zou <szou@vmware.com>
|
254,881
|
15.12.2020 10:57:16
| -28,800
|
3a9f4e8f3cccc1174be0452b9f9d69dd058e4d1d
|
fix: cache and database use specify storageclass
|
[
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack.yaml",
"new_path": "manifests/samples/full_stack.yaml",
"diff": "@@ -68,7 +68,6 @@ spec:\nstorage: 1Gi\nreplicas: 2\nversion: \"12\"\n- storageClassName: default\nresources:\nlimits:\ncpu: 500m\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_fs.yaml",
"new_path": "manifests/samples/full_stack_fs.yaml",
"diff": "@@ -85,7 +85,6 @@ spec:\nstorage: 1Gi\nreplicas: 2\nversion: \"12\"\n- storageClassName: default\nresources:\nlimits:\ncpu: 500m\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/resource_manager.go",
"new_path": "pkg/cluster/controllers/cache/resource_manager.go",
"diff": "@@ -65,7 +65,7 @@ func (rm *redisResourceManager) WithCluster(cluster *v1alpha2.HarborCluster) Res\n// GetCacheCR gets cache cr instance.\nfunc (rm *redisResourceManager) GetCacheCR() runtime.Object {\nresource := rm.GetResourceList()\n- pvc, _ := GenerateStoragePVC(rm.cluster.Name, rm.GetStorageSize(), rm.GetLabels())\n+ pvc, _ := GenerateStoragePVC(rm.GetStorageClass(), rm.cluster.Name, rm.GetStorageSize(), rm.GetLabels())\nreturn &redisOp.RedisFailover{\nTypeMeta: metav1.TypeMeta{\n@@ -223,3 +223,12 @@ func (rm *redisResourceManager) GetStorageSize() string {\nreturn rm.cluster.Spec.InClusterCache.RedisSpec.Server.Storage\n}\n+\n+// GetStorageClass gets the storage class name.\n+func (rm *redisResourceManager) GetStorageClass() string {\n+ if rm.cluster.Spec.InClusterCache.RedisSpec != nil && rm.cluster.Spec.InClusterCache.RedisSpec.Server != nil {\n+ return rm.cluster.Spec.InClusterCache.RedisSpec.Server.StorageClassName\n+ }\n+\n+ return \"\"\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/utils.go",
"new_path": "pkg/cluster/controllers/cache/utils.go",
"diff": "@@ -27,18 +27,24 @@ func GenerateResourceList(cpu, memory string) (resources corev1.ResourceList, er\n}\n// GeneratePVC generates pvc by name and size.\n-func GenerateStoragePVC(name, size string, labels map[string]string) (*corev1.PersistentVolumeClaim, error) {\n+func GenerateStoragePVC(storageClass, name, size string, labels map[string]string) (*corev1.PersistentVolumeClaim, error) {\nstorage, err := resource.ParseQuantity(size)\nif err != nil {\nreturn nil, err\n}\n+ var sc *string\n+ if storageClass != \"\" {\n+ sc = &storageClass\n+ }\n+\nreturn &corev1.PersistentVolumeClaim{\nObjectMeta: metav1.ObjectMeta{\nName: name,\nLabels: labels,\n},\nSpec: corev1.PersistentVolumeClaimSpec{\n+ StorageClassName: sc,\nAccessModes: []corev1.PersistentVolumeAccessMode{corev1.ReadWriteOnce},\nResources: corev1.ResourceRequirements{\nRequests: corev1.ResourceList{\"storage\": storage},\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/api/postgresql_type.go",
"new_path": "pkg/cluster/controllers/database/api/postgresql_type.go",
"diff": "@@ -99,7 +99,7 @@ type MaintenanceWindow struct {\n// Volume describes a single volume in the manifest.\ntype Volume struct {\nSize string `json:\"size\"`\n- StorageClass string `json:\"storageClass\"`\n+ StorageClass string `json:\"storageClass,omitempty\"`\nSubPath string `json:\"subPath,omitempty\"`\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/generate.go",
"new_path": "pkg/cluster/controllers/database/generate.go",
"diff": "@@ -27,6 +27,7 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nstorageSize := p.GetPostgreStorageSize()\nversion := p.GetPostgreVersion()\ndatabases := p.GetDatabases()\n+ storageClass := p.GetStorageClass()\nconf := &api.Postgresql{\nTypeMeta: metav1.TypeMeta{\n@@ -39,6 +40,7 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\n},\nSpec: api.PostgresSpec{\nVolume: api.Volume{\n+ StorageClass: storageClass,\nSize: storageSize,\n},\nTeamID: p.teamID(),\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/utils.go",
"new_path": "pkg/cluster/controllers/database/utils.go",
"diff": "@@ -45,6 +45,15 @@ func (p *PostgreSQLController) GetDatabaseConn(secretName string) (*Connect, err\nreturn conn, nil\n}\n+// GetStorageClass returns the storage class name.\n+func (p *PostgreSQLController) GetStorageClass() string {\n+ if p.HarborCluster.Spec.InClusterDatabase != nil && p.HarborCluster.Spec.InClusterDatabase.PostgresSQLSpec != nil {\n+ return p.HarborCluster.Spec.InClusterDatabase.PostgresSQLSpec.StorageClassName\n+ }\n+\n+ return \"\"\n+}\n+\n// GetSecret returns the database connection Secret.\nfunc (p *PostgreSQLController) GetSecret(secretName string) (map[string][]byte, error) {\nsecret := &corev1.Secret{}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: cache and database use specify storageclass
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,881
|
16.12.2020 10:56:43
| -28,800
|
e64cab18e36889cb30a8fca696e0dc8850544eb5
|
fix: fix generated minio ingress rules backend service name
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/provision.go",
"new_path": "pkg/cluster/controllers/storage/provision.go",
"diff": "@@ -214,7 +214,7 @@ func (m *MinIOController) generateIngress() *netv1.Ingress {\n{\nPath: \"/\",\nBackend: netv1.IngressBackend{\n- ServiceName: \"minio\",\n+ ServiceName: m.getServiceName(),\nServicePort: intstr.FromInt(9000),\n},\n},\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: fix generated minio ingress rules backend service name
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,881
|
16.12.2020 16:14:10
| -28,800
|
c516e3bc5bb483237b1cdb2dbc36f1c48c36d9d0
|
fix: fix the s3 configuration when redirect disable is false
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/provision.go",
"new_path": "pkg/cluster/controllers/storage/provision.go",
"diff": "package storage\nimport (\n- \"encoding/json\"\n\"fmt\"\n\"net/url\"\n\"reflect\"\n@@ -47,19 +46,28 @@ func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goha\nreturn nil, err\n}\n- var endpoint string\n+ var (\n+ endpoint string\n+ scheme string\n+\n+ secure = false\n+ v4Auth = false\n+ skipVerify = false\n+ )\n+\nif !m.HarborCluster.Spec.InClusterStorage.MinIOSpec.Redirect.Disable {\n- _, endpoint, err = GetMinIOHostAndSchema(m.HarborCluster.Spec.ExternalURL)\n+ scheme, endpoint, err = GetMinIOHostAndSchema(m.HarborCluster.Spec.ExternalURL)\nif err != nil {\nreturn nil, err\n}\n+ // if access minio use ingress, secure and skipVerify should be true\n+ secure = true\n+ skipVerify = true\n+ endpoint = fmt.Sprintf(\"%s://%s\", scheme, endpoint)\n} else {\nendpoint = fmt.Sprintf(\"http://%s.%s.svc:%s\", m.getServiceName(), m.HarborCluster.Namespace, \"9000\")\n}\n- secure := false\n- v4Auth := false\n-\nstorageSpec := &goharborv1.HarborStorageImageChartStorageSpec{\nS3: &goharborv1.HarborStorageImageChartStorageS3Spec{\nRegistryStorageDriverS3Spec: goharborv1.RegistryStorageDriverS3Spec{\n@@ -70,6 +78,7 @@ func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goha\nBucket: DefaultBucket,\nSecure: &secure,\nV4Auth: &v4Auth,\n+ SkipVerify: skipVerify,\n},\n},\n}\n@@ -78,10 +87,6 @@ func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goha\n}\nfunc (m *MinIOController) createSecretKeyRef(secretKey []byte, minioInstance *minio.Tenant) *corev1.Secret {\n- data := map[string]string{\n- \"secretkey\": string(secretKey),\n- }\n- dataJSON, _ := json.Marshal(&data)\ns3KeySecret := &corev1.Secret{\nTypeMeta: metav1.TypeMeta{\nAPIVersion: \"v1\",\n@@ -98,7 +103,7 @@ func (m *MinIOController) createSecretKeyRef(secretKey []byte, minioInstance *mi\n},\nType: corev1.SecretTypeOpaque,\nData: map[string][]byte{\n- v1alpha1.SharedSecretKey: dataJSON,\n+ v1alpha1.SharedSecretKey: secretKey,\n},\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: fix the s3 configuration when redirect disable is false
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,881
|
17.12.2020 13:49:05
| -28,800
|
81431ff8814ec8f88eb9c01f57fffb38199e1143
|
fix: fix full stack certs lost minio domain and minio s3 enable v4auth
|
[
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack.yaml",
"new_path": "manifests/samples/full_stack.yaml",
"diff": "@@ -34,6 +34,7 @@ spec:\ndnsNames:\n- core.harbor.domain\n- notary.harbor.domain\n+ - minio.core.harbor.domain\nissuerRef:\nname: selfsigned-issuer\nkind: Issuer\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/provision.go",
"new_path": "pkg/cluster/controllers/storage/provision.go",
"diff": "@@ -51,7 +51,7 @@ func (m *MinIOController) getMinIOProperties(minioInstance *minio.Tenant) (*goha\nscheme string\nsecure = false\n- v4Auth = false\n+ v4Auth = true\nskipVerify = false\n)\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: fix full stack certs lost minio domain and minio s3 enable v4auth
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,875
|
18.12.2020 00:51:41
| -28,800
|
764029fe669583efcad49f1da802262a4398db97
|
feature(redis) sentinel support
|
[
{
"change_type": "MODIFY",
"old_path": "apis/meta/v1alpha1/redis.go",
"new_path": "apis/meta/v1alpha1/redis.go",
"diff": "@@ -29,6 +29,10 @@ type RedisHostSpec struct {\n// +kubebuilder:validation:ExclusiveMinimum=true\n// Server port.\nPort int32 `json:\"port,omitempty\"`\n+\n+ // +kubebuilder:validation:Optional\n+ // for Sentinel MasterSet.\n+ SentinelMasterSet string `json:\"sentinelMasterSet,omitempty\"`\n}\ntype RedisCredentials struct {\n@@ -55,7 +59,10 @@ type RedisConnection struct {\nDatabase int32 `json:\"database,omitempty\"`\n}\n-const RedisScheme = \"redis\"\n+const (\n+ RedisScheme = \"redis\"\n+ RedisSentinelScheme = \"redis+sentinel\"\n+)\nfunc (c *RedisConnection) GetDSNNoCredentials() *url.URL {\nif c == nil {\n@@ -63,10 +70,15 @@ func (c *RedisConnection) GetDSNNoCredentials() *url.URL {\n}\nu := &url.URL{\n- Scheme: RedisScheme,\n- Host: c.Host,\n+ Host: fmt.Sprintf(\"%s:%d\", c.Host, c.Port),\nPath: strconv.Itoa(int(c.Database)),\n}\n+ if c.SentinelMasterSet == \"\" {\n+ u.Scheme = RedisScheme\n+ } else {\n+ u.Scheme = RedisSentinelScheme\n+ u.Path = c.SentinelMasterSet + \"/\" + u.Path\n+ }\nreturn u\n}\n@@ -102,8 +114,8 @@ func (c *RedisConnection) GetDSNStringWithRawPassword(password string) string {\nconst (\ncoreRedisDatabaseIndex = 0\n- jobServiceRedisDatabaseIndex = 1\n- registryRedisDatabaseIndex = 2\n+ registryRedisDatabaseIndex = 1\n+ jobServiceRedisDatabaseIndex = 2\nchartMuseumRedisDatabaseIndex = 3\nclairRedisDatabaseIndex = 4\ntrivyRedisDatabaseIndex = 5\n"
},
{
"change_type": "MODIFY",
"old_path": "config/config/assets/registry-config.yaml.tmpl",
"new_path": "config/config/assets/registry-config.yaml.tmpl",
"diff": "@@ -206,6 +206,9 @@ middleware:\n{{- end }}\n{{- if .Spec.Redis }}\nredis:\n+ {{- if .Spec.Redis.SentinelMasterSet }}\n+ sentinelMasterSet: {{ .Spec.Redis.SentinelMasterSet | quote }}\n+ {{- end }}\n{{- if .Spec.Redis.Port }}\naddr: {{ printf \"%s:%d\" .Spec.Redis.Host .Spec.Redis.Port | quote }}\n{{- else }}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/deployments.go",
"new_path": "controllers/goharbor/core/deployments.go",
"diff": "@@ -193,7 +193,7 @@ func (r *Reconciler) GetDeployment(ctx context.Context, core *goharborv1alpha2.C\n},\n},\n}, {\n- Name: \"_REDIS_URL\",\n+ Name: RedisDSNKey,\nValueFrom: &corev1.EnvVarSource{\nSecretKeyRef: &corev1.SecretKeySelector{\nLocalObjectReference: corev1.LocalObjectReference{\n@@ -297,7 +297,7 @@ func (r *Reconciler) GetDeployment(ctx context.Context, core *goharborv1alpha2.C\nif core.Spec.Components.Registry.Redis != nil {\nenvs = append(envs, corev1.EnvVar{\n- Name: \"_REDIS_URL_REG\",\n+ Name: RegistryRedisDSNKey,\nValueFrom: &corev1.EnvVarSource{\nSecretKeyRef: &corev1.SecretKeySelector{\nKey: RegistryRedisDSNKey,\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/secrets.go",
"new_path": "controllers/goharbor/core/secrets.go",
"diff": "@@ -13,7 +13,7 @@ import (\n)\nconst (\n- RedisDSNKey = \"_REDIS_URL\"\n+ RedisDSNKey = \"_REDIS_URL_CORE\"\nRegistryRedisDSNKey = \"_REDIS_URL_REG\"\n)\n@@ -42,6 +42,8 @@ func (r *Reconciler) GetSecret(ctx context.Context, core *goharborv1alpha2.Core)\nredisPassword = string(password)\n}\n+ coreCacheDSN := core.Spec.Redis.GetDSNStringWithRawPassword(redisPassword)\n+\nvar registryPassword string\nif core.Spec.Components.Registry.Redis.PasswordRef != \"\" {\n@@ -71,8 +73,8 @@ func (r *Reconciler) GetSecret(ctx context.Context, core *goharborv1alpha2.Core)\nNamespace: namespace,\n},\nStringData: map[string]string{\n- RedisDSNKey: fmt.Sprintf(\"%s:%d,100,%s,%d,%.0f\", core.Spec.Redis.Host, core.Spec.Redis.Port, redisPassword, core.Spec.Redis.Database, core.Spec.Redis.IdleTimeout.Duration.Seconds()),\n- RegistryRedisDSNKey: registryCacheDSN,\n+ RedisDSNKey: fmt.Sprintf(\"%s?idle_timeout_seconds=%.0f\", coreCacheDSN, core.Spec.Redis.IdleTimeout.Duration.Seconds()),\n+ RegistryRedisDSNKey: fmt.Sprintf(\"%s?idle_timeout_seconds=%.0f\", registryCacheDSN, core.Spec.Redis.IdleTimeout.Duration.Seconds()),\n},\n}, nil\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/kustomization.yaml",
"new_path": "manifests/cluster/kustomization.yaml",
"diff": "@@ -42,4 +42,4 @@ images:\nnewTag: v1.0.0\n- name: goharbor/harbor-operator\nnewName: goharbor/harbor-operator\n- newTag: latest\n\\ No newline at end of file\n+ newTag: dev_develop\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack.yaml",
"new_path": "manifests/samples/full_stack.yaml",
"diff": "@@ -110,3 +110,5 @@ spec:\nrequests:\ncpu: 100m\nmemory: 250Mi\n+ sentinel:\n+ replicas: 1\n\\ No newline at end of file\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_fs.yaml",
"new_path": "manifests/samples/full_stack_fs.yaml",
"diff": "@@ -105,3 +105,5 @@ spec:\nrequests:\ncpu: 100m\nmemory: 250Mi\n+ sentinel:\n+ replicas: 1\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/readiness.go",
"new_path": "pkg/cluster/controllers/cache/readiness.go",
"diff": "@@ -42,8 +42,9 @@ func (rc *RedisController) Readiness(ctx context.Context, cluster *v1alpha2.Harb\nfunc (rc *RedisController) generateRedisSpec() *v1alpha2.ExternalRedisSpec {\nreturn &v1alpha2.ExternalRedisSpec{\nRedisHostSpec: harbormetav1.RedisHostSpec{\n- Host: rc.ResourceManager.GetServiceName(),\n- Port: RedisRedisConnPort,\n+ Host: fmt.Sprintf(\"rfs-%s\", rc.ResourceManager.GetServiceName()),\n+ Port: RedisSentinelConnPort,\n+ SentinelMasterSet: RedisSentinelConnGroup,\n},\nRedisCredentials: harbormetav1.RedisCredentials{\nPasswordRef: rc.ResourceManager.GetSecretName(),\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/harbor/harbor.go",
"new_path": "pkg/cluster/controllers/harbor/harbor.go",
"diff": "@@ -127,7 +127,7 @@ func (harbor *Controller) getHarborCR(harborcluster *v1alpha2.HarborCluster) *v1\n}\nif cache := harbor.getCacheSpec(); cache != nil {\n- harbor.Log.Info(\"use incluster cache\", \"cache\", cache.Host)\n+ harbor.Log.Info(\"use incluster cache\", \"cache\", cache.Host, \"port\", cache.Port, \"sentinelMasterSet\", cache.SentinelMasterSet)\nharborCR.Spec.Redis = cache\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feature(redis) sentinel support
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,875
|
21.12.2020 00:09:59
| -28,800
|
218d27e41ae01fbe36e09ffa6527935f7882df21
|
add other dependencies in sample yaml
|
[
{
"change_type": "ADD",
"old_path": null,
"new_path": "manifests/samples/full_stack_other_fs.yaml",
"diff": "+# Sample namespace\n+apiVersion: v1\n+kind: Namespace\n+metadata:\n+ name: cluster-sample-ns\n+---\n+# A secret of harbor admin password.\n+apiVersion: v1\n+kind: Secret\n+metadata:\n+ name: admin-core-secret\n+ namespace: cluster-sample-ns\n+data:\n+ secret: SGFyYm9yMTIzNDU=\n+type: Opaque\n+---\n+# A secret of harbor admin password.\n+apiVersion: v1\n+kind: Secret\n+metadata:\n+ name: github-credentials\n+ namespace: cluster-sample-ns\n+data:\n+ github-token: eHh4\n+type: goharbor.io/github\n+---\n+# Cert issuer\n+apiVersion: cert-manager.io/v1alpha2\n+kind: Issuer\n+metadata:\n+ name: selfsigned-issuer\n+ namespace: cluster-sample-ns\n+spec:\n+ selfSigned: {}\n+---\n+# Certificates of ingress\n+apiVersion: cert-manager.io/v1alpha2\n+kind: Certificate\n+metadata:\n+ name: sample-public-certificate\n+ namespace: cluster-sample-ns\n+spec:\n+ secretName: sample-public-certificate\n+ dnsNames:\n+ - core.harbor.domain\n+ - notary.harbor.domain\n+ issuerRef:\n+ name: selfsigned-issuer\n+ kind: Issuer\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ name: sample-harbor-registry\n+ namespace: cluster-sample-ns\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ volumeMode: Filesystem\n+ resources:\n+ requests:\n+ storage: 5Gi\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ name: sample-harbor-trivy-reports\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ volumeMode: Filesystem\n+ resources:\n+ requests:\n+ storage: 5Gi\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ name: sample-harbor-trivy-cache\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ volumeMode: Filesystem\n+ resources:\n+ requests:\n+ storage: 5Gi\n+---\n+apiVersion: v1\n+kind: PersistentVolumeClaim\n+metadata:\n+ name: sample-harbor-chart\n+spec:\n+ accessModes:\n+ - ReadWriteOnce\n+ volumeMode: Filesystem\n+ resources:\n+ requests:\n+ storage: 5Gi\n+---\n+# Full stack Harbor\n+apiVersion: goharbor.io/v1alpha2\n+kind: HarborCluster\n+metadata:\n+ name: harborcluster-sample\n+ namespace: cluster-sample-ns\n+spec:\n+ harborAdminPasswordRef: admin-core-secret\n+ externalURL: https://core.harbor.domain\n+ expose:\n+ core:\n+ ingress:\n+ host: core.harbor.domain\n+ tls:\n+ certificateRef: sample-public-certificate\n+ notary:\n+ ingress:\n+ host: notary.harbor.domain\n+ tls:\n+ certificateRef: sample-public-certificate\n+ trivy:\n+ skipUpdate: false\n+ githubTokenRef: github-credentials\n+ storage:\n+ reportsPersistentVolume:\n+ claimName: sample-harbor-trivy-reports\n+ cachePersistentVolume:\n+ claimName: sample-harbor-trivy-cache\n+ encryptionKeyRef: core-database-encryption\n+ internalTLS:\n+ enabled: true\n+ portal: {}\n+ registry: {}\n+ core:\n+ tokenIssuer:\n+ name: selfsigned-issuer\n+ kind: Issuer\n+ chartmuseum: {}\n+ notary:\n+ migrationEnabled: true\n+ imageChartStorage:\n+ filesystem:\n+ registryPersistentVolume:\n+ claimName: sample-harbor-registry\n+ chartPersistentVolume:\n+ claimName: sample-harbor-chart\n+ inClusterDatabase:\n+ kind: PostgresSQL\n+ postgresSqlSpec:\n+ storage: 1Gi\n+ replicas: 2\n+ version: \"12\"\n+ resources:\n+ limits:\n+ cpu: 500m\n+ memory: 500Mi\n+ requests:\n+ cpu: 100m\n+ memory: 250Mi\n+ inClusterCache:\n+ kind: Redis\n+ redisSpec:\n+ schema: redis\n+ server:\n+ replicas: 1\n+ resources:\n+ limits:\n+ cpu: 500m\n+ memory: 500Mi\n+ requests:\n+ cpu: 100m\n+ memory: 250Mi\n+ sentinel:\n+ replicas: 1\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
add other dependencies in sample yaml
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,875
|
21.12.2020 00:31:57
| -28,800
|
7346bbda42e56875547ee97e5920209218abd348
|
fix(notary) cert name too long
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/notarysigner.go",
"new_path": "controllers/goharbor/harbor/notarysigner.go",
"diff": "@@ -70,13 +70,13 @@ func (r *Reconciler) GetNotarySignerCertificateAuthority(ctx context.Context, ha\nreturn &certv1.Certificate{\nObjectMeta: metav1.ObjectMeta{\n- Name: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authentication\", \"authority\"),\n+ Name: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authority\"),\nNamespace: harbor.GetNamespace(),\n},\nSpec: certv1.CertificateSpec{\n- SecretName: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authentication\", \"authority\"),\n+ SecretName: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authority\"),\nIssuerRef: v1.ObjectReference{\n- Name: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authentication\", \"authority\"),\n+ Name: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authority\"),\n},\nDuration: &metav1.Duration{\nDuration: duration,\n@@ -156,7 +156,7 @@ func (r *Reconciler) AddNotarySignerCertificateAuthorityIssuer(ctx context.Conte\nfunc (r *Reconciler) GetNotarySignerCertificateAuthorityIssuer(ctx context.Context, harbor *goharborv1alpha2.Harbor) (*certv1.Issuer, error) {\nreturn &certv1.Issuer{\nObjectMeta: metav1.ObjectMeta{\n- Name: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authentication\", \"authority\"),\n+ Name: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authority\"),\nNamespace: harbor.GetNamespace(),\n},\nSpec: certv1.IssuerSpec{\n@@ -208,7 +208,7 @@ func (r *Reconciler) GetNotarySignerCertificateIssuer(ctx context.Context, harbo\nSpec: certv1.IssuerSpec{\nIssuerConfig: certv1.IssuerConfig{\nCA: &certv1.CAIssuer{\n- SecretName: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authentication\", \"authority\"),\n+ SecretName: r.NormalizeName(ctx, harbor.GetName(), controllers.NotarySigner.String(), \"authority\"),\n},\n},\n},\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(notary) cert name too long
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,875
|
22.12.2020 10:34:22
| -28,800
|
25b539b6ecb8bf686fb9e70beb95ecfbc366e62a
|
add sentinel support for chartmuseum
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/tests.yml",
"new_path": ".github/workflows/tests.yml",
"diff": "@@ -137,7 +137,7 @@ jobs:\nrun: |\nexport GITHUB_TOKEN=xxx\nset -ex\n- kubectl apply -f manifests/samples/full_stack_fs.yaml\n+ kubectl apply -f manifests/samples/full_stack_other_fs.yaml\nfor i in $(seq 1 6);do\nsleep 30\necho $i\n@@ -166,7 +166,7 @@ jobs:\nsudo kubectl port-forward -n ingress-nginx service/ingress-nginx-controller 443:443 80:80 --address=0.0.0.0 &\nsleep 10\necho 127.0.0.1 core.harbor.domain | sudo tee -a /etc/hosts\n- curl https://core.harbor.domain/api/v2.0/systeminfo -i -k\n+ curl https://core.harbor.domain/api/v2.0/systeminfo -i -k -f\nmkdir -p ~/.docker/tls/core.harbor.domain\nkubectl -n cluster-sample-ns get secret sample-public-certificate -o jsonpath='{.data.ca\\.crt}' \\\n| base64 --decode \\\n"
},
{
"change_type": "MODIFY",
"old_path": "config/config/assets/chartmuseum-config.yaml.tmpl",
"new_path": "config/config/assets/chartmuseum-config.yaml.tmpl",
"diff": "@@ -28,13 +28,22 @@ bearer.auth: 1\n{{- end }}\n{{- if .Spec.Cache.Redis }}\n+{{- if .Spec.Cache.Redis.SentinelMasterSet }}\n+cache: redis_sentinel\n+{{- else }}\ncache: redis\n+{{- end }}\ncache.redis:\n- {{- with (.Spec.Cache.Redis.GetDSN \"\") }}\n- addr: {{ quote .Host }}\n- # password: Will be set with environment variable\n- db: {{ .EscapedPath | trimAll \"/\" }}\n+ {{- if .Spec.Cache.Redis.SentinelMasterSet }}\n+ mastername: {{ .Spec.Cache.Redis.SentinelMasterSet | quote }}\n+ {{- end }}\n+ {{- if .Spec.Cache.Redis.Port }}\n+ addr: {{ printf \"%s:%d\" .Spec.Cache.Redis.Host .Spec.Cache.Redis.Port | quote }}\n+ {{- else }}\n+ addr: {{ .Spec.Cache.Redis.Host | quote }}\n{{- end }}\n+ # password: setted through environment variable\n+ db: {{ .Spec.Cache.Redis.Database }}\n{{- end }}\ncontext.path: ''\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -13377,13 +13377,22 @@ data:\n{{- end }}\n{{- if .Spec.Cache.Redis }}\n+ {{- if .Spec.Cache.Redis.SentinelMasterSet }}\n+ cache: redis_sentinel\n+ {{- else }}\ncache: redis\n+ {{- end }}\ncache.redis:\n- {{- with (.Spec.Cache.Redis.GetDSN \"\") }}\n- addr: {{ quote .Host }}\n- # password: Will be set with environment variable\n- db: {{ .EscapedPath | trimAll \"/\" }}\n+ {{- if .Spec.Cache.Redis.SentinelMasterSet }}\n+ mastername: {{ .Spec.Cache.Redis.SentinelMasterSet | quote }}\n+ {{- end }}\n+ {{- if .Spec.Cache.Redis.Port }}\n+ addr: {{ printf \"%s:%d\" .Spec.Cache.Redis.Host .Spec.Cache.Redis.Port | quote }}\n+ {{- else }}\n+ addr: {{ .Spec.Cache.Redis.Host | quote }}\n{{- end }}\n+ # password: setted through environment variable\n+ db: {{ .Spec.Cache.Redis.Database }}\n{{- end }}\ncontext.path: ''\n@@ -13626,7 +13635,7 @@ data:\n}\n}\n}\n- registry-config.yaml.tmpl: \"{{/* https://docs.docker.com/registry/configuration/ */}}\\nversion: 0.1\\nlog:\\n accesslog:\\n disabled: {{ .Spec.Log.AccessLog.Disabled }}\\n level: {{ .Spec.Log.Level | quote }}\\n formatter: {{ .Spec.Log.Formatter | quote }}\\n {{- if .Spec.Log.Fields }}\\n fields: {{ .Spec.Log.Fields | toJson }}\\n {{- end }}\\n {{- if .Spec.Log.Hooks }}\\n hooks:\\n {{- range $index, $element := .Spec.Log.Hooks }}\\n - type: {{ $element.Type | quote }}\\n disabled: {{ $element.Disabled }}\\n {{- if $element.Levels }}\\n levels: {{ $element.Levels | toJson }}\\n {{- end }}\\n {{- if $element.OptionsRef }}\\n {{- with ( secretData $element.OptionsRef) }}\\n {{- if . }}\\n options: {{ toJson . }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\nhttp:\\n # secret: setted through environment variable\\n {{- if .Spec.HTTP.Debug }}\\n debug:\\n addr: :{{ .Spec.HTTP.Debug.Port }}\\n prometheus:\\n enabled: {{ .Spec.HTTP.Debug.Prometheus.Enabled }}\\n path: {{ .Spec.HTTP.Debug.Prometheus.Path | quote }}\\n {{- end }}\\n net: {{ .Spec.HTTP.Net | quote }}\\n addr: :5000\\n {{- if .Spec.HTTP.Prefix }}\\n prefix: {{ .Spec.HTTP.Prefix | quote }}\\n {{- end }}\\n {{- if .Spec.HTTP.Headers }}\\n headers: {{ .Spec.HTTP.Headers | toJson }}\\n {{- end }}\\n http2:\\n disabled: {{ .Spec.HTTP.HTTP2.Disabled }}\\n host: {{ .Spec.HTTP.Host | quote }}\\n relativeurls: {{ .Spec.HTTP.RelativeURLs }}\\n {{- if .Spec.HTTP.DrainTimeout }}\\n draintimeout: {{ .Spec.HTTP.DrainTimeout.Duration }}\\n {{- end }}\\n {{- if .Spec.HTTP.TLS.Enabled }}\\n tls:\\n certificate: /etc/registry/ssl/tls.crt\\n key: /etc/registry/ssl/tls.key\\n {{- end }}\\n{{- if .Spec.Reporting }}\\nreporting:\\n {{- range $name, $reference := .Spec.Reporting }}\\n {{ $name | quote }}: {{ secretData $reference | toJson }}\\n {{- end }}\\n{{- end }}\\nstorage:\\n {{- if .Spec.Storage.Delete.Enabled }}\\n delete:\\n {{- if .Spec.Storage.Delete.Enabled }}\\n enabled: {{ .Spec.Storage.Delete.Enabled }}\\n {{- end }}\\n {{- end }}\\n cache:\\n blobdescriptor: {{ default \\\"inmemory\\\" .Spec.Storage.Cache.Blobdescriptor | quote }}\\n maintenance:\\n uploadPurging:\\n enabled: {{ .Spec.Storage.Maintenance.UploadPurging.Enabled }}\\n {{- if .Spec.Storage.Maintenance.UploadPurging.Age }}\\n age: {{ .Spec.Storage.Maintenance.UploadPurging.Age.Duration }}\\n {{- end }}\\n {{- if .Spec.Storage.Maintenance.UploadPurging.Interval }}\\n interval: {{ .Spec.Storage.Maintenance.UploadPurging.Interval.Duration }}\\n {{- end }}\\n dryRun: {{ .Spec.Storage.Maintenance.UploadPurging.DryRun }}\\n readOnly:\\n enabled: {{ .Spec.Storage.Maintenance.ReadOnly.Enabled }}\\n redirect: \\n disable: {{ .Spec.Storage.Redirect.Disable }}\\n\\n {{- if .Spec.Storage.Driver.InMemory }}\\n inmemory: {}\\n {{- end }}\\n\\n {{- if .Spec.Storage.Driver.FileSystem }}\\n filesystem:\\n rootdirectory: /var/lib/registry\\n maxthreads: {{ .Spec.Storage.Driver.FileSystem.MaxThreads }}\\n {{- end }}\\n\\n {{- if .Spec.Storage.Driver.S3 }}\\n s3:\\n region: {{ .Spec.Storage.Driver.S3.Region | quote }}\\n bucket: {{ .Spec.Storage.Driver.S3.Bucket | quote }}\\n encrypt: {{ .Spec.Storage.Driver.S3.Encrypt }}\\n skipverify: {{ .Spec.Storage.Driver.S3.SkipVerify }}\\n {{- if .Spec.Storage.Driver.S3.KeyID }}\\n keyid: {{ .Spec.Storage.Driver.S3.KeyID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.Secure }}\\n secure: {{ .Spec.Storage.Driver.S3.Secure }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.V4Auth }}\\n v4auth: {{ .Spec.Storage.Driver.S3.V4Auth }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.ChunkSize }}\\n chunksize: {{ .Spec.Storage.Driver.S3.ChunkSize }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.StorageClass }}\\n storageclass: {{ .Spec.Storage.Driver.S3.StorageClass | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.RootDirectory }}\\n rootdirectory: {{ .Spec.Storage.Driver.S3.RootDirectory | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.AccessKey }}\\n accesskey: {{ .Spec.Storage.Driver.S3.AccessKey | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.SecretKeyRef }}\\n # secretkey: setted through environment variable\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.RegionEndpoint }}\\n regionendpoint: {{ .Spec.Storage.Driver.S3.RegionEndpoint | quote }}\\n {{- end }}\\n {{- end }}\\n\\n {{- if .Spec.Storage.Driver.Swift }}\\n swift:\\n username: {{ .Spec.Storage.Driver.Swift.Username | quote }}\\n # password: setted through environment variable\\n authurl: {{ .Spec.Storage.Driver.Swift.AuthURL | quote }}\\n container: {{ .Spec.Storage.Driver.Swift.Container | quote }}\\n insecureskipverify: {{ .Spec.Storage.Driver.Swift.InsecureSkipVerify }}\\n {{- if .Spec.Storage.Driver.Swift.Prefix }}\\n prefix: {{ .Spec.Storage.Driver.Swift.Prefix | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.EndpointType }}\\n endpointtype: {{ .Spec.Storage.Driver.Swift.EndpointType | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.ChunkSize }}\\n chunksize: {{ .Spec.Storage.Driver.Swift.ChunkSize }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.AccessKey }}\\n accesskey: {{ .Spec.Storage.Driver.Swift.AccessKey | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.SecretKeyRef }}\\n # secretkey: setted through environment variable\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.AuthVersion }}\\n authversion: {{ .Spec.Storage.Driver.Swift.AuthVersion | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.Tenant }}\\n tenantid: {{ .Spec.Storage.Driver.Swift.Tenant | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.TenantID }}\\n tenantid: {{ .Spec.Storage.Driver.Swift.TenantID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.Domain }}\\n domain: {{ .Spec.Storage.Driver.Swift.Domain | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.DomainID }}\\n domainid: {{ .Spec.Storage.Driver.Swift.DomainID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.TrustID }}\\n trustid: {{ .Spec.Storage.Driver.Swift.TrustID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.Region }}\\n region: {{ .Spec.Storage.Driver.Swift.Region | quote }}\\n {{- end }}\\n {{- end }}\\n\\n{{- if ( or .Spec.Middlewares.Registry ( or .Spec.Middlewares.Repository .Spec.Middlewares.Storage ) ) }}\\nmiddleware:\\n {{- if .Spec.Middlewares.Registry }}\\n registry:\\n {{- range $index, $middleware := .Spec.Middlewares.Registry }}\\n - name: {{ $middleware.Name | quote }}\\n {{- if $middleware.OptionsRef }}\\n options: {{ secretData $middleware.OptionsRef | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- if .Spec.Middlewares.Repository }}\\n registry:\\n {{- range $index, $middleware := .Spec.Middlewares.Repository }}\\n - name: {{ $middleware.Name | quote }}\\n {{- if $middleware.OptionsRef }}\\n options: {{ secretData $middleware.OptionsRef | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- if .Spec.Middlewares.Storage }}\\n registry:\\n {{- range $index, $middleware := .Spec.Middlewares.Storage }}\\n - name: {{ $middleware.Name | quote }}\\n {{- if $middleware.OptionsRef }}\\n options: {{ secretData $middleware.OptionsRef | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n{{- end }}\\n{{- if .Spec.Redis }}\\nredis:\\n {{- if .Spec.Redis.SentinelMasterSet }}\\n sentinelMasterSet: mymaster\\n {{- end }}\\n {{- if .Spec.Redis.Port }}\\n addr: {{ printf \\\"%s:%d\\\" .Spec.Redis.Host .Spec.Redis.Port | quote }}\\n {{- else }}\\n addr: {{ .Spec.Redis.Host | quote }}\\n {{- end }}\\n # password: setted through environment variable\\n db: {{ .Spec.Redis.Database }}\\n {{- if .Spec.Redis.DialTimeout }}\\n dialtimeout: {{ .Spec.Redis.DialTimeout.Duration }}\\n {{- end }}\\n {{- if .Spec.Redis.ReadTimeout }}\\n readtimeout: {{ .Spec.Redis.ReadTimeout.Duration }}\\n {{- end }}\\n {{- if .Spec.Redis.WriteTimeout }}\\n writetimeout: {{ .Spec.Redis.WriteTimeout.Duration }}\\n {{- end }}\\n {{- if ( or .Spec.Redis.Pool.MaxIdle ( or .Spec.Redis.Pool.MaxActive .Spec.Redis.Pool.IdleTimeout ) ) }}\\n pool:\\n {{- if .Spec.Redis.Pool.MaxIdle }}\\n maxidle: {{ .Spec.Redis.Pool.MaxIdle }}\\n {{- end }}\\n {{- if .Spec.Redis.Pool.MaxActive }}\\n maxactive: {{ .Spec.Redis.Pool.MaxActive }}\\n {{- end }}\\n {{- if .Spec.Redis.Pool.IdleTimeout }}\\n idletimeout: {{ .Spec.Redis.Pool.IdleTimeout.Duration }}\\n {{- end }}\\n {{- end }}\\n{{- end }}\\n{{- if .Spec.Proxy }}\\nproxy:\\n remoteurl: {{ .Spec.Proxy.RemoteURL | quote }}\\n # username: setted through environment variable\\n # password: setted through environment variable\\n{{- end }}\\ncompatibility:\\n schema1:\\n # signingkeyfile: setted through environment variable\\n enabled: {{ .Spec.Compatibility.Schema1.Enabled }}\\nvalidation:\\n disabled: {{ .Spec.Validation.Disabled }}\\n {{- if or .Spec.Validation.Manifests.URLs.Allow .Spec.Validation.Manifests.URLs.Deny }}\\n manifests:\\n urls:\\n {{- if .Spec.Validation.Manifests.URLs.Allow }}\\n allow: {{ .Spec.Validation.Manifests.URLs.Allow | toJson }}\\n {{- end }}\\n {{- if .Spec.Validation.Manifests.URLs.Deny }}\\n deny: {{ .Spec.Validation.Manifests.URLs.Deny | toJson }}\\n {{- end }}\\n {{- end }}\\n{{- if ( or .Spec.Authentication.Silly ( or .Spec.Authentication.Token .Spec.Authentication.HTPasswd ) ) }}\\nauth:\\n {{- if .Spec.Authentication.Silly }}\\n silly:\\n realm: {{ .Spec.Authentication.Silly.Realm | quote }}\\n service: {{ .Spec.Authentication.Silly.Service | quote }}\\n {{- end }}\\n {{- if .Spec.Authentication.Token }}\\n token:\\n realm: {{ .Spec.Authentication.Token.Realm | quote }}\\n service: {{ .Spec.Authentication.Token.Service | quote }}\\n issuer: registry-token-issuer\\n rootcertbundle: /root/certs/bundle\\n autoredirect: {{ .Spec.Authentication.Token.AutoRedirect }}\\n {{- end }}\\n {{- if .Spec.Authentication.HTPasswd }}\\n htpasswd:\\n realm: {{ .Spec.Authentication.HTPasswd.Realm | quote }}\\n # path: setted through environment variable\\n {{- end }}\\n{{- end }}\\nnotifications:\\n {{- if .Spec.Notifications.Endpoints }}\\n endpoints:\\n {{- range $_, $endpoint := .Spec.Notifications.Endpoints }}\\n - name: {{ $endpoint.Name | quote }}\\n disabled: {{ $endpoint.Disabled }}\\n url: {{ $endpoint.URL | quote }}\\n {{- if $endpoint.Headers }}\\n headers: {{ $endpoint.Headers | toJson }}\\n {{- end }}\\n {{- if $endpoint.Timeout }}\\n timeout: {{ $endpoint.Timeout.Duration }}\\n {{- end }}\\n {{- if $endpoint.Threshold }}\\n threshold: {{ $endpoint.Threshold }}\\n {{- end }}\\n {{- if $endpoint.Backoff }}\\n backoff: {{ $endpoint.Backoff }}\\n {{- end }}\\n {{- if $endpoint.IgnoredMediaTypes }}\\n ignoredmediatypes: {{ $endpoint.IgnoredMediaTypes | toJson }}\\n {{- end }}\\n {{- if ( or $endpoint.Ignore.MediaTypes $endpoint.Ignore.Actions ) }}\\n ignore:\\n {{- if $endpoint.Ignore.MediaTypes }}\\n mediatypes: {{ $endpoint.Ignore.MediaTypes | toJson }}\\n {{- end }}\\n {{- if $endpoint.Ignore.Actions }}\\n actions: {{ $endpoint.Ignore.Actions | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n events:\\n includereferences: {{ default true .Spec.Notifications.Events.IncludeReferences }}\\n\\nhealth:\\n storagedriver:\\n enabled: {{ default true .Spec.Health.StorageDriver.Enabled }}\\n {{- if .Spec.Health.StorageDriver.Interval }}\\n interval: {{ .Spec.Health.StorageDriver.Interval.Duration }}\\n {{- end }}\\n {{- if .Spec.Health.StorageDriver.Threshold }}\\n threshold: {{ .Spec.Health.StorageDriver.Threshold }}\\n {{- end }}\\n\\n {{- if .Spec.Health.File }}\\n file:\\n {{- range $_, $health := .Spec.Health.File }}\\n - file: {{ $health.File | quote }}\\n {{- if $health.Interval }}\\n interval: {{ $health.Interval.Duration }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n\\n {{- if .Spec.Health.HTTP }}\\n http:\\n {{- range $_, $health := .Spec.Health.HTTP }}\\n - uri: {{ $health.URI | quote }}\\n headers: {{ $health.Headers | toJson }}\\n {{- if $health.StatusCode }}\\n statuscode: {{ $health.StatusCode }}\\n {{- end }}\\n {{- if $health.Timeout }}\\n timeout: {{ $health.Timeout.Duration }}\\n {{- end }}\\n {{- if $health.Interval }}\\n interval: {{ $health.Interval.Duration }}\\n {{- end }}\\n threshold: {{ $health.Threshold }}\\n {{- end }}\\n {{- end }}\\n\\n {{- if .Spec.Health.TCP }}\\n tcp:\\n {{- range $_, $health := .Spec.Health.TCP }}\\n - addr: {{ $health.Address | quote }}\\n {{- if $health.Timeout }}\\n timeout: {{ $health.Timeout.Duration }}\\n {{- end }}\\n {{- if $health.Interval }}\\n interval: {{ $health.Interval.Duration }}\\n {{- end }}\\n threshold: {{ $health.Threshold }}\\n {{- end }}\\n {{- end }}\\n\"\n+ registry-config.yaml.tmpl: \"# https://docs.docker.com/registry/configuration/\\nversion: 0.1\\nlog:\\n accesslog:\\n disabled: {{ .Spec.Log.AccessLog.Disabled }}\\n level: {{ .Spec.Log.Level | quote }}\\n formatter: {{ .Spec.Log.Formatter | quote }}\\n {{- if .Spec.Log.Fields }}\\n fields: {{ .Spec.Log.Fields | toJson }}\\n {{- end }}\\n {{- if .Spec.Log.Hooks }}\\n hooks:\\n {{- range $index, $element := .Spec.Log.Hooks }}\\n - type: {{ $element.Type | quote }}\\n disabled: {{ $element.Disabled }}\\n {{- if $element.Levels }}\\n levels: {{ $element.Levels | toJson }}\\n {{- end }}\\n {{- if $element.OptionsRef }}\\n {{- with ( secretData $element.OptionsRef) }}\\n {{- if . }}\\n options: {{ toJson . }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\nhttp:\\n # secret: setted through environment variable\\n {{- if .Spec.HTTP.Debug }}\\n debug:\\n addr: :{{ .Spec.HTTP.Debug.Port }}\\n prometheus:\\n enabled: {{ .Spec.HTTP.Debug.Prometheus.Enabled }}\\n path: {{ .Spec.HTTP.Debug.Prometheus.Path | quote }}\\n {{- end }}\\n net: {{ .Spec.HTTP.Net | quote }}\\n addr: :5000\\n {{- if .Spec.HTTP.Prefix }}\\n prefix: {{ .Spec.HTTP.Prefix | quote }}\\n {{- end }}\\n {{- if .Spec.HTTP.Headers }}\\n headers: {{ .Spec.HTTP.Headers | toJson }}\\n {{- end }}\\n http2:\\n disabled: {{ .Spec.HTTP.HTTP2.Disabled }}\\n host: {{ .Spec.HTTP.Host | quote }}\\n relativeurls: {{ .Spec.HTTP.RelativeURLs }}\\n {{- if .Spec.HTTP.DrainTimeout }}\\n draintimeout: {{ .Spec.HTTP.DrainTimeout.Duration }}\\n {{- end }}\\n {{- if .Spec.HTTP.TLS.Enabled }}\\n tls:\\n certificate: /etc/registry/ssl/tls.crt\\n key: /etc/registry/ssl/tls.key\\n {{- end }}\\n{{- if .Spec.Reporting }}\\nreporting:\\n {{- range $name, $reference := .Spec.Reporting }}\\n {{ $name | quote }}: {{ secretData $reference | toJson }}\\n {{- end }}\\n{{- end }}\\nstorage:\\n {{- if .Spec.Storage.Delete.Enabled }}\\n delete:\\n {{- if .Spec.Storage.Delete.Enabled }}\\n enabled: {{ .Spec.Storage.Delete.Enabled }}\\n {{- end }}\\n {{- end }}\\n cache:\\n blobdescriptor: {{ default \\\"inmemory\\\" .Spec.Storage.Cache.Blobdescriptor | quote }}\\n maintenance:\\n uploadPurging:\\n enabled: {{ .Spec.Storage.Maintenance.UploadPurging.Enabled }}\\n {{- if .Spec.Storage.Maintenance.UploadPurging.Age }}\\n age: {{ .Spec.Storage.Maintenance.UploadPurging.Age.Duration }}\\n {{- end }}\\n {{- if .Spec.Storage.Maintenance.UploadPurging.Interval }}\\n interval: {{ .Spec.Storage.Maintenance.UploadPurging.Interval.Duration }}\\n {{- end }}\\n dryRun: {{ .Spec.Storage.Maintenance.UploadPurging.DryRun }}\\n readOnly:\\n enabled: {{ .Spec.Storage.Maintenance.ReadOnly.Enabled }}\\n redirect: \\n disable: {{ .Spec.Storage.Redirect.Disable }}\\n\\n {{- if .Spec.Storage.Driver.InMemory }}\\n inmemory: {}\\n {{- end }}\\n\\n {{- if .Spec.Storage.Driver.FileSystem }}\\n filesystem:\\n rootdirectory: /var/lib/registry\\n maxthreads: {{ .Spec.Storage.Driver.FileSystem.MaxThreads }}\\n {{- end }}\\n\\n {{- if .Spec.Storage.Driver.S3 }}\\n s3:\\n region: {{ .Spec.Storage.Driver.S3.Region | quote }}\\n bucket: {{ .Spec.Storage.Driver.S3.Bucket | quote }}\\n encrypt: {{ .Spec.Storage.Driver.S3.Encrypt }}\\n skipverify: {{ .Spec.Storage.Driver.S3.SkipVerify }}\\n {{- if .Spec.Storage.Driver.S3.KeyID }}\\n keyid: {{ .Spec.Storage.Driver.S3.KeyID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.Secure }}\\n secure: {{ .Spec.Storage.Driver.S3.Secure }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.V4Auth }}\\n v4auth: {{ .Spec.Storage.Driver.S3.V4Auth }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.ChunkSize }}\\n chunksize: {{ .Spec.Storage.Driver.S3.ChunkSize }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.StorageClass }}\\n storageclass: {{ .Spec.Storage.Driver.S3.StorageClass | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.RootDirectory }}\\n rootdirectory: {{ .Spec.Storage.Driver.S3.RootDirectory | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.AccessKey }}\\n accesskey: {{ .Spec.Storage.Driver.S3.AccessKey | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.SecretKeyRef }}\\n # secretkey: setted through environment variable\\n {{- end }}\\n {{- if .Spec.Storage.Driver.S3.RegionEndpoint }}\\n regionendpoint: {{ .Spec.Storage.Driver.S3.RegionEndpoint | quote }}\\n {{- end }}\\n {{- end }}\\n\\n {{- if .Spec.Storage.Driver.Swift }}\\n swift:\\n username: {{ .Spec.Storage.Driver.Swift.Username | quote }}\\n # password: setted through environment variable\\n authurl: {{ .Spec.Storage.Driver.Swift.AuthURL | quote }}\\n container: {{ .Spec.Storage.Driver.Swift.Container | quote }}\\n insecureskipverify: {{ .Spec.Storage.Driver.Swift.InsecureSkipVerify }}\\n {{- if .Spec.Storage.Driver.Swift.Prefix }}\\n prefix: {{ .Spec.Storage.Driver.Swift.Prefix | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.EndpointType }}\\n endpointtype: {{ .Spec.Storage.Driver.Swift.EndpointType | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.ChunkSize }}\\n chunksize: {{ .Spec.Storage.Driver.Swift.ChunkSize }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.AccessKey }}\\n accesskey: {{ .Spec.Storage.Driver.Swift.AccessKey | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.SecretKeyRef }}\\n # secretkey: setted through environment variable\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.AuthVersion }}\\n authversion: {{ .Spec.Storage.Driver.Swift.AuthVersion | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.Tenant }}\\n tenantid: {{ .Spec.Storage.Driver.Swift.Tenant | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.TenantID }}\\n tenantid: {{ .Spec.Storage.Driver.Swift.TenantID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.Domain }}\\n domain: {{ .Spec.Storage.Driver.Swift.Domain | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.DomainID }}\\n domainid: {{ .Spec.Storage.Driver.Swift.DomainID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.TrustID }}\\n trustid: {{ .Spec.Storage.Driver.Swift.TrustID | quote }}\\n {{- end }}\\n {{- if .Spec.Storage.Driver.Swift.Region }}\\n region: {{ .Spec.Storage.Driver.Swift.Region | quote }}\\n {{- end }}\\n {{- end }}\\n\\n{{- if ( or .Spec.Middlewares.Registry ( or .Spec.Middlewares.Repository .Spec.Middlewares.Storage ) ) }}\\nmiddleware:\\n {{- if .Spec.Middlewares.Registry }}\\n registry:\\n {{- range $index, $middleware := .Spec.Middlewares.Registry }}\\n - name: {{ $middleware.Name | quote }}\\n {{- if $middleware.OptionsRef }}\\n options: {{ secretData $middleware.OptionsRef | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- if .Spec.Middlewares.Repository }}\\n registry:\\n {{- range $index, $middleware := .Spec.Middlewares.Repository }}\\n - name: {{ $middleware.Name | quote }}\\n {{- if $middleware.OptionsRef }}\\n options: {{ secretData $middleware.OptionsRef | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- if .Spec.Middlewares.Storage }}\\n registry:\\n {{- range $index, $middleware := .Spec.Middlewares.Storage }}\\n - name: {{ $middleware.Name | quote }}\\n {{- if $middleware.OptionsRef }}\\n options: {{ secretData $middleware.OptionsRef | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n{{- end }}\\n{{- if .Spec.Redis }}\\nredis:\\n {{- if .Spec.Redis.SentinelMasterSet }}\\n sentinelMasterSet: {{ .Spec.Redis.SentinelMasterSet | quote }}\\n {{- end }}\\n {{- if .Spec.Redis.Port }}\\n addr: {{ printf \\\"%s:%d\\\" .Spec.Redis.Host .Spec.Redis.Port | quote }}\\n {{- else }}\\n addr: {{ .Spec.Redis.Host | quote }}\\n {{- end }}\\n # password: setted through environment variable\\n db: {{ .Spec.Redis.Database }}\\n {{- if .Spec.Redis.DialTimeout }}\\n dialtimeout: {{ .Spec.Redis.DialTimeout.Duration }}\\n {{- end }}\\n {{- if .Spec.Redis.ReadTimeout }}\\n readtimeout: {{ .Spec.Redis.ReadTimeout.Duration }}\\n {{- end }}\\n {{- if .Spec.Redis.WriteTimeout }}\\n writetimeout: {{ .Spec.Redis.WriteTimeout.Duration }}\\n {{- end }}\\n {{- if ( or .Spec.Redis.Pool.MaxIdle ( or .Spec.Redis.Pool.MaxActive .Spec.Redis.Pool.IdleTimeout ) ) }}\\n pool:\\n {{- if .Spec.Redis.Pool.MaxIdle }}\\n maxidle: {{ .Spec.Redis.Pool.MaxIdle }}\\n {{- end }}\\n {{- if .Spec.Redis.Pool.MaxActive }}\\n maxactive: {{ .Spec.Redis.Pool.MaxActive }}\\n {{- end }}\\n {{- if .Spec.Redis.Pool.IdleTimeout }}\\n idletimeout: {{ .Spec.Redis.Pool.IdleTimeout.Duration }}\\n {{- end }}\\n {{- end }}\\n{{- end }}\\n{{- if .Spec.Proxy }}\\nproxy:\\n remoteurl: {{ .Spec.Proxy.RemoteURL | quote }}\\n # username: setted through environment variable\\n # password: setted through environment variable\\n{{- end }}\\ncompatibility:\\n schema1:\\n # signingkeyfile: setted through environment variable\\n enabled: {{ .Spec.Compatibility.Schema1.Enabled }}\\nvalidation:\\n disabled: {{ .Spec.Validation.Disabled }}\\n {{- if or .Spec.Validation.Manifests.URLs.Allow .Spec.Validation.Manifests.URLs.Deny }}\\n manifests:\\n urls:\\n {{- if .Spec.Validation.Manifests.URLs.Allow }}\\n allow: {{ .Spec.Validation.Manifests.URLs.Allow | toJson }}\\n {{- end }}\\n {{- if .Spec.Validation.Manifests.URLs.Deny }}\\n deny: {{ .Spec.Validation.Manifests.URLs.Deny | toJson }}\\n {{- end }}\\n {{- end }}\\n{{- if ( or .Spec.Authentication.Silly ( or .Spec.Authentication.Token .Spec.Authentication.HTPasswd ) ) }}\\nauth:\\n {{- if .Spec.Authentication.Silly }}\\n silly:\\n realm: {{ .Spec.Authentication.Silly.Realm | quote }}\\n service: {{ .Spec.Authentication.Silly.Service | quote }}\\n {{- end }}\\n {{- if .Spec.Authentication.Token }}\\n token:\\n realm: {{ .Spec.Authentication.Token.Realm | quote }}\\n service: {{ .Spec.Authentication.Token.Service | quote }}\\n issuer: registry-token-issuer\\n rootcertbundle: /root/certs/bundle\\n autoredirect: {{ .Spec.Authentication.Token.AutoRedirect }}\\n {{- end }}\\n {{- if .Spec.Authentication.HTPasswd }}\\n htpasswd:\\n realm: {{ .Spec.Authentication.HTPasswd.Realm | quote }}\\n # path: setted through environment variable\\n {{- end }}\\n{{- end }}\\nnotifications:\\n {{- if .Spec.Notifications.Endpoints }}\\n endpoints:\\n {{- range $_, $endpoint := .Spec.Notifications.Endpoints }}\\n - name: {{ $endpoint.Name | quote }}\\n disabled: {{ $endpoint.Disabled }}\\n url: {{ $endpoint.URL | quote }}\\n {{- if $endpoint.Headers }}\\n headers: {{ $endpoint.Headers | toJson }}\\n {{- end }}\\n {{- if $endpoint.Timeout }}\\n timeout: {{ $endpoint.Timeout.Duration }}\\n {{- end }}\\n {{- if $endpoint.Threshold }}\\n threshold: {{ $endpoint.Threshold }}\\n {{- end }}\\n {{- if $endpoint.Backoff }}\\n backoff: {{ $endpoint.Backoff }}\\n {{- end }}\\n {{- if $endpoint.IgnoredMediaTypes }}\\n ignoredmediatypes: {{ $endpoint.IgnoredMediaTypes | toJson }}\\n {{- end }}\\n {{- if ( or $endpoint.Ignore.MediaTypes $endpoint.Ignore.Actions ) }}\\n ignore:\\n {{- if $endpoint.Ignore.MediaTypes }}\\n mediatypes: {{ $endpoint.Ignore.MediaTypes | toJson }}\\n {{- end }}\\n {{- if $endpoint.Ignore.Actions }}\\n actions: {{ $endpoint.Ignore.Actions | toJson }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n events:\\n includereferences: {{ default true .Spec.Notifications.Events.IncludeReferences }}\\n\\nhealth:\\n storagedriver:\\n enabled: {{ default true .Spec.Health.StorageDriver.Enabled }}\\n {{- if .Spec.Health.StorageDriver.Interval }}\\n interval: {{ .Spec.Health.StorageDriver.Interval.Duration }}\\n {{- end }}\\n {{- if .Spec.Health.StorageDriver.Threshold }}\\n threshold: {{ .Spec.Health.StorageDriver.Threshold }}\\n {{- end }}\\n\\n {{- if .Spec.Health.File }}\\n file:\\n {{- range $_, $health := .Spec.Health.File }}\\n - file: {{ $health.File | quote }}\\n {{- if $health.Interval }}\\n interval: {{ $health.Interval.Duration }}\\n {{- end }}\\n {{- end }}\\n {{- end }}\\n\\n {{- if .Spec.Health.HTTP }}\\n http:\\n {{- range $_, $health := .Spec.Health.HTTP }}\\n - uri: {{ $health.URI | quote }}\\n headers: {{ $health.Headers | toJson }}\\n {{- if $health.StatusCode }}\\n statuscode: {{ $health.StatusCode }}\\n {{- end }}\\n {{- if $health.Timeout }}\\n timeout: {{ $health.Timeout.Duration }}\\n {{- end }}\\n {{- if $health.Interval }}\\n interval: {{ $health.Interval.Duration }}\\n {{- end }}\\n threshold: {{ $health.Threshold }}\\n {{- end }}\\n {{- end }}\\n\\n {{- if .Spec.Health.TCP }}\\n tcp:\\n {{- range $_, $health := .Spec.Health.TCP }}\\n - addr: {{ $health.Address | quote }}\\n {{- if $health.Timeout }}\\n timeout: {{ $health.Timeout.Duration }}\\n {{- end }}\\n {{- if $health.Interval }}\\n interval: {{ $health.Interval.Duration }}\\n {{- end }}\\n threshold: {{ $health.Threshold }}\\n {{- end }}\\n {{- end }}\\n\"\nregistryctl-config.yaml.tmpl: |\n{{- if .Spec.TLS.Enabled }}\nprotocol: https\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_other_fs.yaml",
"new_path": "manifests/samples/full_stack_other_fs.yaml",
"diff": "@@ -65,6 +65,7 @@ apiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\nname: sample-harbor-trivy-reports\n+ namespace: cluster-sample-ns\nspec:\naccessModes:\n- ReadWriteOnce\n@@ -77,6 +78,7 @@ apiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\nname: sample-harbor-trivy-cache\n+ namespace: cluster-sample-ns\nspec:\naccessModes:\n- ReadWriteOnce\n@@ -89,6 +91,7 @@ apiVersion: v1\nkind: PersistentVolumeClaim\nmetadata:\nname: sample-harbor-chart\n+ namespace: cluster-sample-ns\nspec:\naccessModes:\n- ReadWriteOnce\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
add sentinel support for chartmuseum
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,875
|
22.12.2020 11:29:34
| -28,800
|
a0607edd037b8f54dc1631ccfd3ff58530e3d5c2
|
update some CI metrix
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/tests.yml",
"new_path": ".github/workflows/tests.yml",
"diff": "@@ -59,6 +59,41 @@ jobs:\n- run: make generated-diff-test\ngo-tests:\n+ runs-on: ubuntu-latest\n+ name: Go tests\n+ env:\n+ USE_EXISTING_CLUSTER: true\n+ steps:\n+ - uses: actions/setup-go@v2\n+ with:\n+ go-version: 1.14\n+\n+ - name: Install Kubernetes\n+ run: |\n+ which kind || (curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.9.0/kind-$(uname)-amd64; sudo install kind /usr/local/bin/)\n+ cat <<EOF | kind create cluster --name harbor --config=-\n+ kind: Cluster\n+ apiVersion: kind.x-k8s.io/v1alpha4\n+ nodes:\n+ - role: control-plane\n+ - role: worker\n+ - role: worker\n+ EOF\n+\n+ - name: Install CertManager\n+ run: |\n+ # Try the recet way to install crd or fallback to the old one\n+ kubectl apply -f \"https://github.com/jetstack/cert-manager/releases/download/v0.16.1/cert-manager.yaml\"\n+ sleep 5\n+ time kubectl -n cert-manager wait --for=condition=Available deployment --all --timeout 300s\n+\n+ - uses: actions/checkout@v2\n+\n+ - name: go tests\n+ run: |\n+ make go-test\n+\n+ harbor-tests:\nruns-on: ubuntu-latest\nname: K8S v${{ matrix.k8sVersion }} (CM v${{ matrix.certManager }})\nenv:\n@@ -69,15 +104,15 @@ jobs:\nmatrix:\n# https://github.com/jetstack/cert-manager/tags\ncertManager:\n- - \"0.15.2\"\n- \"0.16.1\"\n- - \"1.0.3\"\n+ - \"1.0.4\"\n+ - \"1.1.0\"\n# https://snapcraft.io/microk8s\nk8sVersion:\n- - \"1.17\"\n- - \"1.18\"\n- - \"1.19\"\n+ - \"1.17.11\"\n+ - \"1.18.8\"\n+ - \"1.19.1\"\nsteps:\n- uses: actions/setup-go@v2\n@@ -86,8 +121,8 @@ jobs:\n- name: Install Kubernetes v${{ matrix.k8sVersion }}\nrun: |\n- which kind || (curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.7.0/kind-$(uname)-amd64; sudo install kind /usr/local/bin/)\n- cat <<EOF | kind create cluster --name harbor --config=-\n+ which kind || (curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/v0.9.0/kind-$(uname)-amd64; sudo install kind /usr/local/bin/)\n+ cat <<EOF | kind create cluster --name harbor --image=kindest/node:v${{ matrix.k8sVersion }} --config=-\nkind: Cluster\napiVersion: kind.x-k8s.io/v1alpha4\nnodes:\n@@ -111,13 +146,10 @@ jobs:\ntime kubectl -n ingress-nginx wait --for=condition=Available deployment --all --timeout 300s\n- uses: actions/checkout@v2\n- - name: go tests\n- run: |\n- make go-test\n- name: build harbor-operator\nrun: |\n- make docker-build IMG=harbor-operator:dev_test\n+ make go-generate docker-build IMG=harbor-operator:dev_test\nkind load docker-image harbor-operator:dev_test --name harbor\n- name: install harbor-operator\n@@ -138,12 +170,12 @@ jobs:\nexport GITHUB_TOKEN=xxx\nset -ex\nkubectl apply -f manifests/samples/full_stack_other_fs.yaml\n- for i in $(seq 1 6);do\n+ for i in $(seq 1 7);do\nsleep 30\necho $i\nkubectl -n cluster-sample-ns get all\ndone\n- if ! time kubectl -n cluster-sample-ns wait --for=condition=Ready pod --all --timeout 600s ;then\n+ if ! time kubectl -n cluster-sample-ns wait --for=condition=Ready pod --all --timeout 600s && ! time kubectl -n cluster-sample-ns wait --for=condition=Ready pod --all --timeout 60s; then\necho install harbor failed\nkubectl get all -n cluster-sample-ns\n@@ -153,6 +185,7 @@ jobs:\necho show log $n\nkubectl -n cluster-sample-ns logs --tail 100 $n || true\ndone\n+ kubectl logs -l control-plane=harbor-operator -n harbor-operator-ns --tail 100\nexit 1\nelse\nkubectl -n cluster-sample-ns get all\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
update some CI metrix
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,890
|
08.12.2020 07:02:54
| 0
|
e26cf010e9cf1d7bb00dc676dc5ac7c9e66391d7
|
refactor(controller): one method to add mutable and immutable secret
Update `AddSecretToManage` method to support both mutable and immutable
secret, and remove `AddImmutableSecretToManage` method.
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/core.go",
"new_path": "controllers/goharbor/harbor/core.go",
"diff": "@@ -72,7 +72,7 @@ func (r *Reconciler) AddCoreAdminPassword(ctx context.Context, harbor *goharborv\nreturn nil, errors.Wrap(err, \"get\")\n}\n- adminPasswordRes, err := r.AddImmutableSecretToManage(ctx, adminPassword)\n+ adminPasswordRes, err := r.AddSecretToManage(ctx, adminPassword)\nif err != nil {\nreturn nil, errors.Wrap(err, \"add\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/notarysigner.go",
"new_path": "controllers/goharbor/harbor/notarysigner.go",
"diff": "@@ -102,7 +102,7 @@ func (r *Reconciler) AddNotarySignerEncryptionKey(ctx context.Context, harbor *g\nreturn nil, errors.Wrap(err, \"get\")\n}\n- secretRes, err := r.Controller.AddImmutableSecretToManage(ctx, secret)\n+ secretRes, err := r.Controller.AddSecretToManage(ctx, secret)\nif err != nil {\nreturn nil, errors.Wrap(err, \"add\")\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/resource.go",
"new_path": "pkg/controller/resource.go",
"diff": "@@ -276,27 +276,13 @@ func (c *Controller) AddSecretToManage(ctx context.Context, resource *corev1.Sec\nreturn nil, nil\n}\n- res := &Resource{\n- mutable: mutation.NewSecret(c.GlobalMutateFn(ctx), true, false),\n- checkable: statuscheck.True,\n- resource: resource,\n- }\n-\n- g := sgraph.Get(ctx)\n- if g == nil {\n- return nil, errors.Errorf(\"no graph in current context\")\n- }\n-\n- return res, g.AddResource(ctx, res, dependencies, c.ProcessFunc(ctx, resource, dependencies...))\n-}\n-\n-func (c *Controller) AddImmutableSecretToManage(ctx context.Context, resource *corev1.Secret, dependencies ...graph.Resource) (graph.Resource, error) {\n- if resource == nil {\n- return nil, nil\n+ override := true\n+ if resource.Immutable != nil && *resource.Immutable {\n+ override = false\n}\nres := &Resource{\n- mutable: mutation.NewSecret(c.GlobalMutateFn(ctx), false, false),\n+ mutable: mutation.NewSecret(c.GlobalMutateFn(ctx), override, false),\ncheckable: statuscheck.True,\nresource: resource,\n}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
refactor(controller): one method to add mutable and immutable secret
Update `AddSecretToManage` method to support both mutable and immutable
secret, and remove `AddImmutableSecretToManage` method.
Signed-off-by: He Weiwei <hweiwei@vmware.com>
|
254,875
|
06.01.2021 18:08:21
| -28,800
|
58faf475c79ba841c8213dc3fc48a7c64fb449cd
|
feat(redis) remove useless redis service
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"diff": "@@ -58,9 +58,6 @@ type RedisSpec struct {\nGroupName string `json:\"groupName,omitempty\"`\n- // +kubebuilder:validation:Enum=sentinel;redis\n- Schema string `json:\"schema,omitempty\"`\n-\nHosts []RedisHosts `json:\"hosts,omitempty\"`\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"new_path": "config/samples/harborcluster/goharbor_v1alpha2_harborcluster.yaml",
"diff": "@@ -72,7 +72,6 @@ spec:\ninClusterCache:\nkind: Redis\nredisSpec:\n- schema: redis\nserver:\nreplicas: 1\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/cluster/deployment.yaml",
"new_path": "manifests/cluster/deployment.yaml",
"diff": "@@ -2412,11 +2412,6 @@ spec:\npoolSize:\ndescription: Maximum number of socket connections. Default is 10 connections per every CPU as reported by runtime.NumCPU.\ntype: integer\n- schema:\n- enum:\n- - sentinel\n- - redis\n- type: string\nsentinel:\nproperties:\nreplicas:\n@@ -3246,6 +3241,7 @@ spec:\ndefault: RollingUpdate\ntype: string\nversion:\n+ description: The version of the harbor, eg 2.1.2\ntype: string\nrequired:\n- encryptionKeyRef\n@@ -4418,6 +4414,7 @@ spec:\ndefault: RollingUpdate\ntype: string\nversion:\n+ description: The version of the harbor, eg 2.1.2\ntype: string\nrequired:\n- encryptionKeyRef\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack.yaml",
"new_path": "manifests/samples/full_stack.yaml",
"diff": "@@ -102,7 +102,6 @@ spec:\ninClusterCache:\nkind: Redis\nredisSpec:\n- schema: redis\nserver:\nreplicas: 1\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_fs.yaml",
"new_path": "manifests/samples/full_stack_fs.yaml",
"diff": "@@ -97,7 +97,6 @@ spec:\ninClusterCache:\nkind: Redis\nredisSpec:\n- schema: redis\nserver:\nreplicas: 1\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_other_fs.yaml",
"new_path": "manifests/samples/full_stack_other_fs.yaml",
"diff": "@@ -164,7 +164,6 @@ spec:\ninClusterCache:\nkind: Redis\nredisSpec:\n- schema: redis\nserver:\nreplicas: 1\nresources:\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/constants.go",
"new_path": "pkg/cluster/controllers/cache/constants.go",
"diff": "@@ -18,8 +18,3 @@ const (\nErrorUpdateRedisCr = \"Update redis cr error\"\nErrorDefaultUnstructuredConverter = \"Default unstructured converter error\"\n)\n-\n-const (\n- SchemaRedisSentinel = \"sentinel\"\n- SchemaRedisServer = \"redis\"\n-)\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/deploy.go",
"new_path": "pkg/cluster/controllers/cache/deploy.go",
"diff": "@@ -34,10 +34,6 @@ func (rc *RedisController) Deploy(cluster *v1alpha2.HarborCluster) (*lcm.CRStatu\nreturn cacheNotReadyStatus(ErrorCreateRedisSecret, err.Error()), err\n}\n- if err = rc.DeployService(cluster); err != nil {\n- return cacheNotReadyStatus(ErrorCreateRedisServerService, err.Error()), err\n- }\n-\nrc.Log.Info(\"Creating Redis.\", \"namespace\", cluster.Namespace, \"name\", cluster.Name)\nunstructuredData, err := runtime.DefaultUnstructuredConverter.ToUnstructured(expectCR)\n@@ -55,24 +51,6 @@ func (rc *RedisController) Deploy(cluster *v1alpha2.HarborCluster) (*lcm.CRStatu\nreturn cacheUnknownStatus(), nil\n}\n-func (rc *RedisController) DeployService(cluster *v1alpha2.HarborCluster) error {\n- service := &corev1.Service{}\n-\n- svc := rc.ResourceManager.GetService()\n- if err := controllerutil.SetControllerReference(cluster, svc, rc.Scheme); err != nil {\n- return err\n- }\n-\n- err := rc.Client.Get(types.NamespacedName{Name: svc.Name, Namespace: svc.Namespace}, service)\n- if err != nil && errors.IsNotFound(err) {\n- rc.Log.Info(\"Creating Redis server service\", \"namespace\", cluster.Namespace, \"name\", svc.Name)\n-\n- return rc.Client.Create(svc)\n- }\n-\n- return err\n-}\n-\nfunc (rc *RedisController) DeploySecret(cluster *v1alpha2.HarborCluster) error {\nsecret := &corev1.Secret{}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/resource_manager.go",
"new_path": "pkg/cluster/controllers/cache/resource_manager.go",
"diff": "@@ -11,7 +11,6 @@ import (\ncorev1 \"k8s.io/api/core/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/runtime\"\n- \"k8s.io/apimachinery/pkg/util/intstr\"\n)\n// ResourceManager defines the common interface of resources.\n@@ -26,8 +25,6 @@ type ResourceGetter interface {\nGetCacheCR() runtime.Object\nGetCacheCRName() string\nGetResourceList() corev1.ResourceList\n- GetServiceName() string\n- GetService() *corev1.Service\nGetSecretName() string\nGetSecret() *corev1.Secret\nGetServerReplica() int\n@@ -114,44 +111,6 @@ func (rm *redisResourceManager) GetCacheCRName() string {\nreturn fmt.Sprintf(\"%s-%s\", rm.cluster.Name, \"redis\")\n}\n-// GetServiceName gets service name.\n-func (rm *redisResourceManager) GetServiceName() string {\n- return rm.GetCacheCRName()\n-}\n-\n-// GetService gets service.\n-func (rm *redisResourceManager) GetService() *corev1.Service {\n- name := rm.GetServiceName()\n-\n- return &corev1.Service{\n- TypeMeta: metav1.TypeMeta{\n- APIVersion: \"v1\",\n- Kind: \"Service\",\n- },\n- ObjectMeta: metav1.ObjectMeta{\n- Name: name,\n- Namespace: rm.cluster.Namespace,\n- Labels: rm.GetLabels(),\n- },\n- Spec: corev1.ServiceSpec{\n- Type: corev1.ServiceTypeClusterIP,\n- Selector: map[string]string{\n- \"app.kubernetes.io/component\": \"redis\",\n- \"app.kubernetes.io/name\": rm.GetCacheCRName(),\n- \"app.kubernetes.io/part-of\": \"redis-failover\",\n- },\n- Ports: []corev1.ServicePort{\n- {\n- Port: 6379,\n- TargetPort: intstr.FromInt(6379),\n- Protocol: corev1.ProtocolTCP,\n- Name: \"redis\",\n- },\n- },\n- },\n- }\n-}\n-\n// GetSecretName gets secret name.\nfunc (rm *redisResourceManager) GetSecretName() string {\nreturn rm.GetCacheCRName()\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(redis) remove useless redis service
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,865
|
12.01.2021 12:35:56
| -28,800
|
5f366fb1f7ec128a2871aa1c187e7fc2f6afefab
|
feat(trivy): make github token optional.
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/trivy.go",
"new_path": "controllers/goharbor/harbor/trivy.go",
"diff": "@@ -120,9 +120,6 @@ func (r *Reconciler) GetTrivy(ctx context.Context, harbor *goharborv1alpha2.Harb\nredis := harbor.Spec.RedisConnection(harbormetav1.TrivyRedis)\ngithubTokenRef := harbor.Spec.Trivy.GithubTokenRef\n- if githubTokenRef == \"\" {\n- githubTokenRef = r.NormalizeName(ctx, harbor.GetName(), controllers.Trivy.String(), \"github\")\n- }\ntls := harbor.Spec.InternalTLS.GetComponentTLSSpec(r.GetInternalTLSCertificateSecretName(ctx, harbor, harbormetav1.TrivyTLS))\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(trivy): make github token optional.
Signed-off-by: wangcanfeng <wangcanfeng@corp.netease.com>
|
254,890
|
13.01.2021 08:57:44
| 0
|
96bb91ba617353a6830a5ba9449ecaa5f59a64b6
|
feat(database): add max_connections for the incluster postgres
1. Set the max_connections to 1024 for the incluster postgres database.
2. Limit max_open_conns and max_idle_conns for the core component.
Closes
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/deployments.go",
"new_path": "controllers/goharbor/core/deployments.go",
"diff": "@@ -42,6 +42,8 @@ const (\nTokenStoragePath = ConfigPath + \"/token\"\nServiceTokenCertificateVolumeName = \"token-service-private-key\"\nServiceTokenCertificatePath = ConfigPath + \"/private_key.pem\"\n+ PostGreSQLMaxOpenConns = \"1000\"\n+ PostGreSQLMaxIdleConns = \"50\"\n)\nconst (\n@@ -162,6 +164,8 @@ func (r *Reconciler) GetDeployment(ctx context.Context, core *goharborv1alpha2.C\n},\n}),\ncommon.PostGreSQLDatabase: harbor.Value(core.Spec.Database.Database),\n+ common.PostGreSQLMaxOpenConns: harbor.Value(PostGreSQLMaxOpenConns),\n+ common.PostGreSQLMaxIdleConns: harbor.Value(PostGreSQLMaxIdleConns),\ncommon.CoreURL: harbor.Value(coreLocalURL),\ncommon.CoreLocalURL: harbor.Value(coreLocalURL),\ncommon.RegistryControllerURL: harbor.Value(core.Spec.Components.Registry.ControllerURL),\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/api/postgresql_type.go",
"new_path": "pkg/cluster/controllers/database/api/postgresql_type.go",
"diff": "@@ -115,6 +115,7 @@ type AdditionalVolume struct {\n// PostgresqlParam describes PostgreSQL version and pairs of configuration parameter name - values.\ntype PostgresqlParam struct {\nPgVersion string `json:\"version\"`\n+ Parameters map[string]string `json:\"parameters,omitempty\"`\n}\n// ResourceDescription describes CPU and memory resources defined for a cluster.\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/generate.go",
"new_path": "pkg/cluster/controllers/database/generate.go",
"diff": "@@ -50,6 +50,7 @@ func (p *PostgreSQLController) GetPostgresCR() (*unstructured.Unstructured, erro\nDatabases: databases,\nPostgresqlParam: api.PostgresqlParam{\nPgVersion: version,\n+ Parameters: p.GetPostgreParameters(),\n},\nResources: resource,\nDockerImage: p.GetImage(),\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/database/utils.go",
"new_path": "pkg/cluster/controllers/database/utils.go",
"diff": "@@ -2,16 +2,20 @@ package database\nimport (\n\"fmt\"\n+ \"strconv\"\n\"github.com/goharbor/harbor-operator/pkg/cluster/controllers/database/api\"\n+ \"github.com/ovh/configstore\"\ncorev1 \"k8s.io/api/core/v1\"\n\"k8s.io/apimachinery/pkg/types\"\n)\nconst (\n+ ConfigMaxConnectionsKey = \"max-connections\"\nDefaultDatabaseReplica = 3\nDefaultDatabaseMemory = \"1Gi\"\nDefaultDatabaseVersion = \"12\"\n+ DefaultDatabaseMaxConnections = \"1024\"\n)\nfunc (p *PostgreSQLController) GetDatabases() map[string]string {\n@@ -141,6 +145,32 @@ func (p *PostgreSQLController) GetPostgreVersion() string {\nreturn p.HarborCluster.Spec.InClusterDatabase.PostgresSQLSpec.Version\n}\n+func (p *PostgreSQLController) GetPostgreParameters() map[string]string {\n+ return map[string]string{\n+ \"max_connections\": p.GetPosgresMaxConnections(),\n+ }\n+}\n+\n+func (p *PostgreSQLController) GetPosgresMaxConnections() string {\n+ maxConnections, err := p.ConfigStore.GetItemValue(ConfigMaxConnectionsKey)\n+ if err != nil {\n+ if _, ok := err.(configstore.ErrItemNotFound); !ok {\n+ // Just logged\n+ p.Log.V(5).Error(err, \"failed to get database max connections\")\n+ }\n+\n+ maxConnections = DefaultDatabaseMaxConnections\n+ }\n+\n+ if _, err := strconv.ParseInt(maxConnections, 10, 64); err != nil {\n+ p.Log.V(5).Error(err, \"%s is not a valid number for postgres max connections\", maxConnections)\n+\n+ maxConnections = DefaultDatabaseMaxConnections\n+ }\n+\n+ return maxConnections\n+}\n+\n// GenDatabaseURL returns database connection url.\nfunc (c *Connect) GenDatabaseURL() string {\ndatabaseURL := fmt.Sprintf(\"postgres://%s:%s@%s:%s/%s\", c.Username, c.Password, c.Host, c.Port, c.Database)\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(database): add max_connections for the incluster postgres
1. Set the max_connections to 1024 for the incluster postgres database.
2. Limit max_open_conns and max_idle_conns for the core component.
Closes #382
Signed-off-by: He Weiwei <hweiwei@vmware.com>
|
254,875
|
13.01.2021 18:44:59
| -28,800
|
0ef65842930aede3df5c896bac944f7eb66266a3
|
fix(ci) github token is not must
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/tests.yml",
"new_path": ".github/workflows/tests.yml",
"diff": "@@ -167,7 +167,6 @@ jobs:\n- name: install harbor\nrun: |\n- export GITHUB_TOKEN=xxx\nset -ex\nkubectl apply -f manifests/samples/full_stack_other_fs.yaml\nfor i in $(seq 1 7);do\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_other_fs.yaml",
"new_path": "manifests/samples/full_stack_other_fs.yaml",
"diff": "@@ -14,16 +14,6 @@ data:\nsecret: SGFyYm9yMTIzNDU=\ntype: Opaque\n---\n-# A secret of harbor admin password.\n-apiVersion: v1\n-kind: Secret\n-metadata:\n- name: github-credentials\n- namespace: cluster-sample-ns\n-data:\n- github-token: eHh4\n-type: goharbor.io/github\n----\n# Cert issuer\napiVersion: cert-manager.io/v1alpha2\nkind: Issuer\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(ci) github token is not must
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,877
|
16.12.2020 15:17:30
| -3,600
|
5750a0c99cf4d3c7807fff7196ea595af8623fb5
|
fix(test) pkg/controller/
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/controller/resource_test.go",
"new_path": "pkg/controller/resource_test.go",
"diff": "@@ -4,10 +4,12 @@ import (\n\"context\"\n. \"github.com/goharbor/harbor-operator/pkg/controller\"\n+ \"github.com/goharbor/harbor-operator/pkg/scheme\"\n. \"github.com/onsi/ginkgo\"\n. \"github.com/onsi/gomega\"\n\"github.com/goharbor/harbor-operator/pkg/factories/application\"\n+ \"github.com/goharbor/harbor-operator/pkg/factories/owner\"\n\"github.com/goharbor/harbor-operator/pkg/graph\"\n\"github.com/goharbor/harbor-operator/pkg/resources\"\ncertv1 \"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2\"\n@@ -54,6 +56,11 @@ var _ = Context(\"Adding\", func() {\napplication.SetVersion(&setupCtx, \"test\")\nc = NewController(setupCtx, \"test\", nil, nil)\n+ scheme, err := scheme.New(setupCtx)\n+ Expect(err).ToNot(HaveOccurred())\n+\n+ c.Scheme = scheme\n+\nctx = c.NewContext(controllerruntime.Request{\nNamespacedName: types.NamespacedName{\nName: \"resource-name\",\n@@ -61,6 +68,7 @@ var _ = Context(\"Adding\", func() {\n},\n})\n+ owner.Set(&ctx, &appsv1.Deployment{})\napplication.SetName(&ctx, \"test-app\")\napplication.SetVersion(&ctx, \"test\")\n})\n@@ -86,12 +94,21 @@ var _ = Context(\"Adding\", func() {\nDescribe(\"An unknown resource\", func() {\nBeforeEach(func() {\nc := NewController(ctx, \"test\", nil, nil)\n- d, err := c.AddConfigMapToManage(c.NewContext(controllerruntime.Request{\n+ scheme, err := scheme.New(ctx)\n+ Expect(err).ToNot(HaveOccurred())\n+\n+ c.Scheme = scheme\n+\n+ context := c.NewContext(controllerruntime.Request{\nNamespacedName: types.NamespacedName{\nName: \"resource-name\",\nNamespace: \"namespace\",\n},\n- }), &corev1.ConfigMap{})\n+ })\n+\n+ owner.Set(&context, &appsv1.Deployment{})\n+\n+ d, err := c.AddConfigMapToManage(context, &corev1.ConfigMap{})\nExpect(err).ToNot(HaveOccurred())\ndependency = d\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(test) pkg/controller/
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
254,877
|
12.01.2021 10:42:11
| -3,600
|
fd8a56ef38f920cfdee1b0d80b032431d21a5e38
|
fix(ci) Remove installation of certmanager in go-test
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -107,7 +107,7 @@ diff:\ngit diff --stat --diff-filter=d --exit-code HEAD\n.PHONY: go-test\n-go-test: install certmanager\n+go-test: install\nifeq (, $(USE_EXISTING_CLUSTER))\n$(warning USE_EXISTING_CLUSTER variable is not defined)\nendif\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(ci) Remove installation of certmanager in go-test
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
254,877
|
15.01.2021 12:10:10
| -3,600
|
a1e62ec8b7a10058ec449794df021667b0127604
|
feat(ci) Get Kind logs bundle
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/tests.yml",
"new_path": ".github/workflows/tests.yml",
"diff": "@@ -119,6 +119,18 @@ jobs:\nrun: |\nmake go-test\n+ - name: fetch logs\n+ if: ${{ failure() }}\n+ run: |\n+ mkdir -p /tmp/logs\n+ kind export logs --name harbor /tmp/logs\n+\n+ - uses: actions/upload-artifact@v2\n+ if: ${{ failure() }}\n+ with:\n+ name: kind\n+ path: /tmp/logs\n+\n- name: build harbor-operator\nrun: |\nmake docker-build IMG=${dockerImage}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(ci) Get Kind logs bundle
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
254,875
|
15.01.2021 10:41:05
| -28,800
|
3428000549138c3936fceddb9bff9b9f0c766d75
|
feat(ci) import harbor apidb test
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/tests.yml",
"new_path": ".github/workflows/tests.yml",
"diff": "@@ -105,7 +105,6 @@ jobs:\n# https://github.com/jetstack/cert-manager/tags\ncertManager:\n- \"0.16.1\"\n- - \"1.0.4\"\n- \"1.1.0\"\n# https://snapcraft.io/microk8s\n@@ -128,7 +127,6 @@ jobs:\nnodes:\n- role: control-plane\n- role: worker\n- - role: worker\nEOF\n- name: Install CertManager v${{ matrix.certManager }}\n@@ -168,6 +166,15 @@ jobs:\n- name: install harbor\nrun: |\nset -ex\n+ IP=`hostname -I | awk '{print $1}'`\n+ echo \"IP=$IP\" >> $GITHUB_ENV\n+ CORE_HOST=core.$IP.nip.io\n+ NOTARY_HOST=notary.$IP.nip.io\n+ echo \"CORE_HOST=$CORE_HOST\" >> $GITHUB_ENV\n+ echo \"NOTARY_HOST=$NOTARY_HOST\" >> $GITHUB_ENV\n+ sed -i \"s/core.harbor.domain/$CORE_HOST/g\" manifests/samples/full_stack_other_fs.yaml\n+ sed -i \"s/notary.harbor.domain/$NOTARY_HOST/g\" manifests/samples/full_stack_other_fs.yaml\n+\nkubectl apply -f manifests/samples/full_stack_other_fs.yaml\nfor i in $(seq 1 7);do\nsleep 30\n@@ -197,19 +204,28 @@ jobs:\nsudo kubectl get -n ingress-nginx service/ingress-nginx-controller\nsudo kubectl port-forward -n ingress-nginx service/ingress-nginx-controller 443:443 80:80 --address=0.0.0.0 &\nsleep 10\n- echo 127.0.0.1 core.harbor.domain | sudo tee -a /etc/hosts\n- curl https://core.harbor.domain/api/v2.0/systeminfo -i -k -f\n- mkdir -p ~/.docker/tls/core.harbor.domain\n+ curl https://$CORE_HOST/api/v2.0/systeminfo -i -k -f\n+ sudo mkdir -p /etc/docker/certs.d/$CORE_HOST\nkubectl -n cluster-sample-ns get secret sample-public-certificate -o jsonpath='{.data.ca\\.crt}' \\\n| base64 --decode \\\n- | sudo tee ~/.docker/tls/core.harbor.domain/ca.crt\n+ | sudo tee /etc/docker/certs.d/$CORE_HOST/harbor_ca.crt\n# docker login, create image, docker push, docker pull\n- docker login core.harbor.domain -u admin -p Harbor12345 || (kubectl -n cluster-sample-ns get po;kubectl -n cluster-sample-ns logs -l goharbor.io/operator-controller=core;exit 1)\n+ docker login $CORE_HOST -u admin -p Harbor12345 || (kubectl -n cluster-sample-ns get po;kubectl -n cluster-sample-ns logs -l goharbor.io/operator-controller=core;exit 1)\ndocker run busybox dd if=/dev/urandom of=test count=10 bs=1MB\nDOCKERID=`docker ps -l -q`\n- docker commit $DOCKERID core.harbor.domain/library/busybox:test\n- docker push core.harbor.domain/library/busybox:test\n- docker pull core.harbor.domain/library/busybox:test\n+ docker commit $DOCKERID $CORE_HOST/library/busybox:test\n+ docker push $CORE_HOST/library/busybox:test\n+ docker pull $CORE_HOST/library/busybox:test\n+\n+ - name: apidb test\n+ run: |\n+ git clone https://github.com/goharbor/harbor -b v2.1.2\n+ kubectl -n cluster-sample-ns patch deploy harborcluster-sample-harbor-harbor-core -p '{\"spec\":{\"template\":{\"spec\":{\"containers\":[{\"name\":\"core\",\"env\":[{\"name\":\"GC_TIME_WINDOW_HOURS\",\"value\":\"0\"}]}]}}}}'\n+ sleep 5\n+ kubectl -n cluster-sample-ns wait --for=condition=Ready pod --all --timeout 600s\n+ 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 \\\n+ python -u -m robot --exclude proxy_cache -v DOCKER_USER:${{ secrets.DOCKER_USER }} -v DOCKER_PWD:${{ secrets.DOCKER_TOKEN }} -v ip:$CORE_HOST -v ip1: -v HARBOR_PASSWORD:Harbor12345 -X \\\n+ /drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot\n# Kubernetes\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_other_fs.yaml",
"new_path": "manifests/samples/full_stack_other_fs.yaml",
"diff": "@@ -114,7 +114,6 @@ spec:\ncertificateRef: sample-public-certificate\ntrivy:\nskipUpdate: false\n- githubTokenRef: github-credentials\nstorage:\nreportsPersistentVolume:\nclaimName: sample-harbor-trivy-reports\n@@ -142,7 +141,7 @@ spec:\nkind: PostgresSQL\npostgresSqlSpec:\nstorage: 1Gi\n- replicas: 2\n+ replicas: 1\nversion: \"12\"\nresources:\nlimits:\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(ci) import harbor apidb test
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,881
|
24.01.2021 21:42:17
| -28,800
|
8faffda100e3d8f11ae2faf3981fb47bd53c8df5
|
feat: add harbor configuration condition to harbor cluster status
|
[
{
"change_type": "MODIFY",
"old_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"new_path": "apis/goharbor.io/v1alpha2/harborcluster_types.go",
"diff": "@@ -175,6 +175,8 @@ const (\nStorageReady HarborClusterConditionType = \"StorageReady\"\n// ServiceReady means the Service of Harbor is ready.\nServiceReady HarborClusterConditionType = \"ServiceReady\"\n+ // ConfigurationReady means the configuration is applied to harbor.\n+ ConfigurationReady HarborClusterConditionType = \"ConfigurationReady\"\n// StatusUnknown is the status of unknown.\nStatusUnknown ClusterStatus = \"unknown\"\n// StatusCreating is the status of creating.\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/configuration/reconciler.go",
"new_path": "controllers/goharbor/configuration/reconciler.go",
"diff": "@@ -4,6 +4,7 @@ import (\n\"context\"\n\"encoding/json\"\n\"fmt\"\n+ \"time\"\n\"github.com/go-logr/logr\"\n\"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n@@ -36,6 +37,10 @@ func New(ctx context.Context, name string, configStore *configstore.Store) (comm\nconst (\n// ConfigurationLabelKey is the key label for configuration.\nConfigurationLabelKey = \"goharbor.io/configuration\"\n+ // ConfigurationApplyError is the reason of condition.\n+ ConfigurationApplyError = \"ConfigurationApplyError\"\n+ // ConfigurationApplySuccess is the reason of condition.\n+ ConfigurationApplySuccess = \"ConfigurationApplySuccess\"\n)\n// Reconciler reconciles a configuration configmap.\n@@ -117,6 +122,10 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\nlog.V(5).Info(\"Get configmap and harbor cluster cr successfully\", \"configmap\", cm, \"harborcluster\", cluster)\n+ defer func() {\n+ log.Info(\"Reconcile end\", \"result\", res, \"error\", err, \"updateStatusErr\", r.UpdateStatus(ctx, err, cluster))\n+ }()\n+\nharborClient, err := r.getHarborClient(ctx, cluster)\nif err != nil {\nreturn ctrl.Result{}, fmt.Errorf(\"get harbor client error: %w\", err)\n@@ -127,6 +136,7 @@ func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {\nreturn ctrl.Result{}, fmt.Errorf(\"assemble configuration error: %w\", err)\n}\n+ // apply configuration\nif err = harborClient.ApplyConfiguration(ctx, jsonPayload); err != nil {\nreturn ctrl.Result{}, fmt.Errorf(\"apply harbor configuration error: %w\", err)\n}\n@@ -204,3 +214,45 @@ func (r *Reconciler) getHarborClient(ctx context.Context, cluster *v1alpha2.Harb\nreturn harbor.NewClient(url, opts...), nil\n}\n+\n+// UpdateStatus updates harbor cluster status.\n+func (r *Reconciler) UpdateStatus(ctx context.Context, err error, cluster *v1alpha2.HarborCluster) error {\n+ cond := v1alpha2.HarborClusterCondition{\n+ Type: v1alpha2.ConfigurationReady,\n+ LastTransitionTime: metav1.Now(),\n+ }\n+\n+ if err != nil {\n+ cond.Status = corev1.ConditionFalse\n+ cond.Reason = ConfigurationApplyError\n+ cond.Message = err.Error()\n+ } else {\n+ cond.Status = corev1.ConditionTrue\n+ cond.Reason = ConfigurationApplySuccess\n+ cond.Message = \"harbor configuraion has been applied successfully.\"\n+ }\n+\n+ var found bool\n+\n+ for i, c := range cluster.Status.Conditions {\n+ if c.Type == cond.Type {\n+ found = true\n+\n+ if c.Status != cond.Status ||\n+ c.Reason != cond.Reason ||\n+ c.Message != cond.Message {\n+ cluster.Status.Conditions[i] = cond\n+ }\n+\n+ break\n+ }\n+ }\n+\n+ if !found {\n+ cluster.Status.Conditions = append(cluster.Status.Conditions, cond)\n+ }\n+ // update rivision\n+ cluster.Status.Revision = time.Now().UnixNano()\n+\n+ return r.Client.Status().Update(ctx, cluster)\n+}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat: add harbor configuration condition to harbor cluster status
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,890
|
27.01.2021 02:42:58
| 0
|
bd88c9e3fcd6c05d4cee467c580e85aa62672dc3
|
fix: correct GetImage when the respository is empty
Fix the GetImage function for cluster redis component
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/image/image.go",
"new_path": "pkg/image/image.go",
"diff": "@@ -263,7 +263,10 @@ func GetImage(ctx context.Context, component string, options ...Option) (string,\nreturn \"\", fmt.Errorf(\"unknow component %s\", component)\n}\n- repository := strings.TrimSuffix(opts.repository, \"/\")\n+ repository := opts.repository\n+ if repository != \"\" && !strings.HasSuffix(repository, \"/\") {\n+ repository += \"/\"\n+ }\n- return fmt.Sprintf(\"%s/%s:%s%s\", repository, imageName, knowCompoents.GetTag(component, opts.harborVersion), opts.tagSuffix), nil\n+ return fmt.Sprintf(\"%s%s:%s%s\", repository, imageName, knowCompoents.GetTag(component, opts.harborVersion), opts.tagSuffix), nil\n}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/image/image_test.go",
"new_path": "pkg/image/image_test.go",
"diff": "@@ -124,4 +124,12 @@ var _ = Describe(\"Get image\", func() {\nExpect(image).To(Equal(\"goharbor/harbor-core:v2.0.0\"))\n})\n})\n+\n+ Describe(\"Get image for in cluster redis\", func() {\n+ It(\"Should pass\", func() {\n+ image, err := GetImage(ctx, \"cluster-redis\")\n+ Expect(err).ToNot(HaveOccurred())\n+ Expect(image).To(Equal(\"redis:5.0-alpine\"))\n+ })\n+ })\n})\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: correct GetImage when the respository is empty
Fix the GetImage function for cluster redis component
Signed-off-by: He Weiwei <hweiwei@vmware.com>
|
254,890
|
27.01.2021 03:15:02
| 0
|
ad849dc2c068163af251ff7fbbd218caae83cc05
|
fix: correct get image for minio
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/image.go",
"new_path": "pkg/cluster/controllers/storage/image.go",
"diff": "@@ -28,8 +28,8 @@ const (\n// GetImage returns the configured image via configstore or default one.\nfunc (m *MinIOController) GetImage(ctx context.Context, harborcluster *goharborv1alpha2.HarborCluster) (string, error) {\n- if harborcluster.Spec.InClusterCache.RedisSpec.Image != \"\" {\n- return harborcluster.Spec.InClusterCache.RedisSpec.Image, nil\n+ if harborcluster.Spec.InClusterStorage.MinIOSpec.Image != \"\" {\n+ return harborcluster.Spec.InClusterStorage.MinIOSpec.Image, nil\n}\noptions := []image.Option{image.WithHarborVersion(harborcluster.Spec.Version)}\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix: correct get image for minio
Signed-off-by: He Weiwei <hweiwei@vmware.com>
|
254,890
|
27.01.2021 06:37:23
| 0
|
cf0afc6693edda5192879fe0d38f28079b2ffbdb
|
feat: add PERMITTED_REGISTRY_TYPES_FOR_PROXY_CACHE env
|
[
{
"change_type": "MODIFY",
"old_path": ".github/workflows/tests.yml",
"new_path": ".github/workflows/tests.yml",
"diff": "@@ -174,6 +174,7 @@ jobs:\necho \"NOTARY_HOST=$NOTARY_HOST\" >> $GITHUB_ENV\nsed -i \"s/core.harbor.domain/$CORE_HOST/g\" manifests/samples/full_stack_other_fs.yaml\nsed -i \"s/notary.harbor.domain/$NOTARY_HOST/g\" manifests/samples/full_stack_other_fs.yaml\n+ sed -i \"s/logLevel: info/logLevel: debug/g\" manifests/samples/full_stack_other_fs.yaml\nkubectl apply -f manifests/samples/full_stack_other_fs.yaml\nfor i in $(seq 1 7);do\n@@ -223,9 +224,25 @@ jobs:\nsleep 5\nkubectl -n cluster-sample-ns wait --for=condition=Ready pod --all --timeout 600s\ndocker 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 \\\n- python -u -m robot --exclude gc --exclude proxy_cache -v DOCKER_USER:${{ secrets.DOCKER_USER }} -v DOCKER_PWD:${{ secrets.DOCKER_TOKEN }} -v ip:$CORE_HOST -v ip1: -v HARBOR_PASSWORD:Harbor12345 -X \\\n+ python -u -m robot --exclude gc -v DOCKER_USER:${{ secrets.DOCKER_USER }} -v DOCKER_PWD:${{ secrets.DOCKER_TOKEN }} -v ip:$CORE_HOST -v ip1: -v HARBOR_PASSWORD:Harbor12345 -X \\\n/drone/tests/robot-cases/Group1-Nightly/Setup.robot /drone/tests/robot-cases/Group0-BAT/API_DB.robot\n+ - name: fetch harbor logs\n+ if: ${{ failure() }}\n+ run: |\n+ mkdir -p /tmp/harbor\n+ for name in core jobservice registry registryctl trivy chartmuseum notaryserver notarysigner portal; do \\\n+ kubectl -n cluster-sample-ns logs -l \"goharbor.io/operator-controller=$name\" --all-containers > /tmp/harbor/$name.log ; \\\n+ done\n+ kubectl -n cluster-sample-ns logs -l \"application=spilo\" --all-containers > /tmp/harbor/db.log\n+ kubectl -n cluster-sample-ns logs -l \"app.kubernetes.io/component=redis\" > /tmp/harbor/redis.log\n+\n+ - uses: actions/upload-artifact@v2\n+ if: ${{ failure() }}\n+ with:\n+ name: harbor\n+ path: /tmp/harbor\n+\n- name: fetch logs\nif: ${{ failure() }}\nrun: |\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/deployments.go",
"new_path": "controllers/goharbor/core/deployments.go",
"diff": "@@ -33,6 +33,7 @@ const (\nInternalCertificatesVolumeName = \"internal-certificates\"\nInternalCertificateAuthorityDirectory = \"/harbor_cust_cert\"\nInternalCertificatesPath = ConfigPath + \"/ssl\"\n+ PermittedRegistryTypesForProxyCache = \"docker-hub,harbor\"\nPublicCertificateVolumeName = \"ca-download\"\nPublicCertificatePath = ConfigPath + \"/ca\"\nEncryptionKeyVolumeName = \"encryption\"\n@@ -274,6 +275,9 @@ func (r *Reconciler) GetDeployment(ctx context.Context, core *goharborv1alpha2.C\n}, {\nName: \"INTERNAL_TLS_ENABLED\",\nValue: strconv.FormatBool(core.Spec.Components.TLS.Enabled()),\n+ }, {\n+ Name: \"PERMITTED_REGISTRY_TYPES_FOR_PROXY_CACHE\",\n+ Value: PermittedRegistryTypesForProxyCache,\n}}...)\nif core.Spec.Database.MaxIdleConnections != nil {\n"
},
{
"change_type": "MODIFY",
"old_path": "manifests/samples/full_stack_other_fs.yaml",
"new_path": "manifests/samples/full_stack_other_fs.yaml",
"diff": "@@ -97,6 +97,7 @@ metadata:\nname: harborcluster-sample\nnamespace: cluster-sample-ns\nspec:\n+ logLevel: info\nimageSource:\nrepository: quay.io/goharbor\nharborAdminPasswordRef: admin-core-secret\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat: add PERMITTED_REGISTRY_TYPES_FOR_PROXY_CACHE env
Signed-off-by: He Weiwei <hweiwei@vmware.com>
|
254,881
|
27.01.2021 18:12:19
| -28,800
|
464ed1f5367a9c2f803299454f2b93b025d74efa
|
fix(redis): keep redis pvc after harbor cluster delete
|
[
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/cache/resource_manager.go",
"new_path": "pkg/cluster/controllers/cache/resource_manager.go",
"diff": "@@ -72,6 +72,8 @@ func (rm *redisResourceManager) WithCluster(cluster *goharborv1alpha2.HarborClus\nfunc (rm *redisResourceManager) GetCacheCR(ctx context.Context, harborcluster *goharborv1alpha2.HarborCluster) (runtime.Object, error) {\nresource := rm.GetResourceList()\npvc, _ := GenerateStoragePVC(rm.GetStorageClass(), rm.cluster.Name, rm.GetStorageSize(), rm.GetLabels())\n+ // keep pvc after cr deleted.\n+ keepPVCAfterDeletion := true\nimage, err := rm.GetImage(ctx, harborcluster)\nif err != nil {\n@@ -97,6 +99,7 @@ func (rm *redisResourceManager) GetCacheCR(ctx context.Context, harborcluster *g\n},\nStorage: redisOp.RedisStorage{\nPersistentVolumeClaim: pvc,\n+ KeepAfterDeletion: keepPVCAfterDeletion,\n},\nImage: image,\nImagePullPolicy: rm.getImagePullPolicy(ctx, harborcluster),\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(redis): keep redis pvc after harbor cluster delete
Signed-off-by: chlins <chlins.zhang@gmail.com>
|
254,877
|
27.01.2021 11:56:47
| -3,600
|
125a567ac4c28d10de00a23bbadb88032b59b09d
|
fix(harbor class) Close
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"new_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"diff": "@@ -44,18 +44,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className := \"\"\n-\n- configItem, err := configstore.Filter().Store(r.ConfigStore).Slice(config.HarborClassKey).GetFirstItem()\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- if !config.IsNotFound(err, config.HarborClassKey) {\n- return errors.Wrap(err, \"cannot get config template path\")\n- }\n- } else {\n- className, err = configItem.Value()\n- if err != nil {\n- return errors.Wrap(err, \"invalid config template path\")\n- }\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/chartmuseum/chartmuseum_test.go",
"new_path": "controllers/goharbor/chartmuseum/chartmuseum_test.go",
"diff": "@@ -46,11 +46,9 @@ var _ = Describe(\"ChartMuseum\", func() {\nchartMuseum.ObjectMeta = metav1.ObjectMeta{\nName: test.NewName(\"chartmuseum\"),\nNamespace: ns.GetName(),\n- /* TODO: Enable this when HarborClass is fixed\nAnnotations: map[string]string{\ngoharborv1alpha2.HarborClassAnnotation: harborClass,\n},\n- */\n}\n})\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/chartmuseum/suite_test.go",
"new_path": "controllers/goharbor/chartmuseum/suite_test.go",
"diff": "@@ -20,10 +20,12 @@ import (\n. \"github.com/onsi/ginkgo\"\n. \"github.com/onsi/gomega\"\n+ \"github.com/ovh/configstore\"\n\"github.com/goharbor/harbor-operator/controllers\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/chartmuseum\"\n\"github.com/goharbor/harbor-operator/controllers/goharbor/internal/test\"\n+ \"github.com/goharbor/harbor-operator/pkg/config\"\n\"sigs.k8s.io/controller-runtime/pkg/envtest/printer\"\n)\n@@ -54,10 +56,8 @@ var _ = BeforeSuite(func(done Done) {\nname := controllers.ChartMuseum.String()\nharborClass = test.NewName(name)\n- configStore, _ := test.NewConfig(ctx, chartmuseum.ConfigTemplatePathKey, path.Base(chartmuseum.DefaultConfigTemplatePath))\n- /* TODO: Enable this when HarborClass is fixed\n+ configStore, provider := test.NewConfig(ctx, chartmuseum.ConfigTemplatePathKey, path.Base(chartmuseum.DefaultConfigTemplatePath))\nprovider.Add(configstore.NewItem(config.HarborClassKey, harborClass, 100))\n- */\nconfigStore.Env(name)\ncommonReconciler, err := chartmuseum.New(ctx, name, configStore)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/core.go",
"new_path": "controllers/goharbor/core/core.go",
"diff": "@@ -47,9 +47,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/harbor.go",
"new_path": "controllers/goharbor/harbor/harbor.go",
"diff": "@@ -38,9 +38,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/jobservice/jobservice.go",
"new_path": "controllers/goharbor/jobservice/jobservice.go",
"diff": "@@ -47,9 +47,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notaryserver/notaryserver.go",
"new_path": "controllers/goharbor/notaryserver/notaryserver.go",
"diff": "@@ -47,9 +47,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notarysigner/notarysigner.go",
"new_path": "controllers/goharbor/notarysigner/notarysigner.go",
"diff": "@@ -44,9 +44,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/portal/portal.go",
"new_path": "controllers/goharbor/portal/portal.go",
"diff": "@@ -42,9 +42,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registry/registry.go",
"new_path": "controllers/goharbor/registry/registry.go",
"diff": "@@ -47,9 +47,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registryctl/registryctl.go",
"new_path": "controllers/goharbor/registryctl/registryctl.go",
"diff": "@@ -48,9 +48,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/trivy/trivy.go",
"new_path": "controllers/goharbor/trivy/trivy.go",
"diff": "@@ -39,9 +39,9 @@ func (r *Reconciler) SetupWithManager(ctx context.Context, mgr ctrl.Manager) err\nreturn errors.Wrap(err, \"cannot setup common controller\")\n}\n- className, err := r.ConfigStore.GetItemValue(config.HarborClassKey)\n+ className, err := r.GetClassName(ctx)\nif err != nil {\n- return errors.Wrap(err, \"cannot get harbor class\")\n+ return errors.Wrap(err, \"cannot get class name\")\n}\nconcurrentReconcile, err := r.ConfigStore.GetItemValueInt(config.ReconciliationKey)\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/config/config.go",
"new_path": "pkg/config/config.go",
"diff": "@@ -13,7 +13,7 @@ const (\n)\nconst (\n- DefaultPriority = 50\n+ DefaultPriority = 5\nDefaultConcurrentReconcile = 1\nDefaultHarborClass = \"\"\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/helpers.go",
"new_path": "pkg/controller/helpers.go",
"diff": "@@ -4,6 +4,10 @@ import (\n\"context\"\n\"fmt\"\n\"strings\"\n+\n+ \"github.com/goharbor/harbor-operator/pkg/config\"\n+ \"github.com/ovh/configstore\"\n+ \"github.com/pkg/errors\"\n)\nfunc (c *Controller) NormalizeName(ctx context.Context, name string, suffixes ...string) string {\n@@ -15,3 +19,21 @@ func (c *Controller) NormalizeName(ctx context.Context, name string, suffixes ..\nreturn name\n}\n+\n+func (c *Controller) GetClassName(ctx context.Context) (string, error) {\n+ className := \"\"\n+\n+ configItem, err := configstore.Filter().Store(c.ConfigStore).Slice(config.HarborClassKey).GetFirstItem()\n+ if err != nil {\n+ if !config.IsNotFound(err, config.HarborClassKey) {\n+ return \"\", errors.Wrap(err, \"cannot get config template path\")\n+ }\n+ } else {\n+ className, err = configItem.Value()\n+ if err != nil {\n+ return \"\", errors.Wrap(err, \"invalid config template path\")\n+ }\n+ }\n+\n+ return className, nil\n+}\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/mutation.go",
"new_path": "pkg/controller/mutation.go",
"diff": "@@ -5,6 +5,7 @@ import (\n\"fmt\"\n\"strings\"\n+ goharborv1alpha2 \"github.com/goharbor/harbor-operator/apis/goharbor.io/v1alpha2\"\n\"github.com/goharbor/harbor-operator/pkg/controller/mutation\"\n\"github.com/goharbor/harbor-operator/pkg/factories/logger\"\n\"github.com/goharbor/harbor-operator/pkg/factories/owner\"\n@@ -30,6 +31,15 @@ const (\nfunc (c *Controller) GlobalMutateFn(ctx context.Context) (resources.Mutable, error) {\nvar mutate resources.Mutable = mutation.NoOp\n+ className, err := c.GetClassName(ctx)\n+ if err != nil {\n+ return nil, errors.Wrap(err, \"cannot get class name\")\n+ }\n+\n+ if className != \"\" {\n+ mutate.AppendMutation(mutation.GetAnnotationsMutation(goharborv1alpha2.HarborClassAnnotation, className))\n+ }\n+\nmutate.AppendMutation(mutation.GetAnnotationsMutation(WarningAnnotation, fmt.Sprintf(WarningValueTmpl, c.GetName())))\nmutate.AppendMutation(mutation.GetLabelsMutation(OperatorNameLabel, c.GetName(), OperatorVersionLabel, c.GetVersion()))\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(harbor class) Close #399
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
254,890
|
04.02.2021 03:08:32
| 0
|
3fb3a06e84eff14116eaed8a433f497260bc66a6
|
feat: add default secuirty context to components
Add default security context to harbor and minio components to let
harbor run in the restricted psp enabled k8s.
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/chartmuseum/deployments.go",
"new_path": "controllers/goharbor/chartmuseum/deployments.go",
"diff": "@@ -28,7 +28,13 @@ const (\nDefaultLocalStoragePath = \"/mnt/chartstorage\"\n)\n-var varFalse = false\n+var (\n+ varFalse = false\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\nconst (\nhttpsPort = 8443\n@@ -303,7 +309,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, chartMuseum *goharborv1a\nNodeSelector: chartMuseum.Spec.NodeSelector,\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n-\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ },\nContainers: []corev1.Container{{\nName: controllers.ChartMuseum.String(),\nImage: image,\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/deployments.go",
"new_path": "controllers/goharbor/core/deployments.go",
"diff": "@@ -24,7 +24,13 @@ import (\n\"k8s.io/apimachinery/pkg/util/intstr\"\n)\n-var varFalse = false\n+var (\n+ varFalse = false\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\nconst (\nhealthCheckPeriod = 90 * time.Second\n@@ -446,6 +452,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, core *goharborv1alpha2.C\nSpec: corev1.PodSpec{\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ },\nContainers: []corev1.Container{{\nName: controllers.Core.String(),\nImage: image,\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/jobservice/deployments.go",
"new_path": "controllers/goharbor/jobservice/deployments.go",
"diff": "@@ -32,7 +32,13 @@ const (\nInternalCertificateAuthorityDirectory = \"/harbor_cust_cert\"\n)\n-var varFalse = false\n+var (\n+ varFalse = false\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\nconst (\nhttpsPort = 8443\n@@ -253,6 +259,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, jobservice *goharborv1al\nSpec: corev1.PodSpec{\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ },\nContainers: []corev1.Container{{\nName: controllers.JobService.String(),\nImage: image,\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notaryserver/deployments.go",
"new_path": "controllers/goharbor/notaryserver/deployments.go",
"diff": "@@ -27,7 +27,13 @@ const (\nAuthCertificatePath = ConfigPath + \"/auth-certificates\"\n)\n-var varFalse = false\n+var (\n+ varFalse = false\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\nconst apiPort = 4443\n@@ -172,6 +178,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, notary *goharborv1alpha2\nSpec: corev1.PodSpec{\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ },\nInitContainers: initContainers,\nContainers: []corev1.Container{{\nName: controllers.NotaryServer.String(),\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/notarysigner/deployments.go",
"new_path": "controllers/goharbor/notarysigner/deployments.go",
"diff": "@@ -22,7 +22,13 @@ const (\nHTTPSCertificatePath = ConfigPath + \"/certificates\"\n)\n-var varFalse = false\n+var (\n+ varFalse = false\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\nfunc (r *Reconciler) GetDeployment(ctx context.Context, notary *goharborv1alpha2.NotarySigner) (*appsv1.Deployment, error) { // nolint:funlen\ngetImageOptions := []image.Option{\n@@ -128,6 +134,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, notary *goharborv1alpha2\nSpec: corev1.PodSpec{\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ },\nInitContainers: initContainers,\nContainers: []corev1.Container{{\nName: controllers.NotarySigner.String(),\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/portal/deployments.go",
"new_path": "controllers/goharbor/portal/deployments.go",
"diff": "@@ -33,7 +33,13 @@ const (\nhttpPort = 8080\n)\n-var varFalse = false\n+var (\n+ varFalse = false\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\nfunc (r *Reconciler) GetDeployment(ctx context.Context, portal *goharborv1alpha2.Portal) (*appsv1.Deployment, error) { // nolint:funlen\ngetImageOptions := []image.Option{\n@@ -136,6 +142,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, portal *goharborv1alpha2\nSpec: corev1.PodSpec{\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ },\nContainers: []corev1.Container{\n{\nName: controllers.Portal.String(),\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registry/deployments.go",
"new_path": "controllers/goharbor/registry/deployments.go",
"diff": "@@ -38,7 +38,10 @@ const (\nvar (\nvarFalse = false\nvarTrue = true\n- registryUID int64 = 10000\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n)\nconst (\n@@ -269,7 +272,9 @@ func (r *Reconciler) GetDeployment(ctx context.Context, registry *goharborv1alph\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\nSecurityContext: &corev1.PodSecurityContext{\n- FSGroup: ®istryUID,\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n},\nContainers: []corev1.Container{{\nName: controllers.Registry.String(),\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/registryctl/deployments.go",
"new_path": "controllers/goharbor/registryctl/deployments.go",
"diff": "@@ -31,7 +31,13 @@ const (\nHealthPath = \"/api/health\"\n)\n-var varFalse = false\n+var (\n+ varFalse = false\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\nconst (\nhttpsPort = 8443\n@@ -124,6 +130,12 @@ func (r *Reconciler) GetDeployment(ctx context.Context, registryCtl *goharborv1a\n},\n}\n+ deploy.Spec.Template.Spec.SecurityContext = &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ }\n+\nregistryContainer, err := r.getRegistryContainer(deploy)\nif err != nil {\nreturn nil, serrors.UnrecoverrableError(errors.Wrap(err, \"registry container not found\"), serrors.OperatorReason, \"cannot find registry container spec\")\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/trivy/deployments.go",
"new_path": "controllers/goharbor/trivy/deployments.go",
"diff": "@@ -21,7 +21,10 @@ import (\nvar (\nvarFalse = false\n- trivyUID int64 = 10000\n+\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n)\nconst (\n@@ -202,11 +205,11 @@ func (r *Reconciler) GetDeployment(ctx context.Context, trivy *goharborv1alpha2.\nNodeSelector: trivy.Spec.NodeSelector,\nAutomountServiceAccountToken: &varFalse,\nVolumes: volumes,\n-\nSecurityContext: &corev1.PodSecurityContext{\n- FSGroup: &trivyUID,\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n},\n-\nContainers: []corev1.Container{{\nName: ContainerName,\nImage: image,\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/cluster/controllers/storage/provision.go",
"new_path": "pkg/cluster/controllers/storage/provision.go",
"diff": "@@ -19,6 +19,12 @@ import (\n\"k8s.io/apimachinery/pkg/util/intstr\"\n)\n+var (\n+ fsGroup int64 = 10000\n+ runAsGroup int64 = 10000\n+ runAsUser int64 = 10000\n+)\n+\nfunc (m *MinIOController) ProvisionMinIOProperties(minioInstamnce *minio.Tenant) (*lcm.CRStatus, error) {\nproperties := &lcm.Properties{}\n@@ -261,6 +267,11 @@ func (m *MinIOController) generateMinIOCR(ctx context.Context, harborcluster *go\n},\n},\nSpec: minio.TenantSpec{\n+ SecurityContext: &corev1.PodSecurityContext{\n+ FSGroup: &fsGroup,\n+ RunAsGroup: &runAsGroup,\n+ RunAsUser: &runAsUser,\n+ },\nMetadata: &metav1.ObjectMeta{\nLabels: m.getLabels(),\nAnnotations: m.generateAnnotations(),\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat: add default secuirty context to components
Add default security context to harbor and minio components to let
harbor run in the restricted psp enabled k8s.
Signed-off-by: He Weiwei <hweiwei@vmware.com>
|
254,875
|
09.02.2021 21:46:26
| -28,800
|
0415d8133dbbd9584aa9c2a39b33a460e70d213a
|
feat(ci) remove make vendor
|
[
{
"change_type": "MODIFY",
"old_path": "Makefile",
"new_path": "Makefile",
"diff": "@@ -66,7 +66,7 @@ test: go-test go-dependencies-test\n# Run against the configured Kubernetes cluster in ~/.kube/config\n.PHONY: run\n-run: go-generate vendor certmanager $(TMPDIR)k8s-webhook-server/serving-certs/tls.crt\n+run: go-generate certmanager $(TMPDIR)k8s-webhook-server/serving-certs/tls.crt\ngo run *.go\n# Install cert-manager before run\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(ci) remove make vendor
Signed-off-by: Ziming Zhang <zziming@vmware.com>
|
254,877
|
29.01.2021 15:35:59
| -3,600
|
26b8aa8616d29c0a4cbb9abbf4b0e425b7cb190b
|
feat(network policies) Modify netv1 version
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/harbor.go",
"new_path": "controllers/goharbor/harbor/harbor.go",
"diff": "@@ -12,7 +12,7 @@ import (\n\"github.com/ovh/configstore\"\n\"github.com/pkg/errors\"\ncorev1 \"k8s.io/api/core/v1\"\n- netv1 \"k8s.io/api/networking/v1beta1\"\n+ netv1 \"k8s.io/api/networking/v1\"\nctrl \"sigs.k8s.io/controller-runtime\"\n\"sigs.k8s.io/controller-runtime/pkg/controller\"\n)\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/ingresses.go",
"new_path": "controllers/goharbor/harbor/ingresses.go",
"diff": "@@ -10,9 +10,8 @@ import (\n\"github.com/goharbor/harbor-operator/controllers/goharbor/notaryserver\"\n\"github.com/goharbor/harbor-operator/pkg/graph\"\n\"github.com/pkg/errors\"\n- netv1 \"k8s.io/api/networking/v1beta1\"\n+ netv1 \"k8s.io/api/networking/v1\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n- \"k8s.io/apimachinery/pkg/util/intstr\"\n)\nconst (\n@@ -71,8 +70,12 @@ func (r *Reconciler) GetCoreIngressRules(ctx context.Context, harbor *goharborv1\n}\ncoreBackend := netv1.IngressBackend{\n- ServiceName: r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String()),\n- ServicePort: intstr.FromInt(int(corePort)),\n+ Service: &netv1.IngressServiceBackend{\n+ Name: r.NormalizeName(ctx, harbor.GetName(), controllers.Core.String()),\n+ Port: netv1.ServiceBackendPort{\n+ Number: int32(corePort),\n+ },\n+ },\n}\nportalPort, err := harbor.Spec.InternalTLS.GetInternalPort(harbormetav1.PortalTLS)\n@@ -81,8 +84,12 @@ func (r *Reconciler) GetCoreIngressRules(ctx context.Context, harbor *goharborv1\n}\nportalBackend := netv1.IngressBackend{\n- ServiceName: r.NormalizeName(ctx, harbor.GetName(), \"portal\"),\n- ServicePort: intstr.FromInt(int(portalPort)),\n+ Service: &netv1.IngressServiceBackend{\n+ Name: r.NormalizeName(ctx, harbor.GetName(), \"portal\"),\n+ Port: netv1.ServiceBackendPort{\n+ Number: int32(portalPort),\n+ },\n+ },\n}\nruleValue, err := r.GetCoreIngressRuleValue(ctx, harbor, coreBackend, portalBackend)\n@@ -126,6 +133,8 @@ func (r *Reconciler) GetNotaryServerIngresse(ctx context.Context, harbor *goharb\n}}\n}\n+ pathTypeExact := netv1.PathTypeExact\n+\nreturn &netv1.Ingress{\nObjectMeta: metav1.ObjectMeta{\nName: r.NormalizeName(ctx, harbor.GetName(), controllers.NotaryServer.String()),\n@@ -140,9 +149,14 @@ func (r *Reconciler) GetNotaryServerIngresse(ctx context.Context, harbor *goharb\nHTTP: &netv1.HTTPIngressRuleValue{\nPaths: []netv1.HTTPIngressPath{{\nPath: \"/\",\n+ PathType: &pathTypeExact,\nBackend: netv1.IngressBackend{\n- ServiceName: r.NormalizeName(ctx, harbor.GetName(), controllers.NotaryServer.String()),\n- ServicePort: intstr.FromInt(notaryserver.PublicPort),\n+ Service: &netv1.IngressServiceBackend{\n+ Name: r.NormalizeName(ctx, harbor.GetName(), controllers.NotaryServer.String()),\n+ Port: netv1.ServiceBackendPort{\n+ Number: notaryserver.PublicPort,\n+ },\n+ },\n},\n}},\n},\n@@ -203,75 +217,100 @@ func (err ErrInvalidIngressController) Error() string {\n}\nfunc (r *Reconciler) GetCoreIngressRuleValue(ctx context.Context, harbor *goharborv1alpha2.Harbor, core, portal netv1.IngressBackend) (*netv1.IngressRuleValue, error) { // nolint:funlen\n+ pathTypeExact := netv1.PathTypeExact\n+\nswitch harbor.Spec.Expose.Core.Ingress.Controller {\ncase harbormetav1.IngressControllerDefault:\nreturn &netv1.IngressRuleValue{\nHTTP: &netv1.HTTPIngressRuleValue{\nPaths: []netv1.HTTPIngressPath{{\nPath: \"/\",\n+ PathType: &pathTypeExact,\nBackend: portal,\n}, {\nPath: \"/api/\",\n+ PathType: &pathTypeExact,\nBackend: core,\n}, {\nPath: \"/service/\",\n+ PathType: &pathTypeExact,\nBackend: core,\n}, {\nPath: \"/v2/\",\n+ PathType: &pathTypeExact,\nBackend: core,\n}, {\nPath: \"/chartrepo/\",\n+ PathType: &pathTypeExact,\nBackend: core,\n}, {\nPath: \"/c/\",\n+ PathType: &pathTypeExact,\nBackend: core,\n}},\n},\n}, nil\ncase harbormetav1.IngressControllerGCE:\n+ pathTypePrefix := netv1.PathTypePrefix\n+\nreturn &netv1.IngressRuleValue{\nHTTP: &netv1.HTTPIngressRuleValue{\nPaths: []netv1.HTTPIngressPath{{\n- Path: \"/*\",\n+ Path: \"/\",\n+ PathType: &pathTypePrefix,\nBackend: portal,\n}, {\n- Path: \"/api/*\",\n+ Path: \"/api\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/service/*\",\n+ Path: \"/service\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/v2/*\",\n+ Path: \"/v2\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/chartrepo/*\",\n+ Path: \"/chartrepo\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/c/*\",\n+ Path: \"/c\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}},\n},\n}, nil\ncase harbormetav1.IngressControllerNCP:\n+ pathTypeExact := netv1.PathTypeExact\n+ pathTypePrefix := netv1.PathTypePrefix\n+\nreturn &netv1.IngressRuleValue{\nHTTP: &netv1.HTTPIngressRuleValue{\nPaths: []netv1.HTTPIngressPath{{\nPath: \"/\",\n+ PathType: &pathTypeExact,\nBackend: portal,\n}, {\n- Path: \"/api/.*\",\n+ Path: \"/api\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/service/.*\",\n+ Path: \"/service\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/v2/.*\",\n+ Path: \"/v2\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/chartrepo/.*\",\n+ Path: \"/chartrepo\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}, {\n- Path: \"/c/.*\",\n+ Path: \"/c\",\n+ PathType: &pathTypePrefix,\nBackend: core,\n}},\n},\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/resource.go",
"new_path": "pkg/controller/resource.go",
"diff": "@@ -16,7 +16,7 @@ import (\n\"github.com/pkg/errors\"\nappsv1 \"k8s.io/api/apps/v1\"\ncorev1 \"k8s.io/api/core/v1\"\n- netv1 \"k8s.io/api/networking/v1beta1\"\n+ netv1 \"k8s.io/api/networking/v1\"\napierrors \"k8s.io/apimachinery/pkg/api/errors\"\nmetav1 \"k8s.io/apimachinery/pkg/apis/meta/v1\"\n\"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n"
},
{
"change_type": "MODIFY",
"old_path": "pkg/controller/resource_test.go",
"new_path": "pkg/controller/resource_test.go",
"diff": "@@ -15,7 +15,7 @@ import (\ncertv1 \"github.com/jetstack/cert-manager/pkg/apis/certmanager/v1alpha2\"\nappsv1 \"k8s.io/api/apps/v1\"\ncorev1 \"k8s.io/api/core/v1\"\n- netv1 \"k8s.io/api/networking/v1beta1\"\n+ netv1 \"k8s.io/api/networking/v1\"\n\"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured\"\n\"k8s.io/apimachinery/pkg/types\"\ncontrollerruntime \"sigs.k8s.io/controller-runtime\"\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
feat(network policies) Modify netv1 version
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
254,877
|
04.02.2021 16:47:09
| -3,600
|
b31cde7bd220a8e1d3c26dae8f883d73a856e09e
|
fix (ingress) Use of portal controller const
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/harbor/ingresses.go",
"new_path": "controllers/goharbor/harbor/ingresses.go",
"diff": "@@ -85,7 +85,7 @@ func (r *Reconciler) GetCoreIngressRules(ctx context.Context, harbor *goharborv1\nportalBackend := netv1.IngressBackend{\nService: &netv1.IngressServiceBackend{\n- Name: r.NormalizeName(ctx, harbor.GetName(), \"portal\"),\n+ Name: r.NormalizeName(ctx, harbor.GetName(), controllers.Portal.String()),\nPort: netv1.ServiceBackendPort{\nNumber: portalPort,\n},\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix (ingress) Use of portal controller const
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
254,877
|
22.02.2021 16:01:09
| -3,600
|
d71a8735b4df7496b2d0a7b72df915ea458ee7f0
|
fix(network policies) RBAC
|
[
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"new_path": "controllers/goharbor/chartmuseum/chartmuseum.go",
"diff": "@@ -36,6 +36,7 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=goharbor.io,resources=chartmuseums,verbs=get;list;watch\n// +kubebuilder:rbac:groups=goharbor.io,resources=chartmuseums/status,verbs=get;update;patch\n+// +kubebuilder:rbac:groups=networking.k8s.io,resources=networkpolicies,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=\"\",resources=configmaps;services,verbs=get;list;watch;create;update;patch;delete\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/core/core.go",
"new_path": "controllers/goharbor/core/core.go",
"diff": "@@ -39,6 +39,7 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=goharbor.io,resources=cores,verbs=get;list;watch\n// +kubebuilder:rbac:groups=goharbor.io,resources=cores/status,verbs=get;update;patch\n+// +kubebuilder:rbac:groups=networking.k8s.io,resources=networkpolicies,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=\"\",resources=configmaps;secrets;services,verbs=get;list;watch;create;update;patch;delete\n"
},
{
"change_type": "MODIFY",
"old_path": "controllers/goharbor/jobservice/jobservice.go",
"new_path": "controllers/goharbor/jobservice/jobservice.go",
"diff": "@@ -39,6 +39,7 @@ type Reconciler struct {\n// +kubebuilder:rbac:groups=goharbor.io,resources=jobservices,verbs=get;list;watch\n// +kubebuilder:rbac:groups=goharbor.io,resources=jobservices/status,verbs=get;update;patch\n+// +kubebuilder:rbac:groups=networking.k8s.io,resources=networkpolicies,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=apps,resources=deployments,verbs=get;list;watch;create;update;patch;delete\n// +kubebuilder:rbac:groups=\"\",resources=configmaps;secrets;services,verbs=get;list;watch;create;update;patch;delete\n"
}
] |
Go
|
Apache License 2.0
|
goharbor/harbor-operator
|
fix(network policies) RBAC
Signed-off-by: Simon Guyennet <simon.guyennet@corp.ovh.com>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.