def sbo_is_running_in_namespace(context, operator_namespace): """ Checks if the SBO is up and running in the given namespace """ sb_operator = Servicebindingoperator(namespace=operator_namespace) assert sb_operator.is_running(), "Service Binding Operator is not running" print("Service binding operator is running!!!")
def sbo_is_running_in_namespace(context, operator_namespace): """ Checks if the SBO is up and running in the given namespace """ sb_operator = Servicebindingoperator(namespace=operator_namespace) sb_operator.is_running() | should.be_truthy.desc("Service Binding Operator is running") print("Service binding operator is running!!!")
def check_service_account_bound(context, cluster_role_name, cluster_rolebinding_name): openshift = Openshift() sbr = Servicebindingoperator() operator_namespace = openshift.lookup_namespace_for_resource( "deployments", sbr.name) sa_name = openshift.get_resource_info_by_jsonpath( "deployments", sbr.name, operator_namespace, "{.spec.template.spec.serviceAccount}") rolebinding_json = openshift.get_json_resource("clusterrolebinding", cluster_rolebinding_name, operator_namespace) assert rolebinding_json["roleRef"][ "name"] == cluster_role_name, f"Could not find rolebinding for the role '{cluster_role_name}'" subjects_list = rolebinding_json["subjects"] subject_found = False for subject in subjects_list: if subject["kind"] == "ServiceAccount" and subject["name"] == sa_name: subject_found = True else: continue assert subject_found, f"Could not find rolebinding for the role '{cluster_role_name}'"