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

Function resourceExist

pkg/utils/discovery.go:118–135  ·  view source on GitHub ↗
(client discovery.DiscoveryInterface, groupVersion, kind string)

Source from the content-addressed store, hash-verified

116}
117
118func resourceExist(client discovery.DiscoveryInterface, groupVersion, kind string) (bool, error) {
119 apiResourceList, err := client.ServerResourcesForGroupVersion(groupVersion)
120 if err != nil {
121 if apierrors.IsNotFound(err) {
122 return false, nil
123 }
124
125 return false, err
126 }
127
128 for _, resource := range apiResourceList.APIResources {
129 if resource.Name == kind {
130 return true, nil
131 }
132 }
133
134 return false, nil
135}
136
137// DetectSecurityContextConstraints connects to the discovery API and find out if
138// we're running under a system that implements OpenShift Security Context Constraints

Callers 4

PodMonitorExistFunction · 0.85
DetectOLMFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected