Skip to content

Commit 3d8c254

Browse files
committed
Create cloudrc file in openstackclient pod
We are currently only creating the `clouds.yaml` and `secure.yaml` in the `openstackclient` pod, and that is enough for the openstack client, but unfortunately this is not enough since there is no parity between that client and the individual clients. For example it is missing (though it has upstream patches in progress): - The `openstack volume service list` cannot show the cluster. - The `openstack volume service list` cannot show the backend state. - There is no support for any of the default volume type commands: set, show, list, unset. These are some of the ones we know about, but there could still be some other missing. Users will need to use the old `cinder` client, so we should make it convenient for them by having the `cloudrc` available in the `openstackclient` pod. Depends-On: openstack-k8s-operators/keystone-operator#432
1 parent ec29cbf commit 3d8c254

File tree

2 files changed

+15
-10
lines changed

2 files changed

+15
-10
lines changed

pkg/openstackclient/funcs.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ func clientPodVolumeMounts() []corev1.VolumeMount {
106106
MountPath: "/home/cloud-admin/.config/openstack/secure.yaml",
107107
SubPath: "secure.yaml",
108108
},
109+
{
110+
Name: "openstack-config-secret",
111+
MountPath: "/home/cloud-admin/cloudrc",
112+
SubPath: "cloudrc",
113+
},
109114
}
110115
}
111116

tests/functional/ctlplane/openstackoperator_controller_test.go

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -700,13 +700,13 @@ var _ = Describe("OpenStackOperator controller", func() {
700700
}
701701
g.Expect(vols).To(ContainElements("combined-ca-bundle", "openstack-config", "openstack-config-secret"))
702702

703-
volMounts := map[string]string{}
703+
volMounts := map[string][]string{}
704704
for _, x := range pod.Spec.Containers[0].VolumeMounts {
705-
volMounts[x.Name] = x.MountPath
705+
volMounts[x.Name] = append(volMounts[x.Name], x.MountPath)
706706
}
707-
g.Expect(volMounts).To(HaveKeyWithValue("combined-ca-bundle", "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"))
708-
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config", "/home/cloud-admin/.config/openstack/clouds.yaml"))
709-
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config-secret", "/home/cloud-admin/.config/openstack/secure.yaml"))
707+
g.Expect(volMounts).To(HaveKeyWithValue("combined-ca-bundle", []string{"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"}))
708+
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config", []string{"/home/cloud-admin/.config/openstack/clouds.yaml"}))
709+
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config-secret", []string{"/home/cloud-admin/.config/openstack/secure.yaml", "/home/cloud-admin/cloudrc"}))
710710

711711
// simulate pod being in the ready state
712712
th.SimulatePodReady(names.OpenStackClientName)
@@ -985,13 +985,13 @@ var _ = Describe("OpenStackOperator controller", func() {
985985
}
986986
g.Expect(vols).To(ContainElements("combined-ca-bundle", "openstack-config", "openstack-config-secret"))
987987

988-
volMounts := map[string]string{}
988+
volMounts := map[string][]string{}
989989
for _, x := range pod.Spec.Containers[0].VolumeMounts {
990-
volMounts[x.Name] = x.MountPath
990+
volMounts[x.Name] = append(volMounts[x.Name], x.MountPath)
991991
}
992-
g.Expect(volMounts).To(HaveKeyWithValue("combined-ca-bundle", "/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"))
993-
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config", "/home/cloud-admin/.config/openstack/clouds.yaml"))
994-
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config-secret", "/home/cloud-admin/.config/openstack/secure.yaml"))
992+
g.Expect(volMounts).To(HaveKeyWithValue("combined-ca-bundle", []string{"/etc/pki/ca-trust/extracted/pem/tls-ca-bundle.pem"}))
993+
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config", []string{"/home/cloud-admin/.config/openstack/clouds.yaml"}))
994+
g.Expect(volMounts).To(HaveKeyWithValue("openstack-config-secret", []string{"/home/cloud-admin/.config/openstack/secure.yaml", "/home/cloud-admin/cloudrc"}))
995995

996996
// simulate pod being in the ready state
997997
th.SimulatePodReady(names.OpenStackClientName)

0 commit comments

Comments
 (0)