-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Paul Meyer <[email protected]>
- Loading branch information
1 parent
ca8c2b7
commit c6243ac
Showing
2 changed files
with
53 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package main | ||
|
||
import ( | ||
"fmt" | ||
"os" | ||
"path" | ||
|
||
"github.com/edgelesssys/nunki/e2e/internal/kuberesource" | ||
) | ||
|
||
func main() { | ||
if len(os.Args) != 3 { | ||
fmt.Println("Usage: kuberesource <set> <dest>") | ||
os.Exit(1) | ||
} | ||
|
||
set := os.Args[1] | ||
dest := os.Args[2] | ||
|
||
var resources []any | ||
var err error | ||
switch set { | ||
case "simple": | ||
resources, err = kuberesource.Simple() | ||
default: | ||
fmt.Printf("Error: unknown set: %s\n", set) | ||
os.Exit(1) | ||
} | ||
if err != nil { | ||
fmt.Printf("Error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
b, err := kuberesource.EncodeResources(resources...) | ||
if err != nil { | ||
fmt.Printf("Error: %v\n", err) | ||
os.Exit(1) | ||
} | ||
|
||
if err := os.Mkdir(path.Dir(dest), 0o755); err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
if err := os.WriteFile(dest, b, 0o644); err != nil { | ||
fmt.Println(err) | ||
os.Exit(1) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters