Skip to content

Commit 7b95787

Browse files
committed
Pass --cluster-name to OpenStack CCM
By an terrible oversight, since the in-tree, OpenStack cloud provider was run without passing `--cluster-name` argument, meaning that it just used the default of "kubernetes" as the cluster name when constructing the names of the LB resources. Obviously this led to conflicts when there were multiple OCP clusters in a single OpenStack tenant and it's still a challenge for example for QE running tests on a single cloud. This issue couldn't be fixed easily, because we haven't had an upgrade story solved. Now kubernetes/cloud-provider-openstack#2552 is an attempt to make CCM rename the LBs when the cluster-name is reconfigured. This should allow us to finally solve the name conflict issues. This commit makes sure that CCMO deploys OpenStack CCM passing `--cluster-name`.
1 parent f8e0afd commit 7b95787

3 files changed

Lines changed: 12 additions & 6 deletions

File tree

pkg/cloud/openstack/assets/deployment.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ spec:
5454
env:
5555
- name: CLOUD_CONFIG
5656
value: /etc/openstack/config/cloud.conf
57+
- name: OCP_INFRASTRUCTURE_NAME
58+
value: {{ .infrastructureName }}
5759
command:
5860
- /bin/bash
5961
- -c
@@ -67,6 +69,7 @@ spec:
6769
--v=1 \
6870
--cloud-config=$(CLOUD_CONFIG) \
6971
--cloud-provider=openstack \
72+
--cluster-name=$(OCP_INFRASTRUCTURE_NAME) \
7073
--use-service-account-credentials=true \
7174
--configure-cloud-routes=false \
7275
--bind-address=127.0.0.1 \

pkg/cloud/openstack/openstack.go

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,10 @@ type imagesReference struct {
3232
}
3333

3434
var templateValuesValidationMap = map[string]interface{}{
35-
"images": "required",
36-
"cloudproviderName": "required,type(string)",
37-
"featureGates": "type(string)",
35+
"images": "required",
36+
"cloudproviderName": "required,type(string)",
37+
"featureGates": "type(string)",
38+
"infrastructureName": "required,type(string)",
3839
}
3940

4041
type openstackAssets struct {
@@ -48,9 +49,10 @@ func (o *openstackAssets) GetRenderedResources() []client.Object {
4849

4950
func getTemplateValues(images *imagesReference, operatorConfig config.OperatorConfig) (common.TemplateValues, error) {
5051
values := common.TemplateValues{
51-
"images": images,
52-
"cloudproviderName": operatorConfig.GetPlatformNameString(),
53-
"featureGates": operatorConfig.FeatureGates,
52+
"images": images,
53+
"cloudproviderName": operatorConfig.GetPlatformNameString(),
54+
"featureGates": operatorConfig.FeatureGates,
55+
"infrastructureName": operatorConfig.InfrastructureName,
5456
}
5557
_, err := govalidator.ValidateMap(values, templateValuesValidationMap)
5658
if err != nil {

pkg/cloud/openstack/openstack_test.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ func TestResourcesRenderingSmoke(t *testing.T) {
3131
}, {
3232
name: "Minimal allowed config",
3333
config: config.OperatorConfig{
34+
InfrastructureName: "infra-name",
3435
ImagesReference: config.ImagesReference{
3536
CloudControllerManagerOpenStack: "CloudControllerManagerOpenstack",
3637
},

0 commit comments

Comments
 (0)