diff --git a/k8s/client.go b/k8s/client.go index 214d537..3012fcb 100644 --- a/k8s/client.go +++ b/k8s/client.go @@ -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 {