/included/file.txt.
+ // Extract the object key by discarding the bucket prefix.
+ key := strings.TrimPrefix(r.URL.Path, bucketPrefix)
+ // Handle returning object file in a bucket.
+ response, err := gs.GetObjectFile(key)
+ if err != nil {
+ w.WriteHeader(404)
+ return
+ }
+ w.WriteHeader(200)
+ w.Write(response)
+ return
+ }
+ w.WriteHeader(404)
+ return
+ }
+}
+
+func getGCPObject(bucket string, obj gcpMockObject) *raw.Object {
+ return &raw.Object{
+ Bucket: bucket,
+ Name: obj.Key,
+ ContentType: obj.ContentType,
+ }
+}
+
+func getGCPBucket(name, eTag string) *raw.Bucket {
+ return &raw.Bucket{
+ Name: name,
+ Location: "loc",
+ Etag: eTag,
+ }
+}
diff --git a/controllers/gitrepository_controller.go b/controllers/gitrepository_controller.go
index 7642a1614..d2e92d5bb 100644
--- a/controllers/gitrepository_controller.go
+++ b/controllers/gitrepository_controller.go
@@ -122,7 +122,7 @@ func (r *GitRepositoryReconciler) Reconcile(ctx context.Context, req ctrl.Reques
// check dependencies
if len(repository.Spec.Include) > 0 {
if err := r.checkDependencies(repository); err != nil {
- repository = sourcev1.GitRepositoryNotReady(repository, meta.DependencyNotReadyReason, err.Error())
+ repository = sourcev1.GitRepositoryNotReady(repository, "DependencyNotReady", err.Error())
if err := r.updateStatus(ctx, req, repository.Status); err != nil {
log.Error(err, "unable to update status for dependency not ready")
return ctrl.Result{Requeue: true}, err
@@ -284,7 +284,7 @@ func (r *GitRepositoryReconciler) reconcile(ctx context.Context, repository sour
var gr sourcev1.GitRepository
err := r.Get(context.Background(), dName, &gr)
if err != nil {
- return sourcev1.GitRepositoryNotReady(repository, meta.DependencyNotReadyReason, err.Error()), err
+ return sourcev1.GitRepositoryNotReady(repository, "DependencyNotReady", err.Error()), err
}
includedArtifacts = append(includedArtifacts, gr.GetArtifact())
}
@@ -329,11 +329,11 @@ func (r *GitRepositoryReconciler) reconcile(ctx context.Context, repository sour
for i, incl := range repository.Spec.Include {
toPath, err := securejoin.SecureJoin(tmpGit, incl.GetToPath())
if err != nil {
- return sourcev1.GitRepositoryNotReady(repository, meta.DependencyNotReadyReason, err.Error()), err
+ return sourcev1.GitRepositoryNotReady(repository, "DependencyNotReady", err.Error()), err
}
err = r.Storage.CopyToPath(includedArtifacts[i], incl.GetFromPath(), toPath)
if err != nil {
- return sourcev1.GitRepositoryNotReady(repository, meta.DependencyNotReadyReason, err.Error()), err
+ return sourcev1.GitRepositoryNotReady(repository, "DependencyNotReady", err.Error()), err
}
}
@@ -423,22 +423,11 @@ 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 := ctrl.LoggerFrom(ctx)
-
if r.EventRecorder != nil {
- r.EventRecorder.Eventf(&repository, "Normal", severity, msg)
+ r.EventRecorder.Eventf(&repository, corev1.EventTypeNormal, severity, msg)
}
if r.ExternalEventRecorder != nil {
- objRef, err := reference.GetReference(r.Scheme, &repository)
- if err != nil {
- log.Error(err, "unable to send event")
- return
- }
-
- if err := r.ExternalEventRecorder.Eventf(*objRef, nil, severity, severity, msg); err != nil {
- log.Error(err, "unable to send event")
- return
- }
+ r.ExternalEventRecorder.Eventf(&repository, corev1.EventTypeNormal, severity, msg)
}
}
diff --git a/controllers/helmchart_controller.go b/controllers/helmchart_controller.go
index e63f8e458..46da4db08 100644
--- a/controllers/helmchart_controller.go
+++ b/controllers/helmchart_controller.go
@@ -634,21 +634,11 @@ 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 := ctrl.LoggerFrom(ctx)
if r.EventRecorder != nil {
- r.EventRecorder.Eventf(&chart, "Normal", severity, msg)
+ r.EventRecorder.Eventf(&chart, corev1.EventTypeNormal, severity, msg)
}
if r.ExternalEventRecorder != nil {
- objRef, err := reference.GetReference(r.Scheme, &chart)
- if err != nil {
- log.Error(err, "unable to send event")
- return
- }
-
- if err := r.ExternalEventRecorder.Eventf(*objRef, nil, severity, severity, msg); err != nil {
- log.Error(err, "unable to send event")
- return
- }
+ r.ExternalEventRecorder.Eventf(&chart, corev1.EventTypeNormal, severity, msg)
}
}
diff --git a/controllers/helmchart_controller_test.go b/controllers/helmchart_controller_test.go
index cb9838b15..f762fcd08 100644
--- a/controllers/helmchart_controller_test.go
+++ b/controllers/helmchart_controller_test.go
@@ -129,9 +129,9 @@ var _ = Describe("HelmChartReconciler", func() {
got := &sourcev1.HelmChart{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
- return got.Status.Artifact != nil && storage.ArtifactExist(*got.Status.Artifact)
+ return got.Status.Artifact != nil && ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeFalse())
@@ -146,7 +146,7 @@ var _ = Describe("HelmChartReconciler", func() {
_ = k8sClient.Get(context.Background(), key, now)
// Test revision change and garbage collection
return now.Status.Artifact.Revision != got.Status.Artifact.Revision &&
- !storage.ArtifactExist(*got.Status.Artifact)
+ !ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
When("Setting valid valuesFiles attribute", func() {
@@ -161,12 +161,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -184,12 +184,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.ObservedGeneration > updated.Status.ObservedGeneration &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -207,12 +207,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -228,12 +228,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
_, exists := helmChart.Values["testDefault"]
Expect(exists).To(BeFalse())
@@ -250,12 +250,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeFalse())
@@ -271,12 +271,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.ObservedGeneration > updated.Status.ObservedGeneration &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeFalse())
@@ -682,7 +682,7 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact != nil &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
By("Committing a new version in the chart metadata")
@@ -727,9 +727,9 @@ var _ = Describe("HelmChartReconciler", func() {
_ = k8sClient.Get(context.Background(), key, now)
// Test revision change and garbage collection
return now.Status.Artifact.Revision != got.Status.Artifact.Revision &&
- !storage.ArtifactExist(*got.Status.Artifact)
+ !ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- helmChart, err := loader.Load(storage.LocalPath(*now.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*now.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values).ToNot(BeNil())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
@@ -744,7 +744,7 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Revision != updated.Status.Artifact.Revision &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
Expect(got.Status.Artifact.Revision).To(ContainSubstring(updated.Status.Artifact.Revision))
Expect(got.Status.Artifact.Revision).To(ContainSubstring(commit.String()[0:12]))
@@ -762,12 +762,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -785,12 +785,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.ObservedGeneration > updated.Status.ObservedGeneration &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -808,12 +808,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -834,16 +834,16 @@ var _ = Describe("HelmChartReconciler", func() {
// Use status condition to be sure.
for _, condn := range got.Status.Conditions {
if strings.Contains(condn.Message, "with merged values files [./testdata/charts/helmchart/override.yaml]") &&
- storage.ArtifactExist(*got.Status.Artifact) {
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact) {
return true
}
}
return false
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
_, exists := helmChart.Values["testDefault"]
Expect(exists).To(BeFalse())
@@ -860,12 +860,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.ObservedGeneration > updated.Status.ObservedGeneration &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
_, exists := helmChart.Values["testDefault"]
Expect(exists).To(BeFalse())
@@ -970,7 +970,7 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact != nil &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
})
})
@@ -1213,9 +1213,9 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact != nil &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeFalse())
@@ -1232,12 +1232,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -1255,12 +1255,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.ObservedGeneration > updated.Status.ObservedGeneration &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -1278,12 +1278,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(helmChart.Values["testDefault"]).To(BeTrue())
Expect(helmChart.Values["testOverride"]).To(BeTrue())
@@ -1299,12 +1299,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact.Checksum != updated.Status.Artifact.Checksum &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
_, exists := helmChart.Values["testDefault"]
Expect(exists).To(BeFalse())
@@ -1321,12 +1321,12 @@ var _ = Describe("HelmChartReconciler", func() {
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.ObservedGeneration > updated.Status.ObservedGeneration &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
- f, err := os.Stat(storage.LocalPath(*got.Status.Artifact))
+ f, err := os.Stat(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
Expect(f.Size()).To(BeNumerically(">", 0))
- helmChart, err := loader.Load(storage.LocalPath(*got.Status.Artifact))
+ helmChart, err := loader.Load(ginkgoTestStorage.LocalPath(*got.Status.Artifact))
Expect(err).NotTo(HaveOccurred())
_, exists := helmChart.Values["testDefault"]
Expect(exists).To(BeFalse())
diff --git a/controllers/helmrepository_controller.go b/controllers/helmrepository_controller.go
index d82bdad69..a03f6b61b 100644
--- a/controllers/helmrepository_controller.go
+++ b/controllers/helmrepository_controller.go
@@ -335,21 +335,11 @@ 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 := ctrl.LoggerFrom(ctx)
if r.EventRecorder != nil {
- r.EventRecorder.Eventf(&repository, "Normal", severity, msg)
+ r.EventRecorder.Eventf(&repository, corev1.EventTypeNormal, severity, msg)
}
if r.ExternalEventRecorder != nil {
- objRef, err := reference.GetReference(r.Scheme, &repository)
- if err != nil {
- log.Error(err, "unable to send event")
- return
- }
-
- if err := r.ExternalEventRecorder.Eventf(*objRef, nil, severity, severity, msg); err != nil {
- log.Error(err, "unable to send event")
- return
- }
+ r.ExternalEventRecorder.Eventf(&repository, corev1.EventTypeNormal, severity, msg)
}
}
diff --git a/controllers/helmrepository_controller_test.go b/controllers/helmrepository_controller_test.go
index e7d945a60..69a3656e9 100644
--- a/controllers/helmrepository_controller_test.go
+++ b/controllers/helmrepository_controller_test.go
@@ -99,7 +99,7 @@ var _ = Describe("HelmRepositoryReconciler", func() {
got := &sourcev1.HelmRepository{}
Eventually(func() bool {
_ = k8sClient.Get(context.Background(), key, got)
- return got.Status.Artifact != nil && storage.ArtifactExist(*got.Status.Artifact)
+ return got.Status.Artifact != nil && ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
By("Updating the chart index")
@@ -112,7 +112,7 @@ var _ = Describe("HelmRepositoryReconciler", func() {
_ = k8sClient.Get(context.Background(), key, now)
// Test revision change and garbage collection
return now.Status.Artifact.Revision != got.Status.Artifact.Revision &&
- !storage.ArtifactExist(*got.Status.Artifact)
+ !ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
updated := &sourcev1.HelmRepository{}
@@ -291,7 +291,7 @@ var _ = Describe("HelmRepositoryReconciler", func() {
got := &sourcev1.HelmRepository{}
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact != nil &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
By("Expecting missing secret error")
@@ -385,7 +385,7 @@ var _ = Describe("HelmRepositoryReconciler", func() {
got := &sourcev1.HelmRepository{}
_ = k8sClient.Get(context.Background(), key, got)
return got.Status.Artifact != nil &&
- storage.ArtifactExist(*got.Status.Artifact)
+ ginkgoTestStorage.ArtifactExist(*got.Status.Artifact)
}, timeout, interval).Should(BeTrue())
By("Expecting missing secret error")
diff --git a/controllers/legacy_suite_test.go b/controllers/legacy_suite_test.go
new file mode 100644
index 000000000..4b4d1f274
--- /dev/null
+++ b/controllers/legacy_suite_test.go
@@ -0,0 +1,190 @@
+/*
+Copyright 2020 The Flux authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package controllers
+
+import (
+ "context"
+ "math/rand"
+ "net/http"
+ "os"
+ "path/filepath"
+ "testing"
+ "time"
+
+ . "github.com/onsi/ginkgo"
+ . "github.com/onsi/gomega"
+ "helm.sh/helm/v3/pkg/getter"
+ "k8s.io/client-go/kubernetes/scheme"
+ "k8s.io/client-go/rest"
+ ctrl "sigs.k8s.io/controller-runtime"
+ "sigs.k8s.io/controller-runtime/pkg/client"
+ "sigs.k8s.io/controller-runtime/pkg/envtest"
+ "sigs.k8s.io/controller-runtime/pkg/envtest/printer"
+ logf "sigs.k8s.io/controller-runtime/pkg/log"
+ "sigs.k8s.io/controller-runtime/pkg/log/zap"
+
+ sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
+ // +kubebuilder:scaffold:imports
+)
+
+// These tests use Ginkgo (BDD-style Go testing framework). Refer to
+// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.
+
+var cfg *rest.Config
+var k8sClient client.Client
+var k8sManager ctrl.Manager
+var ginkgoTestEnv *envtest.Environment
+var ginkgoTestStorage *Storage
+
+var examplePublicKey []byte
+var examplePrivateKey []byte
+var exampleCA []byte
+var lctx context.Context
+var cancel context.CancelFunc
+
+func TestAPIs(t *testing.T) {
+ RegisterFailHandler(Fail)
+
+ RunSpecsWithDefaultAndCustomReporters(t,
+ "Controller Suite",
+ []Reporter{printer.NewlineReporter{}})
+}
+
+var _ = BeforeSuite(func(done Done) {
+ logf.SetLogger(
+ zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)),
+ )
+ lctx, cancel = context.WithCancel(ctx)
+
+ By("bootstrapping test environment")
+ t := true
+ if os.Getenv("TEST_USE_EXISTING_CLUSTER") == "true" {
+ ginkgoTestEnv = &envtest.Environment{
+ UseExistingCluster: &t,
+ }
+ } else {
+ ginkgoTestEnv = &envtest.Environment{
+ CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
+ }
+ }
+
+ var err error
+ cfg, err = ginkgoTestEnv.Start()
+ Expect(err).ToNot(HaveOccurred())
+ Expect(cfg).ToNot(BeNil())
+
+ err = sourcev1.AddToScheme(scheme.Scheme)
+ Expect(err).NotTo(HaveOccurred())
+
+ // +kubebuilder:scaffold:scheme
+
+ Expect(loadExampleKeys()).To(Succeed())
+
+ tmpStoragePath, err := os.MkdirTemp("", "source-controller-storage-")
+ Expect(err).NotTo(HaveOccurred(), "failed to create tmp storage dir")
+
+ ginkgoTestStorage, err = NewStorage(tmpStoragePath, "localhost:5050", time.Second*30)
+ Expect(err).NotTo(HaveOccurred(), "failed to create tmp storage")
+ // serve artifacts from the filesystem, as done in main.go
+ fs := http.FileServer(http.Dir(tmpStoragePath))
+ http.Handle("/", fs)
+ go http.ListenAndServe(":5050", nil)
+
+ k8sManager, err = ctrl.NewManager(cfg, ctrl.Options{
+ MetricsBindAddress: "0",
+ Scheme: scheme.Scheme,
+ })
+ Expect(err).ToNot(HaveOccurred())
+
+ err = (&GitRepositoryReconciler{
+ Client: k8sManager.GetClient(),
+ Scheme: scheme.Scheme,
+ Storage: ginkgoTestStorage,
+ }).SetupWithManager(k8sManager)
+ Expect(err).ToNot(HaveOccurred(), "failed to setup GtRepositoryReconciler")
+
+ err = (&HelmRepositoryReconciler{
+ Client: k8sManager.GetClient(),
+ Scheme: scheme.Scheme,
+ Storage: ginkgoTestStorage,
+ Getters: getter.Providers{getter.Provider{
+ Schemes: []string{"http", "https"},
+ New: getter.NewHTTPGetter,
+ }},
+ }).SetupWithManager(k8sManager)
+ Expect(err).ToNot(HaveOccurred(), "failed to setup HelmRepositoryReconciler")
+
+ err = (&HelmChartReconciler{
+ Client: k8sManager.GetClient(),
+ Scheme: scheme.Scheme,
+ Storage: ginkgoTestStorage,
+ Getters: getter.Providers{getter.Provider{
+ Schemes: []string{"http", "https"},
+ New: getter.NewHTTPGetter,
+ }},
+ }).SetupWithManager(k8sManager)
+ Expect(err).ToNot(HaveOccurred(), "failed to setup HelmChartReconciler")
+
+ go func() {
+ err = k8sManager.Start(lctx)
+ Expect(err).ToNot(HaveOccurred())
+ }()
+
+ k8sClient = k8sManager.GetClient()
+ Expect(k8sClient).ToNot(BeNil())
+
+ close(done)
+}, 60)
+
+var _ = AfterSuite(func() {
+ By("tearing down the test environment")
+ defer GinkgoRecover()
+ cancel()
+ if ginkgoTestStorage != nil {
+ err := os.RemoveAll(ginkgoTestStorage.BasePath)
+ Expect(err).NotTo(HaveOccurred())
+ }
+ err := ginkgoTestEnv.Stop()
+ Expect(err).ToNot(HaveOccurred())
+})
+
+func init() {
+ rand.Seed(time.Now().UnixNano())
+}
+
+func loadExampleKeys() (err error) {
+ examplePublicKey, err = os.ReadFile("testdata/certs/server.pem")
+ if err != nil {
+ return err
+ }
+ examplePrivateKey, err = os.ReadFile("testdata/certs/server-key.pem")
+ if err != nil {
+ return err
+ }
+ exampleCA, err = os.ReadFile("testdata/certs/ca.pem")
+ return err
+}
+
+var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz1234567890")
+
+func randStringRunes(n int) string {
+ b := make([]rune, n)
+ for i := range b {
+ b[i] = letterRunes[rand.Intn(len(letterRunes))]
+ }
+ return string(b)
+}
diff --git a/controllers/storage.go b/controllers/storage.go
index 5c1f7be02..d58508f40 100644
--- a/controllers/storage.go
+++ b/controllers/storage.go
@@ -53,7 +53,7 @@ type Storage struct {
Timeout time.Duration `json:"timeout"`
}
-// NewStorage creates the storage helper for a given path and hostname
+// NewStorage creates the storage helper for a given path and hostname.
func NewStorage(basePath string, hostname string, timeout time.Duration) (*Storage, error) {
if f, err := os.Stat(basePath); os.IsNotExist(err) || !f.IsDir() {
return nil, fmt.Errorf("invalid dir path: %s", basePath)
@@ -81,7 +81,11 @@ func (s Storage) SetArtifactURL(artifact *sourcev1.Artifact) {
if artifact.Path == "" {
return
}
- artifact.URL = fmt.Sprintf("http://%s/%s", s.Hostname, artifact.Path)
+ format := "http://%s/%s"
+ if strings.HasPrefix(s.Hostname, "http://") || strings.HasPrefix(s.Hostname, "https://") {
+ format = "%s/%s"
+ }
+ artifact.URL = fmt.Sprintf(format, s.Hostname, strings.TrimLeft(artifact.Path, "/"))
}
// SetHostname sets the hostname of the given URL string to the current Storage.Hostname and returns the result.
diff --git a/controllers/suite_test.go b/controllers/suite_test.go
index 9520bcbb6..02426e4ed 100644
--- a/controllers/suite_test.go
+++ b/controllers/suite_test.go
@@ -17,179 +17,138 @@ limitations under the License.
package controllers
import (
- "context"
+ "fmt"
"math/rand"
- "net/http"
"os"
"path/filepath"
"testing"
"time"
- . "github.com/onsi/ginkgo"
- . "github.com/onsi/gomega"
- "helm.sh/helm/v3/pkg/getter"
+ utilruntime "k8s.io/apimachinery/pkg/util/runtime"
"k8s.io/client-go/kubernetes/scheme"
- "k8s.io/client-go/rest"
+ "k8s.io/client-go/tools/record"
ctrl "sigs.k8s.io/controller-runtime"
- "sigs.k8s.io/controller-runtime/pkg/client"
- "sigs.k8s.io/controller-runtime/pkg/envtest"
- "sigs.k8s.io/controller-runtime/pkg/envtest/printer"
- logf "sigs.k8s.io/controller-runtime/pkg/log"
- "sigs.k8s.io/controller-runtime/pkg/log/zap"
+
+ "github.com/fluxcd/pkg/runtime/controller"
+ "github.com/fluxcd/pkg/runtime/testenv"
+ "github.com/fluxcd/pkg/testserver"
sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
// +kubebuilder:scaffold:imports
)
-// These tests use Ginkgo (BDD-style Go testing framework). Refer to
-// http://onsi.github.io/ginkgo/ to learn more about Ginkgo.
+// These tests make use of plain Go using Gomega for assertions.
+// At the beginning of every (sub)test Gomega can be initialized
+// using gomega.NewWithT.
+// Refer to http://onsi.github.io/gomega/ to learn more about
+// Gomega.
-var cfg *rest.Config
-var k8sClient client.Client
-var k8sManager ctrl.Manager
-var testEnv *envtest.Environment
-var storage *Storage
+const (
+ timeout = 10 * time.Second
+ interval = 1 * time.Second
+)
-var examplePublicKey []byte
-var examplePrivateKey []byte
-var exampleCA []byte
-var ctx context.Context
-var cancel context.CancelFunc
+var (
+ testEnv *testenv.Environment
+ testStorage *Storage
+ testServer *testserver.ArtifactServer
+ testMetricsH controller.Metrics
+ ctx = ctrl.SetupSignalHandler()
+)
-func TestAPIs(t *testing.T) {
- RegisterFailHandler(Fail)
+var (
+ tlsPublicKey []byte
+ tlsPrivateKey []byte
+ tlsCA []byte
+)
- RunSpecsWithDefaultAndCustomReporters(t,
- "Controller Suite",
- []Reporter{printer.NewlineReporter{}})
+func init() {
+ rand.Seed(time.Now().UnixNano())
}
-var _ = BeforeSuite(func(done Done) {
- logf.SetLogger(
- zap.New(zap.WriteTo(GinkgoWriter), zap.UseDevMode(true)),
- )
- ctx, cancel = context.WithCancel(context.TODO())
-
- By("bootstrapping test environment")
- t := true
- if os.Getenv("TEST_USE_EXISTING_CLUSTER") == "true" {
- testEnv = &envtest.Environment{
- UseExistingCluster: &t,
- }
- } else {
- testEnv = &envtest.Environment{
- CRDDirectoryPaths: []string{filepath.Join("..", "config", "crd", "bases")},
- }
- }
+func TestMain(m *testing.M) {
+ initTestTLS()
+
+ utilruntime.Must(sourcev1.AddToScheme(scheme.Scheme))
+
+ testEnv = testenv.New(testenv.WithCRDPath(filepath.Join("..", "config", "crd", "bases")))
var err error
- cfg, err = testEnv.Start()
- Expect(err).ToNot(HaveOccurred())
- Expect(cfg).ToNot(BeNil())
-
- err = sourcev1.AddToScheme(scheme.Scheme)
- Expect(err).NotTo(HaveOccurred())
-
- err = sourcev1.AddToScheme(scheme.Scheme)
- Expect(err).NotTo(HaveOccurred())
-
- err = sourcev1.AddToScheme(scheme.Scheme)
- Expect(err).NotTo(HaveOccurred())
-
- // +kubebuilder:scaffold:scheme
-
- Expect(loadExampleKeys()).To(Succeed())
-
- tmpStoragePath, err := os.MkdirTemp("", "source-controller-storage-")
- Expect(err).NotTo(HaveOccurred(), "failed to create tmp storage dir")
-
- storage, err = NewStorage(tmpStoragePath, "localhost:5050", time.Second*30)
- Expect(err).NotTo(HaveOccurred(), "failed to create tmp storage")
- // serve artifacts from the filesystem, as done in main.go
- fs := http.FileServer(http.Dir(tmpStoragePath))
- http.Handle("/", fs)
- go http.ListenAndServe(":5050", nil)
-
- k8sManager, err = ctrl.NewManager(cfg, ctrl.Options{
- Scheme: scheme.Scheme,
- })
- Expect(err).ToNot(HaveOccurred())
-
- err = (&GitRepositoryReconciler{
- Client: k8sManager.GetClient(),
- Scheme: scheme.Scheme,
- Storage: storage,
- }).SetupWithManager(k8sManager)
- Expect(err).ToNot(HaveOccurred(), "failed to setup GtRepositoryReconciler")
-
- err = (&HelmRepositoryReconciler{
- Client: k8sManager.GetClient(),
- Scheme: scheme.Scheme,
- Storage: storage,
- Getters: getter.Providers{getter.Provider{
- Schemes: []string{"http", "https"},
- New: getter.NewHTTPGetter,
- }},
- }).SetupWithManager(k8sManager)
- Expect(err).ToNot(HaveOccurred(), "failed to setup HelmRepositoryReconciler")
-
- err = (&HelmChartReconciler{
- Client: k8sManager.GetClient(),
- Scheme: scheme.Scheme,
- Storage: storage,
- Getters: getter.Providers{getter.Provider{
- Schemes: []string{"http", "https"},
- New: getter.NewHTTPGetter,
- }},
- }).SetupWithManager(k8sManager)
- Expect(err).ToNot(HaveOccurred(), "failed to setup HelmChartReconciler")
+ testServer, err = testserver.NewTempArtifactServer()
+ if err != nil {
+ panic(fmt.Sprintf("Failed to create a temporary storage server: %v", err))
+ }
+ fmt.Println("Starting the test storage server")
+ testServer.Start()
+
+ testStorage, err = newTestStorage(testServer.HTTPServer)
+ if err != nil {
+ panic(fmt.Sprintf("Failed to create a test storage: %v", err))
+ }
+
+ testMetricsH = controller.MustMakeMetrics(testEnv)
+
+ //if err := (&GitRepositoryReconciler{
+ // Client: testEnv,
+ // Metrics: testMetricsH,
+ // Storage: testStorage,
+ //}).SetupWithManager(testEnv); err != nil {
+ // panic(fmt.Sprintf("Failed to start GitRepositoryReconciler: %v", err))
+ //}
+
+ if err := (&BucketReconciler{
+ Client: testEnv,
+ EventRecorder: record.NewFakeRecorder(32),
+ Metrics: testMetricsH,
+ Storage: testStorage,
+ }).SetupWithManager(testEnv); err != nil {
+ panic(fmt.Sprintf("Failed to start BucketReconciler: %v", err))
+ }
go func() {
- defer GinkgoRecover()
- err = k8sManager.Start(ctx)
- Expect(err).ToNot(HaveOccurred())
+ fmt.Println("Starting the test environment")
+ if err := testEnv.Start(ctx); err != nil {
+ panic(fmt.Sprintf("Failed to start the test environment manager: %v", err))
+ }
}()
+ <-testEnv.Manager.Elected()
- k8sClient = k8sManager.GetClient()
- Expect(k8sClient).ToNot(BeNil())
+ code := m.Run()
- close(done)
-}, 60)
+ fmt.Println("Stopping the test environment")
+ if err := testEnv.Stop(); err != nil {
+ panic(fmt.Sprintf("Failed to stop the test environment: %v", err))
+ }
-var _ = AfterSuite(func() {
- cancel()
- By("tearing down the test environment")
- if storage != nil {
- err := os.RemoveAll(storage.BasePath)
- Expect(err).NotTo(HaveOccurred())
+ fmt.Println("Stopping the storage server")
+ testServer.Stop()
+ if err := os.RemoveAll(testServer.Root()); err != nil {
+ panic(fmt.Sprintf("Failed to remove storage server dir: %v", err))
}
- err := testEnv.Stop()
- Expect(err).ToNot(HaveOccurred())
-})
-func init() {
- rand.Seed(time.Now().UnixNano())
+ os.Exit(code)
}
-func loadExampleKeys() (err error) {
- examplePublicKey, err = os.ReadFile("testdata/certs/server.pem")
+func initTestTLS() {
+ var err error
+ tlsPublicKey, err = os.ReadFile("testdata/certs/server.pem")
+ if err != nil {
+ panic(err)
+ }
+ tlsPrivateKey, err = os.ReadFile("testdata/certs/server-key.pem")
if err != nil {
- return err
+ panic(err)
}
- examplePrivateKey, err = os.ReadFile("testdata/certs/server-key.pem")
+ tlsCA, err = os.ReadFile("testdata/certs/ca.pem")
if err != nil {
- return err
+ panic(err)
}
- exampleCA, err = os.ReadFile("testdata/certs/ca.pem")
- return err
}
-var letterRunes = []rune("abcdefghijklmnopqrstuvwxyz1234567890")
-
-func randStringRunes(n int) string {
- b := make([]rune, n)
- for i := range b {
- b[i] = letterRunes[rand.Intn(len(letterRunes))]
+func newTestStorage(s *testserver.HTTPServer) (*Storage, error) {
+ storage, err := NewStorage(s.Root(), s.URL(), timeout)
+ if err != nil {
+ return nil, err
}
- return string(b)
+ return storage, nil
}
diff --git a/docs/api/source.md b/docs/api/source.md
index 8cc4f8ddf..4a506c472 100644
--- a/docs/api/source.md
+++ b/docs/api/source.md
@@ -313,10 +313,8 @@ github.com/fluxcd/pkg/apis/meta.LocalObjectReference
(Optional)
The secret name containing the Git credentials.
-For HTTPS repositories the secret must contain username and password
-fields.
-For SSH repositories the secret must contain identity, identity.pub and
-known_hosts fields.
+For HTTPS repositories the secret must contain username and password fields.
+For SSH repositories the secret must contain ‘identity’, ‘identity.pub’ and ‘known_hosts’ fields.
|
@@ -372,7 +370,7 @@ GitRepositoryVerification
(Optional)
- Verify OpenPGP signature for the Git commit HEAD points to.
+Verification defines the configuration to verify the OpenPGP signature for the Git commit HEAD points to.
|
@@ -384,9 +382,8 @@ string
(Optional)
- Ignore overrides the set of excluded patterns in the .sourceignore format
-(which is the same as .gitignore). If not provided, a default will be used,
-consult the documentation for your version to find out what those are.
+Ignore overrides the set of excluded patterns in the .sourceignore format (which is the same as .gitignore).
+If not provided, a default will be used, consult the documentation for your version to find out what those are.
|
@@ -398,7 +395,8 @@ bool
(Optional)
- This flag tells the controller to suspend the reconciliation of this source.
+Suspend tells the controller to suspend the reconciliation of this source.
+This flag tells the controller to suspend the reconciliation of this source.
|
@@ -423,8 +421,7 @@ bool
(Optional)
- When enabled, after the clone is created, initializes all submodules within,
-using their default settings.
+ When enabled, after the clone is created, initializes all submodules within, using their default settings.
This option is available only when using the ‘go-git’ GitImplementation.
|
@@ -438,7 +435,8 @@ This option is available only when using the ‘go-git’ GitImplementat
- Extra git repositories to map into the repository
+Include defines a list of GitRepository resources which artifacts should be included in the artifact produced for
+this resource.
|
@@ -1349,10 +1347,8 @@ github.com/fluxcd/pkg/apis/meta.LocalObjectReference
(Optional)
The secret name containing the Git credentials.
-For HTTPS repositories the secret must contain username and password
-fields.
-For SSH repositories the secret must contain identity, identity.pub and
-known_hosts fields.
+For HTTPS repositories the secret must contain username and password fields.
+For SSH repositories the secret must contain ‘identity’, ‘identity.pub’ and ‘known_hosts’ fields.
|
@@ -1408,7 +1404,7 @@ GitRepositoryVerification
(Optional)
- Verify OpenPGP signature for the Git commit HEAD points to.
+Verification defines the configuration to verify the OpenPGP signature for the Git commit HEAD points to.
|
@@ -1420,9 +1416,8 @@ string
(Optional)
- Ignore overrides the set of excluded patterns in the .sourceignore format
-(which is the same as .gitignore). If not provided, a default will be used,
-consult the documentation for your version to find out what those are.
+Ignore overrides the set of excluded patterns in the .sourceignore format (which is the same as .gitignore).
+If not provided, a default will be used, consult the documentation for your version to find out what those are.
|
@@ -1434,7 +1429,8 @@ bool
(Optional)
- This flag tells the controller to suspend the reconciliation of this source.
+Suspend tells the controller to suspend the reconciliation of this source.
+This flag tells the controller to suspend the reconciliation of this source.
|
@@ -1459,8 +1455,7 @@ bool
(Optional)
- When enabled, after the clone is created, initializes all submodules within,
-using their default settings.
+ When enabled, after the clone is created, initializes all submodules within, using their default settings.
This option is available only when using the ‘go-git’ GitImplementation.
|
@@ -1474,7 +1469,8 @@ This option is available only when using the ‘go-git’ GitImplementat
- Extra git repositories to map into the repository
+Include defines a list of GitRepository resources which artifacts should be included in the artifact produced for
+this resource.
|
@@ -1547,8 +1543,7 @@ string
(Optional)
- URL is the download link for the artifact output of the last repository
-sync.
+URL is the download link for the artifact output of the last repository sync.
|
@@ -1623,7 +1618,7 @@ string
- Mode describes what git object should be verified, currently (‘head’).
+Mode describes what Git object should be verified, currently (‘head’).
|
@@ -1636,7 +1631,7 @@ github.com/fluxcd/pkg/apis/meta.LocalObjectReference
- The secret name containing the public keys of all trusted Git authors.
+SecretRef containing the public keys of all trusted Git authors.
|
diff --git a/go.mod b/go.mod
index 1fe12d2d4..465ca68bc 100644
--- a/go.mod
+++ b/go.mod
@@ -6,17 +6,25 @@ replace github.com/fluxcd/source-controller/api => ./api
require (
cloud.google.com/go/storage v1.16.0
+ github.com/Azure/aad-pod-identity v1.8.6
+ github.com/Azure/azure-sdk-for-go v60.0.0+incompatible
+ github.com/Azure/azure-storage-blob-go v0.14.0
+ github.com/Azure/go-autorest/autorest v0.11.23
+ github.com/Azure/go-autorest/autorest/adal v0.9.18
+ github.com/Azure/go-autorest/autorest/to v0.4.0
github.com/Masterminds/semver/v3 v3.1.1
github.com/ProtonMail/go-crypto v0.0.0-20210428141323-04723f9f07d7
github.com/cyphar/filepath-securejoin v0.2.2
+ github.com/darkowlzz/controller-check v0.0.0-20220119215126-648356cef22c
github.com/elazarl/goproxy v0.0.0-20211114080932-d06c3be7c11b
- github.com/fluxcd/pkg/apis/meta v0.10.2
+ github.com/fluxcd/pkg/apis/meta v0.11.0-rc.3
github.com/fluxcd/pkg/gittestserver v0.5.0
github.com/fluxcd/pkg/gitutil v0.1.0
github.com/fluxcd/pkg/helmtestserver v0.4.0
github.com/fluxcd/pkg/lockedfile v0.1.0
- github.com/fluxcd/pkg/runtime v0.12.3
+ github.com/fluxcd/pkg/runtime v0.13.0-rc.6.0.20220119182053-85644747ea3d
github.com/fluxcd/pkg/ssh v0.2.0
+ github.com/fluxcd/pkg/testserver v0.2.0
github.com/fluxcd/pkg/untar v0.1.0
github.com/fluxcd/pkg/version v0.1.0
github.com/fluxcd/source-controller/api v0.20.1
@@ -29,21 +37,29 @@ require (
github.com/onsi/gomega v1.17.0
github.com/otiai10/copy v1.7.0
github.com/spf13/pflag v1.0.5
- golang.org/x/crypto v0.0.0-20210817164053-32db794688a5
+ golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
google.golang.org/api v0.54.0
+ gopkg.in/yaml.v2 v2.4.0
gotest.tools v2.2.0+incompatible
helm.sh/helm/v3 v3.7.2
k8s.io/api v0.23.1
k8s.io/apimachinery v0.23.1
k8s.io/client-go v0.23.1
+ k8s.io/klog/v2 v2.30.0
sigs.k8s.io/controller-runtime v0.11.0
sigs.k8s.io/yaml v1.3.0
)
require (
cloud.google.com/go v0.90.0 // indirect
+ github.com/Azure/azure-pipeline-go v0.2.3 // indirect
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 // indirect
+ github.com/Azure/go-autorest v14.2.0+incompatible // indirect
+ github.com/Azure/go-autorest/autorest/date v0.3.0 // indirect
+ github.com/Azure/go-autorest/autorest/validation v0.3.1 // indirect
+ github.com/Azure/go-autorest/logger v0.2.1 // indirect
+ github.com/Azure/go-autorest/tracing v0.6.0 // indirect
github.com/BurntSushi/toml v0.3.1 // indirect
github.com/MakeNowJust/heredoc v0.0.0-20170808103936-bb23615498cd // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
@@ -77,7 +93,6 @@ require (
github.com/exponent-io/jsonpath v0.0.0-20151013193312-d6023ce2651d // indirect
github.com/fatih/color v1.7.0 // indirect
github.com/fluxcd/pkg/apis/acl v0.0.3 // indirect
- github.com/fluxcd/pkg/testserver v0.1.0 // indirect
github.com/fsnotify/fsnotify v1.5.1 // indirect
github.com/go-errors/errors v1.0.1 // indirect
github.com/go-git/gcfg v1.5.0 // indirect
@@ -88,6 +103,7 @@ require (
github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/uuid v4.1.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
+ github.com/golang-jwt/jwt/v4 v4.0.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.2 // indirect
github.com/google/btree v1.0.1 // indirect
@@ -114,12 +130,14 @@ require (
github.com/kevinburke/ssh_config v0.0.0-20201106050909-4977a11b4351 // indirect
github.com/klauspost/compress v1.13.5 // indirect
github.com/klauspost/cpuid v1.3.1 // indirect
+ github.com/kylelemons/godebug v1.1.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.0 // indirect
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
github.com/mailru/easyjson v0.7.6 // indirect
github.com/mattn/go-colorable v0.0.9 // indirect
+ github.com/mattn/go-ieproxy v0.0.1 // indirect
github.com/mattn/go-isatty v0.0.4 // indirect
github.com/mattn/go-runewidth v0.0.9 // indirect
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
@@ -174,8 +192,8 @@ require (
golang.org/x/lint v0.0.0-20210508222113-6edffad5e616 // indirect
golang.org/x/mod v0.4.2 // indirect
golang.org/x/net v0.0.0-20211215060638-4ddde0e984e9 // indirect
- golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f // indirect
- golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 // indirect
+ golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 // indirect
+ golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 // indirect
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b // indirect
golang.org/x/text v0.3.7 // indirect
golang.org/x/time v0.0.0-20210723032227-1f47c861a9ac // indirect
@@ -191,13 +209,11 @@ require (
gopkg.in/ini.v1 v1.62.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
gopkg.in/warnings.v0 v0.1.2 // indirect
- gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
k8s.io/apiextensions-apiserver v0.23.0 // indirect
k8s.io/apiserver v0.23.0 // indirect
k8s.io/cli-runtime v0.23.0 // indirect
k8s.io/component-base v0.23.0 // indirect
- k8s.io/klog/v2 v2.30.0 // indirect
k8s.io/kube-openapi v0.0.0-20211115234752-e816edb12b65 // indirect
k8s.io/kubectl v0.22.4 // indirect
k8s.io/utils v0.0.0-20211208161948-7d6a63dca704 // indirect
diff --git a/go.sum b/go.sum
index 69b819334..40bfdfa39 100644
--- a/go.sum
+++ b/go.sum
@@ -44,24 +44,51 @@ cloud.google.com/go/storage v1.8.0/go.mod h1:Wv1Oy7z6Yz3DshWRJFhqM/UCfaWIRTdp0RX
cloud.google.com/go/storage v1.10.0/go.mod h1:FLPqc6j+Ki4BU591ie1oL6qBQGu2Bl/tZ9ullr3+Kg0=
cloud.google.com/go/storage v1.16.0 h1:1UwAux2OZP4310YXg5ohqBEpV16Y93uZG4+qOX7K2Kg=
cloud.google.com/go/storage v1.16.0/go.mod h1:ieKBmUyzcftN5tbxwnXClMKH00CfcQ+xL6NN0r5QfmE=
+contrib.go.opencensus.io/exporter/prometheus v0.1.0/go.mod h1:cGFniUXGZlKRjzOyuZJ6mgB+PgBcCIa79kEKR8YCW+A=
dmitri.shuralyov.com/gpu/mtl v0.0.0-20190408044501-666a987793e9/go.mod h1:H6x//7gZCb22OMCxBHrMx7a5I7Hp++hsVxbQ4BYO7hU=
+github.com/Azure/aad-pod-identity v1.8.6 h1:aa5ybqA5d2e18MPEQyXvIDDGmXMa6bN7ZxK5PKpWQoE=
+github.com/Azure/aad-pod-identity v1.8.6/go.mod h1:A+7rb0WOEhBmVaFSl/MtdVCiugoTilY7GpwCnrgzm2w=
+github.com/Azure/azure-pipeline-go v0.2.3 h1:7U9HBg1JFK3jHl5qmo4CTZKFTVgMwdFHMVtCdfBE21U=
+github.com/Azure/azure-pipeline-go v0.2.3/go.mod h1:x841ezTBIMG6O3lAcl8ATHnsOPVl2bqk7S3ta6S6u4k=
github.com/Azure/azure-sdk-for-go v16.2.1+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
+github.com/Azure/azure-sdk-for-go v57.2.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
+github.com/Azure/azure-sdk-for-go v60.0.0+incompatible h1:vVRJhSSTwhIHQTzTjqoZCItFJeBwfdNSqHcgGV10FHQ=
+github.com/Azure/azure-sdk-for-go v60.0.0+incompatible/go.mod h1:9XXNKU+eRnpl9moKnB4QOLf1HestfXbmab5FXxiDBjc=
+github.com/Azure/azure-storage-blob-go v0.14.0 h1:1BCg74AmVdYwO3dlKwtFU1V0wU2PZdREkXvAmZJRUlM=
+github.com/Azure/azure-storage-blob-go v0.14.0/go.mod h1:SMqIBi+SuiQH32bvyjngEewEeXoPfKMgWlBDaYf6fck=
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
github.com/Azure/go-ansiterm v0.0.0-20210608223527-2377c96fe795/go.mod h1:LmzpDX56iTiv29bbRTIsUNlaFfuhWRQBWjQdVyAevI8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1 h1:UQHMgLO+TxOElx5B5HZ4hJQsoJ/PvUvKRhJHDQXO8P8=
github.com/Azure/go-ansiterm v0.0.0-20210617225240-d185dfc1b5a1/go.mod h1:xomTg63KZ2rFqZQzSB4Vz2SUXa1BpHTVz9L5PTmPC4E=
github.com/Azure/go-autorest v10.8.1+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
+github.com/Azure/go-autorest v14.2.0+incompatible h1:V5VMDjClD3GiElqLWO7mz2MxNAK/vTfRHdAubSIPRgs=
github.com/Azure/go-autorest v14.2.0+incompatible/go.mod h1:r+4oMnoxhatjLLJ6zxSWATqVooLgysK6ZNox3g/xq24=
github.com/Azure/go-autorest/autorest v0.11.1/go.mod h1:JFgpikqFJ/MleTTxwepExTKnFUKKszPS8UavbQYUMuw=
github.com/Azure/go-autorest/autorest v0.11.18/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA=
+github.com/Azure/go-autorest/autorest v0.11.19/go.mod h1:dSiJPy22c3u0OtOKDNttNgqpNFY/GeWa7GH/Pz56QRA=
+github.com/Azure/go-autorest/autorest v0.11.23 h1:bRQWsW25/YkoxnIqXMPF94JW33qWDcrPMZ3bINaAruU=
+github.com/Azure/go-autorest/autorest v0.11.23/go.mod h1:BAWYUWGPEtKPzjVkp0Q6an0MJcJDsoh5Z1BFAEFs4Xs=
github.com/Azure/go-autorest/autorest/adal v0.9.0/go.mod h1:/c022QCutn2P7uY+/oQWWNcK9YU+MH96NgK+jErpbcg=
github.com/Azure/go-autorest/autorest/adal v0.9.5/go.mod h1:B7KF7jKIeC9Mct5spmyCB/A8CG/sEz1vwIRGv/bbw7A=
github.com/Azure/go-autorest/autorest/adal v0.9.13/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
+github.com/Azure/go-autorest/autorest/adal v0.9.14/go.mod h1:W/MM4U6nLxnIskrw4UwWzlHfGjwUS50aOsc/I3yuU8M=
+github.com/Azure/go-autorest/autorest/adal v0.9.18 h1:kLnPsRjzZZUF3K5REu/Kc+qMQrvuza2bwSnNdhmzLfQ=
+github.com/Azure/go-autorest/autorest/adal v0.9.18/go.mod h1:XVVeme+LZwABT8K5Lc3hA4nAe8LDBVle26gTrguhhPQ=
+github.com/Azure/go-autorest/autorest/azure/auth v0.5.10/go.mod h1:zQXYYNX9kXzRMrJNVXWUfNy38oPMF5/2TeZ4Wylc9fE=
+github.com/Azure/go-autorest/autorest/azure/cli v0.4.2/go.mod h1:7qkJkT+j6b+hIpzMOwPChJhTqS8VbsqqgULzMNRugoM=
+github.com/Azure/go-autorest/autorest/date v0.3.0 h1:7gUk1U5M/CQbp9WoqinNzJar+8KY+LPI6wiWrP/myHw=
github.com/Azure/go-autorest/autorest/date v0.3.0/go.mod h1:BI0uouVdmngYNUzGWeSYnokU+TrmwEsOqdt8Y6sso74=
github.com/Azure/go-autorest/autorest/mocks v0.4.0/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
+github.com/Azure/go-autorest/autorest/mocks v0.4.1 h1:K0laFcLE6VLTOwNgSxaGbUcLPuGXlNkbVvq4cW4nIHk=
github.com/Azure/go-autorest/autorest/mocks v0.4.1/go.mod h1:LTp+uSrOhSkaKrUy935gNZuuIPPVsHlr9DSOxSayd+k=
+github.com/Azure/go-autorest/autorest/to v0.4.0 h1:oXVqrxakqqV1UZdSazDOPOLvOIz+XA683u8EctwboHk=
+github.com/Azure/go-autorest/autorest/to v0.4.0/go.mod h1:fE8iZBn7LQR7zH/9XU2NcPR4o9jEImooCeWJcYV/zLE=
+github.com/Azure/go-autorest/autorest/validation v0.3.1 h1:AgyqjAd94fwNAoTjl/WQXg4VvFeRFpO+UhNyRXqF1ac=
+github.com/Azure/go-autorest/autorest/validation v0.3.1/go.mod h1:yhLgjC0Wda5DYXl6JAsWyUe4KVNffhoDhG0zVzUMo3E=
github.com/Azure/go-autorest/logger v0.2.0/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
+github.com/Azure/go-autorest/logger v0.2.1 h1:IG7i4p/mDa2Ce4TRyAO8IHnVhAVF3RFU+ZtXWSmf4Tg=
github.com/Azure/go-autorest/logger v0.2.1/go.mod h1:T9E3cAhj2VqvPOtCYAvby9aBXkZmbF5NWuPV8+WeEW8=
+github.com/Azure/go-autorest/tracing v0.6.0 h1:TYi4+3m5t6K48TGI9AUdb+IzbnSxvnvUMfuitfgcfuo=
github.com/Azure/go-autorest/tracing v0.6.0/go.mod h1:+vhtPC754Xsa23ID7GlGsrdKBpUA79WCAKPPZVC2DeU=
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
@@ -209,6 +236,7 @@ github.com/containers/ocicrypt v1.1.1/go.mod h1:Dm55fwWm1YZAjYRaJ94z2mfZikIyIN4B
github.com/coreos/bbolt v1.3.2/go.mod h1:iRUV2dpdMOn7Bo10OQBFzIJO9kkE559Wcmn+qkEiiKk=
github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
github.com/coreos/etcd v3.3.13+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE=
+github.com/coreos/go-iptables v0.3.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
github.com/coreos/go-iptables v0.5.0/go.mod h1:/mVI274lEDI2ns62jHCDnCyBF9Iwsmekav8Dbxlm1MU=
github.com/coreos/go-oidc v2.1.0+incompatible/go.mod h1:CgnwVTmzoESiwO9qyAFEMiHoZ1nMCKZlZ9V6mm3/LKc=
github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
@@ -231,6 +259,8 @@ github.com/d2g/dhcp4 v0.0.0-20170904100407-a1d1b6c41b1c/go.mod h1:Ct2BUK8SB0YC1S
github.com/d2g/dhcp4client v1.0.0/go.mod h1:j0hNfjhrt2SxUOw55nL0ATM/z4Yt3t2Kd1mW34z5W5s=
github.com/d2g/dhcp4server v0.0.0-20181031114812-7d4a0a7f59a5/go.mod h1:Eo87+Kg/IX2hfWJfwxMzLyuSZyxSoAug2nGa1G2QAi8=
github.com/d2g/hardwareaddr v0.0.0-20190221164911-e7d9fbe030e4/go.mod h1:bMl4RjIciD2oAxI7DmWRx6gbeqrkoLqv3MV0vzNad+I=
+github.com/darkowlzz/controller-check v0.0.0-20220119215126-648356cef22c h1:pyp/Dvd1gYP/D3z1zs46h0YhYzFp0hjxw0XVIO9+vh4=
+github.com/darkowlzz/controller-check v0.0.0-20220119215126-648356cef22c/go.mod h1:haYO9UW76kUUKpIBbv3ydaU5wZ/7r0yqp61PGzVRSYU=
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
@@ -240,6 +270,8 @@ github.com/denverdino/aliyungo v0.0.0-20190125010748-a747050bb1ba/go.mod h1:dV8l
github.com/dgrijalva/jwt-go v0.0.0-20170104182250-a601269ab70c/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgrijalva/jwt-go v3.2.0+incompatible/go.mod h1:E3ru+11k8xSBh+hMPgOLZmtrrCbhqsmaPHjLKYnJCaQ=
github.com/dgryski/go-sip13 v0.0.0-20181026042036-e10d5fee7954/go.mod h1:vAd38F8PWV+bWy6jNmig1y/TA+kYO4g3RSRF0IAv0no=
+github.com/dimchansky/utfbom v1.1.0/go.mod h1:rO41eb7gLfo8SF1jd9F8HplJm1Fewwi4mQvIirEdv+8=
+github.com/dimchansky/utfbom v1.1.1/go.mod h1:SxdoEBH5qIqFocHMyGOXVAybYJdr71b1Q/j0mACtrfE=
github.com/distribution/distribution/v3 v3.0.0-20210804104954-38ab4c606ee3 h1:rEK0juuU5idazw//KzUcL3yYwUU3DIe2OnfJwjDBqno=
github.com/distribution/distribution/v3 v3.0.0-20210804104954-38ab4c606ee3/go.mod h1:gt38b7cvVKazi5XkHvINNytZXgTEntyhtyM3HQz46Nk=
github.com/dnaeon/go-vcr v1.0.1/go.mod h1:aBB1+wY4s93YsC3HHjMBMrwTj2R9FHDzUr9KyGc8n1E=
@@ -298,8 +330,8 @@ github.com/felixge/httpsnoop v1.0.1 h1:lvB5Jl89CsZtGIWuTcDM1E/vkVs49/Ml7JJe07l8S
github.com/felixge/httpsnoop v1.0.1/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U=
github.com/fluxcd/pkg/apis/acl v0.0.3 h1:Lw0ZHdpnO4G7Zy9KjrzwwBmDZQuy4qEjaU/RvA6k1lc=
github.com/fluxcd/pkg/apis/acl v0.0.3/go.mod h1:XPts6lRJ9C9fIF9xVWofmQwftvhY25n1ps7W9xw0XLU=
-github.com/fluxcd/pkg/apis/meta v0.10.2 h1:pnDBBEvfs4HaKiVAYgz+e/AQ8dLvcgmVfSeBroZ/KKI=
-github.com/fluxcd/pkg/apis/meta v0.10.2/go.mod h1:KQ2er9xa6koy7uoPMZjIjNudB5p4tXs+w0GO6fRcy7I=
+github.com/fluxcd/pkg/apis/meta v0.11.0-rc.3 h1:YY6RlaHIMXawgEOJhJbSrm4NpD9fJTCWFGKgtNfQ0/g=
+github.com/fluxcd/pkg/apis/meta v0.11.0-rc.3/go.mod h1:ki5wJE4nuFOZt78q0RSYkrKwINgIBPynuswZhnTOSoI=
github.com/fluxcd/pkg/gittestserver v0.5.0 h1:pPdaz7pUsukt4eQ+xQeNwoypOXGGOHFHnPjIHQAv0tE=
github.com/fluxcd/pkg/gittestserver v0.5.0/go.mod h1:mFEF/Xrg+CjQH4VFCRCou2qZmhWKo7EYcjr7MIoX6+s=
github.com/fluxcd/pkg/gitutil v0.1.0 h1:VO3kJY/CKOCO4ysDNqfdpTg04icAKBOSb3lbR5uE/IE=
@@ -308,12 +340,14 @@ github.com/fluxcd/pkg/helmtestserver v0.4.0 h1:RT0G5buw5qrzEfIIH0fklppIvPAaQF//p
github.com/fluxcd/pkg/helmtestserver v0.4.0/go.mod h1:JOI9f3oXUFIWmMKWMBan7FjglAU+fRTO/sPPV/Kj3gQ=
github.com/fluxcd/pkg/lockedfile v0.1.0 h1:YsYFAkd6wawMCcD74ikadAKXA4s2sukdxrn7w8RB5eo=
github.com/fluxcd/pkg/lockedfile v0.1.0/go.mod h1:EJLan8t9MiOcgTs8+puDjbE6I/KAfHbdvIy9VUgIjm8=
-github.com/fluxcd/pkg/runtime v0.12.3 h1:h21AZ3YG5MAP7DxFF9hfKrP+vFzys2L7CkUbPFjbP/0=
-github.com/fluxcd/pkg/runtime v0.12.3/go.mod h1:imJ2xYy/d4PbSinX2IefmZk+iS2c1P5fY0js8mCE4SM=
+github.com/fluxcd/pkg/runtime v0.13.0-rc.6/go.mod h1:4oKUO19TeudXrnCRnxCfMSS7EQTYpYlgfXwlQuDJ/Eg=
+github.com/fluxcd/pkg/runtime v0.13.0-rc.6.0.20220119182053-85644747ea3d h1:RllfQpqtWKw+ZkrphMDIrX9J4X4u5am58T+rjVGkzsE=
+github.com/fluxcd/pkg/runtime v0.13.0-rc.6.0.20220119182053-85644747ea3d/go.mod h1:uGPudgMUNC3wu7Zoh6AgJM8WSH3VpmnzjrwkVb86d3Y=
github.com/fluxcd/pkg/ssh v0.2.0 h1:e9V+HReOL7czm7edVzYS1e+CnFKz1/kHiUNfLRpBdH8=
github.com/fluxcd/pkg/ssh v0.2.0/go.mod h1:EpQC7Ztdlbi8S/dlYXqVDZtHtLpN3FNl3N6zWujVzbA=
-github.com/fluxcd/pkg/testserver v0.1.0 h1:nOYgM1HYFZNNSUFykuWDmrsxj4jQxUCvmLHWOQeqmyA=
github.com/fluxcd/pkg/testserver v0.1.0/go.mod h1:fvt8BHhXw6c1+CLw1QFZxcQprlcXzsrL4rzXaiGM+Iw=
+github.com/fluxcd/pkg/testserver v0.2.0 h1:Mj0TapmKaywI6Fi5wvt1LAZpakUHmtzWQpJNKQ0Krt4=
+github.com/fluxcd/pkg/testserver v0.2.0/go.mod h1:bgjjydkXsZTeFzjz9Cr4heGANr41uTB1Aj1Q5qzuYVk=
github.com/fluxcd/pkg/untar v0.1.0 h1:k97V/xV5hFrAkIkVPuv5AVhyxh1ZzzAKba/lbDfGo6o=
github.com/fluxcd/pkg/untar v0.1.0/go.mod h1:aGswNyzB1mlz/T/kpOS58mITBMxMKc9tlJBH037A2HY=
github.com/fluxcd/pkg/version v0.1.0 h1:v+SmCanmCB5Tj2Cx9TXlj+kNRfPGbAvirkeqsp7ZEAQ=
@@ -401,6 +435,8 @@ github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zV
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q=
github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q=
+github.com/golang-jwt/jwt/v4 v4.0.0 h1:RAqyYixv1p7uEnocuy8P1nru5wprCh/MH2BIlW5z5/o=
+github.com/golang-jwt/jwt/v4 v4.0.0/go.mod h1:/xlHOz8bRuivTWchD4jCa+NbatV+wEUSzwAxVc6locg=
github.com/golang-sql/civil v0.0.0-20190719163853-cb61b32ac6fe/go.mod h1:8vg3r2VgvsThLBIFL93Qb5yWzgyZWhEmBwUJWevAkK0=
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
github.com/golang/glog v1.0.0/go.mod h1:EWib/APOK0SL3dFbYqvxE3UYd8E6s1ouQ7iEp/0LWV4=
@@ -615,6 +651,8 @@ github.com/kr/pty v1.1.5/go.mod h1:9r2w37qlBe7rQ6e1fg1S/9xpWHSnaqNdHD3WcMdbPDA=
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY=
github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE=
+github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc=
+github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 h1:SOEGU9fKiNWd/HOJuq6+3iTQz8KNCLtVX6idSoTLdUw=
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0/go.mod h1:dXGbAdH5GtBTC4WfIxhKZfyBF/HBFgRZSWwZ9g/He9o=
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 h1:P6pPBnrTSX3DEVR4fDembhRWSsG5rVo6hYhAB/ADZrk=
@@ -646,6 +684,8 @@ github.com/matryer/is v1.2.0 h1:92UTHpy8CDwaJ08GqLDzhhuixiBUUD1p3AU6PHddz4A=
github.com/matryer/is v1.2.0/go.mod h1:2fLPjFQM9rhQ15aVEtbuwhJinnOqrmgXPNdZsdwlWXA=
github.com/mattn/go-colorable v0.0.9 h1:UVL0vNpWh04HeJXV0KLcaT7r06gOH2l4OW6ddYRUIY4=
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
+github.com/mattn/go-ieproxy v0.0.1 h1:qiyop7gCflfhwCzGyeT0gro3sF9AIg9HU98JORTkqfI=
+github.com/mattn/go-ieproxy v0.0.1/go.mod h1:pYabZ6IHcRpFh7vIaLfK7rdcWgFEb3SFJ6/gNWuh88E=
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
github.com/mattn/go-isatty v0.0.4 h1:bnP0vzxcAdeI1zdubAl5PjU6zsERjGZb7raWodagDYs=
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
@@ -778,6 +818,7 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZN
github.com/posener/complete v1.1.1/go.mod h1:em0nMJCgc9GFtwrmVmEMR/ZL6WyhyjMBndrE9hABlRI=
github.com/pquerna/cachecontrol v0.0.0-20171018203845-0dec1b30a021/go.mod h1:prYjPmNq4d1NPVmpShWobRqXY3q7Vp+80DqgxxUrUIA=
github.com/prometheus/client_golang v0.9.1/go.mod h1:7SWBe2y4D6OKWSNQJUaRYU/AaXPKyh/dDVn+NZz0KFw=
+github.com/prometheus/client_golang v0.9.2/go.mod h1:OsXs2jCmiKlQ1lTBmv21f2mNfw4xf/QclQDMrYNZzcM=
github.com/prometheus/client_golang v0.9.3/go.mod h1:/TN21ttK/J9q6uSwhBd54HahCDft0ttaMvbicHlPoso=
github.com/prometheus/client_golang v1.0.0/go.mod h1:db9x61etRT2tGnBNRi70OPL5FsnadC4Ky3P0J6CfImo=
github.com/prometheus/client_golang v1.1.0/go.mod h1:I1FGZT9+L76gKKOs5djB6ezCbFQP1xR9D75/vuwEF3g=
@@ -790,6 +831,7 @@ github.com/prometheus/client_model v0.0.0-20190812154241-14fe0d1b01d4/go.mod h1:
github.com/prometheus/client_model v0.2.0 h1:uq5h0d+GuxiXLJLNABMgp2qUWDPiLvgCzz2dUR+/W/M=
github.com/prometheus/client_model v0.2.0/go.mod h1:xMI15A0UPsDsEKsMN9yxemIoYk6Tm2C1GtYGdfGttqA=
github.com/prometheus/common v0.0.0-20181113130724-41aa239b4cce/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
+github.com/prometheus/common v0.0.0-20181126121408-4724e9255275/go.mod h1:daVV7qP5qjZbuso7PdcryaAu0sAZbrN9i7WWcTMWvro=
github.com/prometheus/common v0.4.0/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.4.1/go.mod h1:TNfzLD0ON7rHzMJeJkieUDPYmFC7Snx/y86RQel1bk4=
github.com/prometheus/common v0.6.0/go.mod h1:eBmuwkDJBwy6iBfxCBob6t6dR6ENT/y+J+Zk0j9GMYc=
@@ -798,6 +840,7 @@ github.com/prometheus/common v0.26.0/go.mod h1:M7rCNAaPfAosfx8veZJCuw84e35h3Cfd9
github.com/prometheus/common v0.28.0 h1:vGVfV9KrDTvWt5boZO0I19g2E3CsWfpPPKZM9dt3mEw=
github.com/prometheus/common v0.28.0/go.mod h1:vu+V0TpY+O6vW9J44gczi3Ap/oXXR10b+M/gUGO4Hls=
github.com/prometheus/procfs v0.0.0-20181005140218-185b4288413d/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
+github.com/prometheus/procfs v0.0.0-20181204211112-1dc9a6cbc91a/go.mod h1:c3At6R/oaqEKCNdg8wHV1ftS6bRYblBhIjjI8uT2IGk=
github.com/prometheus/procfs v0.0.0-20190507164030-5867b95ac084/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.0-20190522114515-bc1a522cf7b1/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
@@ -1000,8 +1043,9 @@ golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWP
golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4=
golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a/go.mod h1:P+XmwS30IXTQdn5tA2iutPOUgjI07+tq3H3K9MVA1s8=
-golang.org/x/crypto v0.0.0-20210817164053-32db794688a5 h1:HWj/xjIHfjYU5nVXpTM0s39J9CbLn7Cc5a7IC5rwsMQ=
golang.org/x/crypto v0.0.0-20210817164053-32db794688a5/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519 h1:7I4JAnoQBe7ZtJcBaYHi5UtiO8tQHbUSXxL+pnGRANg=
+golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8=
@@ -1060,6 +1104,7 @@ golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLL
golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20190827160401-ba9fcec4b297/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20191112182307-2180aed22343/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20191209160850-c0dbc17a3553/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200114155413-6afb5195e5aa/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/net v0.0.0-20200202094626-16171245cfb2/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
@@ -1112,8 +1157,9 @@ golang.org/x/oauth2 v0.0.0-20210514164344-f6687ab2804c/go.mod h1:KelEdhl1UZF7XfJ
golang.org/x/oauth2 v0.0.0-20210615190721-d04028783cf1/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210628180205-a41e5a781914/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/oauth2 v0.0.0-20210805134026-6f1e6394065a/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
-golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f h1:Qmd2pbz05z7z6lm0DrgQVVPuBm92jqujBKMHMOlOQEw=
golang.org/x/oauth2 v0.0.0-20210819190943-2bc19b11175f/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
+golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8 h1:RerP+noqYHUQ8CMRcPlC2nvTa4dcBIjegkuWdcUDuqg=
+golang.org/x/oauth2 v0.0.0-20211104180415-d3ed0bb246c8/go.mod h1:KelEdhl1UZF7XfJ4dDtk6s++YSgaE7mD/BuKKDLBl4A=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -1152,6 +1198,7 @@ golang.org/x/sys v0.0.0-20191001151750-bb3f8db39f24/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20191002063906-3421d5a6bb1c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191005200804-aed5e4c7ecf9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20191112214154-59a1497f0cea/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191115151921-52ab43148777/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191120155948-bd437916bb0e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20191204072324-ce4227a45e2e/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1177,6 +1224,7 @@ golang.org/x/sys v0.0.0-20200615200032-f1bc736245b1/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20200625212154-ddb9806d33ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200728102440-3e129f6d46b1/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20200828194041-157a740278f4/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200831180312-196b9ba8737a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200905004654-be1d3432aa8f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20200909081042-eff7692f9009/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
@@ -1213,8 +1261,9 @@ golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20210806184541-e5e7981a1069/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20210831042530-f4d43177bf5e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
-golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8 h1:M69LAlWZCshgp0QSzyDcSsSIejIEeuaCVpmwcKwyLMk=
golang.org/x/sys v0.0.0-20211029165221-6e7872819dc8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211110154304-99a53858aa08 h1:WecRHqgE09JBkh/584XIE6PMz5KKE/vER4izNUi30AQ=
+golang.org/x/sys v0.0.0-20211110154304-99a53858aa08/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
diff --git a/internal/error/error.go b/internal/error/error.go
new file mode 100644
index 000000000..65d1feb62
--- /dev/null
+++ b/internal/error/error.go
@@ -0,0 +1,54 @@
+/*
+Copyright 2021 The Flux authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package error
+
+// Stalling is the reconciliation stalled state error. It contains an error
+// and a reason for the stalled condition.
+type Stalling struct {
+ // Reason is the stalled condition reason string.
+ Reason string
+ // Err is the error that caused stalling. This can be used as the message in
+ // stalled condition.
+ Err error
+}
+
+// Error implements error interface.
+func (se *Stalling) Error() string {
+ return se.Err.Error()
+}
+
+// Unwrap returns the underlying error.
+func (se *Stalling) Unwrap() error {
+ return se.Err
+}
+
+// Event is an error event. It can be used to construct an event to be
+// recorded.
+type Event struct {
+ Reason string
+ Err error
+}
+
+// Error implements error interface.
+func (ee *Event) Error() string {
+ return ee.Err.Error()
+}
+
+// Unwrap returns the underlying error.
+func (ee *Event) Unwrap() error {
+ return ee.Err
+}
diff --git a/internal/reconcile/reconcile.go b/internal/reconcile/reconcile.go
new file mode 100644
index 000000000..f7593fcee
--- /dev/null
+++ b/internal/reconcile/reconcile.go
@@ -0,0 +1,148 @@
+/*
+Copyright 2021 The Flux authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package reconcile
+
+import (
+ "context"
+
+ corev1 "k8s.io/api/core/v1"
+ kuberecorder "k8s.io/client-go/tools/record"
+ ctrl "sigs.k8s.io/controller-runtime"
+
+ "github.com/fluxcd/pkg/apis/meta"
+ "github.com/fluxcd/pkg/runtime/conditions"
+ "github.com/fluxcd/pkg/runtime/patch"
+
+ sourcev1 "github.com/fluxcd/source-controller/api/v1beta1"
+ serror "github.com/fluxcd/source-controller/internal/error"
+)
+
+// Result is a type for creating an abstraction for the controller-runtime
+// reconcile Result to simplify the Result values.
+type Result int
+
+const (
+ // ResultEmpty indicates a reconcile result which does not requeue.
+ ResultEmpty Result = iota
+ // ResultRequeue indicates a reconcile result which should immediately
+ // requeue.
+ ResultRequeue
+ // ResultSuccess indicates a reconcile result which should be
+ // requeued on the interval as defined on the reconciled object.
+ ResultSuccess
+)
+
+// BuildRuntimeResult converts a given Result and error into the
+// return values of a controller's Reconcile function.
+func BuildRuntimeResult(ctx context.Context, recorder kuberecorder.EventRecorder, obj sourcev1.Source, rr Result, err error) (ctrl.Result, error) {
+ // NOTE: The return values can be modified based on the error type.
+ // For example, if an error signifies a short requeue period that's
+ // not equal to the requeue period of the object, the error can be checked
+ // and an appropriate result with the period can be returned.
+ //
+ // Example:
+ // if e, ok := err.(*waitError); ok {
+ // return ctrl.Result{RequeueAfter: e.RequeueAfter}, err
+ // }
+
+ // Log and record event based on the error.
+ switch e := err.(type) {
+ case *serror.Event:
+ recorder.Eventf(obj, corev1.EventTypeWarning, e.Reason, e.Error())
+ case *serror.Stalling:
+ // Stalling errors are not returned to the runtime. Log it explicitly.
+ ctrl.LoggerFrom(ctx).Error(e, "reconciliation stalled")
+ recorder.Eventf(obj, corev1.EventTypeWarning, e.Reason, e.Error())
+ }
+
+ switch rr {
+ case ResultRequeue:
+ return ctrl.Result{Requeue: true}, err
+ case ResultSuccess:
+ return ctrl.Result{RequeueAfter: obj.GetRequeueAfter()}, err
+ default:
+ return ctrl.Result{}, err
+ }
+}
+
+// ComputeReconcileResult analyzes the reconcile results (result + error),
+// updates the status conditions of the object with any corrections and returns
+// result patch configuration and any error to the caller. The caller is
+// responsible for using the patch option to patch the object in the API server.
+func ComputeReconcileResult(obj conditions.Setter, res Result, recErr error, ownedConditions []string) ([]patch.Option, error) {
+ // Remove reconciling condition on successful reconciliation.
+ if recErr == nil && res == ResultSuccess {
+ conditions.Delete(obj, meta.ReconcilingCondition)
+ }
+
+ // Patch the object, ignoring conflicts on the conditions owned by this controller.
+ pOpts := []patch.Option{
+ patch.WithOwnedConditions{
+ Conditions: ownedConditions,
+ },
+ }
+
+ // Analyze the reconcile error.
+ switch t := recErr.(type) {
+ case *serror.Stalling:
+ if res == ResultEmpty {
+ // The current generation has been reconciled successfully and it
+ // has resulted in a stalled state. Return no error to stop further
+ // requeuing.
+ pOpts = append(pOpts, patch.WithStatusObservedGeneration{})
+ conditions.MarkStalled(obj, t.Reason, t.Error())
+ return pOpts, nil
+ }
+ // NOTE: Non-empty result with stalling error indicates that the
+ // returned result is incorrect.
+ case nil:
+ // The reconcile didn't result in any error, we are not in stalled
+ // state. If a requeue is requested, the current generation has not been
+ // reconciled successfully.
+ if res != ResultRequeue {
+ pOpts = append(pOpts, patch.WithStatusObservedGeneration{})
+ }
+ conditions.Delete(obj, meta.StalledCondition)
+ default:
+ // The reconcile resulted in some error, but we are not in stalled
+ // state.
+ conditions.Delete(obj, meta.StalledCondition)
+ }
+
+ return pOpts, recErr
+}
+
+// LowestRequeuingResult returns the ReconcileResult with the lowest requeue
+// period.
+// Weightage:
+// ResultRequeue - immediate requeue (lowest)
+// ResultSuccess - requeue at an interval
+// ResultEmpty - no requeue
+func LowestRequeuingResult(i, j Result) Result {
+ switch {
+ case i == ResultEmpty:
+ return j
+ case j == ResultEmpty:
+ return i
+ case i == ResultRequeue:
+ return i
+ case j == ResultRequeue:
+ return j
+ default:
+ return j
+ }
+}
diff --git a/internal/reconcile/reconcile_test.go b/internal/reconcile/reconcile_test.go
new file mode 100644
index 000000000..bb0cf4c44
--- /dev/null
+++ b/internal/reconcile/reconcile_test.go
@@ -0,0 +1,47 @@
+/*
+Copyright 2021 The Flux authors
+
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+*/
+
+package reconcile
+
+import (
+ "testing"
+
+ . "github.com/onsi/gomega"
+)
+
+func TestLowestRequeuingResult(t *testing.T) {
+ tests := []struct {
+ name string
+ i Result
+ j Result
+ wantResult Result
+ }{
+ {"bail,requeue", ResultEmpty, ResultRequeue, ResultRequeue},
+ {"bail,requeueInterval", ResultEmpty, ResultSuccess, ResultSuccess},
+ {"requeue,bail", ResultRequeue, ResultEmpty, ResultRequeue},
+ {"requeue,requeueInterval", ResultRequeue, ResultSuccess, ResultRequeue},
+ {"requeueInterval,requeue", ResultSuccess, ResultRequeue, ResultRequeue},
+ {"requeueInterval,requeueInterval", ResultSuccess, ResultSuccess, ResultSuccess},
+ }
+
+ for _, tt := range tests {
+ t.Run(tt.name, func(t *testing.T) {
+ g := NewWithT(t)
+
+ g.Expect(LowestRequeuingResult(tt.i, tt.j)).To(Equal(tt.wantResult))
+ })
+ }
+}
diff --git a/main.go b/main.go
index 67f00a920..ea6e4c233 100644
--- a/main.go
+++ b/main.go
@@ -33,13 +33,12 @@ import (
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
ctrl "sigs.k8s.io/controller-runtime"
- crtlmetrics "sigs.k8s.io/controller-runtime/pkg/metrics"
"github.com/fluxcd/pkg/runtime/client"
+ helper "github.com/fluxcd/pkg/runtime/controller"
"github.com/fluxcd/pkg/runtime/events"
"github.com/fluxcd/pkg/runtime/leaderelection"
"github.com/fluxcd/pkg/runtime/logger"
- "github.com/fluxcd/pkg/runtime/metrics"
"github.com/fluxcd/pkg/runtime/pprof"
"github.com/fluxcd/pkg/runtime/probes"
@@ -77,6 +76,7 @@ func main() {
storagePath string
storageAddr string
storageAdvAddr string
+ azureCloudConfig string
concurrent int
requeueDependency time.Duration
watchAllNamespaces bool
@@ -110,10 +110,14 @@ func main() {
"The max allowed size in bytes of a file in a Helm chart.")
flag.DurationVar(&requeueDependency, "requeue-dependency", 30*time.Second,
"The interval at which failing dependencies are reevaluated.")
+ flag.StringVar(&azureCloudConfig, "azure-cloud-config",
+ envOrDefault("AZURE_CLOUD_CONFIG", "/etc/kubernetes/azure.json"),
+ "Azure cloud config file.")
clientOptions.BindFlags(flag.CommandLine)
logOptions.BindFlags(flag.CommandLine)
leaderElectionOptions.BindFlags(flag.CommandLine)
+
flag.Parse()
ctrl.SetLogger(logger.NewLogger(logOptions))
@@ -123,18 +127,6 @@ func main() {
helm.MaxChartSize = helmChartLimit
helm.MaxChartFileSize = helmChartFileLimit
- var eventRecorder *events.Recorder
- if eventsAddr != "" {
- var err error
- if eventRecorder, err = events.NewRecorder(eventsAddr, controllerName); err != nil {
- setupLog.Error(err, "unable to create event recorder")
- os.Exit(1)
- }
- }
-
- metricsRecorder := metrics.NewRecorder()
- crtlmetrics.Registry.MustRegister(metricsRecorder.Collectors()...)
-
watchNamespace := ""
if !watchAllNamespaces {
watchNamespace = os.Getenv("RUNTIME_NAMESPACE")
@@ -163,18 +155,25 @@ func main() {
probes.SetupChecks(mgr, setupLog)
pprof.SetupHandlers(mgr, setupLog)
+ var eventRecorder *events.Recorder
+ if eventRecorder, err = events.NewRecorder(mgr, ctrl.Log, eventsAddr, controllerName); err != nil {
+ setupLog.Error(err, "unable to create event recorder")
+ os.Exit(1)
+ }
+
+ metricsH := helper.MustMakeMetrics(mgr)
+
if storageAdvAddr == "" {
storageAdvAddr = determineAdvStorageAddr(storageAddr, setupLog)
}
storage := mustInitStorage(storagePath, storageAdvAddr, setupLog)
if err = (&controllers.GitRepositoryReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- Storage: storage,
- EventRecorder: mgr.GetEventRecorderFor(controllerName),
- ExternalEventRecorder: eventRecorder,
- MetricsRecorder: metricsRecorder,
+ Client: mgr.GetClient(),
+ Scheme: mgr.GetScheme(),
+ Storage: storage,
+ EventRecorder: eventRecorder,
+ MetricsRecorder: metricsH.MetricsRecorder,
}).SetupWithManagerAndOptions(mgr, controllers.GitRepositoryReconcilerOptions{
MaxConcurrentReconciles: concurrent,
DependencyRequeueInterval: requeueDependency,
@@ -183,13 +182,12 @@ func main() {
os.Exit(1)
}
if err = (&controllers.HelmRepositoryReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- Storage: storage,
- Getters: getters,
- EventRecorder: mgr.GetEventRecorderFor(controllerName),
- ExternalEventRecorder: eventRecorder,
- MetricsRecorder: metricsRecorder,
+ Client: mgr.GetClient(),
+ Scheme: mgr.GetScheme(),
+ Storage: storage,
+ Getters: getters,
+ EventRecorder: eventRecorder,
+ MetricsRecorder: metricsH.MetricsRecorder,
}).SetupWithManagerAndOptions(mgr, controllers.HelmRepositoryReconcilerOptions{
MaxConcurrentReconciles: concurrent,
}); err != nil {
@@ -197,13 +195,12 @@ func main() {
os.Exit(1)
}
if err = (&controllers.HelmChartReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- Storage: storage,
- Getters: getters,
- EventRecorder: mgr.GetEventRecorderFor(controllerName),
- ExternalEventRecorder: eventRecorder,
- MetricsRecorder: metricsRecorder,
+ Client: mgr.GetClient(),
+ Scheme: mgr.GetScheme(),
+ Storage: storage,
+ Getters: getters,
+ EventRecorder: eventRecorder,
+ MetricsRecorder: metricsH.MetricsRecorder,
}).SetupWithManagerAndOptions(mgr, controllers.HelmChartReconcilerOptions{
MaxConcurrentReconciles: concurrent,
}); err != nil {
@@ -211,12 +208,11 @@ func main() {
os.Exit(1)
}
if err = (&controllers.BucketReconciler{
- Client: mgr.GetClient(),
- Scheme: mgr.GetScheme(),
- Storage: storage,
- EventRecorder: mgr.GetEventRecorderFor(controllerName),
- ExternalEventRecorder: eventRecorder,
- MetricsRecorder: metricsRecorder,
+ Client: mgr.GetClient(),
+ EventRecorder: eventRecorder,
+ Metrics: metricsH,
+ Storage: storage,
+ AzureCloudConfig: azureCloudConfig,
}).SetupWithManagerAndOptions(mgr, controllers.BucketReconcilerOptions{
MaxConcurrentReconciles: concurrent,
}); err != nil {
diff --git a/pkg/azure/cloudprovider/cloudprovider.go b/pkg/azure/cloudprovider/cloudprovider.go
new file mode 100644
index 000000000..b6d44ae51
--- /dev/null
+++ b/pkg/azure/cloudprovider/cloudprovider.go
@@ -0,0 +1,124 @@
+/*
+ MIT License
+
+ Copyright (c) Microsoft Corporation. All rights reserved.
+
+ Permission is hereby granted, free of charge, to any person obtaining a copy
+ of this software and associated documentation files (the "Software"), to deal
+ in the Software without restriction, including without limitation the rights
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ copies of the Software, and to permit persons to whom the Software is
+ furnished to do so, subject to the following conditions:
+
+ The above copyright notice and this permission notice shall be included in all
+ copies or substantial portions of the Software.
+
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ SOFTWARE
+*/
+// based on https://github.com/Azure/aad-pod-identity/blob/0fbc00f8b572ee780199ddb4489a94f1f01d3815/pkg/cloudprovider/cloudprovider.go
+
+package cloudprovider
+
+import (
+ "fmt"
+ "os"
+ "strings"
+
+ "github.com/Azure/aad-pod-identity/pkg/config"
+ "github.com/Azure/aad-pod-identity/pkg/utils"
+ "github.com/Azure/go-autorest/autorest"
+ "github.com/Azure/go-autorest/autorest/adal"
+ "github.com/Azure/go-autorest/autorest/azure"
+ "gopkg.in/yaml.v2"
+ "k8s.io/klog/v2"
+)
+
+// Client is a cloud provider client
+type Client struct {
+ Config config.AzureConfig
+ configFile string
+ Authorizer autorest.Authorizer
+}
+
+// NewCloudProvider returns a azure cloud provider client
+func NewCloudProvider(configFile string) (*Client, error) {
+ client := &Client{
+ configFile: configFile,
+ }
+ if err := client.Init(); err != nil {
+ return nil, fmt.Errorf("failed to initialize cloud provider client, error: %+v", err)
+ }
+ return client, nil
+}
+
+// Init initializes the cloud provider client based
+// on a config path or environment variables
+func (c *Client) Init() error {
+ c.Config = config.AzureConfig{}
+ if c.configFile != "" {
+ klog.V(6).Info("populating AzureConfig from azure.json")
+ bytes, err := os.ReadFile(c.configFile)
+ if err != nil {
+ return fmt.Errorf("failed to config file %s, error: %+v", c.configFile, err)
+ }
+ if err = yaml.Unmarshal(bytes, &c.Config); err != nil {
+ return fmt.Errorf("failed to unmarshal JSON, error: %+v", err)
+ }
+ } else {
+ klog.V(6).Info("populating AzureConfig from secret/environment variables")
+ c.Config.Cloud = os.Getenv("CLOUD")
+ c.Config.TenantID = os.Getenv("TENANT_ID")
+ c.Config.ClientID = os.Getenv("CLIENT_ID")
+ c.Config.ClientSecret = os.Getenv("CLIENT_SECRET")
+ c.Config.SubscriptionID = os.Getenv("SUBSCRIPTION_ID")
+ c.Config.ResourceGroupName = os.Getenv("RESOURCE_GROUP")
+ c.Config.VMType = os.Getenv("VM_TYPE")
+ c.Config.UseManagedIdentityExtension = strings.EqualFold(os.Getenv("USE_MSI"), "True")
+ c.Config.UserAssignedIdentityID = os.Getenv("USER_ASSIGNED_MSI_CLIENT_ID")
+ }
+
+ azureEnv, err := azure.EnvironmentFromName(c.Config.Cloud)
+ if err != nil {
+ return fmt.Errorf("failed to get cloud environment, error: %+v", err)
+ }
+
+ err = adal.AddToUserAgent("flux-source-controller")
+ if err != nil {
+ return fmt.Errorf("failed to add flux-source-controller to user agent, error: %+v", err)
+ }
+
+ oauthConfig, err := adal.NewOAuthConfig(azureEnv.ActiveDirectoryEndpoint, c.Config.TenantID)
+ if err != nil {
+ return fmt.Errorf("failed to create OAuth config, error: %+v", err)
+ }
+
+ var spt *adal.ServicePrincipalToken
+ if c.Config.UseManagedIdentityExtension {
+ klog.Infof("using user assigned identity: %s for authentication.", utils.RedactClientID(c.Config.UserAssignedIdentityID))
+ spt, err = adal.NewServicePrincipalTokenFromManagedIdentity(azureEnv.ResourceManagerEndpoint, &adal.ManagedIdentityOptions{
+ ClientID: c.Config.UserAssignedIdentityID,
+ })
+ if err != nil {
+ return fmt.Errorf("failed to get token from user-assigned identity, error: %+v", err)
+ }
+ } else { // This is the default scenario - use service principal to get the token.
+ spt, err = adal.NewServicePrincipalToken(
+ *oauthConfig,
+ c.Config.ClientID,
+ c.Config.ClientSecret,
+ azureEnv.ResourceManagerEndpoint,
+ )
+ if err != nil {
+ return fmt.Errorf("failed to get service principal token, error: %+v", err)
+ }
+ }
+
+ c.Authorizer = autorest.NewBearerAuthorizer(spt)
+ return nil
+}
diff --git a/pkg/gcp/gcp.go b/pkg/gcp/gcp.go
index 9127fcde3..f98e498c4 100644
--- a/pkg/gcp/gcp.go
+++ b/pkg/gcp/gcp.go
@@ -73,7 +73,8 @@ func ValidateSecret(secret map[string][]byte, name string) error {
func (c *GCPClient) BucketExists(ctx context.Context, bucketName string) (bool, error) {
_, err := c.Client.Bucket(bucketName).Attrs(ctx)
if err == gcpstorage.ErrBucketNotExist {
- return false, err
+ // Not returning error to be compatible with minio's API.
+ return false, nil
}
if err != nil {
return false, err