-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
use custom runtime "contrast-cc" #344
Changes from all commits
1b2f5a3
c7c03bf
ca0940a
4e07189
3793b9a
9ad3672
89538ed
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -166,24 +166,24 @@ func findGenerateTargets(args []string, logger *slog.Logger) ([]string, error) { | |
} | ||
} | ||
|
||
paths = filterNonCoCoRuntime("kata-cc-isolation", paths, logger) | ||
paths = filterNonCoCoRuntime("contrast-cc", paths, logger) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This reminds me that we'll likely need to do something here if kata-containers/kata-containers#8571 would eventually be fixed. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Agreed. I do expect that resourcegen will give us a flag to specify the runtimeClassName to select, so this should be a trivial fix. |
||
|
||
if len(paths) == 0 { | ||
return nil, fmt.Errorf("no .yml/.yaml files found") | ||
} | ||
return paths, nil | ||
} | ||
|
||
func filterNonCoCoRuntime(runtimeClassName string, paths []string, logger *slog.Logger) []string { | ||
func filterNonCoCoRuntime(runtimeClassNamePrefix string, paths []string, logger *slog.Logger) []string { | ||
var filtered []string | ||
for _, path := range paths { | ||
data, err := os.ReadFile(path) | ||
if err != nil { | ||
logger.Warn("Failed to read file", "path", path, "err", err) | ||
continue | ||
} | ||
if !bytes.Contains(data, []byte(runtimeClassName)) { | ||
logger.Info("Ignoring non-CoCo runtime", "className", runtimeClassName, "path", path) | ||
if !bytes.Contains(data, []byte(runtimeClassNamePrefix)) { | ||
logger.Info("Ignoring non-CoCo runtime", "className", runtimeClassNamePrefix, "path", path) | ||
continue | ||
} | ||
filtered = append(filtered, path) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,29 @@ | ||
package cmd | ||
|
||
// DefaultCoordinatorPolicyHash is derived from the coordinator release candidate and injected at release build time. | ||
// | ||
// It is intentionally left empty for dev builds. | ||
var DefaultCoordinatorPolicyHash = "" | ||
import ( | ||
"github.com/spf13/cobra" | ||
) | ||
|
||
// This value is injected at build time. | ||
var runtimeHandler = "contrast-cc" | ||
|
||
// NewRuntimeCmd creates the contrast runtime subcommand. | ||
func NewRuntimeCmd() *cobra.Command { | ||
cmd := &cobra.Command{ | ||
Use: "runtime", | ||
Short: "Prints the runtimeClassName", | ||
Long: `Prints runtimeClassName used by Contrast. | ||
|
||
Contrast uses a custom container runtime, where every pod is a confidential | ||
virtual machine. Pod specs of workloads running on Contrast must | ||
have the runtimeClassName set to the value returned by this command. | ||
`, | ||
Run: runRuntime, | ||
} | ||
|
||
return cmd | ||
} | ||
|
||
func runRuntime(cmd *cobra.Command, _ []string) { | ||
cmd.Println(runtimeHandler) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cc @wirungu: another use case for image patching incoming.