summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/library
diff options
context:
space:
mode:
authorFabian von Feilitzsch <fabian@fabianism.us>2017-11-20 11:34:23 -0500
committerFabian von Feilitzsch <fabian@fabianism.us>2017-11-28 13:44:07 -0500
commit4f72e8a10da24aa231498c897db1153ef51ba2ee (patch)
tree14a8da11ac81e548d76086434aa2a2521cf52550 /roles/lib_openshift/library
parente7e699a4201754fe9ccd1b9adffad5be5fff18b3 (diff)
downloadopenshift-4f72e8a10da24aa231498c897db1153ef51ba2ee.tar.gz
openshift-4f72e8a10da24aa231498c897db1153ef51ba2ee.tar.bz2
openshift-4f72e8a10da24aa231498c897db1153ef51ba2ee.tar.xz
openshift-4f72e8a10da24aa231498c897db1153ef51ba2ee.zip
Bug 1512793- Fix idempotence issues in ASB deploy
- Add support for annotations in oc_service - Use oc_service instead of oc_obj - Use oc_pvc instead of oc_obj - Work around lack of idempotency for oc_obj DeploymentConfig
Diffstat (limited to 'roles/lib_openshift/library')
-rw-r--r--roles/lib_openshift/library/oc_adm_registry.py5
-rw-r--r--roles/lib_openshift/library/oc_adm_router.py5
-rw-r--r--roles/lib_openshift/library/oc_service.py16
3 files changed, 25 insertions, 1 deletions
diff --git a/roles/lib_openshift/library/oc_adm_registry.py b/roles/lib_openshift/library/oc_adm_registry.py
index 0771aa5a5..fe565987c 100644
--- a/roles/lib_openshift/library/oc_adm_registry.py
+++ b/roles/lib_openshift/library/oc_adm_registry.py
@@ -1993,6 +1993,7 @@ class ServiceConfig(object):
sname,
namespace,
ports,
+ annotations=None,
selector=None,
labels=None,
cluster_ip=None,
@@ -2004,6 +2005,7 @@ class ServiceConfig(object):
self.name = sname
self.namespace = namespace
self.ports = ports
+ self.annotations = annotations
self.selector = selector
self.labels = labels
self.cluster_ip = cluster_ip
@@ -2026,6 +2028,9 @@ class ServiceConfig(object):
self.data['metadata']['labels'] = {}
for lab, lab_value in self.labels.items():
self.data['metadata']['labels'][lab] = lab_value
+ if self.annotations:
+ self.data['metadata']['annotations'] = self.annotations
+
self.data['spec'] = {}
if self.ports:
diff --git a/roles/lib_openshift/library/oc_adm_router.py b/roles/lib_openshift/library/oc_adm_router.py
index 146f71f68..5550390e4 100644
--- a/roles/lib_openshift/library/oc_adm_router.py
+++ b/roles/lib_openshift/library/oc_adm_router.py
@@ -1559,6 +1559,7 @@ class ServiceConfig(object):
sname,
namespace,
ports,
+ annotations=None,
selector=None,
labels=None,
cluster_ip=None,
@@ -1570,6 +1571,7 @@ class ServiceConfig(object):
self.name = sname
self.namespace = namespace
self.ports = ports
+ self.annotations = annotations
self.selector = selector
self.labels = labels
self.cluster_ip = cluster_ip
@@ -1592,6 +1594,9 @@ class ServiceConfig(object):
self.data['metadata']['labels'] = {}
for lab, lab_value in self.labels.items():
self.data['metadata']['labels'][lab] = lab_value
+ if self.annotations:
+ self.data['metadata']['annotations'] = self.annotations
+
self.data['spec'] = {}
if self.ports:
diff --git a/roles/lib_openshift/library/oc_service.py b/roles/lib_openshift/library/oc_service.py
index 3e8aea4f1..c541e1bbd 100644
--- a/roles/lib_openshift/library/oc_service.py
+++ b/roles/lib_openshift/library/oc_service.py
@@ -90,6 +90,12 @@ options:
required: false
default: default
aliases: []
+ annotations:
+ description:
+ - Annotations to apply to the object
+ required: false
+ default: None
+ aliases: []
selector:
description:
- The selector to apply when filtering for services.
@@ -1471,6 +1477,7 @@ class ServiceConfig(object):
sname,
namespace,
ports,
+ annotations=None,
selector=None,
labels=None,
cluster_ip=None,
@@ -1482,6 +1489,7 @@ class ServiceConfig(object):
self.name = sname
self.namespace = namespace
self.ports = ports
+ self.annotations = annotations
self.selector = selector
self.labels = labels
self.cluster_ip = cluster_ip
@@ -1504,6 +1512,9 @@ class ServiceConfig(object):
self.data['metadata']['labels'] = {}
for lab, lab_value in self.labels.items():
self.data['metadata']['labels'][lab] = lab_value
+ if self.annotations:
+ self.data['metadata']['annotations'] = self.annotations
+
self.data['spec'] = {}
if self.ports:
@@ -1662,6 +1673,7 @@ class OCService(OpenShiftCLI):
sname,
namespace,
labels,
+ annotations,
selector,
cluster_ip,
portal_ip,
@@ -1674,7 +1686,7 @@ class OCService(OpenShiftCLI):
''' Constructor for OCVolume '''
super(OCService, self).__init__(namespace, kubeconfig, verbose)
self.namespace = namespace
- self.config = ServiceConfig(sname, namespace, ports, selector, labels,
+ self.config = ServiceConfig(sname, namespace, ports, annotations, selector, labels,
cluster_ip, portal_ip, session_affinity, service_type,
external_ips)
self.user_svc = Service(content=self.config.data)
@@ -1739,6 +1751,7 @@ class OCService(OpenShiftCLI):
oc_svc = OCService(params['name'],
params['namespace'],
params['labels'],
+ params['annotations'],
params['selector'],
params['clusterip'],
params['portalip'],
@@ -1840,6 +1853,7 @@ def main():
debug=dict(default=False, type='bool'),
namespace=dict(default='default', type='str'),
name=dict(default=None, type='str'),
+ annotations=dict(default=None, type='dict'),
labels=dict(default=None, type='dict'),
selector=dict(default=None, type='dict'),
clusterip=dict(default=None, type='str'),