@@ -119,7 +119,7 @@ func New(cfg Config, kubeClient k8sutil.KubernetesClient, pgSpec spec.Postgresql
119
119
}
120
120
cluster .logger = logger .WithField ("pkg" , "cluster" ).WithField ("cluster-name" , cluster .clusterName ())
121
121
cluster .teamsAPIClient = teams .NewTeamsAPI (cfg .OpConfig .TeamsAPIUrl , logger )
122
- cluster .oauthTokenGetter = NewSecretOauthTokenGetter (& kubeClient , cfg .OpConfig .OAuthTokenSecretName )
122
+ cluster .oauthTokenGetter = newSecretOauthTokenGetter (& kubeClient , cfg .OpConfig .OAuthTokenSecretName )
123
123
cluster .patroni = patroni .New (cluster .logger )
124
124
125
125
return cluster
@@ -404,15 +404,15 @@ func (c *Cluster) compareStatefulSetWith(statefulSet *v1beta1.StatefulSet) *comp
404
404
return & compareStatefulsetResult {match : match , reasons : reasons , rollingUpdate : needsRollUpdate , replace : needsReplace }
405
405
}
406
406
407
- type ContainerCondition func (a , b v1.Container ) bool
407
+ type containerCondition func (a , b v1.Container ) bool
408
408
409
- type ContainerCheck struct {
410
- condition ContainerCondition
409
+ type containerCheck struct {
410
+ condition containerCondition
411
411
reason string
412
412
}
413
413
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 }
416
416
}
417
417
418
418
// compareContainers: compare containers from two stateful sets
@@ -422,18 +422,18 @@ func NewCheck(msg string, cond ContainerCondition) ContainerCheck {
422
422
func (c * Cluster ) compareContainers (setA , setB * v1beta1.StatefulSet ) (bool , []string ) {
423
423
reasons := make ([]string , 0 )
424
424
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" ,
427
427
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" ,
429
429
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" ,
431
431
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" ,
433
433
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" ,
435
435
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" ,
437
437
func (a , b v1.Container ) bool { return ! reflect .DeepEqual (a .EnvFrom , b .EnvFrom ) }),
438
438
}
439
439
@@ -630,6 +630,7 @@ func (c *Cluster) Delete() {
630
630
}
631
631
}
632
632
633
+ //NeedsRepair returns true if the cluster should be included in the repair scan (based on its in-memory status).
633
634
func (c * Cluster ) NeedsRepair () (bool , spec.PostgresStatus ) {
634
635
c .specMu .RLock ()
635
636
defer c .specMu .RUnlock ()
@@ -905,9 +906,9 @@ func (c *Cluster) shouldDeleteSecret(secret *v1.Secret) (delete bool, userName s
905
906
906
907
type simpleActionWithResult func () error
907
908
908
- type ClusterObjectGet func (name string ) (spec.NamespacedName , error )
909
+ type clusterObjectGet func (name string ) (spec.NamespacedName , error )
909
910
910
- type ClusterObjectDelete func (name string ) error
911
+ type clusterObjectDelete func (name string ) error
911
912
912
913
func (c * Cluster ) deletePatroniClusterObjects () error {
913
914
// TODO: figure out how to remove leftover patroni objects in other cases
@@ -924,8 +925,8 @@ func (c *Cluster) deletePatroniClusterObjects() error {
924
925
}
925
926
926
927
func (c * Cluster ) deleteClusterObject (
927
- get ClusterObjectGet ,
928
- del ClusterObjectDelete ,
928
+ get clusterObjectGet ,
929
+ del clusterObjectDelete ,
929
930
objType string ) error {
930
931
for _ , suffix := range patroniObjectSuffixes {
931
932
name := fmt .Sprintf ("%s-%s" , c .Name , suffix )
0 commit comments