@@ -119,7 +119,7 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec spec.Postgresql
119119 }
120120 cluster .logger = logger .WithField ("pkg" , "cluster" ).WithField ("cluster-name" , cluster .clusterName ())
121121 cluster .teamsAPIClient = teams .NewTeamsAPI (cfg .OpConfig .TeamsAPIUrl , logger )
122- cluster .oauthTokenGetter = NewSecretOauthTokenGetter (& kubeClient , cfg .OpConfig .OAuthTokenSecretName )
122+ cluster .oauthTokenGetter = newSecretOauthTokenGetter (& kubeClient , cfg .OpConfig .OAuthTokenSecretName )
123123 cluster .patroni = patroni .New (cluster .logger )
124124
125125 return cluster
@@ -404,15 +404,15 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *v1beta1.StatefulSet) *comp
404404 return & compareStatefulsetResult {match : match , reasons : reasons , rollingUpdate : needsRollUpdate , replace : needsReplace }
405405}
406406
407- type ContainerCondition func (a , b v1.Container ) bool
407+ type containerCondition func (a , b v1.Container ) bool
408408
409- type ContainerCheck struct {
410- condition ContainerCondition
409+ type containerCheck struct {
410+ condition containerCondition
411411 reason string
412412}
413413
414- func NewCheck (msg string , cond ContainerCondition ) ContainerCheck {
415- return ContainerCheck {reason : msg , condition : cond }
414+ func newCheck (msg string , cond containerCondition ) containerCheck {
415+ return containerCheck {reason : msg , condition : cond }
416416}
417417
418418// compareContainers: compare containers from two stateful sets
@@ -422,18 +422,18 @@ func NewCheck(msg string, cond ContainerCondition) ContainerCheck {
422422func (c * Cluster ) compareContainers (setA , setB * v1beta1.StatefulSet ) (bool , []string ) {
423423 reasons := make ([]string , 0 )
424424 needsRollUpdate := false
425- checks := []ContainerCheck {
426- NewCheck ("new statefulset's container %d name doesn't match the current one" ,
425+ checks := []containerCheck {
426+ newCheck ("new statefulset's container %d name doesn't match the current one" ,
427427 func (a , b v1.Container ) bool { return a .Name != b .Name }),
428- NewCheck ("new statefulset's container %d image doesn't match the current one" ,
428+ newCheck ("new statefulset's container %d image doesn't match the current one" ,
429429 func (a , b v1.Container ) bool { return a .Image != b .Image }),
430- NewCheck ("new statefulset's container %d ports don't match the current one" ,
430+ newCheck ("new statefulset's container %d ports don't match the current one" ,
431431 func (a , b v1.Container ) bool { return ! reflect .DeepEqual (a .Ports , b .Ports ) }),
432- NewCheck ("new statefulset's container %d resources don't match the current ones" ,
432+ newCheck ("new statefulset's container %d resources don't match the current ones" ,
433433 func (a , b v1.Container ) bool { return ! compareResources (& a .Resources , & b .Resources ) }),
434- NewCheck ("new statefulset's container %d environment doesn't match the current one" ,
434+ newCheck ("new statefulset's container %d environment doesn't match the current one" ,
435435 func (a , b v1.Container ) bool { return ! reflect .DeepEqual (a .Env , b .Env ) }),
436- NewCheck ("new statefulset's container %d environment sources don't match the current one" ,
436+ newCheck ("new statefulset's container %d environment sources don't match the current one" ,
437437 func (a , b v1.Container ) bool { return ! reflect .DeepEqual (a .EnvFrom , b .EnvFrom ) }),
438438 }
439439
@@ -630,6 +630,7 @@ func (c *Cluster) Delete() {
630630 }
631631}
632632
633+ //NeedsRepair returns true if the cluster should be included in the repair scan (based on its in-memory status).
633634func (c * Cluster ) NeedsRepair () (bool , spec.PostgresStatus ) {
634635 c .specMu .RLock ()
635636 defer c .specMu .RUnlock ()
@@ -905,9 +906,9 @@ func (c *Cluster) shouldDeleteSecret(secret *v1.Secret) (delete bool, userName s
905906
906907type simpleActionWithResult func () error
907908
908- type ClusterObjectGet func (name string ) (spec.NamespacedName , error )
909+ type clusterObjectGet func (name string ) (spec.NamespacedName , error )
909910
910- type ClusterObjectDelete func (name string ) error
911+ type clusterObjectDelete func (name string ) error
911912
912913func (c * Cluster ) deletePatroniClusterObjects () error {
913914 // TODO: figure out how to remove leftover patroni objects in other cases
@@ -924,8 +925,8 @@ func (c *Cluster) deletePatroniClusterObjects() error {
924925}
925926
926927func (c * Cluster ) deleteClusterObject (
927- get ClusterObjectGet ,
928- del ClusterObjectDelete ,
928+ get clusterObjectGet ,
929+ del clusterObjectDelete ,
929930 objType string ) error {
930931 for _ , suffix := range patroniObjectSuffixes {
931932 name := fmt .Sprintf ("%s-%s" , c .Name , suffix )
0 commit comments