Skip to content

Commit

Permalink
Merge pull request #473 from fluxcd/go-v1.17
Browse files Browse the repository at this point in the history
Update Go to v1.17
  • Loading branch information
stefanprodan authored Jan 5, 2022
2 parents 1475eca + 22d0880 commit bd6fc92
Show file tree
Hide file tree
Showing 11 changed files with 928 additions and 456 deletions.
2 changes: 1 addition & 1 deletion .github/actions/run-tests/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
ARG BASE_VARIANT=bullseye
ARG GO_VERSION=1.16.12
ARG GO_VERSION=1.17.5
ARG XX_VERSION=1.1.0

ARG LIBGIT2_IMG=ghcr.io/fluxcd/golang-with-libgit2
Expand Down
4 changes: 1 addition & 3 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
ARG BASE_VARIANT=bullseye
ARG GO_VERSION=1.16.12
ARG GO_LATEST=1.17.5
ARG GO_VERSION=1.17
ARG XX_VERSION=1.1.0

ARG LIBGIT2_IMG=ghcr.io/fluxcd/golang-with-libgit2
Expand All @@ -10,7 +9,6 @@ FROM --platform=$BUILDPLATFORM tonistiigi/xx:${XX_VERSION} AS xx
FROM ${LIBGIT2_IMG}:${LIBGIT2_TAG} as libgit2

FROM --platform=$BUILDPLATFORM golang:${GO_VERSION}-${BASE_VARIANT} as gostable
FROM --platform=$BUILDPLATFORM golang:${GO_LATEST}-${BASE_VARIANT} AS golatest

FROM gostable AS go-linux

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ endif


# API (doc) generation utilities
CONTROLLER_GEN_VERSION ?= v0.5.0
CONTROLLER_GEN_VERSION ?= v0.7.0
GEN_API_REF_DOCS_VERSION ?= v0.3.0

# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
Expand Down
28 changes: 23 additions & 5 deletions api/go.mod
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
module github.com/fluxcd/source-controller/api

go 1.16
go 1.17

require (
github.com/fluxcd/pkg/apis/acl v0.0.1
github.com/fluxcd/pkg/apis/meta v0.10.1
k8s.io/apimachinery v0.22.2
sigs.k8s.io/controller-runtime v0.10.2
github.com/fluxcd/pkg/apis/acl v0.0.3
github.com/fluxcd/pkg/apis/meta v0.10.2
k8s.io/apimachinery v0.23.1
sigs.k8s.io/controller-runtime v0.11.0
)

require (
github.com/go-logr/logr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.5.6 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
github.com/modern-go/reflect2 v1.0.2 // indirect
golang.org/x/net v0.0.0-20211215060638-4ddde0e984e9 // indirect
golang.org/x/text v0.3.7 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/utils v0.0.0-20211208161948-7d6a63dca704 // indirect
sigs.k8s.io/json v0.0.0-20211208200746-9f7c6b3444d2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.0 // indirect
)
301 changes: 236 additions & 65 deletions api/go.sum

Large diffs are not rendered by default.

9 changes: 4 additions & 5 deletions controllers/bucket_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"strings"
"time"

