Skip to content

Commit

Permalink
IBM Cloud DirectLink support
Browse files Browse the repository at this point in the history
Signed-off-by: Prajyot Parab <[email protected]>
  • Loading branch information
Prajyot-Parab authored and yussufsh committed Nov 19, 2020
1 parent b07c89d commit 5d837d8
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/powervs_config_vars.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---

ibm_cloud_dl_endpoint_net_cidr: "" #IBM Cloud DirectLink endpoint network cidr eg. 10.0.0.0/8
ibm_cloud_http_proxy: "" #IBM Cloud http/squid proxy eg. http://10.166.13.64:3128
ocp_node_net_gw: "" #OCP node private network gateway eg. 192.168.25.1
ocp_node_net_intf: "" #OCP node private network interface name eg. env3

6 changes: 6 additions & 0 deletions playbooks/powervs_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: PowerVS specific configuration
hosts: bastion
roles:
- powervs-nodes-config

45 changes: 45 additions & 0 deletions playbooks/roles/powervs-nodes-config/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
powervs-nodes-config: PowerVS OCP Cluster Nodes Configuration
=========

This module will enable connectivity between OCP nodes in PowerVS and IBM Cloud infrastructure over DirectLink.

Requirements
------------

- A working OCP 4.X cluster
- OCP cluster private network advertised over IBM Cloud DirectLink.
- Running proxy service on classic infrastructure.

Role Variables
--------------

| Variable | Required | Default | Comments |
|--------------------------------|----------|---------|---------------------------------------------------------------|
| ibm_cloud_dl_endpoint_net_cidr | yes | | IBM Cloud DirectLink endpoint network cidr eg. 10.0.0.0/8 |
| ibm_cloud_http_proxy | yes | | IBM Cloud http/squid proxy url eg. `http://10.166.13.64:3128` |
| ocp_node_net_gw | yes | | OCP node private network gateway eg. 192.168.25.1 |
| ocp_node_net_intf | yes | | OCP node private network interface name eg. env3 |

Dependencies
------------

- None

Example Playbook
----------------

- name: PowerVS specific nodes configuration
hosts: bastion
roles:
- powervs-nodes-config

License
-------

See LICENCE.txt

Author Information
------------------

Prajyot Parab ([email protected])

24 changes: 24 additions & 0 deletions playbooks/roles/powervs-nodes-config/tasks/main.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
# tasks file for powervs nodes configuration

- name: Get Connection UUID
shell: |
nmcli -g uuid,device con | grep {{ ocp_node_net_intf }} | awk -F: '{ print $1 }'
register: con_uuid

- name: Add route to connection
shell: |
nmcli connection modify {{ con_uuid.stdout }} +ipv4.routes "{{ ibm_cloud_dl_endpoint_net_cidr }} {{ ocp_node_net_gw }}"
nmcli connection up {{ con_uuid.stdout }}
- name: Retrieve proxy details
shell: |
oc get proxy/cluster -o template --template {{'{{'}}.spec.noProxy{{'}}'}}
register: proxy
run_once: true

- name: Switch to classic infrastructure proxy
shell: |
oc patch proxy/cluster --type merge --patch '{"spec":{"httpProxy": "{{ ibm_cloud_http_proxy }}", "httpsProxy": "{{ ibm_cloud_http_proxy }}", "noProxy": "{{ proxy.stdout }},{{ ibm_cloud_dl_endpoint_net_cidr }}" }}'
run_once: true

0 comments on commit 5d837d8

Please sign in to comment.