@@ -17,7 +17,6 @@ import (
1717
1818 pg "github.com/fi-ts/postgreslet/api/v1"
1919 "github.com/go-logr/logr"
20- zalando "github.com/zalando/postgres-operator/pkg/apis/acid.zalan.do/v1"
2120 appsv1 "k8s.io/api/apps/v1"
2221 corev1 "k8s.io/api/core/v1"
2322 rbacv1 "k8s.io/api/rbac/v1"
@@ -188,23 +187,6 @@ func (m *OperatorManager) IsOperatorDeletable(ctx context.Context, namespace str
188187 return true , nil
189188}
190189
191- // IsOperatorInstalled returns true when the operator is installed
192- func (m * OperatorManager ) IsOperatorInstalled (ctx context.Context , namespace string ) (bool , error ) {
193- pods := & corev1.PodList {}
194- opts := []client.ListOption {
195- client .InNamespace (namespace ),
196- operatorPodMatchingLabels ,
197- }
198- if err := m .client .List (ctx , pods , opts ... ); err != nil {
199- return false , client .IgnoreNotFound (err )
200- }
201- if len (pods .Items ) == 0 {
202- return false , nil
203- }
204- m .log .Info ("operator is installed" , "ns" , namespace )
205- return true , nil
206- }
207-
208190// UninstallOperator uninstalls the operator
209191func (m * OperatorManager ) UninstallOperator (ctx context.Context , namespace string ) error {
210192 items := m .list .Items
@@ -672,29 +654,3 @@ func (m *OperatorManager) toObjectKey(obj runtime.Object, namespace string) (cli
672654 Name : name ,
673655 }, nil
674656}
675-
676- // UpdateAllManagedOperators Updates the manifests of all postgres operators managed by this postgreslet
677- func (m * OperatorManager ) UpdateAllManagedOperators (ctx context.Context ) error {
678- // fetch postgresql custom resource (running or otherwise)
679- m .log .Info ("Fetching all zalando custom resources managed by this postgreslet" )
680- matchingLabels := client.MatchingLabels {
681- pg .PartitionIDLabelName : m .options .PartitionID ,
682- }
683- zList := & zalando.PostgresqlList {}
684- opts := []client.ListOption {
685- matchingLabels ,
686- }
687- if err := m .client .List (ctx , zList , opts ... ); err != nil {
688- return client .IgnoreNotFound (err )
689- }
690- // update each namespace
691- for _ , z := range zList .Items {
692- m .log .Info ("Updating postgres operator installation" , "ns" , z .Namespace )
693- if err := m .InstallOrUpdateOperator (ctx , z .Namespace ); err != nil {
694- return err
695- }
696- }
697-
698- m .log .Info ("Done updating postgres operators in managed namespaces" )
699- return nil
700- }
0 commit comments