summaryrefslogtreecommitdiffstats
path: root/roles/openshift_node_group
diff options
context:
space:
mode:
authorKenny Woodson <kwoodson@redhat.com>2017-10-28 20:46:44 -0400
committerKenny Woodson <kwoodson@redhat.com>2017-11-08 10:01:08 -0500
commit8757073d8509a6301b70ff66383d84416bdd78cb (patch)
treec4eef61dc19e5dc80a3b1b159b2b9f5e72ba826b /roles/openshift_node_group
parentadb5c51666dfe7c6b93c7bd7c87b339ef2a27f5b (diff)
downloadopenshift-8757073d8509a6301b70ff66383d84416bdd78cb.tar.gz
openshift-8757073d8509a6301b70ff66383d84416bdd78cb.tar.bz2
openshift-8757073d8509a6301b70ff66383d84416bdd78cb.tar.xz
openshift-8757073d8509a6301b70ff66383d84416bdd78cb.zip
Bootstrap enhancements.
Diffstat (limited to 'roles/openshift_node_group')
-rw-r--r--roles/openshift_node_group/defaults/main.yml26
-rw-r--r--roles/openshift_node_group/meta/main.yml4
-rw-r--r--roles/openshift_node_group/tasks/create_config.yml58
-rw-r--r--roles/openshift_node_group/tasks/main.yml10
-rw-r--r--roles/openshift_node_group/templates/node-config.yaml.j253
5 files changed, 151 insertions, 0 deletions
diff --git a/roles/openshift_node_group/defaults/main.yml b/roles/openshift_node_group/defaults/main.yml
new file mode 100644
index 000000000..d398a7fdc
--- /dev/null
+++ b/roles/openshift_node_group/defaults/main.yml
@@ -0,0 +1,26 @@
+---
+openshift_node_groups:
+- name: node-config-master
+ labels:
+ - 'type=master'
+ edits: []
+- name: node-config-infra
+ labels:
+ - 'type=infra'
+ edits: []
+- name: node-config-compute
+ labels:
+ - 'type=compute'
+ edits: []
+
+openshift_node_group_edits: []
+openshift_node_group_namespace: openshift-node
+openshift_node_group_labels: []
+
+openshift_imageconfig_format: "{{ oreg_url if oreg_url is defined else openshift.node.registry_url }}"
+openshift_node_group_cloud_provider: "{{ openshift_cloudprovider_kind | default('aws') }}"
+openshift_node_group_network_plugin_default: "{{ os_sdn_network_plugin_name | default('redhat/openshift-ovs-subnet') }}"
+openshift_node_group_network_plugin: "{{ openshift_node_group_network_plugin_default }}"
+openshift_node_group_node_data_dir_default: "{{ openshift_data_dir | default('/var/lib/origin') }}"
+openshift_node_group_node_data_dir: "{{ openshift_node_group_node_data_dir_default }}"
+openshift_node_group_network_mtu: "{{ openshift_node_sdn_mtu | default(8951) }}"
diff --git a/roles/openshift_node_group/meta/main.yml b/roles/openshift_node_group/meta/main.yml
new file mode 100644
index 000000000..14c1dd498
--- /dev/null
+++ b/roles/openshift_node_group/meta/main.yml
@@ -0,0 +1,4 @@
+---
+dependencies:
+- role: lib_openshift
+- role: lib_utils
diff --git a/roles/openshift_node_group/tasks/create_config.yml b/roles/openshift_node_group/tasks/create_config.yml
new file mode 100644
index 000000000..02ec30a62
--- /dev/null
+++ b/roles/openshift_node_group/tasks/create_config.yml
@@ -0,0 +1,58 @@
+---
+- name: fetch node configmap
+ oc_configmap:
+ name: "{{ openshift_node_group_name }}"
+ namespace: "{{ openshift_node_group_namespace }}"
+ state: list
+ register: configout
+ run_once: true
+
+- name: debug node config
+ debug: var=configout
+
+- when:
+ - configout.results.results.0 == {} or (configout.results.results.0 != {} and openshift_node_group_edits|length > 0)
+ block:
+ - name: create a temp dir for this work
+ command: mktemp -d /tmp/openshift_node_config-XXXXXX
+ register: mktempout
+ run_once: true
+
+ - name: create node config template
+ template:
+ src: node-config.yaml.j2
+ dest: "{{ mktempout.stdout }}/node-config.yaml"
+ when:
+ - configout.results.results.0 == {}
+
+ - name: lay down the config from the existing configmap
+ copy:
+ content: "{{ configout.results.results.0.data['node-config.yaml'] }}"
+ dest: "{{ mktempout.stdout }}/node-config.yaml"
+ when:
+ - configout.results.results.0 != {}
+
+ - name: "specialize the generated configs for {{ openshift_node_group_name }}"
+ yedit:
+ content:
+ src: "{{ mktempout.stdout }}/node-config.yaml"
+ edits: "{{ openshift_node_group_edits }}"
+ register: yeditout
+ when: openshift_node_group_edits|length > 0
+ run_once: true
+
+ - debug: var=yeditout
+
+ - name: create node-config.yaml configmap
+ oc_configmap:
+ name: "{{ openshift_node_group_name }}"
+ namespace: "{{ openshift_node_group_namespace }}"
+ from_file:
+ node-config.yaml: "{{ mktempout.stdout }}/node-config.yaml"
+ run_once: true
+
+ - name: remove templated files
+ file:
+ dest: "{{ mktempout.stdout }}/"
+ state: absent
+ run_once: true
diff --git a/roles/openshift_node_group/tasks/main.yml b/roles/openshift_node_group/tasks/main.yml
new file mode 100644
index 000000000..c7c15683d
--- /dev/null
+++ b/roles/openshift_node_group/tasks/main.yml
@@ -0,0 +1,10 @@
+---
+- name: Build node config maps
+ include: create_config.yml
+ vars:
+ openshift_node_group_name: "{{ node_group.name }}"
+ openshift_node_group_edits: "{{ node_group.edits | default([]) }}"
+ openshift_node_group_labels: "{{ node_group.labels | default([]) }}"
+ with_items: "{{ openshift_node_groups }}"
+ loop_control:
+ loop_var: node_group
diff --git a/roles/openshift_node_group/templates/node-config.yaml.j2 b/roles/openshift_node_group/templates/node-config.yaml.j2
new file mode 100644
index 000000000..5e22dc6d2
--- /dev/null
+++ b/roles/openshift_node_group/templates/node-config.yaml.j2
@@ -0,0 +1,53 @@
+allowDisabledDocker: false
+apiVersion: v1
+authConfig:
+ authenticationCacheSize: 1000
+ authenticationCacheTTL: 5m
+ authorizationCacheSize: 1000
+ authorizationCacheTTL: 5m
+dnsBindAddress: "127.0.0.1:53"
+dnsDomain: cluster.local
+dnsIP: 0.0.0.0
+dnsNameservers: null
+dnsRecursiveResolvConf: /etc/origin/node/resolv.conf
+dockerConfig:
+ dockerShimRootDirectory: /var/lib/dockershim
+ dockerShimSocket: /var/run/dockershim.sock
+ execHandlerName: native
+enableUnidling: true
+imageConfig:
+ format: "{{ openshift_imageconfig_format }}"
+ latest: false
+iptablesSyncPeriod: 30s
+kind: NodeConfig
+kubeletArguments:
+ cloud-config:
+ - /etc/origin/cloudprovider/{{ openshift_node_group_cloud_provider }}.conf
+ cloud-provider:
+ - {{ openshift_node_group_cloud_provider }}
+ node-labels: {{ openshift_node_group_labels | to_json }}
+masterClientConnectionOverrides:
+ acceptContentTypes: application/vnd.kubernetes.protobuf,application/json
+ burst: 40
+ contentType: application/vnd.kubernetes.protobuf
+ qps: 20
+masterKubeConfig: node.kubeconfig
+networkConfig:
+ mtu: "{{ openshift_node_group_network_mtu }}"
+ networkPluginName: {{ openshift_node_group_network_plugin }}
+nodeIP: ""
+podManifestConfig: null
+servingInfo:
+ bindAddress: 0.0.0.0:10250
+ bindNetwork: tcp4
+ certFile: server.crt
+ clientCA: node-client-ca.crt
+ keyFile: server.key
+ namedCertificates: null
+volumeConfig:
+ localQuota:
+ perFSGroup: null
+volumeDirectory: {{ openshift_node_group_node_data_dir }}/openshift.local.volumes
+enable-controller-attach-detach:
+- 'true'
+networkPluginName: {{ openshift_node_group_network_plugin }}