9494from crate .operator .config import config
9595from crate .operator .constants import (
9696 API_GROUP ,
97+ CRATE_CONTROL_PORT ,
9798 DATA_PVC_NAME_PREFIX ,
9899 DCUTIL_FILESERVER_URL ,
99100 DECOMMISSION_TIMEOUT ,
@@ -322,6 +323,12 @@ def get_statefulset_containers(
322323 sql_exporter_image = config .SQL_EXPORTER_IMAGE
323324 crate_control_image = config .CRATE_CONTROL_IMAGE
324325
326+ if config .CLOUD_PROVIDER == CloudProvider .OPENSHIFT and not crate_control_image :
327+ raise kopf .PermanentError (
328+ "CRATEDB_OPERATOR_CRATE_CONTROL_IMAGE must be set when "
329+ "CRATEDB_OPERATOR_CLOUD_PROVIDER=openshift"
330+ )
331+
325332 crate_container = V1Container (
326333 command = crate_command ,
327334 env = crate_env ,
@@ -434,7 +441,7 @@ def get_statefulset_containers(
434441 name = "crate-control" ,
435442 image = crate_control_image ,
436443 ports = [
437- V1ContainerPort (container_port = 5050 , name = "control" ),
444+ V1ContainerPort (container_port = CRATE_CONTROL_PORT , name = "control" ),
438445 ],
439446 env = [
440447 V1EnvVar (
@@ -452,11 +459,21 @@ def get_statefulset_containers(
452459 ),
453460 ],
454461 readiness_probe = V1Probe (
455- http_get = V1HTTPGetAction (path = "/health" , port = 5050 ),
462+ http_get = V1HTTPGetAction (path = "/health" , port = CRATE_CONTROL_PORT ),
456463 initial_delay_seconds = 20 ,
457464 period_seconds = 5 ,
458465 failure_threshold = 6 ,
459466 ),
467+ resources = V1ResourceRequirements (
468+ limits = {
469+ "cpu" : "100m" ,
470+ "memory" : "64Mi" ,
471+ },
472+ requests = {
473+ "cpu" : "50m" ,
474+ "memory" : "32Mi" ,
475+ },
476+ ),
460477 )
461478 )
462479
@@ -857,8 +874,6 @@ def get_statefulset(
857874 node_labels .update (node_spec .get ("labels" , {}))
858875 # This is to identify pods of the same cluster but with a different node type
859876 node_labels [LABEL_NODE_NAME ] = node_name
860- if config .CLOUD_PROVIDER == CloudProvider .OPENSHIFT :
861- node_labels ["tuned.openshift.io/cratedb" ] = ""
862877 full_pod_name_prefix = f"crate-{ node_name_prefix } { name } "
863878 image_registry , version = crate_image .rsplit (":" , 1 )
864879
@@ -999,10 +1014,10 @@ async def create_crate_scc(
9991014 plural = "securitycontextconstraints" ,
10001015 body = scc ,
10011016 )
1002- logger .info (f "Created SCC { scc_name } " )
1017+ logger .info ("Created SCC %s" , scc_name )
10031018 except ApiException as e :
10041019 if e .status == 409 : # Already exists
1005- logger .info (f "SCC { scc_name } already exists" )
1020+ logger .info ("SCC %s already exists" , scc_name )
10061021 else :
10071022 raise
10081023
@@ -1303,7 +1318,7 @@ def get_crate_control_service(
13031318 name : str ,
13041319 namespace : str ,
13051320 labels : Dict [str , str ],
1306- port : int = 5050 ,
1321+ port : int = CRATE_CONTROL_PORT ,
13071322) -> V1Service :
13081323 """
13091324 Create a headless service that exposes the crate-control sidecar of a
0 commit comments