projectriff-archive / cnab-k8s-installer-base

A CNAB bundle that allows creation of other declarative CNAB bundles
Apache License 2.0
0 stars 6 forks source link

Have riff install process check target k8s version #52

Open georgeharley opened 5 years ago

georgeharley commented 5 years ago

At present, running riff system install against a Kubernetes cluster that fails to meet the minimum version requirement of knative will appear to succeed but later on problems can occur when running other commands such as riff function create. It could be a big time saver if riff system install could detect that the target cluster did not meet the minimum k8s version requirement and so fail early.

georgeharley commented 5 years ago

As a bit of background on why this issue has been created:
I installed riff on a GKE cluster that had previously been created using the web console where the Kubernetes version had defaulted to 1.9.7. Running riff system install seemed to complete OK but when riff function create node square ... was run (as per the getting started guide for GKE) there was a failure message:

Error: function creation failed: RevisionMissing: Configuration "square" does not have any ready Revision.; Revision "square-00001" failed with message: "Unable to create pods for more than 120 seconds.".

Attempts to invoke the square function failed silently (a "HTTP 404 Not Found" could be seen when run verbosely though). The virtual service required to direct invocation request traffic to the function was also found not to exist (presumably because of the revision creation failure).

It was only after creating a new 1.10.7 GKE cluster and using that to install and run riff on that things worked as expected. Would be nice to catch that problem in riff system install so that it failed fast.

fbiville commented 5 years ago

As far as I understand, we can get the current k8s version like this:

kubectl version --output json | jq -r '(.serverVersion.major + "." + .serverVersion.minor)'
1.11
kubectl version --output json | jq -r '.serverVersion.gitVersion'
v1.11.5

I'm not completely sure about getting the mininal version requirement from Knative. Would the version of the transitive dependency k8s.io/api be enough?