Compare commits

...

1 Commits

Author SHA1 Message Date
谢作欢
f0bd8013fa 🎨
All checks were successful
continuous-integration/drone/tag Build is passing
2023-11-03 16:36:52 +08:00

View File

@ -7,7 +7,6 @@ import (
"fmt"
appv1 "k8s.io/api/apps/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/json"
"k8s.io/client-go/kubernetes"
kindv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
"time"
@ -70,7 +69,9 @@ func (c client) Do(namespace, kind, resourceName, actionMethod, repo string) (er
return fmt.Errorf("repo not empty")
}
resource.(*appv1.Deployment).Spec.Template.Spec.Containers[0].Image = utils.ParseImage(repo)
repo = utils.ParseImage(repo)
resource.(*appv1.Deployment).Spec.Template.Spec.Containers[0].Image = repo
_, err = kindType.(kindv1.DeploymentInterface).Update(context.Background(), resource.(*appv1.Deployment), metav1.UpdateOptions{})
@ -94,10 +95,6 @@ func (c client) Do(namespace, kind, resourceName, actionMethod, repo string) (er
return fmt.Errorf("get deployment error: %v", err.Error())
}
rJ, _ := json.Marshal(resource)
fmt.Println(string(rJ))
resource.(*appv1.Deployment).Spec.Template.ObjectMeta.Annotations["kubectl.kubernetes.io/restartedAt"] = time.Now().Local().String()
_, err = kindType.(kindv1.DeploymentInterface).Update(context.Background(), resource.(*appv1.Deployment), metav1.UpdateOptions{})
if err != nil {