deployment#

State module for managing Kubernetes Deployment.

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

create/update a Deployment

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) – Specification of the desired behavior of the Deployment.

  • 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

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

Returns:

Dict[str, Any]

Examples

resource_is_present:
  k8s.apps.v1.deployment.present:
  - metadata:
      name: nginx-deployment
      namespace: default
  - spec:
      replicas: 1
      selector:
        match_labels:
          app: nginx
      strategy:
        rolling_update:
          max_surge: 25%
          max_unavailable: 25%
        type: RollingUpdate
      template:
        metadata:
          labels:
            app: nginx
        spec:
          containers:
          - image: nginx:1.14.2
            image_pull_policy: IfNotPresent
            name: nginx
            ports:
            - container_port: 80
              protocol: TCP
            termination_message_path: /dev/termination-log
            termination_message_policy: File
          restart_policy: Always
async idem_k8s.states.k8s.apps.v1.deployment.absent(hub, ctx, name: str, metadata: Dict = {'namespace': 'default'}, resource_id: str = None, timeout: Dict = None) Dict[str, Any][source]#

Delete a Deployment

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

  • timeout (dict, Optional) –

    Timeout configuration for resource deletion.

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

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

Returns:

Dict[str, Any]

Examples

resource_is_absent:
  k8s.apps.v1.deployment.absent:
    - name: value
    - metadata: value
async idem_k8s.states.k8s.apps.v1.deployment.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 objects of kind Deployment in all namespaces

Returns:

Dict[str, Dict[str, Any]]

Examples

$ idem describe k8s.apps.v1.deployment