@@ -830,8 +830,6 @@ fn build_server_rolegroup_daemonset(
830830 & v1alpha1:: Container :: BundleBuilder ,
831831 ) ;
832832
833- let opa_tls_config = opa. spec . cluster_config . tls . as_ref ( ) ;
834-
835833 cb_opa
836834 . image_from_product_image ( resolved_product_image)
837835 . command ( vec ! [
@@ -844,7 +842,7 @@ fn build_server_rolegroup_daemonset(
844842 . args ( vec ! [ build_opa_start_command(
845843 merged_config,
846844 & opa_container_name,
847- opa_tls_config ,
845+ opa . spec . cluster_config . tls_enabled ( ) ,
848846 ) ] )
849847 . add_env_vars ( env)
850848 . add_env_var (
@@ -858,7 +856,7 @@ fn build_server_rolegroup_daemonset(
858856 // .spec.template.spec.containers[name="opa"].ports: duplicate entries for key [containerPort=8081,protocol="TCP"]
859857 //
860858 // So we don't do that
861- if opa_tls_config . is_some ( ) {
859+ if opa . spec . cluster_config . tls_enabled ( ) {
862860 cb_opa. add_container_port ( service:: APP_TLS_PORT_NAME , service:: APP_TLS_PORT . into ( ) ) ;
863861 cb_opa
864862 . add_volume_mount ( TLS_VOLUME_NAME , TLS_STORE_DIR )
@@ -874,7 +872,7 @@ fn build_server_rolegroup_daemonset(
874872 . context ( AddVolumeMountSnafu ) ?
875873 . resources ( merged_config. resources . to_owned ( ) . into ( ) ) ;
876874
877- let ( probe_port_name, probe_scheme) = if opa_tls_config . is_some ( ) {
875+ let ( probe_port_name, probe_scheme) = if opa . spec . cluster_config . tls_enabled ( ) {
878876 ( service:: APP_TLS_PORT_NAME , Some ( "HTTPS" . to_string ( ) ) )
879877 } else {
880878 ( APP_PORT_NAME , Some ( "HTTP" . to_string ( ) ) )
@@ -949,7 +947,7 @@ fn build_server_rolegroup_daemonset(
949947 . service_account_name ( service_account. name_any ( ) )
950948 . security_context ( PodSecurityContextBuilder :: new ( ) . fs_group ( 1000 ) . build ( ) ) ;
951949
952- if let Some ( tls) = opa_tls_config {
950+ if let Some ( tls) = & opa . spec . cluster_config . tls {
953951 pb. add_volume (
954952 VolumeBuilder :: new ( TLS_VOLUME_NAME )
955953 . ephemeral (
@@ -1196,7 +1194,7 @@ fn build_config_file(merged_config: &v1alpha1::OpaConfig) -> String {
11961194fn build_opa_start_command (
11971195 merged_config : & v1alpha1:: OpaConfig ,
11981196 container_name : & str ,
1199- tls_config : Option < & v1alpha1 :: OpaTls > ,
1197+ tls_enabled : bool ,
12001198) -> String {
12011199 let mut file_log_level = DEFAULT_FILE_LOG_LEVEL ;
12021200 let mut console_log_level = DEFAULT_CONSOLE_LOG_LEVEL ;
@@ -1238,7 +1236,7 @@ fn build_opa_start_command(
12381236 }
12391237 }
12401238
1241- let ( bind_port, tls_flags) = if tls_config . is_some ( ) {
1239+ let ( bind_port, tls_flags) = if tls_enabled {
12421240 (
12431241 service:: APP_TLS_PORT ,
12441242 format ! (
0 commit comments