Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Shift to ServerVersion call to get version#640

Merged
underrun merged 2 commits intoksonnet:masterfrom
underrun:fix-k8s-version-openshift
Jun 29, 2018
Merged

Shift to ServerVersion call to get version#640
underrun merged 2 commits intoksonnet:masterfrom
underrun:fix-k8s-version-openshift

Conversation

@underrun
Copy link
Collaborator

instead of using OpenAPISchema for version because openshift stores its
own version data in Info.Version

this only addresses the app init section - there are other places where version info could be gathered for environments that will need to be addressed as well. before i head down that road i'm pushing this to check and see if this is the right direction to move in - which is why it's WIP right now.

related to #427

@underrun underrun requested a review from a team June 23, 2018 02:20
@coveralls
Copy link

coveralls commented Jun 23, 2018

Pull Request Test Coverage Report for Build 1076

  • 7 of 7 (100.0%) changed or added relevant lines in 1 file are covered.
  • 590 unchanged lines in 18 files lost coverage.
  • Overall coverage decreased (-1.0%) to 70.744%

Files with Coverage Reduction New Missed Lines %
pkg/registry/fs.go 3 65.54%
pkg/actions/actions.go 6 96.2%
pkg/util/jsonnet/vm.go 11 90.26%
pkg/registry/cache.go 12 73.63%
pkg/component/manager.go 12 57.53%
pkg/registry/schema.go 16 80.68%
pkg/app/app010.go 17 66.97%
pkg/pkg/helm.go 18 84.07%
pkg/pkg/local.go 18 78.49%
pkg/pkg/pkg.go 22 55.1%
Totals Coverage Status
Change from base Build 1055: -1.0%
Covered Lines: 10809
Relevant Lines: 15279

💛 - Coveralls

@bryanl
Copy link
Member

bryanl commented Jun 26, 2018

This won't be reviewed until the wip is removed.

@underrun underrun added the wip work in progress label Jun 26, 2018
@underrun underrun changed the title WIP: shift to ServerVersion call to get version Shift to ServerVersion call to get version Jun 26, 2018
instead of useing OpenAPISchema for version because openshift stores its
own version data in Info.Version

Signed-off-by: Derek Wilson <derek@heptio.com>
@underrun underrun force-pushed the fix-k8s-version-openshift branch from d3a76d0 to 9c08501 Compare June 26, 2018 18:33
Copy link
Member

@bryanl bryanl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes how ksonnet works. If at all possible, it should retrieve the cluster schema from the cluster itself.

Here is an example failure:

$ ks init mule --skip-default-registries
INFO Using context "gke_bryan-heptio_us-central1-a_dev-001" from kubeconfig file "/Users/bryan/.kube/config"
INFO Creating environment "default" with namespace "default", pointing to "version:v1.10.2-gke.1" cluster at address "https://35.175.192.254"
ERROR Received status code '404' when trying to retrieve OpenAPI schema for cluster version 'v1.10.2-gke.1' from URL 'https://raw.githubusercontent.com/kubernetes/kubernetes/v1.10.2-gke.1/api/openapi-spec/swagger.json'
To undo this simply delete directory 'mule' and re-run `ks init`.
If the error persists, try using flag '--context' to set a different context or run `ks init --help` for more options

because gke used - instead of + ... just look for version-ish thing
instead

Signed-off-by: Derek Wilson <derek@heptio.com>
@underrun underrun removed the wip work in progress label Jun 28, 2018
@underrun
Copy link
Collaborator Author

underrun commented Jun 28, 2018

@bryanl the reason it didn't work against GKE is because the git version representation was different than on openshift so rather than splitting on anything we can look for something that looks like a kubernetes version instead.

This also does hit the cluster to ask for version if at all possible. if it fails to hit the live cluster we fall back to 1.8.0 still. The major difference with this PR is that we are hitting the api at /version rather than /openapi/v2 - openshift doesn't include the kubernetes version in the swagger.json - it's only in the /version end point.

Also because /version has major and minor version but not patch, we can't just render the full version from parts - we need to parse the git version which includes commit info beyond the latest k8s tag (but does have major.minor.patch version info)

@underrun underrun merged commit 9903dad into ksonnet:master Jun 29, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants