-
Notifications
You must be signed in to change notification settings - Fork 37
Add --runtime-class flag to buildrun create #366
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
base: main
Are you sure you want to change the base?
Changes from all commits
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 |
|---|---|---|
|
|
@@ -38,8 +38,9 @@ func TestBuildRunSpecFromFlags(t *testing.T) { | |
| Duration: 30 * time.Minute, | ||
| }, | ||
| }, | ||
| NodeSelector: map[string]string{"kubernetes.io/hostname": "worker-1"}, | ||
| SchedulerName: ptr.To("dolphinscheduler"), | ||
| NodeSelector: map[string]string{"kubernetes.io/hostname": "worker-1"}, | ||
| SchedulerName: ptr.To("dolphinscheduler"), | ||
| RuntimeClassName: ptr.To("kata"), | ||
| } | ||
|
|
||
| cmd := &cobra.Command{} | ||
|
|
@@ -91,6 +92,13 @@ func TestBuildRunSpecFromFlags(t *testing.T) { | |
| g.Expect(expected.SchedulerName).To(o.Equal(spec.SchedulerName), "spec.schedulerName") | ||
| }) | ||
|
|
||
| t.Run(".spec.runtimeClassName", func(_ *testing.T) { | ||
| err := flags.Set(RuntimeClassNameFlag, *expected.RuntimeClassName) | ||
| g.Expect(err).To(o.BeNil()) | ||
|
|
||
| g.Expect(expected.RuntimeClassName).To(o.Equal(spec.RuntimeClassName), "spec.runtimeClassName") | ||
| }) | ||
|
|
||
|
Comment on lines
+95
to
+101
Member
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. 👍 |
||
| t.Run(".spec.retention.ttlAfterFailed", func(_ *testing.T) { | ||
| err := flags.Set(RetentionTTLAfterFailedFlag, expected.Retention.TTLAfterFailed.Duration.String()) | ||
| g.Expect(err).To(o.BeNil()) | ||
|
|
@@ -150,6 +158,10 @@ func TestSanitizeBuildRunSpec(t *testing.T) { | |
| Retention: &buildv1beta1.BuildRunRetention{}, | ||
| }, | ||
| out: buildv1beta1.BuildRunSpec{}, | ||
| }, { | ||
| name: "should clean-up runtime-class-name", | ||
| in: buildv1beta1.BuildRunSpec{RuntimeClassName: ptr.To("")}, | ||
| out: buildv1beta1.BuildRunSpec{}, | ||
| }} | ||
|
|
||
| for _, tt := range testCases { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -78,6 +78,8 @@ const ( | |
| NodeSelectorFlag = "node-selector" | ||
| // SchedulerNameFlag command-line flag. | ||
| SchedulerNameFlag = "scheduler-name" | ||
| // RuntimeClassNameFlag command-line flag. | ||
| RuntimeClassNameFlag = "runtime-class" | ||
| ) | ||
|
|
||
| // sourceFlags flags for ".spec.source" | ||
|
|
@@ -287,6 +289,16 @@ func buildSchedulerNameFlag(flags *pflag.FlagSet, schedulerName *string) { | |
| ) | ||
| } | ||
|
|
||
| // buildRuntimeClassNameFlag registers flags for adding BuildRunSpec.RuntimeClassName | ||
|
Member
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. 👍 |
||
| func buildRuntimeClassNameFlag(flags *pflag.FlagSet, runtimeClassName *string) { | ||
| flags.StringVar( | ||
| runtimeClassName, | ||
| RuntimeClassNameFlag, | ||
| "", | ||
| "specify the runtime class to be used for the Pod", | ||
| ) | ||
| } | ||
|
|
||
| // envFlags registers flags for adding corev1.EnvVars. | ||
| func envFlags(flags *pflag.FlagSet, envs *[]corev1.EnvVar) { | ||
| flags.VarP( | ||
|
|
||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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.
👍 - necessary to get the new API. We will update to v0.19.0 when we get ready to release next month.