mirror of
https://github.com/portainer/portainer.git
synced 2025-07-18 21:09:40 +02:00
23 lines
471 B
Go
23 lines
471 B
Go
package libkubectl
|
|
|
|
import (
|
|
"bytes"
|
|
"context"
|
|
"fmt"
|
|
|
|
"k8s.io/kubectl/pkg/cmd/rollout"
|
|
)
|
|
|
|
func (c *Client) RolloutRestart(ctx context.Context, manifests []string) (string, error) {
|
|
buf := new(bytes.Buffer)
|
|
|
|
cmd := rollout.NewCmdRollout(c.factory, c.streams)
|
|
cmd.SetArgs(manifestFilesToArgs(manifests))
|
|
cmd.SetOut(buf)
|
|
|
|
if err := cmd.ExecuteContext(ctx); err != nil {
|
|
return "", fmt.Errorf("error restarting resources: %w", err)
|
|
}
|
|
|
|
return buf.String(), nil
|
|
}
|