make general profile default

Kubernetes-commit: 8e420e0b3ac1e6c770a265eb2e69476576a58d43
This commit is contained in:
mochizuki875 2025-12-23 15:50:14 +00:00 committed by Kubernetes Publisher
parent a887594ae3
commit 4b1d211ade
3 changed files with 20 additions and 18 deletions

View file

@ -213,7 +213,7 @@ func (o *DebugOptions) AddFlags(cmd *cobra.Command) {
cmd.Flags().BoolVar(&o.ShareProcesses, "share-processes", o.ShareProcesses, i18n.T("When used with '--copy-to', enable process namespace sharing in the copy."))
cmd.Flags().StringVar(&o.TargetContainer, "target", "", i18n.T("When using an ephemeral container, target processes in this container name."))
cmd.Flags().BoolVarP(&o.TTY, "tty", "t", o.TTY, i18n.T("Allocate a TTY for the debugging container."))
cmd.Flags().StringVar(&o.Profile, "profile", ProfileLegacy, i18n.T(`Options are "legacy", "general", "baseline", "netadmin", "restricted" or "sysadmin".`))
cmd.Flags().StringVar(&o.Profile, "profile", ProfileGeneral, i18n.T(`Options are "general", "baseline", "restricted", "netadmin" or "sysadmin". Defaults to general`))
cmd.Flags().StringVar(&o.CustomProfileFile, "custom", o.CustomProfileFile, i18n.T("Path to a JSON or YAML file containing a partial container spec to customize built-in debug profiles."))
}
@ -401,7 +401,7 @@ func (o *DebugOptions) Validate() error {
// Warning for legacy profile
if o.Profile == ProfileLegacy {
fmt.Fprintln(o.ErrOut, `--profile=legacy is deprecated and will be removed in the future. It is recommended to explicitly specify a profile, for example "--profile=general".`)
fmt.Fprintln(o.ErrOut, `--profile=legacy is deprecated and planned to be removed in v1.39. It is recommended to specify other profile, for example "--profile=general".`) //nolint:errcheck
}
return nil

View file

@ -2620,7 +2620,7 @@ func TestCompleteAndValidate(t *testing.T) {
Namespace: "test",
PullPolicy: corev1.PullPolicy("Always"),
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
},
},
@ -2633,7 +2633,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod1", "mypod2"},
},
},
@ -2646,7 +2646,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod1", "mypod2"},
},
},
@ -2661,7 +2661,7 @@ func TestCompleteAndValidate(t *testing.T) {
Interactive: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
TTY: true,
},
@ -2676,7 +2676,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
},
},
@ -2691,7 +2691,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
TTY: true,
},
@ -2706,7 +2706,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
PullPolicy: corev1.PullPolicy("Always"),
Profile: ProfileLegacy,
Profile: ProfileGeneral,
ShareProcesses: true,
TargetNames: []string{"mypod"},
},
@ -2748,7 +2748,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
TTY: true,
},
@ -2764,7 +2764,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
},
},
@ -2779,7 +2779,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
},
},
@ -2794,7 +2794,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
},
},
@ -2811,7 +2811,7 @@ func TestCompleteAndValidate(t *testing.T) {
"app": "app-debugger",
},
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
},
},
@ -2831,7 +2831,7 @@ func TestCompleteAndValidate(t *testing.T) {
"sidecar": "sidecar:debug",
},
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
TTY: true,
},
@ -2848,7 +2848,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
TTY: true,
},
@ -2870,7 +2870,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: false,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"mypod"},
TTY: true,
},
@ -2911,7 +2911,7 @@ func TestCompleteAndValidate(t *testing.T) {
KeepInitContainers: true,
Namespace: "test",
ShareProcesses: true,
Profile: ProfileLegacy,
Profile: ProfileGeneral,
TargetNames: []string{"node/mynode"},
TTY: true,
},

View file

@ -43,6 +43,8 @@ const (
// --profile flag's help text
// ProfileLegacy represents the legacy debugging profile which is backwards-compatible with 1.23 behavior.
//
// Deprecated: legacyProfile is planned to be removed in v1.39.
ProfileLegacy = "legacy"
// ProfileGeneral contains a reasonable set of defaults tailored for each debugging journey.
ProfileGeneral = "general"