Skip to content

Commit

Permalink
Merge pull request yunionio#80 from zhasm/automated-cherry-pick-of-#7…
Browse files Browse the repository at this point in the history
…9-upstream-release-3.7

Automated cherry pick of yunionio#79: ocboot 与 yunionboot 合并
  • Loading branch information
yunion-ci-robot authored Apr 28, 2021
2 parents 58e89e3 + 65a3964 commit 9053246
Show file tree
Hide file tree
Showing 12 changed files with 103 additions and 375 deletions.
64 changes: 4 additions & 60 deletions lib/ocboot.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@
GROUP_PRIMARY_MASTER_NODE = "primary_master_node"
GROUP_MASTER_NODES = "master_nodes"
GROUP_WORKER_NODES = "worker_nodes"
GROUP_LONGHORN_NODES = "longhorn_nodes"
GROUP_REBOOT_NODES = "reboot_nodes"


def load_config(config_file):
Expand All @@ -34,8 +32,6 @@ def __init__(self, config):
self.primary_master_config = self._fetch_conf(PrimaryMasterConfig)
self.master_config = self._fetch_conf(MasterConfig)
self.worker_config = self._fetch_conf(WorkerConfig)
self.longhorn_config = self._fetch_conf(LonghornConfig)
self.reboot_config = self._fetch_conf(RebootConfig)

def load_bastion_host(self, config):
bastion_config = config.get('bastion_host', None)
Expand Down Expand Up @@ -68,9 +64,7 @@ def get_ansible_inventory(self):
self.registry_config,
self.primary_master_config,
self.master_config,
self.worker_config,
self.longhorn_config,
self.reboot_config)
self.worker_config)

def generate_inventory_file(self):
content = self.get_ansible_inventory()
Expand Down Expand Up @@ -139,8 +133,8 @@ def ensure_get(self, key, alter_key=None):
class Node(object):

def __init__(self, config):
self.host = config.ensure_get('host', 'hostname')
self.use_local = config.get('user_local', False)
self.use_local = config.get('use_local', False)
self.host = '127.0.0.1' if self.use_local else config.ensure_get('host', 'hostname')
self.user = config.get('user', 'root')
self.port = config.get('port', 22)
self.host_networks = config.get('host_networks', None)
Expand Down Expand Up @@ -206,6 +200,7 @@ def ansible_vars(self):
"db_user": self.db_user,
"db_password": self.db_password,
"db_port": self.db_port,
"db_host": self.node.host,
}


Expand Down Expand Up @@ -377,54 +372,3 @@ def get_group(cls):

def get_nodes(self):
return self.nodes


class LonghornConfig(object):

def __init__(self, config, bastion_host=None):
self.nodes = get_nodes(config, bastion_host)
self.k8s_host_node_ips = config.get('k8s_host_node_ips', None)
self.longhorn_image_repository = config.get('longhorn_image_repository', None)
self.longhorn_data_path = config.get('longhorn_data_path', None)
self.longhorn_over_provisioning_percentage = config.get('longhorn_over_provisioning_percentage', None)
self.high_availability_controlplane_as_host = config.get('high_availability_controlplane_as_host', None)

@classmethod
def get_group(cls):
return GROUP_LONGHORN_NODES

def ansible_vars(self):
vars = {}
if self.k8s_host_node_ips:
vars['k8s_host_node_ips'] = self.k8s_host_node_ips
if self.longhorn_image_repository:
vars['longhorn_image_repository'] = self.longhorn_image_repository
if self.longhorn_data_path:
vars['longhorn_data_path'] = self.longhorn_data_path
if self.longhorn_over_provisioning_percentage:
vars['longhorn_over_provisioning_percentage'] = self.longhorn_over_provisioning_percentage
if self.high_availability_controlplane_as_host:
vars['high_availability_controlplane_as_host'] = self.high_availability_controlplane_as_host

def get_nodes(self):
return self.nodes


class RebootConfig(object):

def __init__(self, config, bastion_host=None):
self.nodes = get_nodes(config, bastion_host)
self.availability_controlplane_as_host = config.get('availability_controlplane_as_host', None)

@classmethod
def get_group(cls):
return GROUP_REBOOT_NODES

def ansible_vars(self):
vars = {}
if self.availability_controlplane_as_host:
vars['availability_controlplane_as_host'] = self.availability_controlplane_as_host
return vars

def get_nodes(self):
return self.nodes
1 change: 0 additions & 1 deletion onecloud/roles/common/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@
- name: Install yum utils
yum:
name:
- yum-utils
- bash-completion
- epel-release
when:
Expand Down
169 changes: 0 additions & 169 deletions onecloud/roles/longhorn-node/tasks/main.yml

This file was deleted.

10 changes: 4 additions & 6 deletions onecloud/roles/master-node/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
- name: Do common setup
include_role:
name: common

- name: pre-install-common
include_role:
name: pre-install-common
when:
- ansible_connection is defined
- ansible_connection == "ssh"

- name: Do common setup
include_role:
name: common

- name: TCP Configuration
include_role:
name: tcp
Expand Down Expand Up @@ -104,8 +104,6 @@
join_args: "{{ join_args }} --enable-host-agent"
when:
- k8s_node_as_oc_host|default(false)|bool == true
- ansible_connection is defined
- ansible_connection == "local"

- name: join with high availibility ip option
set_fact:
Expand Down
Loading

0 comments on commit 9053246

Please sign in to comment.