Browse Source

devstack: Create LB objects only if Octavia is enabled

kuryr-kubernetes used to allow to disable Octavia, but then lbaasv2 was
used instead for creating all LB related objects. Since lbaasv2 support
is dropped, devstack plugin tries to create LB prjects even when Octavia
is disabled.

After this change, devstack plugin does not create any LB objects if
Octavia is disabled.

Change-Id: I0749b0d0388dcbca558434a5abc2a97bc0dcbe35
Closes-Bug: #1812997
Michal Rostecki 3 months ago
parent
commit
3441a700b1
1 changed files with 25 additions and 12 deletions
  1. 25
    12
      devstack/plugin.sh

+ 25
- 12
devstack/plugin.sh View File

@@ -773,11 +773,12 @@ function run_k8s_kubelet {
773 773
 
774 774
 function run_kuryr_kubernetes {
775 775
     local python_bin=$(which python)
776
+
776 777
     if is_service_enabled openshift-master; then
777
-        wait_for "OpenShift API Server" "$KURYR_K8S_API_LB_URL" \
778
+        wait_for "OpenShift API Server" "${KURYR_K8S_API_ROOT}" \
778 779
             "${OPENSHIFT_DATA_DIR}/master/ca.crt" 1200
779 780
     else
780
-        wait_for_ok_health "Kubernetes API Server" "${KURYR_K8S_API_LB_URL}/healthz" \
781
+        wait_for_ok_health "Kubernetes API Server" "${KURYR_K8S_API_ROOT}/healthz" \
781 782
             "${KURYR_HYPERKUBE_DATA_DIR}/kuryr-ca.crt" \
782 783
             "${KURYR_HYPERKUBE_DATA_DIR}/kuryr.key" \
783 784
             "${KURYR_HYPERKUBE_DATA_DIR}/kuryr.crt" \
@@ -850,9 +851,16 @@ function create_ingress_l7_router {
850 851
 }
851 852
 
852 853
 function configure_overcloud_vm_k8s_svc_sg {
854
+    local dst_port
853 855
     local project_id
854 856
     local security_group
855 857
 
858
+    if is_service_enabled octavia; then
859
+        dst_port=${KURYR_K8S_API_LB_PORT}
860
+    else
861
+        dst_port=${KURYR_K8S_API_PORT}
862
+    fi
863
+
856 864
     project_id=$(get_or_create_project \
857 865
         "$KURYR_NEUTRON_DEFAULT_PROJECT" default)
858 866
     security_group=$(openstack security group list \
@@ -860,7 +868,7 @@ function configure_overcloud_vm_k8s_svc_sg {
860 868
         awk '{if ($2=="default") print $1}')
861 869
     openstack --os-cloud devstack-admin --os-region "$REGION_NAME" \
862 870
         security group rule create --project "$project_id" \
863
-        --dst-port "$KURYR_K8S_API_LB_PORT" "$security_group"
871
+        --dst-port "$dst_port" "$security_group"
864 872
     openstack port set "$KURYR_OVERCLOUD_VM_PORT" --security-group service_pod_access
865 873
 }
866 874
 
@@ -932,10 +940,13 @@ if [[ "$1" == "stack" && "$2" == "extra" ]]; then
932 940
                                      subnet show "$KURYR_NEUTRON_DEFAULT_SERVICE_SUBNET" \
933 941
                                      -c cidr -f value)
934 942
             k8s_api_clusterip=$(_cidr_range "$service_cidr" | cut -f1)
935
-            # NOTE(dulek): KURYR_K8S_API_LB_URL will be a global to be used by next
936
-            #              deployment phases.
937
-            KURYR_K8S_API_LB_URL="https://${k8s_api_clusterip}:${KURYR_K8S_API_LB_PORT}"
938
-            iniset "$KURYR_CONFIG" kubernetes api_root ${KURYR_K8S_API_LB_URL}
943
+            # NOTE(mrostecki): KURYR_K8S_API_ROOT will be a global to be used by next
944
+            #                  deployment phases.
945
+            KURYR_K8S_API_ROOT=${KURYR_K8S_API_URL}
946
+            if is_service_enabled octavia; then
947
+                KURYR_K8S_API_ROOT="https://${k8s_api_clusterip}:${KURYR_K8S_API_LB_PORT}"
948
+            fi
949
+            iniset "$KURYR_CONFIG" kubernetes api_root ${KURYR_K8S_API_ROOT}
939 950
         else
940 951
             iniset "$KURYR_CONFIG" kubernetes api_root '""'
941 952
         fi
@@ -1052,12 +1063,14 @@ if [[ "$1" == "stack" && "$2" == "extra" ]]; then
1052 1063
 
1053 1064
 elif [[ "$1" == "stack" && "$2" == "test-config" ]]; then
1054 1065
     if is_service_enabled kuryr-kubernetes; then
1055
-        create_k8s_api_service
1056
-        #create Ingress L7 router if required
1057
-        enable_ingress=$(trueorfalse False KURYR_ENABLE_INGRESS)
1066
+        if is_service_enabled octavia; then
1067
+            create_k8s_api_service
1068
+            #create Ingress L7 router if required
1069
+            enable_ingress=$(trueorfalse False KURYR_ENABLE_INGRESS)
1058 1070
 
1059
-        if [ "$enable_ingress" == "True" ]; then
1060
-            create_ingress_l7_router
1071
+            if [ "$enable_ingress" == "True" ]; then
1072
+                create_ingress_l7_router
1073
+            fi
1061 1074
         fi
1062 1075
 
1063 1076
         # FIXME(dulek): This is a very late phase to start Kuryr services.

Loading…
Cancel
Save