Run k8s-on-openstack to manage k8s control plane

The k8s-on-openstack project produces an opinionated kubernetes
that is correctly set up to be integrated with OpenStack. All of the
patches we've submitted to update it for our environment have been
landed upstream, so just consume it directly.

It's possible we might want to take a more hands-on forky approach in
the future, but for now it seems fairly stable.

Change-Id: I4ff605b6a947ab9b9f3d0a73852dde74c705979f
This commit is contained in:
Monty Taylor 2018-12-21 18:40:47 +00:00
parent 56888df142
commit 9cac3c6b63
4 changed files with 92 additions and 0 deletions

View File

@ -0,0 +1,15 @@
- hosts: "localhost:!disabled"
name: "System-config: Update the system-config repo on bridge"
connection: local
gather_facts: false
tasks:
- name: Make sure k8s-on-openstack repo is up to date
git:
repo: https://github.com/infraly/k8s-on-openstack
dest: /opt/k8s-on-openstack
force: yes
- name: Run kubernetes deploy playbook
command: ./run_k8s_ansible.sh
args:
chdir: /opt/system-config

View File

@ -82,6 +82,11 @@ start_timer
timeout -k 2m 120m ansible-playbook -f 50 ${ANSIBLE_PLAYBOOKS}/base.yaml
send_timer base
# Run k8s-on-openstack
start_timer
timeout -k 2m 120m ansible-playbook -f 50 ${ANSIBLE_PLAYBOOKS}/run-k8s-on-openstack.yaml
send_timer k8s
# Update the puppet version
start_timer
timeout -k 2m 120m ansible-playbook -f 50 ${ANSIBLE_PLAYBOOKS}/update_puppet_version.yaml

42
run_k8s_ansible.sh Executable file
View File

@ -0,0 +1,42 @@
#!/bin/bash
#
# Copyright (c) 2018 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
# implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# This file is required to wrap the ansible playbook invocation because
# we need to set config options via environment variables. There are parts
# of this that could be cleaned up upstream, but doing so makes the actual
# os_ module invocations really chatty.
eval $(python3 tools/cloud-to-env.py --cloud=openstackci-vexxhost --region=sjc1)
export KEY="bridge-root-2014-09-15"
export NAME="opendev-k8s"
export IMAGE="Ubuntu 16.04 LTS (x86_64) [2018-08-24]"
export MASTER_FLAVOR="v2-highcpu-4"
export MASTER_BOOT_FROM_VOLUME="True"
export IGNORE_VOLUME_AZ="True"
export FLOATING_IP_NETWORK_UUID="0048fce6-c715-4106-a810-473620326cb0"
export NODE_FLAVOR="v2-highcpu-8"
export NODE_AUTO_IP="True"
export NODE_BOOT_FROM_VOLUME="True"
export NODE_VOLUME_SIZE="64"
export NODE_EXTRA_VOLUME="True"
export NODE_EXTRA_VOLUME_SIZE="80"
export USE_OCTAVIA="True"
export BLOCK_STORAGE_VERSION='v3'
cd /opt/k8s-on-openstack
ansible-playbook -v site.yaml

30
tools/cloud-to-env.py Normal file
View File

@ -0,0 +1,30 @@
import argparse
import sys
import openstack
def main():
parser = argparse.ArgumentParser()
parser.add_argument(
"--cloud", dest="cloud", required=True,
help="cloud name")
parser.add_argument(
"--region", dest="region", required=True,
help="cloud region")
options = parser.parse_args()
cloud_region = openstack.config.OpenStackConfig().get_one(
cloud=options.cloud, region_name=options.region)
print("export OS_REGION_NAME='{region_name}'".format(
region_name=cloud_region.region_name))
for k, v in cloud_region.auth.items():
print("export OS_{key}='{value}'".format(
key=k.upper(),
value=v))
return 0
if __name__ == '__main__':
sys.exit(main())