Browse Source

Merge pull request #8302 from kwoodson/azure_node_images

Adding support for node images on 3.10 for azure.
Scott Dodson 6 years ago
parent
commit
231df581c5

+ 5 - 3
playbooks/azure/openshift-cluster/build_node_image.yml

@@ -20,6 +20,8 @@
       openshift_node_bootstrap: True
       skip_node_svc_handlers: True
       openshift_additional_repos: "{{ azure_node_repos[ansible_distribution] }}"
+      openshift_node_include_control_plane: True
+      openshift_control_plane_static_pod_location: /etc/origin/node/disabled/
 
   - set_fact:
       openshift_additional_repos: "{{ openshift_additional_repos + [{'name': 'install_repo', 'baseurl': openshift_azure_install_repo, 'enabled': true, 'gpgcheck': false}] }}"
@@ -54,9 +56,9 @@
     register: yum
 
   - name: run waagent deprovision
-    command: waagent -deprovision+user -force
-    args:
-      chdir: /
+    shell: sleep 2 && waagent -deprovision+user -force
+    async: 1
+    poll: 0
 
 - hosts: localhost
   gather_facts: no

+ 21 - 4
playbooks/openshift-node/private/image_prep.yml

@@ -20,12 +20,29 @@
 - name: node bootstrap config
   hosts: oo_nodes_to_config
   tasks:
+  - import_role:
+      name: openshift_node
+      tasks_from: bootstrap.yml
+  - import_role:
+      name: openshift_node_group
+      tasks_from: bootstrap.yml
+
+  - when:
+    - openshift_node_include_control_plane | default(False)
+    block:
+    - import_role:
+        name: etcd
+        tasks_from: static.yml
+
     - import_role:
-        name: openshift_node
-        tasks_from: bootstrap.yml
+        name: openshift_control_plane
+        tasks_from: static_shim.yml
+
     - import_role:
-        name: openshift_node_group
-        tasks_from: bootstrap.yml
+        name: openshift_control_plane
+        tasks_from: static.yml
+      vars:
+        openshift_control_plane_apply_cluster_signing_config: False
 
 - name: Re-enable excluders
   import_playbook: enable_excluders.yml

+ 2 - 0
roles/etcd/defaults/main.yaml

@@ -115,3 +115,5 @@ etcd_ca_host: "{{ groups['oo_etcd_to_config'].0 }}"
 
 l_etcd_restart_is_pod: "{{ (inventory_hostname in groups['oo_masters']) | bool }}"
 l_etcd_restart_command: "{{ l_etcd_restart_is_pod | ternary('/usr/local/bin/master-restart etcd', 'systemctl restart etcd') }}"
+
+etcd_static_pod_location: "{{ openshift_control_plane_static_pod_location | default('/etc/origin/node/pods/') }}"

+ 2 - 2
roles/etcd/tasks/static.yml

@@ -20,7 +20,7 @@
 
 - name: Validate permissions on the static pods dir
   file:
-    path: "/etc/origin/node/pods/"
+    path: "{{ etcd_static_pod_location }}"
     state: directory
     owner: "root"
     group: "root"
@@ -58,7 +58,7 @@
   copy:
     remote_src: true
     src: "{{ mktemp.stdout }}/{{ item }}"
-    dest: "/etc/origin/node/pods/"
+    dest: "{{ etcd_static_pod_location }}"
     mode: 0600
   with_items:
   - etcd.yaml

+ 4 - 0
roles/openshift_control_plane/defaults/main.yml

@@ -161,3 +161,7 @@ openshift_master_pod_eviction_timeout: ""
 l_new_config_clusterNetworks:
 - cidr: "{{ openshift_cluster_network_cidr }}"
   hostSubnetLength: "{{ openshift_host_subnet_length }}"
+
+# added so that it can lay down the static pod definitions in a configurable place
+openshift_control_plane_static_pod_location: /etc/origin/node/pods/
+openshift_control_plane_apply_cluster_signing_config: True

+ 9 - 1
roles/openshift_control_plane/tasks/static.yml

@@ -9,6 +9,8 @@
     - key: kubernetesMasterConfig.controllerArguments.cluster-signing-key-file
       value:
       - /etc/origin/master/ca.key
+  when:
+  - openshift_control_plane_apply_cluster_signing_config | default(True)
 
 - name: Create temp directory for static pods
   command: mktemp -d /tmp/openshift-ansible-XXXXXX
@@ -43,11 +45,17 @@
     - key: spec.containers[0].readinessProbe.httpGet.port
       value: "{{ openshift_master_api_port }}"
 
+- name: ensure pod location exists
+  file:
+    path: "{{ openshift_control_plane_static_pod_location }}"
+    state: directory
+    mode: "0755"
+
 - name: Update master static pods
   copy:
     remote_src: true
     src: "{{ mktemp.stdout }}/{{ item }}"
-    dest: "/etc/origin/node/pods/"
+    dest: "{{ openshift_control_plane_static_pod_location }}"
     mode: 0600
   with_items:
   - apiserver.yaml