Miscellaneous tidying of minor things
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
This commit is contained in:
		
							parent
							
								
									0d30be93ec
								
							
						
					
					
						commit
						2d927b9b9e
					
				| 
						 | 
				
			
			@ -24,7 +24,7 @@ import (
 | 
			
		|||
	helmaction "helm.sh/helm/v3/pkg/action"
 | 
			
		||||
	helmrelease "helm.sh/helm/v3/pkg/release"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/util/errors"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
	"sigs.k8s.io/controller-runtime/pkg/client"
 | 
			
		||||
	"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -42,7 +42,7 @@ func Diff(ctx context.Context, config *helmaction.Configuration, rls *helmreleas
 | 
			
		|||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	c, err := client.New(cfg, client.Options{DryRun: pointer.Bool(true)})
 | 
			
		||||
	c, err := client.New(cfg, client.Options{DryRun: ptr.To(true)})
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -549,6 +549,9 @@ func (r *HelmReleaseReconciler) adoptLegacyRelease(ctx context.Context, getter g
 | 
			
		|||
		action.WithStorage(action.DefaultStorageDriver, storageNamespace),
 | 
			
		||||
		action.WithStorageLog(action.NewDebugLog(ctrl.LoggerFrom(ctx).V(logger.TraceLevel))),
 | 
			
		||||
	)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return err
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// Get the last successful release based on the observation for the v2beta1
 | 
			
		||||
	// object.
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -512,7 +512,7 @@ func TestHelmReleaseReconciler_reconcileRelease(t *testing.T) {
 | 
			
		|||
			Status: v2.HelmReleaseStatus{
 | 
			
		||||
				HelmChart:                   chart.Namespace + "/" + chart.Name,
 | 
			
		||||
				LastReleaseRevision:         rls.Version,
 | 
			
		||||
				LastAttemptedValuesChecksum: valChecksum.Hex(),
 | 
			
		||||
				LastAttemptedValuesChecksum: valChecksum.Encoded(),
 | 
			
		||||
			},
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -321,7 +321,7 @@ func (r *AtomicRelease) actionForState(ctx context.Context, req *Request, state
 | 
			
		|||
		log.Info(msgWithReason("detected changes in cluster state", diff.SummarizeDiffSetBrief(state.Diff)))
 | 
			
		||||
		for _, change := range state.Diff {
 | 
			
		||||
			if change.Type == jsondiff.DiffTypeCreate || change.Type == jsondiff.DiffTypeUpdate {
 | 
			
		||||
				log.V(logger.DebugLevel).Info(fmt.Sprintf("observed change in cluster state"), "diff", change)
 | 
			
		||||
				log.V(logger.DebugLevel).Info("observed change in cluster state", "diff", change)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -33,7 +33,7 @@ import (
 | 
			
		|||
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
 | 
			
		||||
	"k8s.io/apimachinery/pkg/runtime/schema"
 | 
			
		||||
	"k8s.io/client-go/tools/record"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
	"sigs.k8s.io/controller-runtime/pkg/client/fake"
 | 
			
		||||
 | 
			
		||||
	"github.com/fluxcd/pkg/apis/meta"
 | 
			
		||||
| 
						 | 
				
			
			@ -616,7 +616,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
 | 
			
		|||
			spec: func(spec *v2.HelmReleaseSpec) {
 | 
			
		||||
				spec.Install = &v2.Install{
 | 
			
		||||
					Remediation: &v2.InstallRemediation{
 | 
			
		||||
						RemediateLastFailure: pointer.Bool(true),
 | 
			
		||||
						RemediateLastFailure: ptr.To(true),
 | 
			
		||||
					},
 | 
			
		||||
				}
 | 
			
		||||
				spec.Uninstall = &v2.Uninstall{
 | 
			
		||||
| 
						 | 
				
			
			@ -635,7 +635,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
 | 
			
		|||
			spec: func(spec *v2.HelmReleaseSpec) {
 | 
			
		||||
				spec.Install = &v2.Install{
 | 
			
		||||
					Remediation: &v2.InstallRemediation{
 | 
			
		||||
						RemediateLastFailure: pointer.Bool(true),
 | 
			
		||||
						RemediateLastFailure: ptr.To(true),
 | 
			
		||||
					},
 | 
			
		||||
				}
 | 
			
		||||
				spec.Test = &v2.Test{
 | 
			
		||||
| 
						 | 
				
			
			@ -740,7 +740,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
 | 
			
		|||
			spec: func(spec *v2.HelmReleaseSpec) {
 | 
			
		||||
				spec.Upgrade = &v2.Upgrade{
 | 
			
		||||
					Remediation: &v2.UpgradeRemediation{
 | 
			
		||||
						RemediateLastFailure: pointer.Bool(true),
 | 
			
		||||
						RemediateLastFailure: ptr.To(true),
 | 
			
		||||
					},
 | 
			
		||||
				}
 | 
			
		||||
			},
 | 
			
		||||
| 
						 | 
				
			
			@ -778,7 +778,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
 | 
			
		|||
				spec.Upgrade = &v2.Upgrade{
 | 
			
		||||
					Remediation: &v2.UpgradeRemediation{
 | 
			
		||||
						Strategy:             &strategy,
 | 
			
		||||
						RemediateLastFailure: pointer.Bool(true),
 | 
			
		||||
						RemediateLastFailure: ptr.To(true),
 | 
			
		||||
					},
 | 
			
		||||
				}
 | 
			
		||||
				spec.Uninstall = &v2.Uninstall{
 | 
			
		||||
| 
						 | 
				
			
			@ -816,7 +816,7 @@ func TestAtomicRelease_Reconcile_Scenarios(t *testing.T) {
 | 
			
		|||
			spec: func(spec *v2.HelmReleaseSpec) {
 | 
			
		||||
				spec.Upgrade = &v2.Upgrade{
 | 
			
		||||
					Remediation: &v2.UpgradeRemediation{
 | 
			
		||||
						RemediateLastFailure: pointer.Bool(true),
 | 
			
		||||
						RemediateLastFailure: ptr.To(true),
 | 
			
		||||
					},
 | 
			
		||||
				}
 | 
			
		||||
				spec.Test = &v2.Test{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -129,7 +129,7 @@ func DetermineReleaseState(ctx context.Context, cfg *action.ConfigFactory, req *
 | 
			
		|||
	case helmrelease.StatusFailed:
 | 
			
		||||
		return ReleaseState{Status: ReleaseStatusFailed}, nil
 | 
			
		||||
	case helmrelease.StatusUninstalled:
 | 
			
		||||
		return ReleaseState{Status: ReleaseStatusAbsent, Reason: fmt.Sprintf("found uninstalled release in storage")}, nil
 | 
			
		||||
		return ReleaseState{Status: ReleaseStatusAbsent, Reason: "found uninstalled release in storage"}, nil
 | 
			
		||||
	case helmrelease.StatusDeployed:
 | 
			
		||||
		// Verify the release is in sync with the desired configuration.
 | 
			
		||||
		if err = action.VerifyRelease(rls, cur, req.Chart.Metadata, req.Values); err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								main.go
								
								
								
								
							
							
						
						
									
										4
									
								
								main.go
								
								
								
								
							| 
						 | 
				
			
			@ -28,7 +28,7 @@ import (
 | 
			
		|||
	utilruntime "k8s.io/apimachinery/pkg/util/runtime"
 | 
			
		||||
	clientgoscheme "k8s.io/client-go/kubernetes/scheme"
 | 
			
		||||
	_ "k8s.io/client-go/plugin/pkg/client/auth/gcp"
 | 
			
		||||
	"k8s.io/utils/pointer"
 | 
			
		||||
	"k8s.io/utils/ptr"
 | 
			
		||||
	ctrl "sigs.k8s.io/controller-runtime"
 | 
			
		||||
	ctrlcache "sigs.k8s.io/controller-runtime/pkg/cache"
 | 
			
		||||
	ctrlclient "sigs.k8s.io/controller-runtime/pkg/client"
 | 
			
		||||
| 
						 | 
				
			
			@ -204,7 +204,7 @@ func main() {
 | 
			
		|||
			},
 | 
			
		||||
		},
 | 
			
		||||
		Controller: ctrlcfg.Controller{
 | 
			
		||||
			RecoverPanic:            pointer.Bool(true),
 | 
			
		||||
			RecoverPanic:            ptr.To(true),
 | 
			
		||||
			MaxConcurrentReconciles: concurrent,
 | 
			
		||||
		},
 | 
			
		||||
		Metrics: metricsserver.Options{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue