コード例 #1
0
    def create_pvc_and_deploymentconfig_pod(self, request, pvc_factory):
        """"""

        def finalizer():
            delete_deploymentconfig_pods(pod_obj)

        request.addfinalizer(finalizer)

        # Create pvc
        pvc_obj = pvc_factory()

        # Create service_account to get privilege for deployment pods
        sa_name = helpers.create_serviceaccount(pvc_obj.project.namespace)

        helpers.add_scc_policy(
            sa_name=sa_name.name, namespace=pvc_obj.project.namespace
        )

        pod_obj = helpers.create_pod(
            interface_type=constants.CEPHBLOCKPOOL,
            pvc_name=pvc_obj.name,
            namespace=pvc_obj.project.namespace,
            sa_name=sa_name.name,
            dc_deployment=True,
        )
        helpers.wait_for_resource_state(
            resource=pod_obj, state=constants.STATUS_RUNNING
        )
        return pod_obj, pvc_obj
コード例 #2
0
    def create_resource_hsbench(self):
        """
        Create resource for hsbench mark test:
            Create service account
            Create PVC
            Create golang pod

        """

        # Create service account
        self.sa_name = helpers.create_serviceaccount(self.namespace)
        self.sa_name = self.sa_name.name
        helpers.add_scc_policy(sa_name=self.sa_name, namespace=self.namespace)

        # Create test pvc+pod
        log.info(
            f"Create Golang pod to generate S3 workload... {self.namespace}")
        pvc_size = "50Gi"
        self.pod_name = "hsbench-pod"
        self.pvc_obj = helpers.create_pvc(
            sc_name=constants.DEFAULT_STORAGECLASS_RBD,
            namespace=self.namespace,
            size=pvc_size,
        )
        self.pod_obj = helpers.create_pod(
            constants.CEPHBLOCKPOOL,
            namespace=self.namespace,
            pod_name=self.pod_name,
            pvc_name=self.pvc_obj.name,
            sa_name=self.sa_name,
            pod_dict_path=self.pod_dic_path,
            dc_deployment=True,
            deploy_pod_status=constants.STATUS_COMPLETED,
        )
コード例 #3
0
def create_serviceaccount(request):
    """
    Create a service account
    """
    class_instance = request.node.cls

    def finalizer():
        """
        Delete the service account
        """
        helpers.remove_scc_policy(
            sa_name=class_instance.sa_obj.name,
            namespace=class_instance.project_obj.namespace,
        )
        class_instance.sa_obj.delete()

    request.addfinalizer(finalizer)

    class_instance.sa_obj = helpers.create_serviceaccount(
        namespace=class_instance.project_obj.namespace, )
    helpers.add_scc_policy(
        sa_name=class_instance.sa_obj.name,
        namespace=class_instance.project_obj.namespace,
    )
    assert class_instance.sa_obj, "Failed to create serviceaccount"
コード例 #4
0
 def create_and_set_namespace(self):
     """
     Create and set namespace for the pods to be created
     Create sa_name if Kind if DeploymentConfig
     """
     self.namespace_list.append(helpers.create_project())
     self.namespace = self.namespace_list[-1].namespace
     if self.dc_deployment:
         self.sa_name = helpers.create_serviceaccount(self.namespace)
         self.sa_name = self.sa_name.name
         helpers.add_scc_policy(sa_name=self.sa_name, namespace=self.namespace)
     else:
         self.sa_name = None
コード例 #5
0
ファイル: hsbench.py プロジェクト: ypersky1980/ocs-ci
    def create_resource_hsbench(self):
        """
        Create resource for hsbench mark test:
            Create service account
            Create PVC
            Create golang pod

        """
        # Check for existing rgw pods on cluster
        self.rgw_pod = pod.get_rgw_pods()
        if self.rgw_pod:
            # Create service account
            self.sa_name = helpers.create_serviceaccount(self.namespace)
            self.sa_name = self.sa_name.name
            helpers.add_scc_policy(sa_name=self.sa_name,
                                   namespace=self.namespace)

            # Create test pvc+pod
            log.info(
                f"Create Golang pod to generate S3 workload... {self.namespace}"
            )
            pvc_size = "50Gi"
            node_name = "compute-0"
            self.pod_name = "hsbench-pod"
            self.pvc_obj = helpers.create_pvc(
                sc_name=constants.DEFAULT_STORAGECLASS_RBD,
                namespace=self.namespace,
                size=pvc_size,
            )
            self.pod_obj = helpers.create_pod(
                constants.CEPHBLOCKPOOL,
                namespace=self.namespace,
                pod_name=self.pod_name,
                pvc_name=self.pvc_obj.name,
                node_name=node_name,
                sa_name=self.sa_name,
                pod_dict_path=self.pod_dic_path,
                dc_deployment=True,
                deploy_pod_status=constants.STATUS_COMPLETED,
            )
        else:
            raise UnexpectedBehaviour(
                "This cluster doesn't have RGW pod(s) to perform hsbench")