"github.com/go-logr/logr"
"github.com/minio/minio-go/v7"
"github.com/minio/minio-go/v7/pkg/credentials"
"github.com/minio/minio-go/v7/pkg/s3utils"
Expand Down Expand Up @@ -268,7 +267,7 @@ func (r *BucketReconciler) reconcileDelete(ctx context.Context, bucket sourcev1.
// reconcileWithGCP handles getting objects from a Google Cloud Platform bucket
// using a gcp client
func (r *BucketReconciler) reconcileWithGCP(ctx context.Context, bucket sourcev1.Bucket, tempDir string) (sourcev1.Bucket, error) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
gcpClient, err := r.authGCP(ctx, bucket)
if err != nil {
err = fmt.Errorf("auth error: %w", err)
Expand Down Expand Up @@ -534,7 +533,7 @@ func (r *BucketReconciler) gc(bucket sourcev1.Bucket) error {

// event emits a Kubernetes event and forwards the event to notification controller if configured
func (r *BucketReconciler) event(ctx context.Context, bucket sourcev1.Bucket, severity, msg string) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
if r.EventRecorder != nil {
r.EventRecorder.Eventf(&bucket, "Normal", severity, msg)
}
Expand All @@ -553,7 +552,7 @@ func (r *BucketReconciler) event(ctx context.Context, bucket sourcev1.Bucket, se
}

func (r *BucketReconciler) recordReadiness(ctx context.Context, bucket sourcev1.Bucket) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
if r.MetricsRecorder == nil {
return
}
Expand All @@ -576,7 +575,7 @@ func (r *BucketReconciler) recordSuspension(ctx context.Context, bucket sourcev1
if r.MetricsRecorder == nil {
return
}
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

objRef, err := reference.GetReference(r.Scheme, &bucket)
if err != nil {
Expand Down
9 changes: 4 additions & 5 deletions controllers/gitrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import (
"time"

securejoin "github.com/cyphar/filepath-securejoin"
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
apimeta "k8s.io/apimachinery/pkg/api/meta"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -89,7 +88,7 @@ func (r *GitRepositoryReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager, o

func (r *GitRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
start := time.Now()
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

var repository sourcev1.GitRepository
if err := r.Get(ctx, req.NamespacedName, &repository); err != nil {
Expand Down Expand Up @@ -417,7 +416,7 @@ func (r *GitRepositoryReconciler) gc(repository sourcev1.GitRepository) error {

// event emits a Kubernetes event and forwards the event to notification controller if configured
func (r *GitRepositoryReconciler) event(ctx context.Context, repository sourcev1.GitRepository, severity, msg string) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

if r.EventRecorder != nil {
r.EventRecorder.Eventf(&repository, "Normal", severity, msg)
Expand All @@ -437,7 +436,7 @@ func (r *GitRepositoryReconciler) event(ctx context.Context, repository sourcev1
}

func (r *GitRepositoryReconciler) recordReadiness(ctx context.Context, repository sourcev1.GitRepository) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
if r.MetricsRecorder == nil {
return
}
Expand All @@ -460,7 +459,7 @@ func (r *GitRepositoryReconciler) recordSuspension(ctx context.Context, gitrepos
if r.MetricsRecorder == nil {
return
}
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

objRef, err := reference.GetReference(r.Scheme, &gitrepository)
if err != nil {
Expand Down
9 changes: 4 additions & 5 deletions controllers/helmchart_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import (
"time"

securejoin "github.com/cyphar/filepath-securejoin"
"github.com/go-logr/logr"
helmgetter "helm.sh/helm/v3/pkg/getter"
corev1 "k8s.io/api/core/v1"
apierrs "k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -115,7 +114,7 @@ func (r *HelmChartReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager, opts

func (r *HelmChartReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
start := time.Now()
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

var chart sourcev1.HelmChart
if err := r.Get(ctx, req.NamespacedName, &chart); err != nil {
Expand Down Expand Up @@ -630,7 +629,7 @@ func (r *HelmChartReconciler) gc(chart sourcev1.HelmChart) error {
// event emits a Kubernetes event and forwards the event to notification
// controller if configured.
func (r *HelmChartReconciler) event(ctx context.Context, chart sourcev1.HelmChart, severity, msg string) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
if r.EventRecorder != nil {
r.EventRecorder.Eventf(&chart, "Normal", severity, msg)
}
Expand All @@ -649,7 +648,7 @@ func (r *HelmChartReconciler) event(ctx context.Context, chart sourcev1.HelmChar
}

func (r *HelmChartReconciler) recordReadiness(ctx context.Context, chart sourcev1.HelmChart) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
if r.MetricsRecorder == nil {
return
}
Expand Down Expand Up @@ -825,7 +824,7 @@ func (r *HelmChartReconciler) recordSuspension(ctx context.Context, chart source
if r.MetricsRecorder == nil {
return
}
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

objRef, err := reference.GetReference(r.Scheme, &chart)
if err != nil {
Expand Down
9 changes: 4 additions & 5 deletions controllers/helmrepository_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ import (
"os"
"time"

"github.com/go-logr/logr"
helmgetter "helm.sh/helm/v3/pkg/getter"
corev1 "k8s.io/api/core/v1"
apimeta "k8s.io/apimachinery/pkg/api/meta"
Expand Down Expand Up @@ -82,7 +81,7 @@ func (r *HelmRepositoryReconciler) SetupWithManagerAndOptions(mgr ctrl.Manager,

func (r *HelmRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
start := time.Now()
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

var repository sourcev1.HelmRepository
if err := r.Get(ctx, req.NamespacedName, &repository); err != nil {
Expand Down Expand Up @@ -330,7 +329,7 @@ func (r *HelmRepositoryReconciler) gc(repository sourcev1.HelmRepository) error

// event emits a Kubernetes event and forwards the event to notification controller if configured
func (r *HelmRepositoryReconciler) event(ctx context.Context, repository sourcev1.HelmRepository, severity, msg string) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
if r.EventRecorder != nil {
r.EventRecorder.Eventf(&repository, "Normal", severity, msg)
}
Expand All @@ -349,7 +348,7 @@ func (r *HelmRepositoryReconciler) event(ctx context.Context, repository sourcev
}

func (r *HelmRepositoryReconciler) recordReadiness(ctx context.Context, repository sourcev1.HelmRepository) {
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)
if r.MetricsRecorder == nil {
return
}
Expand Down Expand Up @@ -384,7 +383,7 @@ func (r *HelmRepositoryReconciler) recordSuspension(ctx context.Context, hr sour
if r.MetricsRecorder == nil {
return
}
log := logr.FromContext(ctx)
log := ctrl.LoggerFrom(ctx)

objRef, err := reference.GetReference(r.Scheme, &hr)
if err != nil {
Expand Down
Loading

0 comments on commit bd6fc92

Please sign in to comment.