summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/lib/route.py
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-01-19 12:24:52 -0500
committerKenny Woodson <kwoodson@redhat.com>2017-01-20 11:52:10 -0500
commit6218b9938b523c545a7610a3c77d6a19aea81e1a (patch)
treeb98fa3931aff326c10fec573c442e283d3d6f9bf /roles/lib_openshift/src/lib/route.py
parent836bd8115c7d9386b9f5d3d6cca41785853c16c7 (diff)
downloadopenshift-6218b9938b523c545a7610a3c77d6a19aea81e1a.tar.gz
openshift-6218b9938b523c545a7610a3c77d6a19aea81e1a.tar.bz2
openshift-6218b9938b523c545a7610a3c77d6a19aea81e1a.tar.xz
openshift-6218b9938b523c545a7610a3c77d6a19aea81e1a.zip
Adding version to lib_openshift
Diffstat (limited to 'roles/lib_openshift/src/lib/route.py')
-rw-r--r--roles/lib_openshift/src/lib/route.py25
1 files changed, 23 insertions, 2 deletions
diff --git a/roles/lib_openshift/src/lib/route.py b/roles/lib_openshift/src/lib/route.py
index df062b0dd..3130e7358 100644
--- a/roles/lib_openshift/src/lib/route.py
+++ b/roles/lib_openshift/src/lib/route.py
@@ -17,7 +17,9 @@ class RouteConfig(object):
key=None,
host=None,
tls_termination=None,
- service_name=None):
+ service_name=None,
+ wildcard_policy=None,
+ weight=None):
''' constructor for handling route options '''
self.kubeconfig = kubeconfig
self.name = sname
@@ -30,6 +32,12 @@ class RouteConfig(object):
self.key = key
self.service_name = service_name
self.data = {}
+ self.wildcard_policy = wildcard_policy
+ if wildcard_policy is None:
+ self.wildcard_policy = 'None'
+ self.weight = weight
+ if weight is None:
+ self.weight = 100
self.create_dict()
@@ -54,14 +62,19 @@ class RouteConfig(object):
self.data['spec']['tls']['certificate'] = self.cert
self.data['spec']['tls']['termination'] = self.tls_termination
- self.data['spec']['to'] = {'kind': 'Service', 'name': self.service_name}
+ self.data['spec']['to'] = {'kind': 'Service',
+ 'name': self.service_name,
+ 'weight': self.weight}
+ self.data['spec']['wildcardPolicy'] = self.wildcard_policy
# pylint: disable=too-many-instance-attributes,too-many-public-methods
class Route(Yedit):
''' Class to wrap the oc command line tools '''
+ wildcard_policy = "spec.wildcardPolicy"
host_path = "spec.host"
service_path = "spec.to.name"
+ weight_path = "spec.to.weight"
cert_path = "spec.tls.certificate"
cacert_path = "spec.tls.caCertificate"
destcacert_path = "spec.tls.destinationCACertificate"
@@ -93,6 +106,10 @@ class Route(Yedit):
''' return service name '''
return self.get(Route.service_path)
+ def get_weight(self):
+ ''' return service weight '''
+ return self.get(Route.weight_path)
+
def get_termination(self):
''' return tls termination'''
return self.get(Route.termination_path)
@@ -100,3 +117,7 @@ class Route(Yedit):
def get_host(self):
''' return host '''
return self.get(Route.host_path)
+
+ def get_wildcard_policy(self):
+ ''' return wildcardPolicy '''
+ return self.get(Route.wildcard_policy)