|
| 1 | +--- |
| 2 | +# Patch the leaf/workload region OpenStackControlPlane to use the Skupper |
| 3 | +# Listener virtual endpoint for internal Keystone authentication traffic. |
| 4 | +# |
| 5 | +# The public endpoint override is left unchanged so that end-user traffic and |
| 6 | +# the Keystone service catalog continue to reference the central region's |
| 7 | +# external (public) URL. Only the *internal* override — used for all |
| 8 | +# service-to-service communication inside the workload namespace — is updated |
| 9 | +# to point at the Skupper Listener. |
| 10 | +# |
| 11 | +# After the OSCP is updated, this playbook also ensures that EDPM compute |
| 12 | +# nodes can resolve the Skupper Keystone virtual service name. The Skupper |
| 13 | +# Listener creates a ClusterIP-only Service (keystone-regionone) that is not |
| 14 | +# reachable from outside the OCP cluster. EDPM nodes use the dnsmasq |
| 15 | +# LoadBalancer Service (in the leaf namespace) as their DNS server and require |
| 16 | +# a resolvable hostname for the Keystone auth_url configured in nova.conf. |
| 17 | +# To bridge this gap, the playbook: |
| 18 | +# 1. Creates a dedicated MetalLB LoadBalancer Service that selects the |
| 19 | +# Skupper router pod and exposes port 5000 on the leaf internalapi network. |
| 20 | +# 2. Creates a DNSData CR so dnsmasq resolves both the short (.svc) and |
| 21 | +# fully-qualified (.svc.cluster.local) names to the LoadBalancer IP. |
| 22 | +# |
| 23 | +# Run skupper-keystone-connector.yaml and skupper-keystone-listener.yaml |
| 24 | +# before this playbook so that the Skupper virtual service is in place. |
| 25 | +# |
| 26 | +# Variables: |
| 27 | +# cifmw_skupper_leaf_namespace (default: openstack2) |
| 28 | +# cifmw_skupper_keystone_listener_host (default: keystone-regionone) |
| 29 | +# cifmw_skupper_keystone_port (default: 5000) |
| 30 | +# cifmw_skupper_keystone_metallb_pool (default: internalapi2) |
| 31 | +# MetalLB address-pool name for the leaf internalapi network. An IP is |
| 32 | +# auto-assigned from this pool; no static address is required. |
| 33 | +- name: Configure leaf region to use Skupper Keystone internal endpoint |
| 34 | + hosts: localhost |
| 35 | + gather_facts: false |
| 36 | + vars: |
| 37 | + cifmw_skupper_leaf_namespace: openstack2 |
| 38 | + cifmw_skupper_keystone_listener_host: keystone-regionone |
| 39 | + cifmw_skupper_keystone_port: 5000 |
| 40 | + cifmw_skupper_keystone_metallb_pool: internalapi2 |
| 41 | + tasks: |
| 42 | + - name: Build the Skupper Keystone internal URL |
| 43 | + ansible.builtin.set_fact: |
| 44 | + _skupper_keystone_internal_url: >- |
| 45 | + https://{{ cifmw_skupper_keystone_listener_host }}.{{ cifmw_skupper_leaf_namespace }}.svc.cluster.local:{{ cifmw_skupper_keystone_port }} |
| 46 | +
|
| 47 | + - name: Patch leaf OSCP internal Keystone override to use Skupper endpoint |
| 48 | + # This switches the internal keystone endpoint URL from the central |
| 49 | + # region's public URL to the Skupper Listener virtual service. The |
| 50 | + # public endpoint override is not touched. |
| 51 | + kubernetes.core.k8s: |
| 52 | + state: patched |
| 53 | + api_version: core.openstack.org/v1beta1 |
| 54 | + kind: OpenStackControlPlane |
| 55 | + name: controlplane |
| 56 | + namespace: "{{ cifmw_skupper_leaf_namespace }}" |
| 57 | + definition: |
| 58 | + spec: |
| 59 | + keystone: |
| 60 | + template: |
| 61 | + override: |
| 62 | + service: |
| 63 | + internal: |
| 64 | + endpointURL: "{{ _skupper_keystone_internal_url }}" |
| 65 | + |
| 66 | + - name: Wait for leaf OSCP to reconcile after Keystone endpoint change |
| 67 | + kubernetes.core.k8s_info: |
| 68 | + api_version: core.openstack.org/v1beta1 |
| 69 | + kind: OpenStackControlPlane |
| 70 | + name: controlplane |
| 71 | + namespace: "{{ cifmw_skupper_leaf_namespace }}" |
| 72 | + register: _leaf_oscp |
| 73 | + retries: 60 |
| 74 | + delay: 30 |
| 75 | + until: |
| 76 | + - _leaf_oscp.resources | length > 0 |
| 77 | + - _leaf_oscp.resources[0].status is defined |
| 78 | + - _leaf_oscp.resources[0].status.conditions is defined |
| 79 | + - _leaf_oscp.resources[0].status.conditions | |
| 80 | + selectattr('type', 'equalto', 'Ready') | |
| 81 | + selectattr('status', 'equalto', 'True') | list | length > 0 |
| 82 | + |
| 83 | + - name: Create LoadBalancer service to expose Skupper Keystone for EDPM nodes |
| 84 | + # The Skupper Listener creates a ClusterIP-only Service that EDPM nodes |
| 85 | + # outside the OCP cluster cannot reach. This LoadBalancer Service selects |
| 86 | + # the same Skupper router pod and obtains a MetalLB IP on the leaf |
| 87 | + # internalapi network, making port 5000 reachable from EDPM compute nodes. |
| 88 | + kubernetes.core.k8s: |
| 89 | + state: present |
| 90 | + definition: |
| 91 | + apiVersion: v1 |
| 92 | + kind: Service |
| 93 | + metadata: |
| 94 | + name: "{{ cifmw_skupper_keystone_listener_host }}-lb" |
| 95 | + namespace: "{{ cifmw_skupper_leaf_namespace }}" |
| 96 | + annotations: |
| 97 | + metallb.universe.tf/address-pool: "{{ cifmw_skupper_keystone_metallb_pool }}" |
| 98 | + spec: |
| 99 | + type: LoadBalancer |
| 100 | + selector: |
| 101 | + application: skupper-router |
| 102 | + skupper.io/component: router |
| 103 | + ports: |
| 104 | + - name: keystone-internal |
| 105 | + port: "{{ cifmw_skupper_keystone_port | int }}" |
| 106 | + protocol: TCP |
| 107 | + targetPort: 1024 |
| 108 | + |
| 109 | + - name: Wait for MetalLB to assign an external IP to the keystone LoadBalancer |
| 110 | + kubernetes.core.k8s_info: |
| 111 | + api_version: v1 |
| 112 | + kind: Service |
| 113 | + name: "{{ cifmw_skupper_keystone_listener_host }}-lb" |
| 114 | + namespace: "{{ cifmw_skupper_leaf_namespace }}" |
| 115 | + register: _keystone_lb_svc |
| 116 | + retries: 12 |
| 117 | + delay: 10 |
| 118 | + until: |
| 119 | + - _keystone_lb_svc.resources | length > 0 |
| 120 | + - _keystone_lb_svc.resources[0].status.loadBalancer.ingress is defined |
| 121 | + - _keystone_lb_svc.resources[0].status.loadBalancer.ingress | length > 0 |
| 122 | + |
| 123 | + - name: Set keystone LoadBalancer IP fact |
| 124 | + ansible.builtin.set_fact: |
| 125 | + _keystone_lb_ip: >- |
| 126 | + {{ _keystone_lb_svc.resources[0].status.loadBalancer.ingress[0].ip }} |
| 127 | +
|
| 128 | + - name: Create DNSData entry for Skupper Keystone endpoint |
| 129 | + # Adds both the short (.svc) and fully-qualified (.svc.cluster.local) |
| 130 | + # names to the dnsmasq instance serving EDPM nodes, so that nova-compute |
| 131 | + # auth_url lookups resolve to the LoadBalancer IP above. |
| 132 | + kubernetes.core.k8s: |
| 133 | + state: present |
| 134 | + definition: |
| 135 | + apiVersion: network.openstack.org/v1beta1 |
| 136 | + kind: DNSData |
| 137 | + metadata: |
| 138 | + name: keystone-skupper |
| 139 | + namespace: "{{ cifmw_skupper_leaf_namespace }}" |
| 140 | + spec: |
| 141 | + dnsDataLabelSelectorValue: dnsdata |
| 142 | + hosts: |
| 143 | + - hostnames: |
| 144 | + - "{{ cifmw_skupper_keystone_listener_host }}.{{ cifmw_skupper_leaf_namespace }}.svc" |
| 145 | + - "{{ cifmw_skupper_keystone_listener_host }}.{{ cifmw_skupper_leaf_namespace }}.svc.cluster.local" |
| 146 | + ip: "{{ _keystone_lb_ip }}" |
0 commit comments