rancher / support-bundle-kit

A toolkit to generate and analyze the support bundles for Kubernetes and Kubernetes-native applications
Apache License 2.0
17 stars 28 forks source link

fix: support bundle daemonset condition #91

Closed Yu-Jack closed 9 months ago

Yu-Jack commented 9 months ago

Description

When you create multiple support bundle at the same time, they're stuck for waiting daemonset condition until timeout.

In general, there is no such case which creates multiple support bundle at the same time, but there is still an issue for that case, so I think we need to fix it.

How to reproduce

Click to toggle contents of testing yaml ```yaml --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-01 name: supportbundle-manager-sample-01 namespace: harvester-system spec: replicas: 1 selector: matchLabels: app: support-bundle-manager template: metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-01 spec: containers: - args: - /usr/bin/support-bundle-kit - manager env: - name: SUPPORT_BUNDLE_TARGET_NAMESPACES value: harvester-system,longhorn-system - name: SUPPORT_BUNDLE_NAME value: sample-01 - name: SUPPORT_BUNDLE_DEBUG value: "true" - name: SUPPORT_BUNDLE_MANAGER_POD_IP valueFrom: fieldRef: apiVersion: v1 fieldPath: status.podIP - name: POD_NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - name: SUPPORT_BUNDLE_IMAGE value: rancher/support-bundle-kit:master-head - name: SUPPORT_BUNDLE_IMAGE_PULL_POLICY value: Always image: rancher/support-bundle-kit:master-head imagePullPolicy: Always name: manager ports: - containerPort: 8080 protocol: TCP serviceAccountName: harvester --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-02 name: supportbundle-manager-sample-02 namespace: harvester-system spec: replicas: 1 selector: matchLabels: app: support-bundle-manager template: metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-02 spec: containers: - args: - /usr/bin/support-bundle-kit - manager env: - name: SUPPORT_BUNDLE_TARGET_NAMESPACES value: harvester-system,longhorn-system - name: SUPPORT_BUNDLE_NAME value: sample-02 - name: SUPPORT_BUNDLE_DEBUG value: "true" - name: SUPPORT_BUNDLE_MANAGER_POD_IP valueFrom: fieldRef: apiVersion: v1 fieldPath: status.podIP - name: POD_NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - name: SUPPORT_BUNDLE_IMAGE value: rancher/support-bundle-kit:master-head - name: SUPPORT_BUNDLE_IMAGE_PULL_POLICY value: Always image: rancher/support-bundle-kit:master-head imagePullPolicy: Always name: manager ports: - containerPort: 8080 protocol: TCP serviceAccountName: harvester ```

Use above yaml to create two support bundle manager, and these two support bundle manager will stuck for waiting daemonset condition checking like below until timeout.

image

Although daemonset was created in the end, and it worked. But, we don't need to wait for timeout.

image

image

Test Plan

Click to toggle contents of testing yaml ```yaml --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-01 name: supportbundle-manager-sample-01 namespace: harvester-system spec: replicas: 1 selector: matchLabels: app: support-bundle-manager template: metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-01 spec: containers: - args: - /usr/bin/support-bundle-kit - manager env: - name: SUPPORT_BUNDLE_TARGET_NAMESPACES value: harvester-system,longhorn-system - name: SUPPORT_BUNDLE_NAME value: sample-01 - name: SUPPORT_BUNDLE_DEBUG value: "true" - name: SUPPORT_BUNDLE_MANAGER_POD_IP valueFrom: fieldRef: apiVersion: v1 fieldPath: status.podIP - name: POD_NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - name: SUPPORT_BUNDLE_IMAGE value: jk82421/support-bundle-kit:v0.0.34.6 - name: SUPPORT_BUNDLE_IMAGE_PULL_POLICY value: Always image: jk82421/support-bundle-kit:v0.0.34.6 imagePullPolicy: Always name: manager ports: - containerPort: 8080 protocol: TCP serviceAccountName: harvester --- apiVersion: apps/v1 kind: Deployment metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-02 name: supportbundle-manager-sample-02 namespace: harvester-system spec: replicas: 1 selector: matchLabels: app: support-bundle-manager template: metadata: labels: app: support-bundle-manager rancher/supportbundle: sample-02 spec: containers: - args: - /usr/bin/support-bundle-kit - manager env: - name: SUPPORT_BUNDLE_TARGET_NAMESPACES value: harvester-system,longhorn-system - name: SUPPORT_BUNDLE_NAME value: sample-02 - name: SUPPORT_BUNDLE_DEBUG value: "true" - name: SUPPORT_BUNDLE_MANAGER_POD_IP valueFrom: fieldRef: apiVersion: v1 fieldPath: status.podIP - name: POD_NAMESPACE valueFrom: fieldRef: apiVersion: v1 fieldPath: metadata.namespace - name: SUPPORT_BUNDLE_IMAGE value: jk82421/support-bundle-kit:v0.0.34.6 - name: SUPPORT_BUNDLE_IMAGE_PULL_POLICY value: Always image: jk82421/support-bundle-kit:v0.0.34.6 imagePullPolicy: Always name: manager ports: - containerPort: 8080 protocol: TCP serviceAccountName: harvester ```

Testing image: jk82421/support-bundle-kit:v0.0.34.6

Use above yaml to create two support bundle manager, and these two support bundle manager won't encounter timeout issue.

image

Related Issue

https://github.com/harvester/harvester/issues/4922