Skip to content

Commit

Permalink
Update flux pkg components
Browse files Browse the repository at this point in the history
Signed-off-by: Aurel Canciu <aurelcanciu@gmail.com>
  • Loading branch information
relu committed Dec 20, 2021
1 parent 27ef5c1 commit 22d0880
Show file tree
Hide file tree
Showing 9 changed files with 779 additions and 493 deletions.
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: 15 additions & 13 deletions api/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,24 +3,26 @@ module github.com/fluxcd/source-controller/api
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 v0.4.0 // indirect
github.com/go-logr/logr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/google/go-cmp v0.5.5 // indirect
github.com/google/gofuzz v1.1.0 // indirect
github.com/json-iterator/go v1.1.11 // 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.1 // indirect
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023 // indirect
golang.org/x/text v0.3.6 // 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.9.0 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.1.2 // 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 22d0880

Please sign in to comment.