@@ -1250,33 +1250,33 @@ var _ = Describe("StatefulSet", func() {
12501250 "&& chown 999:999 /var/lib/rabbitmq/.rabbitmqadmin.conf " +
12511251 "&& chmod 600 /var/lib/rabbitmq/.rabbitmqadmin.conf" ,
12521252 ),
1253- "VolumeMounts" : ConsistOf (
1254- corev1. VolumeMount {
1253+ "VolumeMounts" : ConsistOf ([]corev1. VolumeMount {
1254+ {
12551255 Name : "plugins-conf" ,
12561256 MountPath : "/tmp/rabbitmq-plugins/" ,
12571257 },
1258- corev1. VolumeMount {
1258+ {
12591259 Name : "rabbitmq-erlang-cookie" ,
12601260 MountPath : "/var/lib/rabbitmq/" ,
12611261 },
1262- corev1. VolumeMount {
1262+ {
12631263 Name : "erlang-cookie-secret" ,
12641264 MountPath : "/tmp/erlang-cookie-secret/" ,
12651265 },
1266- corev1. VolumeMount {
1266+ {
12671267 Name : "rabbitmq-plugins" ,
12681268 MountPath : "/operator" ,
12691269 },
1270- corev1. VolumeMount {
1270+ {
12711271 Name : "persistence" ,
12721272 MountPath : "/var/lib/rabbitmq/mnesia/" ,
12731273 },
1274- corev1. VolumeMount {
1274+ {
12751275 Name : "rabbitmq-confd" ,
12761276 MountPath : "/tmp/default_user.conf" ,
12771277 SubPath : "default_user.conf" ,
12781278 },
1279- ),
1279+ } ),
12801280 }))
12811281 })
12821282
@@ -1625,90 +1625,92 @@ var _ = Describe("StatefulSet", func() {
16251625 },
16261626 ))
16271627
1628- Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "rabbitmq" ).Env ).To (ConsistOf (
1629- corev1.EnvVar {
1630- Name : "test1" ,
1631- Value : "test1" ,
1632- },
1633- corev1.EnvVar {
1634- Name : "MY_POD_NAME" ,
1635- ValueFrom : & corev1.EnvVarSource {
1636- FieldRef : & corev1.ObjectFieldSelector {
1637- FieldPath : "metadata.name" ,
1638- APIVersion : "v1" ,
1628+ Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "rabbitmq" ).Env ).To (
1629+ ConsistOf ([]corev1.EnvVar {
1630+ {
1631+ Name : "test1" ,
1632+ Value : "test1" ,
1633+ },
1634+ {
1635+ Name : "MY_POD_NAME" ,
1636+ ValueFrom : & corev1.EnvVarSource {
1637+ FieldRef : & corev1.ObjectFieldSelector {
1638+ FieldPath : "metadata.name" ,
1639+ APIVersion : "v1" ,
1640+ },
16391641 },
16401642 },
1641- },
1642- corev1. EnvVar {
1643- Name : "MY_POD_NAMESPACE" ,
1644- ValueFrom : & corev1.EnvVarSource {
1645- FieldRef : & corev1. ObjectFieldSelector {
1646- FieldPath : "metadata.namespace " ,
1647- APIVersion : "v1" ,
1643+ {
1644+ Name : "MY_POD_NAMESPACE" ,
1645+ ValueFrom : & corev1. EnvVarSource {
1646+ FieldRef : & corev1.ObjectFieldSelector {
1647+ FieldPath : "metadata.namespace" ,
1648+ APIVersion : "v1 " ,
1649+ } ,
16481650 },
16491651 },
1650- },
1651- corev1.EnvVar {
1652- Name : "K8S_SERVICE_NAME" ,
1653- Value : instance .ChildResourceName ("nodes" ),
1654- },
1655- corev1.EnvVar {
1656- Name : "RABBITMQ_USE_LONGNAME" ,
1657- Value : "true" ,
1658- },
1659- corev1.EnvVar {
1660- Name : "RABBITMQ_ENABLED_PLUGINS_FILE" ,
1661- Value : "/operator/enabled_plugins" ,
1662- },
1663- corev1.EnvVar {
1664- Name : "RABBITMQ_NODENAME" ,
1665- Value : "rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)" ,
1666- },
1667- corev1.EnvVar {
1668- Name : "K8S_HOSTNAME_SUFFIX" ,
1669- Value : ".$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)" ,
1670- }))
1652+ {
1653+ Name : "K8S_SERVICE_NAME" ,
1654+ Value : instance .ChildResourceName ("nodes" ),
1655+ },
1656+ {
1657+ Name : "RABBITMQ_USE_LONGNAME" ,
1658+ Value : "true" ,
1659+ },
1660+ {
1661+ Name : "RABBITMQ_ENABLED_PLUGINS_FILE" ,
1662+ Value : "/operator/enabled_plugins" ,
1663+ },
1664+ {
1665+ Name : "RABBITMQ_NODENAME" ,
1666+ Value : "rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)" ,
1667+ },
1668+ {
1669+ Name : "K8S_HOSTNAME_SUFFIX" ,
1670+ Value : ".$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)" ,
1671+ }}))
16711672 Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "new-container-0" )).To (Equal (
16721673 corev1.Container {Name : "new-container-0" , Image : "my-image-0" }))
16731674 Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "new-container-1" )).To (Equal (
16741675 corev1.Container {Name : "new-container-1" , Image : "my-image-1" }))
1675- Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "rabbitmq" ).VolumeMounts ).To (ConsistOf (
1676- corev1.VolumeMount {
1677- Name : "test" ,
1678- MountPath : "test-path" ,
1679- },
1680- corev1.VolumeMount {
1681- Name : "persistence" ,
1682- MountPath : "/var/lib/rabbitmq/mnesia/" ,
1683- },
1684- corev1.VolumeMount {
1685- Name : "rabbitmq-confd" ,
1686- MountPath : "/etc/rabbitmq/conf.d/10-operatorDefaults.conf" ,
1687- SubPath : "operatorDefaults.conf" ,
1688- },
1689- corev1.VolumeMount {
1690- Name : "rabbitmq-confd" ,
1691- MountPath : "/etc/rabbitmq/conf.d/11-default_user.conf" ,
1692- SubPath : "default_user.conf" ,
1693- },
1694- corev1.VolumeMount {
1695- Name : "rabbitmq-confd" ,
1696- MountPath : "/etc/rabbitmq/conf.d/90-userDefinedConfiguration.conf" ,
1697- SubPath : "userDefinedConfiguration.conf" ,
1698- },
1699- corev1.VolumeMount {
1700- Name : "rabbitmq-erlang-cookie" ,
1701- MountPath : "/var/lib/rabbitmq/" ,
1702- },
1703- corev1.VolumeMount {
1704- Name : "pod-info" ,
1705- MountPath : "/etc/pod-info/" ,
1706- },
1707- corev1.VolumeMount {
1708- Name : "rabbitmq-plugins" ,
1709- MountPath : "/operator" ,
1710- },
1711- ))
1676+ Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "rabbitmq" ).VolumeMounts ).To (
1677+ ConsistOf ([]corev1.VolumeMount {
1678+ {
1679+ Name : "test" ,
1680+ MountPath : "test-path" ,
1681+ },
1682+ {
1683+ Name : "persistence" ,
1684+ MountPath : "/var/lib/rabbitmq/mnesia/" ,
1685+ },
1686+ {
1687+ Name : "rabbitmq-confd" ,
1688+ MountPath : "/etc/rabbitmq/conf.d/10-operatorDefaults.conf" ,
1689+ SubPath : "operatorDefaults.conf" ,
1690+ },
1691+ {
1692+ Name : "rabbitmq-confd" ,
1693+ MountPath : "/etc/rabbitmq/conf.d/11-default_user.conf" ,
1694+ SubPath : "default_user.conf" ,
1695+ },
1696+ {
1697+ Name : "rabbitmq-confd" ,
1698+ MountPath : "/etc/rabbitmq/conf.d/90-userDefinedConfiguration.conf" ,
1699+ SubPath : "userDefinedConfiguration.conf" ,
1700+ },
1701+ {
1702+ Name : "rabbitmq-erlang-cookie" ,
1703+ MountPath : "/var/lib/rabbitmq/" ,
1704+ },
1705+ {
1706+ Name : "pod-info" ,
1707+ MountPath : "/etc/pod-info/" ,
1708+ },
1709+ {
1710+ Name : "rabbitmq-plugins" ,
1711+ MountPath : "/operator" ,
1712+ },
1713+ }))
17121714 })
17131715
17141716 Context ("Rabbitmq Container volume mounts" , func () {
@@ -1824,8 +1826,8 @@ var _ = Describe("StatefulSet", func() {
18241826 Name : "K8S_SERVICE_NAME" ,
18251827 Value : "foo-nodes" ,
18261828 }))
1827- Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "rabbitmq" ).Env ).To (ConsistOf (
1828- corev1. EnvVar {
1829+ Expect (extractContainer (statefulSet .Spec .Template .Spec .Containers , "rabbitmq" ).Env ).To (ConsistOf ([]corev1. EnvVar {
1830+ {
18291831 Name : "MY_POD_NAME" ,
18301832 ValueFrom : & corev1.EnvVarSource {
18311833 FieldRef : & corev1.ObjectFieldSelector {
@@ -1834,7 +1836,7 @@ var _ = Describe("StatefulSet", func() {
18341836 },
18351837 },
18361838 },
1837- corev1. EnvVar {
1839+ {
18381840 Name : "MY_POD_NAMESPACE" ,
18391841 ValueFrom : & corev1.EnvVarSource {
18401842 FieldRef : & corev1.ObjectFieldSelector {
@@ -1843,34 +1845,34 @@ var _ = Describe("StatefulSet", func() {
18431845 },
18441846 },
18451847 },
1846- corev1. EnvVar {
1848+ {
18471849 Name : "test1" ,
18481850 Value : "test1" ,
18491851 },
1850- corev1. EnvVar {
1852+ {
18511853 Name : "K8S_SERVICE_NAME" ,
18521854 Value : instance .ChildResourceName ("nodes" ),
18531855 },
1854- corev1. EnvVar {
1856+ {
18551857 Name : "RABBITMQ_USE_LONGNAME" ,
18561858 Value : "false" ,
18571859 },
1858- corev1. EnvVar {
1860+ {
18591861 Name : "RABBITMQ_ENABLED_PLUGINS_FILE" ,
18601862 Value : "/operator/enabled_plugins" ,
18611863 },
1862- corev1. EnvVar {
1864+ {
18631865 Name : "RABBITMQ_NODENAME" ,
18641866 Value : "rabbit@$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)" ,
18651867 },
1866- corev1. EnvVar {
1868+ {
18671869 Name : "K8S_HOSTNAME_SUFFIX" ,
18681870 Value : ".$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)" ,
18691871 },
1870- corev1. EnvVar {
1872+ {
18711873 Name : "RABBITMQ_STREAM_ADVERTISED_HOST" ,
18721874 Value : "$(MY_POD_NAME).$(K8S_SERVICE_NAME).$(MY_POD_NAMESPACE)" ,
1873- }))
1875+ }} ))
18741876 })
18751877 })
18761878 })
0 commit comments