@@ -127,6 +127,12 @@ class Config(object):
127127 # The minimal version of OPM which requires setting the --migrate-level flag for migrate
128128 iib_opm_new_migrate_version = "v1.46.0"
129129
130+ # Konflux configuration for cross-cluster access
131+ iib_konflux_cluster_url : Optional [str ] = None
132+ iib_konflux_cluster_token : Optional [str ] = None
133+ iib_konflux_cluster_ca_cert : Optional [str ] = None
134+ iib_konflux_namespace : str = 'iib-tenant'
135+
130136
131137class ProductionConfig (Config ):
132138 """The production IIB Celery configuration."""
@@ -326,6 +332,7 @@ def validate_celery_config(conf: app.utils.Settings, **kwargs) -> None:
326332
327333 _validate_multiple_opm_mapping (conf ['iib_ocp_opm_mapping' ])
328334 _validate_iib_org_customizations (conf ['iib_organization_customizations' ])
335+ _validate_konflux_config (conf )
329336
330337 if conf .get ('iib_aws_s3_bucket_name' ):
331338 if not isinstance (conf ['iib_aws_s3_bucket_name' ], str ):
@@ -481,6 +488,46 @@ def _validate_iib_org_customizations(
481488 )
482489
483490
491+ def _validate_konflux_config (conf : app .utils .Settings ) -> None :
492+ """
493+ Validate Konflux configuration variables.
494+
495+ :param celery.app.utils.Settings conf: the Celery application configuration to validate
496+ :raises iib.exceptions.ConfigError: if the configuration is invalid
497+ """
498+ konflux_url = conf .get ('iib_konflux_cluster_url' )
499+ konflux_token = conf .get ('iib_konflux_cluster_token' )
500+ konflux_ca_cert = conf .get ('iib_konflux_cluster_ca_cert' )
501+
502+ if any ([konflux_url , konflux_token , konflux_ca_cert ]):
503+ _validate_konflux_required_fields (konflux_url , konflux_token , konflux_ca_cert )
504+ _validate_konflux_field_types (konflux_url , konflux_token , konflux_ca_cert )
505+
506+
507+ def _validate_konflux_required_fields (konflux_url , konflux_token , konflux_ca_cert ):
508+ """Validate that all required Konflux fields are provided."""
509+ if not konflux_url :
510+ raise ConfigError ('iib_konflux_cluster_url must be set when using Konflux configuration' )
511+ if not konflux_token :
512+ raise ConfigError ('iib_konflux_cluster_token must be set when using Konflux configuration' )
513+ if not konflux_ca_cert :
514+ raise ConfigError (
515+ 'iib_konflux_cluster_ca_cert must be set when using Konflux configuration'
516+ )
517+
518+
519+ def _validate_konflux_field_types (konflux_url , konflux_token , konflux_ca_cert ):
520+ """Validate the types and formats of Konflux configuration fields."""
521+ if not isinstance (konflux_url , str ) or not konflux_url .startswith ('https://' ):
522+ raise ConfigError ('iib_konflux_cluster_url must be a valid HTTPS URL' )
523+
524+ if not isinstance (konflux_token , str ):
525+ raise ConfigError ('iib_konflux_cluster_token must be a string' )
526+
527+ if not isinstance (konflux_ca_cert , str ):
528+ raise ConfigError ('iib_konflux_cluster_ca_cert must be a string' )
529+
530+
484531def get_worker_config () -> app .utils .Settings :
485532 """Return the Celery configuration."""
486533 # Import this here to avoid a circular import
0 commit comments