service#

State module for managing Kubernetes Service.

async idem_k8s.states.k8s.core.v1.service.present(hub, ctx, name: str, metadata: Dict, spec: Dict, resource_id: str = None, timeout: Dict = None) Dict[str, Any][source]#

create a Service

Parameters:
  • name (str) – An Idem name of the resource.

  • resource_id (str, Optional) – An identifier of the resource in the provider. Defaults to None.

  • metadata (dict) – Standard object’s metadata. More info: Kubernetes reference

  • spec (dict) – Spec defines the behavior of a service. More info: Kubernetes Spec reference

  • timeout (dict, Optional) –

    Timeout configuration for resource creation.

    • create (dict) – Timeout configuration for resource creation
      • delay(int, Optional) – The amount of time in seconds to wait between attempts. Defaults to 15 in case of None.

      • max_attempts(int, Optional) – Customized timeout configuration containing delay and max attempts. Defaults to 40 in case of None.

Request Syntax:
[service-name]:
  k8s.core.v1.service.present:
    - name: "string"
    - metadata: "Dict"
    - spec: "Dict"
    - resource_id: "string"
    - timeout: "Dict"
Returns:

Dict[str, Any]

Examples

resource_is_present:
  k8s.core.v1.service.present:
    - name: idem-test-service
    - metadata:
        name: idem-test-secret
        namespace: default
    - spec:
        type: NodePort
        selector:
          app: echo-hostname
        ports:
          - nodePort: 30163
            port: 8080
            targetPort: 80
async idem_k8s.states.k8s.core.v1.service.absent(hub, ctx, name: str, metadata: Dict = {'namespace': 'default'}, resource_id: str = None) Dict[str, Any][source]#

delete a Service

Parameters:
  • name (str) – An Idem name of the resource.

  • resource_id (str, Optional) – An identifier of the resource in the provider. Defaults to None.

  • metadata (dict, Optional) –

    Standard object’s metadata. Defaults to metadata with ‘default’ namespace, in case of value not provided in absent state. More info: Kubernetes reference

Request Syntax:
[service-name]:
   k8s.core.v1.service.absent:
     - name: 'string'
     - metadata: 'Dict'
     - resource_id: 'string'
Returns:

Dict[str, Any]

Examples

resource_is_absent:
  k8s.core.v1.service.absent:
    - name: value
    - metadata: value
async idem_k8s.states.k8s.core.v1.service.describe(hub, ctx) Dict[str, Dict[str, Any]][source]#

Describe the resource in a way that can be recreated/managed with the corresponding “present” function.

List or watch objects of kind Service

Returns:

Dict[str, Dict[str, Any]]

Examples

$ idem describe k8s.core.v1.service