This role provides the openshift
module, that you can use to create
an openshift
task:
- name: "My ImageStream"
openshift:
state: latest
kind: ImageStream
name: "{{ image_name }}"
namespace: "{{ openshift_namespace }}"
content: |
kind: ImageStream
apiVersion: v1
metadata:
name: "{{ image_name }}"
namespace: "{{ openshift_namespace }}"
labels:
app: MyApp
This ensures that the Kubernetes object of the provided name
and
namespace
exists and (under state: latest
) that the desired state
(under content: |
) is a strict subset of the in-cluster state (as
retrieved with oc get -o yaml
). If that is not the case, the role
applies the desired mutations (using oc apply
if the object already
exists, and oc create
otherwise).
- A working
oc
orkubectl
command - Suitable access to the cluster (i.e. you must be logged in prior to running atask that uses this module)
- hosts: all
roles:
# Loads library/openshift.py to make it available to other plays;
# does nothing else by itself
- { role: epfl-idevelop.openshift_module }
- hosts: all
tasks:
- name: "My ImageStream"
openshift:
state: latest
kind: ImageStream
name: "{{ image_name }}"
namespace: "{{ openshift_namespace }}"
content: |
kind: ImageStream
apiVersion: v1
metadata:
name: "{{ image_name }}"
namespace: "{{ openshift_namespace }}"
labels:
app: MyApp
See additional documentation in the source code
This work may be freely distributed and re-used under the terms of the Apache License v2.0
This work contains code initially authored as part of Kubespray, reproduced and modified with permission under the terms of that same License.
Please contact EPFL IDEV-FSD [email protected].