Skip to content

Commit

Permalink
Adapt new interface signature: OperatorClient, add func GetOperatorSt…
Browse files Browse the repository at this point in the history
…ateWithQuorum()

* xref libray-go commit for details: openshift/library-go@bd5e34c,
  openshift/library-go#1658

Signed-off-by: Swarup Ghosh <swghosh@redhat.com>
  • Loading branch information
swghosh committed Apr 22, 2024
1 parent 748a663 commit 2addc76
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions pkg/operator/operatorclient/operatorclient.go
Expand Up @@ -36,6 +36,7 @@ func (c OperatorClient) Informer() cache.SharedIndexInformer {
return c.Informers.Operator().V1alpha1().CertManagers().Informer()
}

// GetOperatorState uses a lister from shared informers
func (c OperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *operatorv1.OperatorStatus, string, error) {
instance, err := c.Informers.Operator().V1alpha1().CertManagers().Lister().Get("cluster")
if err != nil {
Expand All @@ -45,6 +46,16 @@ func (c OperatorClient) GetOperatorState() (*operatorv1.OperatorSpec, *operatorv
return &instance.Spec.OperatorSpec, &instance.Status.OperatorStatus, instance.ResourceVersion, nil
}

// GetOperatorStateWithQuorum performs direct server read
func (c OperatorClient) GetOperatorStateWithQuorum(ctx context.Context) (spec *operatorv1.OperatorSpec, status *operatorv1.OperatorStatus, resourceVersion string, err error) {
instance, err := c.Client.CertManagers().Get(ctx, "cluster", metav1.GetOptions{})
if err != nil {
return nil, nil, "", err
}

return &instance.Spec.OperatorSpec, &instance.Status.OperatorStatus, instance.ResourceVersion, nil
}

func GetUnsupportedConfigOverrides(operatorSpec *operatorv1.OperatorSpec) (*v1alpha1.UnsupportedConfigOverrides, error) {
if len(operatorSpec.UnsupportedConfigOverrides.Raw) != 0 {
out := &v1alpha1.UnsupportedConfigOverrides{}
Expand Down

0 comments on commit 2addc76

Please sign in to comment.