Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

upgrade certmanger k8s version in CI #665

Merged
merged 1 commit into from
Jun 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/build-dev.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- uses: actions/checkout@v2
- name: Build manager
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
run: git fetch --prune --unshallow
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- name: prepare changelog
run: |
tag=${{ github.ref }}
Expand Down
46 changes: 23 additions & 23 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- uses: actions/checkout@v2
- run: make docker-build

Expand All @@ -37,7 +37,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- uses: actions/checkout@v2
- run: make go-lint

Expand All @@ -47,7 +47,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- uses: actions/checkout@v2
- run: make go-dependencies-test

Expand All @@ -57,7 +57,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- uses: actions/checkout@v2
- run: make generated-diff-test

Expand Down Expand Up @@ -85,7 +85,7 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16

- name: Cache go mod
uses: actions/cache@v2
Expand Down Expand Up @@ -142,18 +142,18 @@ jobs:
matrix:
# https://github.com/jetstack/cert-manager/tags
certManager:
- "1.0.4"
# - "1.1.0"
- "1.2.0"
- "1.1.1"
# - "1.2.0"
- "1.3.1"

# https://snapcraft.io/microk8s
k8sVersion:
- "1.18.15"
# - "1.19.1"
- "1.19.11"
- "1.20.2"
- "1.21.1"

ingress:
- "0.35.0"
- "0.46.0"

samples:
- "full_stack.yaml"
Expand All @@ -164,7 +164,7 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16

- uses: azure/setup-kubectl@v1
with:
Expand All @@ -187,7 +187,7 @@ jobs:
- name: Install Kubernetes v${{ matrix.k8sVersion }}
uses: helm/[email protected]
with:
version: v0.10.0
version: v0.11.0
node_image: kindest/node:v${{ matrix.k8sVersion }}
cluster_name: harbor
config: .github/kind.yaml
Expand Down Expand Up @@ -360,7 +360,7 @@ jobs:

# https://snapcraft.io/microk8s
k8sVersion:
- "1.20.2"
- "1.20.7"

samples:
- "full_stack.yaml"
Expand All @@ -370,7 +370,7 @@ jobs:

- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16

- uses: azure/setup-kubectl@v1
with:
Expand All @@ -393,7 +393,7 @@ jobs:
- name: Install Kubernetes v${{ matrix.k8sVersion }}
uses: helm/[email protected]
with:
version: v0.10.0
version: v0.11.0
node_image: kindest/node:v${{ matrix.k8sVersion }}
cluster_name: harbor
config: .github/kind.yaml
Expand Down Expand Up @@ -568,21 +568,21 @@ jobs:
matrix:
# https://github.com/jetstack/cert-manager/tags
certManager:
- "1.1.0"
- "1.3.1"

# https://snapcraft.io/microk8s
k8sVersion:
- "1.19.7"
- "1.21.1"

ingress:
- "0.35.0"
- "0.46.0"

steps:
- uses: actions/checkout@v2

- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16

- uses: azure/setup-kubectl@v1
with:
Expand All @@ -605,7 +605,7 @@ jobs:
- name: Install Kubernetes v${{ matrix.k8sVersion }}
uses: helm/[email protected]
with:
version: v0.10.0
version: v0.11.0
node_image: kindest/node:v${{ matrix.k8sVersion }}
cluster_name: harbor
config: .github/kind.yaml
Expand Down Expand Up @@ -748,7 +748,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- uses: actions/checkout@v2
- run: make manifests
- uses: azure/k8s-bake@v1
Expand All @@ -763,7 +763,7 @@ jobs:
steps:
- uses: actions/setup-go@v2
with:
go-version: 1.14
go-version: 1.16
- uses: actions/checkout@v2
- run: make manifests
- uses: azure/k8s-bake@v1
Expand Down
10 changes: 5 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -486,13 +486,13 @@ clean:

# find or download controller-gen
# download controller-gen if necessary
CONTROLLER_GEN_VERSION := 0.4.1
CONTROLLER_GEN_VERSION := 0.5.0
CONTROLLER_GEN := $(BIN)/controller-gen

