New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
render: generate cloud config when infrastructure and configmap are provided #140
render: generate cloud config when infrastructure and configmap are provided #140
Conversation
pkg/cmd/render/render.go
Outdated
// Determine the platform type | ||
var platformName configv1.PlatformType | ||
if pstatus := clusterInfrastructure.Status.PlatformStatus; pstatus != nil { | ||
platformName = pstatus.Type | ||
} | ||
if len(platformName) == 0 { | ||
platformName = clusterInfrastructure.Status.Platform | ||
} | ||
|
||
// Determine the platform specific transformer method to use | ||
cloudConfigTransformers := kubecloudconfig.CloudConfigTransformers() | ||
cloudConfigTransformerFn, ok := cloudConfigTransformers[platformName] | ||
if !ok { | ||
cloudConfigTransformerFn = kubecloudconfig.DefaultCloudConfigTransformer() | ||
} | ||
target, err := cloudConfigTransformerFn(&cloudProviderConfigInput, clusterInfrastructure.Spec.CloudConfig.Key, &clusterInfrastructure) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
targetCloudConfigMap := kubecloudconfig.TargetConfigName() | ||
|
||
target.Name = kubecloudconfig.TargetConfigName() | ||
target.Namespace = operatorclient.GlobalMachineSpecifiedConfigNamespace | ||
/* ApplyConfigMap() */ | ||
|
||
targetCloudConfigMapData, err := yaml.Marshal(target) | ||
if err != nil { | ||
return err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
all this should be part of the kube_cloud_config package.
we can keep the load inputs in here, but how/when to generate the new cloud config file should be controlled by kube_cloud_config package. the sync also needs something like that so maybe we can re-use one implementation...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've moved the code to kube_cloud_config. I still need to look at sync() and perhaps generalize the transformer functions also.
47b92c2
to
f3417d3
Compare
f3417d3
to
d250cd1
Compare
d250cd1
to
edb88fb
Compare
29bfd4e
to
d23b37f
Compare
@jhixson74 can you open a PR on the installer showing how we will use this on the bootstrap host. you can then test these together using cluster-bot in slack
Option B:
|
d23b37f
to
f6b5e2b
Compare
f6b5e2b
to
6f540a1
Compare
/test e2e-azure |
/lgtm |
/retitle render: generate cloud config when infrastructure and configmap are provided To match e87cce2, because the current PR title doesn't talk about which ConfigMap. |
/approve |
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: abhinavdahiya, jhixson74, sttts The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
/retest Please review the full test history for this PR and help us cut down flakes. |
14 similar comments
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
/retest Please review the full test history for this PR and help us cut down flakes. |
@jhixson74: The following test failed, say
Full PR test history. Your PR dashboard. Instructions 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. |
/retest Please review the full test history for this PR and help us cut down flakes. |
Previously the cloud provider config map was sourced from the `.spec.cloudConf` of the infrastructure object. but to enable user input and stitching explained in [1] and [2], we added a controller to generate a cloud configuraration using the spec for use by kubelet and kube cloud controller manager. The new API defined in [3] creates a config map `openshift-config-managed/kube-cloud-config` with the configuration in `cloud.conf` key. We updated the in-cluster MCO to use the new API [4] but the MCO on bootstrap host was left untouched because the controller could not generated on the bootstrap host yet. But [5] and [6] intend to provide the same generated config map on the bootstrap host for MCO, and therefore we need the bootstrap MCO to read the key defined by the generated API but fallback to he spec key (old behavior) for backward compatibility. [1]: https://github.com/openshift/enhancements/blob/master/enhancements/installer/aws-custom-region-and-endpoints.md [2]: https://github.com/openshift/enhancements/blob/master/enhancements/installer/azure-support-known-cloud-environments.md [3]: https://github.com/openshift/api/blob/e21882127f24772e3b5388fe1fdc37669e8e1d04/config/v1/types_infrastructure.go#L26-L40 [4]: openshift#1658 [5]: openshift/cluster-config-operator#140 [6]: openshift/installer#3831
This relies on #133 and is included for now. When it can be shown that it works, I can remove those commits from this PR. This is very much a WIP, so please point out anywhere that I am going about things completely wrong ;-)
https://issues.redhat.com/browse/CORS-1458