-
Notifications
You must be signed in to change notification settings - Fork 158
Expand file tree
/
Copy pathroot_controller.py
More file actions
160 lines (149 loc) · 7.17 KB
/
root_controller.py
File metadata and controls
160 lines (149 loc) · 7.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# Copyright 2014 Rackspace
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations
# under the License.
from oslo_config import cfg
from oslo_log import log as logging
from oslo_middleware import healthcheck
from pecan import abort as pecan_abort
from pecan import expose as pecan_expose
from pecan import request as pecan_request
from wsme import types as wtypes
from wsmeext import pecan as wsme_pecan
from octavia.api.v2 import controllers as v2_controller
CONF = cfg.CONF
LOG = logging.getLogger(__name__)
class RootController:
"""The controller with which the pecan wsgi app should be created."""
def __init__(self):
super().__init__()
setattr(self, 'v2.0', v2_controller.V2Controller())
setattr(self, 'v2', v2_controller.V2Controller())
if CONF.api_settings.healthcheck_enabled:
self.healthcheck_obj = healthcheck.Healthcheck.app_factory(None)
# Run the oslo middleware healthcheck for /healthcheck
@pecan_expose('json')
@pecan_expose(content_type='text/plain')
@pecan_expose(content_type='text/html')
def healthcheck(self): # pylint: disable=inconsistent-return-statements
if CONF.api_settings.healthcheck_enabled:
if pecan_request.method not in ['GET', 'HEAD']:
pecan_abort(405)
return self.healthcheck_obj.process_request(pecan_request)
pecan_abort(404)
def _add_a_version(self, versions, version, url_version, status,
timestamp, base_url):
versions.append({
'id': version,
'status': status,
'updated': timestamp,
'links': [{
'href': base_url + url_version,
'rel': 'self'
}]
})
@wsme_pecan.wsexpose(wtypes.text)
def index(self):
host_url = pecan_request.path_url
if not host_url.endswith('/'):
host_url = f'{host_url}/'
versions = []
self._add_a_version(versions, 'v2.0', 'v2', 'SUPPORTED',
'2016-12-11T00:00:00Z', host_url)
self._add_a_version(versions, 'v2.1', 'v2', 'SUPPORTED',
'2018-04-20T00:00:00Z', host_url)
self._add_a_version(versions, 'v2.2', 'v2', 'SUPPORTED',
'2018-07-31T00:00:00Z', host_url)
self._add_a_version(versions, 'v2.3', 'v2', 'SUPPORTED',
'2018-12-18T00:00:00Z', host_url)
# amp statistics
self._add_a_version(versions, 'v2.4', 'v2', 'SUPPORTED',
'2018-12-19T00:00:00Z', host_url)
# Tags
self._add_a_version(versions, 'v2.5', 'v2', 'SUPPORTED',
'2019-01-21T00:00:00Z', host_url)
# Flavors
self._add_a_version(versions, 'v2.6', 'v2', 'SUPPORTED',
'2019-01-25T00:00:00Z', host_url)
# Amphora Config update
self._add_a_version(versions, 'v2.7', 'v2', 'SUPPORTED',
'2018-01-25T12:00:00Z', host_url)
# TLS client authentication
self._add_a_version(versions, 'v2.8', 'v2', 'SUPPORTED',
'2019-02-12T00:00:00Z', host_url)
# HTTP Redirect code
self._add_a_version(versions, 'v2.9', 'v2', 'SUPPORTED',
'2019-03-04T00:00:00Z', host_url)
# Healthmonitor host header
self._add_a_version(versions, 'v2.10', 'v2', 'SUPPORTED',
'2019-03-05T00:00:00Z', host_url)
# Additive batch member update
self._add_a_version(versions, 'v2.11', 'v2', 'SUPPORTED',
'2019-06-24T00:00:00Z', host_url)
# VIP ACL
self._add_a_version(versions, 'v2.12', 'v2', 'SUPPORTED',
'2019-09-11T00:00:00Z', host_url)
# SOURCE_IP_PORT algorithm
self._add_a_version(versions, 'v2.13', 'v2', 'SUPPORTED',
'2019-09-13T00:00:00Z', host_url)
# Availability Zones
self._add_a_version(versions, 'v2.14', 'v2', 'SUPPORTED',
'2019-11-10T00:00:00Z', host_url)
# TLS cipher options
self._add_a_version(versions, 'v2.15', 'v2', 'SUPPORTED',
'2020-03-10T00:00:00Z', host_url)
# Additional UDP Healthcheck Types (HTTP/TCP)
self._add_a_version(versions, 'v2.16', 'v2', 'SUPPORTED',
'2020-03-15T00:00:00Z', host_url)
# Listener TLS versions
self._add_a_version(versions, 'v2.17', 'v2', 'SUPPORTED',
'2020-04-29T00:00:00Z', host_url)
# Pool TLS versions
self._add_a_version(versions, 'v2.18', 'v2', 'SUPPORTED',
'2020-04-29T01:00:00Z', host_url)
# Add quota support to octavia's l7policy and l7rule
self._add_a_version(versions, 'v2.19', 'v2', 'SUPPORTED',
'2020-05-12T00:00:00Z', host_url)
# ALPN protocols (listener)
self._add_a_version(versions, 'v2.20', 'v2', 'SUPPORTED',
'2020-08-02T00:00:00Z', host_url)
# Amphora delete
self._add_a_version(versions, 'v2.21', 'v2', 'SUPPORTED',
'2020-09-03T00:00:00Z', host_url)
# Add PROXYV2 pool protocol
self._add_a_version(versions, 'v2.22', 'v2', 'SUPPORTED',
'2020-09-04T00:00:00Z', host_url)
# SCTP protocol
self._add_a_version(versions, 'v2.23', 'v2', 'SUPPORTED',
'2020-09-07T00:00:00Z', host_url)
# ALPN protocols (pool)
self._add_a_version(versions, 'v2.24', 'v2', 'SUPPORTED',
'2020-10-15T00:00:00Z', host_url)
# PROMETHEUS listeners
self._add_a_version(versions, 'v2.25', 'v2', 'SUPPORTED',
'2021-10-02T00:00:00Z', host_url)
# Additional VIPs
self._add_a_version(versions, 'v2.26', 'v2', 'SUPPORTED',
'2022-08-29T00:00:00Z', host_url)
# HTTP Strict Transport Security (HSTS)
self._add_a_version(versions, 'v2.27', 'v2', 'SUPPORTED',
'2023-05-05T00:00:00Z', host_url)
# Add VIP port vnic_type for SR-IOV
self._add_a_version(versions, 'v2.28', 'v2', 'SUPPORTED',
'2023-11-08T00:00:00Z', host_url)
# Add VIP SGs
self._add_a_version(versions, 'v2.29', 'v2', 'SUPPORTED',
'2024-10-15T00:00:00Z', host_url)
# Add member port SR-IOV support
self._add_a_version(versions, 'v2.30', 'v2', 'CURRENT',
'2025-02-26T00:00:00Z', host_url)
return {'versions': versions}