mirror of
https://github.com/stakater/Reloader.git
synced 2026-05-16 21:56:55 +00:00
24 lines
515 B
Go
24 lines
515 B
Go
package utils
|
|
|
|
import (
|
|
"k8s.io/client-go/discovery"
|
|
)
|
|
|
|
// HasDeploymentConfigSupport checks if the cluster has OpenShift DeploymentConfig API available.
|
|
func HasDeploymentConfigSupport(discoveryClient discovery.DiscoveryInterface) bool {
|
|
_, apiLists, err := discoveryClient.ServerGroupsAndResources()
|
|
if err != nil {
|
|
return false
|
|
}
|
|
|
|
for _, apiList := range apiLists {
|
|
for _, resource := range apiList.APIResources {
|
|
if resource.Kind == "DeploymentConfig" {
|
|
return true
|
|
}
|
|
}
|
|
}
|
|
|
|
return false
|
|
}
|