.PHONY: controller-gen
controller-gen:
@$(CONTROLLER_GEN) --version 2>&1 \
| grep 'v$(CONTROLLER_GEN_VERSION)' > /dev/null \
| grep 'v$(CONTROLLER_GEN_VERSION)' \
|| rm -f $(CONTROLLER_GEN)
@$(MAKE) $(CONTROLLER_GEN)

Expand Down Expand Up @@ -541,13 +541,13 @@ $(GOLANGCI_LINT):

# find or download kubebuilder
# download kubebuilder if necessary
KUBEBUIDER_VERSION := 2.0.1
KUBEBUIDER_VERSION := 3.1.0
KUBEBUILDER=$(BIN)/kubebuilder

.PHONY: kubebuilder
kubebuilder:
@$(KUBEBUILDER) version 2>&1 \
| grep 'KubeBuilderVersion:"$(KUBEBUIDER_VERSION)"' > /dev/null \
| grep 'KubeBuilderVersion:"$(KUBEBUIDER_VERSION)"' \
|| rm -f $(KUBEBUILDER)
@$(MAKE) $(KUBEBUILDER)

Expand Down Expand Up @@ -606,7 +606,7 @@ $(GORELEASER):

# find or download stringer
# download stringer if necessary
STRINGER_VERSION := v0.0.0-20201223010750-3fa0e8f87c1a
STRINGER_VERSION := v0.1.2
STRINGER := $(BIN)/stringer

.PHONY: stringer
Expand Down
7 changes: 2 additions & 5 deletions controllers/goharbor/chartmuseum/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import (
)

var (
stopCh chan struct{}
ctx context.Context
reconciler *chartmuseum.Reconciler
)
Expand All @@ -34,15 +33,13 @@ var _ = BeforeSuite(func(done Done) {

reconciler = controllers.NewChartMuseum(ctx, className)

ctx, stopCh = test.StartManager(ctx)
test.StartManager(ctx)

close(done)
}, 60)

