OpenstackProviderSpec moved to machine v1alpha1#2117
Conversation
Since the recent revendor (openshift#2052 / 26a0b81), OpenstackProviderSpec (embedded in MachineSets under OpenStack) stopped being able to unmarshal. This is because its schema moved from github.com/openshift/cluster-api-provider-openstack to github.com/openshift/api/machine/v1alpha1 and the revendor picked up this move from the installer code: see openshift/installer#6382 This commit moves our references accordingly to match that upstream code. Quirk 1: Strangely, this one type is in o/api/machine v1alpha1 even though everything else in o/api/machine is in v1beta1. Quirk 2: o/api/machine v1alpha1's registration methods don't actually register the OpenstackProviderSpec type. (Why??) So we have to register it explicitly, as the installer does. This more or less reverts the prior attempt at openshift#2114 / 1f1ec2c, which turned out to be completely redundant (the added registration call ended up in the same place as the one on the previous line). HIVE-2308
|
/assign @lleshchi |
|
@2uasimojo: all tests passed! Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
Codecov Report
Additional details and impacted files@@ Coverage Diff @@
## master #2117 +/- ##
==========================================
- Coverage 57.55% 57.55% -0.01%
==========================================
Files 187 187
Lines 25815 25824 +9
==========================================
+ Hits 14859 14864 +5
- Misses 9711 9715 +4
Partials 1245 1245
|
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: 2uasimojo, lleshchi The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
tide seems to be sleeping. But I want to add some UT for this niche anyway. /hold |
Well, that turns out not to be possible. The existing UT for this code path is disabled, noted as broken, because the installer's MachineSets() func tries to call into OpenStack. We can't mock any part of this because there are no interfaces. We can't bypass it and call generateProviderSpec directly because it's private. And that's as low as we could go while still achieving the goal of matching the GroupVersion of the returned OpenstackProviderSpec. Le sigh. /hold cancel |
Another attempt to address the move of OpenstackProviderSpec from cluster-api-provider-openstack to openstack/api/machine. See openshift#2117 for background. In that PR, we simply replaced our imports. The result is that we could only decode the _new_ thing. The problem is that we may still get the _old_ thing if we're talking to an old cluster. We only need the decoding to steal the osImage from the master machines so we can use that value for new workers. Rather than importing both schemata, trying to figure out which version we're talking to, and decoding against the correct one, this commit unmarshals the providerSpec as raw JSON into an Unstructured object and explicitly paths into it map-wise. On the creation side, we're told that the spoke cluster itself will understand the new thing even if it's an old version (MAPI also unmarshals the JSON raw). So it should be fine to continue using recent vendored installer code to generate MachineSets (which will contain new-apiVersion OpenstackProviderSpec). HIVE-2308
Another attempt to address the move of OpenstackProviderSpec from cluster-api-provider-openstack to openstack/api/machine. See openshift#2117 for background. In that PR, we simply replaced our imports. The result is that we could only decode the _new_ thing. The problem is that we may still get the _old_ thing if we're talking to an old cluster. We only need the decoding to steal the osImage from the master machines so we can use that value for new workers. Rather than importing both schemata, trying to figure out which version we're talking to, and decoding against the correct one, this commit unmarshals the providerSpec as raw JSON into an Unstructured object and explicitly paths into it map-wise. On the creation side, we're told that the spoke cluster itself will understand the new thing even if it's an old version (MAPI also unmarshals the JSON raw). So it should be fine to continue using recent vendored installer code to generate MachineSets (which will contain new-apiVersion OpenstackProviderSpec). HIVE-2308
Another attempt to address the move of OpenstackProviderSpec from cluster-api-provider-openstack to openstack/api/machine. See openshift#2117 for background. In that PR, we simply replaced our imports. The result is that we could only decode the _new_ thing. The problem is that we may still get the _old_ thing if we're talking to an old cluster. We only need the decoding to steal the osImage from the master machines so we can use that value for new workers. Rather than importing both schemata, trying to figure out which version we're talking to, and decoding against the correct one, this commit unmarshals the providerSpec as raw JSON into an Unstructured object and explicitly paths into it map-wise. On the creation side, we're told that the spoke cluster itself will understand the new thing even if it's an old version (MAPI also unmarshals the JSON raw). So it should be fine to continue using recent vendored installer code to generate MachineSets (which will contain new-apiVersion OpenstackProviderSpec). HIVE-2308
Another attempt to address the move of OpenstackProviderSpec from cluster-api-provider-openstack to openstack/api/machine. See openshift#2117 for background. In that PR, we simply replaced our imports. The result is that we could only decode the _new_ thing. The problem is that we may still get the _old_ thing if we're talking to an old cluster. We only need the decoding to steal the osImage from the master machines so we can use that value for new workers. Rather than importing both schemata, trying to figure out which version we're talking to, and decoding against the correct one, this commit unmarshals the providerSpec as raw JSON into an Unstructured object and explicitly paths into it map-wise. On the creation side, we're told that the spoke cluster itself will understand the new thing even if it's an old version (MAPI also unmarshals the JSON raw). So it should be fine to continue using recent vendored installer code to generate MachineSets (which will contain new-apiVersion OpenstackProviderSpec). HIVE-2308
Another attempt to address the move of OpenstackProviderSpec from cluster-api-provider-openstack to openstack/api/machine. See openshift#2117 for background. In that PR, we simply replaced our imports. The result is that we could only decode the _new_ thing. The problem is that we may still get the _old_ thing if we're talking to an old cluster. We only need the decoding to steal the osImage from the master machines so we can use that value for new workers. Rather than importing both schemata, trying to figure out which version we're talking to, and decoding against the correct one, this commit unmarshals the providerSpec as raw JSON into an Unstructured object and explicitly paths into it map-wise. On the creation side, we're told that the spoke cluster itself will understand the new thing even if it's an old version (MAPI also unmarshals the JSON raw). So it should be fine to continue using recent vendored installer code to generate MachineSets (which will contain new-apiVersion OpenstackProviderSpec). HIVE-2308 (cherry picked from commit 28dac77)
Another attempt to address the move of OpenstackProviderSpec from cluster-api-provider-openstack to openstack/api/machine. See openshift#2117 for background. In that PR, we simply replaced our imports. The result is that we could only decode the _new_ thing. The problem is that we may still get the _old_ thing if we're talking to an old cluster. We only need the decoding to steal the osImage from the master machines so we can use that value for new workers. Rather than importing both schemata, trying to figure out which version we're talking to, and decoding against the correct one, this commit unmarshals the providerSpec as raw JSON into an Unstructured object and explicitly paths into it map-wise. On the creation side, we're told that the spoke cluster itself will understand the new thing even if it's an old version (MAPI also unmarshals the JSON raw). So it should be fine to continue using recent vendored installer code to generate MachineSets (which will contain new-apiVersion OpenstackProviderSpec). HIVE-2308 (cherry picked from commit 28dac77) (cherry picked from commit 567cdd3)
Since the recent revendor (#2052 / 26a0b81), OpenstackProviderSpec (embedded in MachineSets under OpenStack) stopped being able to unmarshal. This is because its schema moved from
github.com/openshift/cluster-api-provider-openstack to github.com/openshift/api/machine/v1alpha1 and the revendor picked up this move from the installer code: see
openshift/installer#6382
This commit moves our references accordingly to match that upstream code.
Quirk 1: Strangely, this one type is in o/api/machine v1alpha1 even though everything else in o/api/machine is in v1beta1.
Quirk 2: o/api/machine v1alpha1's registration methods don't actually register the OpenstackProviderSpec type. (Why??) So we have to register it explicitly, as the installer does.
This more or less reverts the prior attempt at #2114 / 1f1ec2c, which turned out to be completely redundant (the added registration call ended up in the same place as the one on the previous line).
HIVE-2308