@@ -82,6 +82,16 @@ func StatefulSet(
8282 PeriodSeconds : 30 ,
8383 InitialDelaySeconds : 5 ,
8484 }
85+ novncLivenessProbe := & corev1.Probe {
86+ TimeoutSeconds : 10 ,
87+ PeriodSeconds : 30 ,
88+ InitialDelaySeconds : 5 ,
89+ }
90+ novncReadinessProbe := & corev1.Probe {
91+ TimeoutSeconds : 10 ,
92+ PeriodSeconds : 30 ,
93+ InitialDelaySeconds : 5 ,
94+ }
8595
8696 args := []string {"-c" , ServiceCommand }
8797
@@ -115,6 +125,12 @@ func StatefulSet(
115125 httpbootReadinessProbe .TCPSocket = & corev1.TCPSocketAction {
116126 Port : intstr.IntOrString {Type : intstr .Int , IntVal : int32 (8088 )},
117127 }
128+ novncLivenessProbe .TCPSocket = & corev1.TCPSocketAction {
129+ Port : intstr.IntOrString {Type : intstr .Int , IntVal : int32 (6090 )},
130+ }
131+ novncReadinessProbe .TCPSocket = & corev1.TCPSocketAction {
132+ Port : intstr.IntOrString {Type : intstr .Int , IntVal : int32 (6090 )},
133+ }
118134
119135 // Parse the storageRequest defined in the CR
120136 storageRequest , err := resource .ParseQuantity (instance .Spec .StorageRequest )
@@ -156,13 +172,18 @@ func StatefulSet(
156172 httpbootEnvVars ["KOLLA_CONFIG_STRATEGY" ] = env .SetValue ("COPY_ALWAYS" )
157173 httpbootEnvVars ["CONFIG_HASH" ] = env .SetValue (configHash )
158174
175+ novncEnvVars := map [string ]env.Setter {}
176+ novncEnvVars ["KOLLA_CONFIG_STRATEGY" ] = env .SetValue ("COPY_ALWAYS" )
177+ novncEnvVars ["CONFIG_HASH" ] = env .SetValue (configHash )
178+
159179 ramdiskLogsEnvVars := map [string ]env.Setter {}
160180 ramdiskLogsEnvVars ["KOLLA_CONFIG_STRATEGY" ] = env .SetValue ("COPY_ALWAYS" )
161181 ramdiskLogsEnvVars ["CONFIG_HASH" ] = env .SetValue (configHash )
162182
163183 volumes := GetVolumes (ctx , instance )
164184 conductorVolumeMounts := GetVolumeMounts ("ironic-conductor" )
165185 httpbootVolumeMounts := GetVolumeMounts ("httpboot" )
186+ novncVolumeMounts := GetVolumeMounts ("novnc" )
166187 dnsmasqVolumeMounts := GetVolumeMounts ("dnsmasq" )
167188 ramdiskLogsVolumeMounts := GetVolumeMounts ("ramdisk-logs" )
168189 initVolumeMounts := GetInitVolumeMounts (instance )
@@ -175,6 +196,7 @@ func StatefulSet(
175196 dnsmasqVolumeMounts = append (dnsmasqVolumeMounts , instance .Spec .TLS .CreateVolumeMounts (nil )... )
176197 ramdiskLogsVolumeMounts = append (ramdiskLogsVolumeMounts , instance .Spec .TLS .CreateVolumeMounts (nil )... )
177198 initVolumeMounts = append (initVolumeMounts , instance .Spec .TLS .CreateVolumeMounts (nil )... )
199+ novncVolumeMounts = append (novncVolumeMounts , instance .Spec .TLS .CreateVolumeMounts (nil )... )
178200 }
179201
180202 resourceName := fmt .Sprintf ("%s-%s" , ironic .ServiceName , ironic .ConductorComponent )
@@ -269,11 +291,29 @@ func StatefulSet(
269291 LivenessProbe : dnsmasqLivenessProbe ,
270292 // StartupProbe: startupProbe,
271293 }
272- containers = []corev1.Container {
273- conductorContainer ,
274- httpbootContainer ,
275- dnsmasqContainer ,
294+ containers = append (containers , dnsmasqContainer )
295+ }
296+
297+ if instance .Spec .GraphicalConsoles == "Enabled" {
298+ // Only include the novnc container if graphical consoles are enabled
299+ novncContainer := corev1.Container {
300+ Name : "novnc" ,
301+ Command : []string {
302+ "/bin/bash" ,
303+ },
304+ Args : args ,
305+ Image : instance .Spec .NoVNCProxyImage ,
306+ SecurityContext : & corev1.SecurityContext {
307+ RunAsUser : & runAsUser ,
308+ },
309+ Env : env .MergeEnvs ([]corev1.EnvVar {}, novncEnvVars ),
310+ VolumeMounts : novncVolumeMounts ,
311+ Resources : instance .Spec .Resources ,
312+ ReadinessProbe : novncReadinessProbe ,
313+ LivenessProbe : novncLivenessProbe ,
314+ // StartupProbe: startupProbe,
276315 }
316+ containers = append (containers , novncContainer )
277317 }
278318
279319 // Default oslo.service graceful_shutdown_timeout is 60, so align with that
@@ -346,6 +386,14 @@ func StatefulSet(
346386 // Build what the fully qualified Route hostname will be when the Route exists
347387 deployHTTPURL = "http://%(PodName)s-%(PodNamespace)s.%(IngressDomain)s/"
348388 }
389+ novncProxyURL := ""
390+ if instance .Spec .GraphicalConsoles == "Enabled" {
391+
392+ novncProtocol := "http"
393+ // TODO(stevebaker) detect if https should be used, and also for deployHTTPURL above
394+ novncDomain := "%(PodName)s-novnc-%(PodNamespace)s.%(IngressDomain)s"
395+ novncProxyURL = fmt .Sprintf ("%s://%s/vnc_auto.html" , novncProtocol , novncDomain )
396+ }
349397
350398 initContainerDetails := ironic.APIDetails {
351399 ContainerImage : instance .Spec .ContainerImage ,
@@ -362,6 +410,7 @@ func StatefulSet(
362410 ConductorInit : true ,
363411 Privileged : true ,
364412 DeployHTTPURL : deployHTTPURL ,
413+ NoVNCProxyURL : novncProxyURL ,
365414 IngressDomain : ingressDomain ,
366415 ProvisionNetwork : instance .Spec .ProvisionNetwork ,
367416 }
0 commit comments