|
411 | 411 | {% endif %} |
412 | 412 | {% endfor %} |
413 | 413 |
|
414 | | -- name: Get OVN SB internalapi IPs for DCN nodesets |
415 | | - when: edpm_nodes_dcn1 is defined or edpm_nodes_dcn2 is defined |
416 | | - no_log: "{{ use_no_log }}" |
417 | | - ansible.builtin.shell: | |
418 | | - {{ shell_header }} |
419 | | - {{ oc_header }} |
420 | | -
|
421 | | - # Get internalapi IPs from OVN SB pods |
422 | | - OVN_SB_IPS="" |
423 | | - for pod in ovsdbserver-sb-0 ovsdbserver-sb-1 ovsdbserver-sb-2; do |
424 | | - IP=$(oc get pod -n openstack $pod -o jsonpath='{.metadata.annotations.k8s\.v1\.cni\.cncf\.io/network-status}' | \ |
425 | | - python3 -c "import sys, json; data=json.load(sys.stdin); print([n for n in data if 'internalapi' in n.get('name','')][0]['ips'][0])") |
426 | | - if [ -z "$OVN_SB_IPS" ]; then |
427 | | - OVN_SB_IPS="\"$IP\"" |
428 | | - else |
429 | | - OVN_SB_IPS="$OVN_SB_IPS, \"$IP\"" |
430 | | - fi |
431 | | - done |
432 | | -
|
433 | | - echo "[$OVN_SB_IPS]" |
434 | | - register: ovn_sb_ips_result |
435 | | - |
436 | | -- name: Set OVN SB IPs fact for DCN nodesets |
437 | | - when: edpm_nodes_dcn1 is defined or edpm_nodes_dcn2 is defined |
438 | | - ansible.builtin.set_fact: |
439 | | - edpm_ovn_dbs_dcn: "{{ ovn_sb_ips_result.stdout | trim | from_json }}" |
440 | | - |
441 | | -- name: Create DCN OVN controller ConfigMap with direct IPs |
442 | | - when: edpm_nodes_dcn1 is defined or edpm_nodes_dcn2 is defined |
443 | | - no_log: "{{ use_no_log }}" |
444 | | - ansible.builtin.shell: | |
445 | | - {{ shell_header }} |
446 | | - {{ oc_header }} |
447 | | -
|
448 | | - # Build ovn-remote connection string from internalapi IPs |
449 | | - OVN_REMOTE="{% for ip in edpm_ovn_dbs_dcn %}tcp:{{ ip }}:6642{% if not loop.last %},{% endif %}{% endfor %}" |
450 | | -
|
451 | | - # Create ConfigMap for DCN nodes with direct IPs |
452 | | - oc apply -f - <<EOF |
453 | | - apiVersion: v1 |
454 | | - kind: ConfigMap |
455 | | - metadata: |
456 | | - name: ovncontroller-config-dcn |
457 | | - namespace: openstack |
458 | | - data: |
459 | | - ovsdb-config: | |
460 | | - ovn-remote: $OVN_REMOTE |
461 | | - EOF |
462 | | -
|
463 | | -- name: Create DCN-specific OVN DataPlaneService |
464 | | - when: edpm_nodes_dcn1 is defined or edpm_nodes_dcn2 is defined |
465 | | - no_log: "{{ use_no_log }}" |
466 | | - ansible.builtin.shell: | |
467 | | - {{ shell_header }} |
468 | | - {{ oc_header }} |
469 | | -
|
470 | | - # Create OpenStackDataPlaneService for DCN that uses the DCN ConfigMap |
471 | | - oc apply -f - <<EOF |
472 | | - apiVersion: dataplane.openstack.org/v1beta1 |
473 | | - kind: OpenStackDataPlaneService |
474 | | - metadata: |
475 | | - name: ovn-dcn |
476 | | - namespace: openstack |
477 | | - spec: |
478 | | - addCertMounts: false |
479 | | - caCerts: combined-ca-bundle |
480 | | - containerImageFields: |
481 | | - - OvnControllerImage |
482 | | - dataSources: |
483 | | - - configMapRef: |
484 | | - name: ovncontroller-config-dcn |
485 | | - edpmServiceType: ovn |
486 | | - playbook: osp.edpm.ovn |
487 | | - tlsCerts: |
488 | | - default: |
489 | | - contents: |
490 | | - - dnsnames |
491 | | - - ips |
492 | | - issuer: osp-rootca-issuer-ovn |
493 | | - keyUsages: |
494 | | - - digital signature |
495 | | - - key encipherment |
496 | | - - server auth |
497 | | - - client auth |
498 | | - networks: |
499 | | - - ctlplane |
500 | | - EOF |
501 | | -
|
502 | 414 | - name: Create OpenStackDataPlaneNodeSet_dcn1 |
503 | 415 | when: edpm_nodes_dcn1 is defined |
504 | 416 | no_log: "{{ use_no_log }}" |
505 | 417 | vars: |
506 | 418 | edpm_ovn_bridge_mappings_nodeset: "{{ edpm_ovn_bridge_mappings_dcn1|default(omit) }}" |
507 | | - edpm_ovn_dbs_nodeset: "{{ edpm_ovn_dbs_dcn }}" |
508 | 419 | ansible.builtin.shell: | |
509 | 420 | {{ shell_header }} |
510 | 421 | CELL=cell1 |
|
521 | 432 | no_log: "{{ use_no_log }}" |
522 | 433 | vars: |
523 | 434 | edpm_ovn_bridge_mappings_nodeset: "{{ edpm_ovn_bridge_mappings_dcn2|default(omit) }}" |
524 | | - edpm_ovn_dbs_nodeset: "{{ edpm_ovn_dbs_dcn }}" |
525 | 435 | ansible.builtin.shell: | |
526 | 436 | {{ shell_header }} |
527 | 437 | CELL=cell1 |
|
579 | 489 | cat nodeset-cell1-dcn2.yaml | oc apply -f - |
580 | 490 | {%+ endif +%} |
581 | 491 |
|
582 | | -- name: Patch DCN nodesets to use ovn-dcn service instead of ovn |
583 | | - when: edpm_nodes_dcn1 is defined or edpm_nodes_dcn2 is defined |
584 | | - no_log: "{{ use_no_log }}" |
585 | | - ansible.builtin.shell: | |
586 | | - {{ shell_header }} |
587 | | - {{ oc_header }} |
588 | | -
|
589 | | - # Patch dcn1 nodeset if it exists |
590 | | - {% if edpm_nodes_dcn1 is defined %} |
591 | | - if oc get openstackdataplanenodeset dcn1 -n openstack &>/dev/null; then |
592 | | - # Get current services list and replace 'ovn' with 'ovn-dcn' |
593 | | - SERVICES=$(oc get openstackdataplanenodeset dcn1 -n openstack -o jsonpath='{.spec.services}' | \ |
594 | | - sed 's/"ovn"/"ovn-dcn"/g') |
595 | | -
|
596 | | - # Apply the patch |
597 | | - oc patch openstackdataplanenodeset dcn1 -n openstack --type=merge --patch " |
598 | | - spec: |
599 | | - services: $SERVICES |
600 | | - " |
601 | | - echo "Patched dcn1 nodeset to use ovn-dcn service" |
602 | | - fi |
603 | | - {% endif %} |
604 | | -
|
605 | | - # Patch dcn2 nodeset if it exists |
606 | | - {% if edpm_nodes_dcn2 is defined %} |
607 | | - if oc get openstackdataplanenodeset dcn2 -n openstack &>/dev/null; then |
608 | | - # Get current services list and replace 'ovn' with 'ovn-dcn' |
609 | | - SERVICES=$(oc get openstackdataplanenodeset dcn2 -n openstack -o jsonpath='{.spec.services}' | \ |
610 | | - sed 's/"ovn"/"ovn-dcn"/g') |
611 | | -
|
612 | | - # Apply the patch |
613 | | - oc patch openstackdataplanenodeset dcn2 -n openstack --type=merge --patch " |
614 | | - spec: |
615 | | - services: $SERVICES |
616 | | - " |
617 | | - echo "Patched dcn2 nodeset to use ovn-dcn service" |
618 | | - fi |
619 | | - {% endif %} |
620 | | -
|
621 | 492 | # TODO(bogdando): Apply the ceph backend config for Cinder in the original openstack CR, via kustomize perhaps? |
622 | 493 | - name: prepare the adopted data plane workloads to use Ceph backend for Cinder, if configured so |
623 | 494 | no_log: "{{ use_no_log }}" |
|
0 commit comments