This commit is contained in:
parent
57a38b9d2b
commit
f0bd8013fa
@ -7,7 +7,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
appv1 "k8s.io/api/apps/v1"
|
appv1 "k8s.io/api/apps/v1"
|
||||||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
|
||||||
"k8s.io/apimachinery/pkg/util/json"
|
|
||||||
"k8s.io/client-go/kubernetes"
|
"k8s.io/client-go/kubernetes"
|
||||||
kindv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
|
kindv1 "k8s.io/client-go/kubernetes/typed/apps/v1"
|
||||||
"time"
|
"time"
|
||||||
@ -70,7 +69,9 @@ func (c client) Do(namespace, kind, resourceName, actionMethod, repo string) (er
|
|||||||
return fmt.Errorf("repo not empty")
|
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{})
|
_, 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())
|
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()
|
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{})
|
_, err = kindType.(kindv1.DeploymentInterface).Update(context.Background(), resource.(*appv1.Deployment), metav1.UpdateOptions{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
Reference in New Issue
Block a user