Close
    logoCloudomation Docs

    TaskK8S

    class tasks.task_k8s.TaskK8S

    Interact with a kubernetes cluster.

    This task enables you to interact with a remote kubernetes cluster. See the Official Python client library for kubernetes for a description of available APIs and methods.

    Inputs

    NameTypeDefaultDescription
    apistrNoneThe API to use. E.g. "CoreV1Api". Either document or api and method must be specified
    argslistNonePositional arguments to pass to the method call
    certificatestrThe CA certificate of the kubernetes cluster
    documentdictNoneA Kubernetes API object to apply. Either document or api and method must be specified
    grantstrNonethe name of an oauth grant to use for authentication. Either token, key, or grant must be specified
    hoststrThe hostname or IP of the kubernetes cluster to use
    keydictNoneThe content of the key file of the service account to use. Either token, key, or grant must be specified
    kwargsdictNoneKeyword arguments to pass to the method call
    methodstrNoneThe method to call. E.g. "create_namespaced_deployment". Either document or api and method must be specified
    parametersdictNoneDeprecated: Additional keyword parameters to pass to the method call
    tokenstrNoneThe bearer token to use for authentication. Either token, key, or grant must be specified

    Outputs

    NameTypeDefaultDescription
    resultdict
    execution_idintThe ID of the task execution
    messagestrThe ended message for the task. If the task ended with an error, the message will contain information about what went wrong
    statusstrThe ended status for the task. Either "success" or "error".

    Constants

    input_list = ['api', 'args', 'certificate', 'document', 'grant', 'host', 'key', 'kwargs', 'method', 'parameters', 'token']output_list = ['result']version = 1

    Methods

    run ()

    Example

    import yaml
    import flow_api
    def handler(system: flow_api.System, this: flow_api.Execution):
    nginx_deployment_str = system.file('nginx-deployment.yaml').get('content')
    nginx_deployment = yaml.safe_load(nginx_deployment_str)
    this.task(
    'K8S',
    token='*secret*',
    host='my-kubernetes-cluster-master',
    certificate='-----BEGIN CERTIFICATE-----\nMII...',
    api='ExtensionsV1beta1Api',
    method='create_namespaced_deployment',
    kwargs={
    'body': nginx_deployment,
    },
    )
    return this.success('all done')
    Previous
    TaskIMAP
    Next
    TaskLDAP