Skip to content

Commit

Permalink
bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
jacksontong committed Apr 5, 2024
1 parent 076ad96 commit 81a7ec4
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion pkg/application/controller/app/action/daemonset.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package action

import (
"context"
"encoding/json"
"fmt"
"strconv"
"strings"
Expand All @@ -31,6 +32,8 @@ import (
extensionsv1beta1 "k8s.io/api/extensions/v1beta1"
apierrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
"k8s.io/apimachinery/pkg/runtime"

applicationv1 "tkestack.io/tke/api/application/v1"
applicationversionedclient "tkestack.io/tke/api/client/clientset/versioned/typed/application/v1"
Expand Down Expand Up @@ -145,7 +148,14 @@ func getOndeleteDaemonsets(ctx context.Context,
for _, v := range clusterResource {
switch kube.AsVersioned(v).(type) {
case *extensionsv1beta1.DaemonSet, *appsv1.DaemonSet, *appsv1beta2.DaemonSet:
daemonset := v.Object.(*appsv1.DaemonSet)
data, _ := json.Marshal(v.Object)
log.Infof("object is %s", string(data))
daemonsetObj := v.Object.(*unstructured.Unstructured)
var daemonset appsv1.DaemonSet
err = runtime.DefaultUnstructuredConverter.FromUnstructured(daemonsetObj.UnstructuredContent(), &daemonset)
if err != nil {
log.Fatalf("Error converting *unstructured.Unstructured to *v1.DaemonSet: %v", err)
}
if daemonset.Spec.UpdateStrategy.Type == appsv1.OnDeleteDaemonSetStrategyType {
ds = append(ds, daemonset.Namespace+"/"+daemonset.Name)
}
Expand Down

0 comments on commit 81a7ec4

Please sign in to comment.