When channel is unavailable, don't try to validate things from it

Update upup/pkg/fi/cloudup/apply_cluster.go

Co-authored-by: Ciprian Hacman <ciprianhacman@gmail.com>
This commit is contained in:
Ole Markus With 2020-07-13 13:21:39 +02:00
parent 40b92e7d29
commit 48a72467c2
1 changed files with 10 additions and 0 deletions

View File

@ -863,6 +863,11 @@ func (c *ApplyClusterCmd) validateKopsVersion() error {
return nil
}
if c.channel == nil {
klog.Warning("channel unavailable, skipping version validation")
return nil
}
versionInfo := kops.FindKopsVersionSpec(c.channel.Spec.KopsVersions, kopsVersion)
if versionInfo == nil {
klog.Warningf("unable to find version information for kops version %q in channel", kopsVersion)
@ -975,6 +980,11 @@ func (c *ApplyClusterCmd) validateKubernetesVersion() error {
// TODO: make util.ParseKubernetesVersion not return a pointer
kubernetesVersion := *parsed
if c.channel == nil {
klog.Warning("unable to load channel, skipping kubernetes version recommendation/requirements checks")
return nil
}
versionInfo := kops.FindKubernetesVersionSpec(c.channel.Spec.KubernetesVersions, kubernetesVersion)
if versionInfo == nil {
klog.Warningf("unable to find version information for kubernetes version %q in channel", kubernetesVersion)