Skip to content

Commit

Permalink
Merge pull request #2248 from ks-ci-bot/cherry-pick-2246-to-release-3.4
Browse files Browse the repository at this point in the history
[release-3.4] fix bug monitoring task failed when updating from v3.3.x to v3.4.0
  • Loading branch information
redscholar authored Oct 26, 2023
2 parents a3a409d + 8eb713c commit 3c85231
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 176 deletions.
133 changes: 0 additions & 133 deletions roles/ks-monitor/files/federated/federatednamespaces.yaml

This file was deleted.

43 changes: 0 additions & 43 deletions roles/ks-monitor/tasks/notification-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
src: "notification-manager"
dest: "{{ kubesphere_dir }}/"

- name: notification-manager | Getting federated files
copy:
src: "federated"
dest: "{{ kubesphere_dir }}/"

- name: notification-manager | Getting notification-manager installation files
template:
src: "{{ item.file }}.j2"
Expand Down Expand Up @@ -47,42 +42,4 @@
- notification_check.rc == 0
- notification_check.stdout.find("2.3.0") == -1

- name: notification-manager | Checking federatednamespace crd installed
shell: >
{{ bin_dir }}/kubectl get crd federatednamespaces.types.kubefed.io -o jsonpath='{.metadata.name}'
register: crd_installed
failed_when: false

- name: notification-manager | Deploying federatednamespace crd
shell: "{{ bin_dir }}/kubectl apply -f {{ kubesphere_dir }}/federated/federatednamespaces.yaml"
register: fed_result
failed_when: "fed_result.stderr and 'Warning' not in fed_result.stderr and 'spec.clusterIP' not in fed_result.stderr"
until: fed_result is succeeded
retries: 5
delay: 3
when:
- multicluster is defined and multicluster.clusterRole == 'host'
- crd_installed.rc != 0 or crd_installed.stdout.find("federatednamespaces.types.kubefed.io") == -1

- name: notification-manager | Checking federated namespace deployed
shell: >
{{ bin_dir }}/kubectl get federatednamespaces.types.kubefed.io -n kubesphere-monitoring-federated kubesphere-monitoring-federated -o jsonpath='{.metadata.name}'
register: namespace_deployed
failed_when: false

- name: notification-manager | Deploying federated namespace
shell: "{{ bin_dir }}/kubectl apply -f {{ kubesphere_dir }}/federated/kubesphere-monitoring-federated.yaml"
register: fed_result
failed_when: "fed_result.stderr and 'Warning' not in fed_result.stderr and 'spec.clusterIP' not in fed_result.stderr"
until: fed_result is succeeded
retries: 5
delay: 3
when:
- multicluster is defined and multicluster.clusterRole == 'host'
- namespace_deployed.rc != 0 or namespace_deployed.stdout.find("kubesphere-monitoring-federated") == -1

- name: notification-manager | Update federated crds
shell: "bash {{ kubesphere_dir }}/federated/update_federated_crds.sh"
when:
- multicluster is defined and multicluster.clusterRole == 'host'

1 change: 1 addition & 0 deletions roles/ks-multicluster/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@
with_fileglob:
- "{{ kubesphere_dir }}/kubefed/federatedcrds/*"

- import_tasks: notification-manager.yaml

- name: Kubefed | Importing multicluster status
shell: >
Expand Down
24 changes: 24 additions & 0 deletions roles/ks-multicluster/tasks/notification-manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
---
- name: notification-manager | Getting federated files
copy:
src: "notification"
dest: "{{ kubesphere_dir }}/"

- name: notification-manager | Checking federated namespace deployed
shell: >
{{ bin_dir }}/kubectl get federatednamespaces.types.kubefed.io -n kubesphere-monitoring-federated kubesphere-monitoring-federated -o jsonpath='{.metadata.name}'
register: namespace_deployed
failed_when: false

- name: notification-manager | Deploying federated namespace
shell: "{{ bin_dir }}/kubectl apply -f {{ kubesphere_dir }}/notification/kubesphere-monitoring-federated.yaml"
register: fed_result
failed_when: "fed_result.stderr and 'Warning' not in fed_result.stderr and 'spec.clusterIP' not in fed_result.stderr"
until: fed_result is succeeded
retries: 5
delay: 3
when:
- namespace_deployed.rc != 0 or namespace_deployed.stdout.find("kubesphere-monitoring-federated") == -1

- name: notification-manager | Update federated crds
shell: "bash {{ kubesphere_dir }}/notification/update_federated_crds.sh"

0 comments on commit 3c85231

Please sign in to comment.