MCPcopy Create free account
hub / github.com/cloudnative-pg/cloudnative-pg / PatchStatusCondition

Function PatchStatusCondition

tests/utils/openshift/openshift.go:82–102  ·  view source on GitHub ↗

PatchStatusCondition removes status conditions on a given Cluster

(
	ctx context.Context,
	crudClient client.Client,
	namespace, clusterName string,
)

Source from the content-addressed store, hash-verified

80
81// PatchStatusCondition removes status conditions on a given Cluster
82func PatchStatusCondition(
83 ctx context.Context,
84 crudClient client.Client,
85 namespace, clusterName string,
86) error {
87 cluster := &apiv1.Cluster{}
88 var err error
89 err = retry.RetryOnConflict(retry.DefaultBackoff, func() error {
90 cluster, err = clusterutils.Get(ctx, crudClient, namespace, clusterName)
91 if err != nil {
92 return err
93 }
94 clusterNoConditions := cluster.DeepCopy()
95 clusterNoConditions.Status.Conditions = nil
96 return crudClient.Patch(ctx, clusterNoConditions, client.MergeFrom(cluster))
97 })
98 if err != nil {
99 return err
100 }
101 return nil
102}
103
104// GetOpenshiftVersion returns the current openshift version
105func GetOpenshiftVersion(ctx context.Context, restConfig *rest.Config) (semver.Version, error) {

Callers

nothing calls this directly

Calls 3

DeepCopyMethod · 0.95
GetFunction · 0.92
PatchMethod · 0.45

Tested by

no test coverage detected