summaryrefslogtreecommitdiffstats
path: root/roles/lib_openshift/src/lib/route.py
diff options
context:
space:
mode:
authorEric Wolinetz <ewolinet@redhat.com>2017-01-23 16:08:20 -0600
committerGitHub <noreply@github.com>2017-01-23 16:08:20 -0600
commit066494438d5baff9f555cd56a8bde94df148dc31 (patch)
treee0c802a5af8dc07f0a16b5d41ebea55de4a34d06 /roles/lib_openshift/src/lib/route.py
parentd740fd159416783c88839e6e2c2e150eb81b67da (diff)
parentc2bdcebcf9bc8aebba6d09a80c6b5cccdb17786d (diff)
downloadopenshift-066494438d5baff9f555cd56a8bde94df148dc31.tar.gz
openshift-066494438d5baff9f555cd56a8bde94df148dc31.tar.bz2
openshift-066494438d5baff9f555cd56a8bde94df148dc31.tar.xz
openshift-066494438d5baff9f555cd56a8bde94df148dc31.zip
Merge branch 'master' into fix_logging_jks_gen
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)