Coder Social home page Coder Social logo

ansible-k8s-status-module's Introduction

k8s_status

Update the status for a Kubernetes API resource

Author: Fabian von Feilitzsch (@fabianvf)

Version added: 2.7


Table of Contents


Requirements

  • python >= 2.7
  • openshift >= 0.8.1
  • PyYAML >= 3.11

Synopsis

Sets the status field on a Kubernetes API resource. Only should be used if you are using Ansible to implement a controller for the resource being modified.

Options

Parameter aliases required default choices comments
api_key Token used to authenticate with the API. Can also be specified via K8S_AUTH_API_KEY environment variable.
api_version api, version yes Use to specify the API version. Use in conjunction with I(kind), I(name), and I(namespace) to identify a specific object.
cert_file Path to a certificate used to authenticate with the API. Can also be specified via K8S_AUTH_CERT_FILE environment variable.
conditions A list of condition objects that will be set on the status.conditions field of the specified resource. Unless I(force) is C(true) the specified conditions will be merged with the conditions already set on the status field of the specified resource. Each element in the list will be validated according to the conventions specified in the Kubernetes API conventions document. The fields supported for each condition are: type (required), status (required, one of "True", "False", "Unknown"), reason (single CamelCase word), message, lastHeartbeatTime (RFC3339 datetime string), and lastTransitionTime (RFC3339 datetime string). One of I(status) or I(conditions) is required.'
context The name of a context found in the config file. Can also be specified via K8S_AUTH_CONTEXT environment variable.
force False If set to C(True), the status will be set using PUT rather than PATCH, replacing the full status object.
host Provide a URL for accessing the API. Can also be specified via K8S_AUTH_HOST environment variable.
key_file Path to a key file used to authenticate with the API. Can also be specified via K8S_AUTH_KEY_FILE environment variable.
kind yes Use to specify an object model. Use in conjunction with I(api_version), I(name), and I(namespace) to identify a specific object.
kubeconfig Path to an instance Kubernetes config file. If not provided, and no other connection options are provided, the openshift client will attempt to load the default configuration file from I(~/.kube/config.json). Can also be specified via K8S_AUTH_KUBECONFIG environment variable.
name yes Use to specify an object name. Use in conjunction with I(api_version), I(kind) and I(namespace) to identify a specific object.
namespace Use to specify an object namespace. Use in conjunction with I(api_version), I(kind), and I(name) to identify a specific object.
password Provide a password for authenticating with the API. Can also be specified via K8S_AUTH_PASSWORD environment variable.
ssl_ca_cert Path to a CA certificate used to authenticate with the API. Can also be specified via K8S_AUTH_SSL_CA_CERT environment variable.
status {u'A object containing key': u'value pairs that will be set on the status object of the specified resource.'} One of I(status) or I(conditions) is required.
username Provide a username for authenticating with the API. Can also be specified via K8S_AUTH_USERNAME environment variable.
verify_ssl Whether or not to verify the API server's SSL certificates. Can also be specified via K8S_AUTH_VERIFY_SSL environment variable.

Examples

---

- name: Set custom status fields on TestCR
  k8s_status:
    api_version: apps.example.com/v1alpha1
    kind: TestCR
    name: my-test
    namespace: testing
    status:
        hello: world
        custom: entries

- name: Update the standard condition of an Ansible Operator
  k8s_status:
    api_version: apps.example.com/v1alpha1
    kind: TestCR
    name: my-test
    namespace: testing
    conditions:
    - type: Running
      status: "True"
      reason: MigrationStarted
      message: "Migration from v2 to v3 has begun"
      lastTransitionTime: "{{ ansible_date_time.iso8601 }}"

- name: |
    Create custom conditions. WARNING: The default Ansible Operator status management
    will never overwrite custom conditions, so they will persist indefinitely. If you
    want the values to change or be removed, you will need to clean them up manually.
  k8s_status:
    conditions:
    - type: Available
      status: "False"
      reason: PingFailed
      message: "The service did not respond to a ping"

Return

result:
  description:
  - If a change was made, will return the patched object, otherwise returns the instance object.
  returned: success
  type: complex
  contains:
     api_version:
       description: The versioned schema of this representation of an object.
       returned: success
       type: str
     kind:
       description: Represents the REST resource this object represents.
       returned: success
       type: str
     metadata:
       description: Standard object metadata. Includes name, namespace, annotations, labels, etc.
       returned: success
       type: complex
     spec:
       description: Specific attributes of the object. Will vary based on the I(api_version) and I(kind).
       returned: success
       type: complex
     status:
       description: Current status details for the object.
       returned: success
       type: complex

ansible-k8s-status-module's People

Contributors

fabianvf avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.