mirror of
https://github.com/portainer/portainer.git
synced 2025-07-19 13:29:41 +02:00
fix(kubectl): rollout restart [r8s-322] (#729)
This commit is contained in:
parent
1abdf42f99
commit
3b313b9308
8 changed files with 85 additions and 68 deletions
20
pkg/libkubectl/resource.go
Normal file
20
pkg/libkubectl/resource.go
Normal file
|
@ -0,0 +1,20 @@
|
|||
package libkubectl
|
||||
|
||||
import "strings"
|
||||
|
||||
func isManifestFile(resource string) bool {
|
||||
trimmedResource := strings.TrimSpace(resource)
|
||||
return strings.HasSuffix(trimmedResource, ".yaml") || strings.HasSuffix(trimmedResource, ".yml")
|
||||
}
|
||||
|
||||
func resourcesToArgs(resources []string) []string {
|
||||
args := []string{}
|
||||
for _, resource := range resources {
|
||||
if isManifestFile(resource) {
|
||||
args = append(args, "-f", strings.TrimSpace(resource))
|
||||
} else {
|
||||
args = append(args, resource)
|
||||
}
|
||||
}
|
||||
return args
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue