def create_sagemaker_resource(
    resource_plural,
    resource_name,
    spec_file,
    replacements,
    namespace="default",
    wait_period=3,
    period_length=10,
):
    """
    Wrapper around k8s.load_and_create_resource to create a SageMaker resource
    """
    # Add a random sleep to prevent throttling exception before the call to load and create
    # This is because there may be many of the same resource ex: Multiple Models being created at the same time
    # If this occurs then a throttling exception may occur and cause the tests to fail, this sleep prevents this from occurring.
    rand = random.randrange(1, 4)
    time.sleep(rand)
    reference, spec, resource = k8s.load_and_create_resource(
        resource_directory,
        CRD_GROUP,
        CRD_VERSION,
        resource_plural,
        resource_name,
        spec_file,
        replacements,
        namespace,
        wait_period,
        period_length,
    )

    return reference, spec, resource
def create_adopted_resource(replacements,
                            namespace="default",
                            spec_file="adopted_resource_base"):
    """
    Wrapper around k8s.load_and_create_resource to create a Adopoted resource
    """

    reference, spec, resource = k8s.load_and_create_resource(
        resource_directory,
        ADOPTED_RESOURCE_CRD_GROUP,
        CRD_VERSION,
        "adoptedresources",
        replacements["ADOPTED_RESOURCE_NAME"],
        spec_file,
        replacements,
        namespace,
    )

    return reference, spec, resource
Exemple #3
0
def create_s3_resource(resource_plural,
                       resource_name,
                       spec_file,
                       replacements,
                       namespace="default"):
    """
    Wrapper around k8s.load_and_create_resource to create an S3 resource
    """

    reference, spec, resource = resource.load_and_create_resource(
        resource_directory,
        CRD_GROUP,
        CRD_VERSION,
        resource_plural,
        resource_name,
        spec_file,
        replacements,
        namespace,
    )

    return reference, spec, resource
def create_resource(
    resource_plural,
    resource_name,
    spec_file,
    replacements,
    namespace="default",
):
    """Wrapper around acktest.k8s.load_and_create_resource to create a CR
    through the k8s API.
    """
    reference, spec, resource = resource.load_and_create_resource(
        resource_directory,
        CRD_GROUP,
        CRD_VERSION,
        resource_plural,
        resource_name,
        spec_file,
        replacements,
        namespace,
    )

    return reference, spec, resource