Jelajahi Sumber

Merge pull request #1024 from j0hnL/issue-1023

fix MetalLB and remove volcano
Sujit Jadhav 3 tahun lalu
induk
melakukan
861a5df7ad

+ 1 - 10
roles/k8s_start_services/files/metal-config.yaml

@@ -9,13 +9,4 @@ data:
     - name: default
       protocol: layer2
       addresses:
-      - 192.168.2.150/24
-      - 192.168.2.151/24
-      - 192.168.2.152/24
-      - 192.168.2.153/24
-      - 192.168.2.154/24
-      - 192.168.2.155/24
-      - 192.168.2.156/24
-      - 192.168.2.157/24
-      - 192.168.2.158/24
-      - 192.168.2.159/24
+      - 192.168.2.150-192.168.2.160

+ 42 - 17
roles/k8s_start_services/tasks/deploy_k8s_services.yml

@@ -34,10 +34,10 @@
   register: k8s_pods
   tags: init
 
-- name: Get metallb repo
-  command: "helm repo add metallb '{{ metallb_helm_url }}'"
-  changed_when: false
-  tags: init
+#- name: Get metallb repo
+  #command: "helm repo add metallb '{{ metallb_helm_url }}'"
+  #changed_when: false
+  #tags: init
 
 - name: Create MetalLB Setup Config Files
   copy:
@@ -48,17 +48,42 @@
     mode: "{{ metallb_config_file_mode }}"
   tags: init
 
-- name: Create MetalLB Setup Deployment Files
-  copy:
-    src: metallb.yaml
-    dest: "{{ metallb_deployment_file_dest }}"
-    owner: root
-    group: root
-    mode: "{{ metallb_deployment_file_mode }}"
+#- name: Create MetalLB Setup Deployment Files
+  #copy:
+    #src: metallb.yaml
+    #dest: "{{ metallb_deployment_file_dest }}"
+    #owner: root
+    #group: root
+    #mode: "{{ metallb_deployment_file_mode }}"
+  #tags: init
+
+- name: Create Metallb namespace
+  command: "kubectl create -f https://raw.githubusercontent.com/metallb/metallb/v0.10.3/manifests/namespace.yaml"
+  changed_when: true
+  when: "'metallb' not in k8s_pods.stdout"
+  tags: init
+
+- name: Generate Metallb default secret
+  command: "kubectl create secret generic metallb-memberlist --from-literal=secretkey='$(openssl rand -base64 128)'"
+  changed_when: true
+  when: "'metallb' not in k8s_pods.stdout"
+  tags: init
+
+- name: Generate Metallb metallb-system secret
+  command: "kubectl create secret generic -n metallb-system metallb-memberlist --from-literal=secretkey='$(openssl rand -base64 128)'"
+  changed_when: true
+  when: "'metallb' not in k8s_pods.stdout"
   tags: init
 
 - name: Deploy Metallb
-  command: "helm install metallb metallb/metallb  -f '{{ metallb_config_file_dest }}'"
+  #command: "helm install metallb metallb/metallb  -f '{{ metallb_config_file_dest }}'"
+  command: "kubectl create -f  https://raw.githubusercontent.com/metallb/metallb/v0.10.3/manifests/metallb.yaml"
+  changed_when: true
+  when: "'metallb' not in k8s_pods.stdout"
+  tags: init
+
+- name: Apply Metallb config
+  command: "kubectl create -f  '{{ metallb_config_file_dest }}'"
   changed_when: true
   when: "'metallb' not in k8s_pods.stdout"
   tags: init
@@ -211,11 +236,11 @@
   when: "'amdgpu-device-plugin' not in k8s_pods.stdout"
   tags: init
 
-- name: Deploy Volcano Scheduling
-  command: "kubectl apply -f '{{ volcano_scheduling_yaml_url }}'"
-  changed_when: true
-  when: "'volcano-system' not in k8s_pods.stdout"
-  tags: init
+#- name: Deploy Volcano Scheduling
+  #command: "kubectl apply -f '{{ volcano_scheduling_yaml_url }}'"
+  #changed_when: true
+  #when: "'volcano-system' not in k8s_pods.stdout"
+  #tags: init
 
 - name: Install Spark Operator
   command: "helm repo add spark-operator '{{ spark_operator_repo }}'"