diff --git a/devstack/lib/neutron-legacy b/devstack/lib/neutron-legacy index dcbe1fa9..99811416 100644 --- a/devstack/lib/neutron-legacy +++ b/devstack/lib/neutron-legacy @@ -56,6 +56,11 @@ function configure_mutnauq { } export -f configure_mutnauq +function create_mutnauq_accounts { + # NOTE(mnaser): We'll have to drop all uses of this at some point + create_service_user "neutron" +} + function init_mutnauq { echo noop } diff --git a/openstack_operator/neutron.py b/openstack_operator/neutron.py index f5db5b36..c53bff24 100644 --- a/openstack_operator/neutron.py +++ b/openstack_operator/neutron.py @@ -44,3 +44,14 @@ def create_or_resume(spec, **_): utils.create_or_update('neutron/service.yml.j2') identity.ensure_application_credential(name="neutron") + + url = None + if "ingress" in spec: + utils.create_or_update('neutron/ingress.yml.j2', spec=spec) + url = spec["ingress"]["host"] + + if "endpoint" not in spec: + spec["endpoint"] = True + if spec["endpoint"]: + identity.ensure_service(name="neutron", service_type="network", + url=url, desc="Neutron Service") diff --git a/openstack_operator/templates/neutron/ingress.yml.j2 b/openstack_operator/templates/neutron/ingress.yml.j2 new file mode 100644 index 00000000..3e6277fc --- /dev/null +++ b/openstack_operator/templates/neutron/ingress.yml.j2 @@ -0,0 +1,55 @@ +--- +# Copyright 2020 VEXXHOST, Inc. +# +# 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. + +apiVersion: networking.k8s.io/v1beta1 +kind: Ingress +metadata: + name: neutron + namespace: openstack + annotations: + cert-manager.io/cluster-issuer: "letsencrypt-prod" + certmanager.k8s.io/cluster-issuer: "letsencrypt-prod" +spec: +{% if spec.ingress.host is defined %} + rules: + - host: {{ spec.ingress.host }} + http: + paths: + - path: / + backend: + serviceName: neutron + servicePort: 80 + tls: + - hosts: + - {{ spec.ingress.host }} + secretName: neutron-tls +{% else %} + rules: + {% for v in spec.ingress %} + - host: {{ v.host }} + http: + paths: + - path: / + backend: + serviceName: neutron + servicePort: 80 + {% endfor %} + tls: + - hosts: + {% for v in spec.ingress %} + - {{ v.host }} + {% endfor %} + secretName: neutron-tls +{% endif %}