Do not fail if imagePuller CRD does not exist (#700)
* Fix check if ImagePuller API is installed Signed-off-by: Anatolii Bazko <abazko@redhat.com> Co-authored-by: Anatolii Bazko <abazko@redhat.com>pull/714/head
parent
e0ff1bfbd9
commit
ddcabcb60c
|
|
@ -257,23 +257,27 @@ func SubscriptionsAreEqual(expected *operatorsv1alpha1.Subscription, actual *ope
|
|||
// foundKubernetesImagePullerAPI - true if the server discovers the che.eclipse.org API
|
||||
// error - any error returned by the call to discoveryClient.ServerGroups()
|
||||
func CheckNeededImagePullerApis(ctx *DeployContext) (bool, bool, bool, error) {
|
||||
groupList, err := ctx.ClusterAPI.DiscoveryClient.ServerGroups()
|
||||
groupList, resourcesList, err := ctx.ClusterAPI.DiscoveryClient.ServerGroupsAndResources()
|
||||
if err != nil {
|
||||
return false, false, false, err
|
||||
}
|
||||
groups := groupList.Groups
|
||||
foundPackagesAPI := false
|
||||
foundOperatorsAPI := false
|
||||
foundKubernetesImagePullerAPI := false
|
||||
for _, group := range groups {
|
||||
for _, group := range groupList {
|
||||
if group.Name == packagesv1.SchemeGroupVersion.Group {
|
||||
foundPackagesAPI = true
|
||||
}
|
||||
if group.Name == operatorsv1alpha1.SchemeGroupVersion.Group {
|
||||
foundOperatorsAPI = true
|
||||
}
|
||||
if group.Name == chev1alpha1.SchemeGroupVersion.Group {
|
||||
foundKubernetesImagePullerAPI = true
|
||||
}
|
||||
|
||||
for _, l := range resourcesList {
|
||||
for _, r := range l.APIResources {
|
||||
if l.GroupVersion == chev1alpha1.SchemeGroupVersion.String() && r.Kind == "KubernetesImagePuller" {
|
||||
foundKubernetesImagePullerAPI = true
|
||||
}
|
||||
}
|
||||
}
|
||||
return foundPackagesAPI, foundOperatorsAPI, foundKubernetesImagePullerAPI, nil
|
||||
|
|
|
|||
Loading…
Reference in New Issue