@@ -40,7 +40,7 @@ def getPackageManifest(dynClient: DynamicClient, packageName: str, catalogSource
4040 return manifestResource
4141
4242
43- def ensureOperatorGroupExists (dynClient : DynamicClient , env : Environment , namespace : str ):
43+ def ensureOperatorGroupExists (dynClient : DynamicClient , env : Environment , namespace : str , installMode : str = "OwnNamespace" ):
4444 # Create a new OperatorGroup if necessary
4545 operatorGroupsAPI = dynClient .resources .get (api_version = "operators.coreos.com/v1" , kind = "OperatorGroup" )
4646 operatorGroupList = operatorGroupsAPI .get (namespace = namespace )
@@ -49,7 +49,8 @@ def ensureOperatorGroupExists(dynClient: DynamicClient, env: Environment, namesp
4949 template = env .get_template ("operatorgroup.yml.j2" )
5050 renderedTemplate = template .render (
5151 name = "operatorgroup" ,
52- namespace = namespace
52+ namespace = namespace ,
53+ installMode = installMode
5354 )
5455 operatorGroup = yaml .safe_load (renderedTemplate )
5556 operatorGroupsAPI .apply (body = operatorGroup , namespace = namespace )
@@ -70,7 +71,7 @@ def getSubscription(dynClient: DynamicClient, namespace: str, packageName: str):
7071 return subscriptions .items [0 ]
7172
7273
73- def applySubscription (dynClient : DynamicClient , namespace : str , packageName : str , packageChannel : str = None , catalogSource : str = None , catalogSourceNamespace : str = "openshift-marketplace" , config : dict = None ):
74+ def applySubscription (dynClient : DynamicClient , namespace : str , packageName : str , packageChannel : str = None , catalogSource : str = None , catalogSourceNamespace : str = "openshift-marketplace" , config : dict = None , installMode : str = "OwnNamespace" ):
7475 """
7576 Usage:
7677 createSubscription(dynClient, "testns1", "sub1", "ibm-sls") # use default channel, & auto-detect CatalogSource
@@ -101,7 +102,7 @@ def applySubscription(dynClient: DynamicClient, namespace: str, packageName: str
101102 # Create the Namespace & OperatorGroup if necessary
102103 logger .debug (f"Setting up OperatorGroup in { namespace } " )
103104 createNamespace (dynClient , namespace )
104- ensureOperatorGroupExists (dynClient , env , namespace )
105+ ensureOperatorGroupExists (dynClient , env , namespace , installMode )
105106
106107 # Create (or update) the subscription
107108 subscriptionsAPI = dynClient .resources .get (api_version = "operators.coreos.com/v1alpha1" , kind = "Subscription" )
0 commit comments