var _ = AfterSuite(func() {
defer test.AfterSuite(ctx)

if stopCh != nil {
close(stopCh)
}
ctx.Done()
})
7 changes: 3 additions & 4 deletions controllers/goharbor/configuration/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ var configMapPredicate = predicate.Funcs{
// configuration reconciler only watch create and update events, ignore
// delete and generic events.
CreateFunc: func(event event.CreateEvent) bool {
return isConfiguration(event.Meta)
return isConfiguration(event.Object)
},
UpdateFunc: func(event event.UpdateEvent) bool {
return isConfiguration(event.MetaNew)
return isConfiguration(event.ObjectNew)
},
DeleteFunc: func(event event.DeleteEvent) bool {
return false
Expand Down Expand Up @@ -95,8 +95,7 @@ func (r *Reconciler) NormalizeName(ctx context.Context, name string, suffixes ..
}

// Reconcile does configuration reconcile.
func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) {
ctx := context.TODO()
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error) {
log := r.Log.WithValues("resource", req.NamespacedName)

// get the configmap firstly
Expand Down
7 changes: 2 additions & 5 deletions controllers/goharbor/core/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ import (
)

var (
stopCh chan struct{}
ctx context.Context
reconciler *core.Reconciler
)
Expand All @@ -47,15 +46,13 @@ var _ = BeforeSuite(func(done Done) {

reconciler = controllers.NewCore(ctx, className)

ctx, stopCh = test.StartManager(ctx)
test.StartManager(ctx)

close(done)
}, 60)

var _ = AfterSuite(func() {
defer test.AfterSuite(ctx)

if stopCh != nil {
close(stopCh)
}
ctx.Done()
})
10 changes: 5 additions & 5 deletions controllers/goharbor/harbor/trivy_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ var _ = Describe("Trivy", func() {

h := getSpec("./manifests/trivy/default.yaml")

c := r.NewContext(ctrl.Request{}) // this ctx has resource manager
c := r.PopulateContext(context.TODO(), ctrl.Request{}) // this ctx has resource manager
owner.Set(&c, h)

_, trivyUpdateSecret, err := r.AddTrivyConfigurations(c, h, nil)
Expand All @@ -60,7 +60,7 @@ var _ = Describe("Trivy", func() {

h := getSpec("./manifests/trivy/default.yaml")

c := r.NewContext(ctrl.Request{}) // this ctx has resource manager
c := r.PopulateContext(context.TODO(), ctrl.Request{}) // this ctx has resource manager
owner.Set(&c, h)

_, trivyUpdateSecret, err := r.AddTrivyConfigurations(c, h, nil)
Expand All @@ -82,7 +82,7 @@ var _ = Describe("Trivy", func() {

h := getSpec("./manifests/trivy/default.yaml")

c := r.NewContext(ctrl.Request{}) // this ctx has resource manager
c := r.PopulateContext(context.TODO(), ctrl.Request{}) // this ctx has resource manager
owner.Set(&c, h)

trivy, err := r.AddTrivy(c, h, nil, nil)
Expand All @@ -104,7 +104,7 @@ var _ = Describe("Trivy", func() {

h := getSpec("./manifests/trivy/default.yaml")

c := r.NewContext(ctrl.Request{}) // this ctx has resource manager
c := r.PopulateContext(context.TODO(), ctrl.Request{}) // this ctx has resource manager
owner.Set(&c, h)

trivyUpdateSecret, err := r.AddTrivyUpdateSecret(c, h)
Expand All @@ -130,7 +130,7 @@ var _ = Describe("Trivy", func() {

h := getSpec("./manifests/trivy/github-token.yaml")

c := r.NewContext(ctrl.Request{}) // this ctx has resource manager
c := r.PopulateContext(context.TODO(), ctrl.Request{}) // this ctx has resource manager
owner.Set(&c, h)

trivy, err := r.AddTrivy(c, h, nil, nil)
Expand Down
5 changes: 3 additions & 2 deletions controllers/goharbor/harborcluster/harborcluster.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package harborcluster

import (
"context"
"fmt"
"time"

Expand All @@ -15,8 +16,8 @@ import (
)

// Reconcile logic of the HarborCluster.
func (r *Reconciler) Reconcile(req ctrl.Request) (res ctrl.Result, err error) { // nolint:funlen
ctx := r.ctrl.NewContext(req)
func (r *Reconciler) Reconcile(ctx context.Context, req ctrl.Request) (res ctrl.Result, err error) { // nolint:funlen
ctx = r.ctrl.PopulateContext(ctx, req)
log := logger.Get(ctx)

// Get the harborcluster first
Expand Down
2 changes: 1 addition & 1 deletion controllers/goharbor/internal/test/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ func WithRestConfig(ctx context.Context, cfg *rest.Config) context.Context {
}

func NewContext() context.Context {
log := zap.LoggerTo(ginkgo.GinkgoWriter, true)
log := zap.New(zap.WriteTo(ginkgo.GinkgoWriter), zap.UseDevMode(true))
logf.SetLogger(log)

ctx := logger.Context(log)
Expand Down
8 changes: 2 additions & 6 deletions controllers/goharbor/internal/test/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,17 @@ import (
"sigs.k8s.io/controller-runtime/pkg/manager"
)

func StartManager(ctx context.Context) (context.Context, chan struct{}) {
func StartManager(ctx context.Context) {
ginkgo.By("Starting controller")

stopCh := make(chan struct{})

go func() {
defer ginkgo.GinkgoRecover()

ginkgo.By("Starting manager")

gomega.Expect(GetManager(ctx).Start(stopCh)).
gomega.Expect(GetManager(ctx).Start(ctx)).
To(gomega.Succeed(), "failed to start manager")
}()

return ctx, stopCh
}

func NewManager(ctx context.Context) manager.Manager {
Expand Down
Loading