From 360fa681c3cbe4ac2e5afac585d576ffe54330d1 Mon Sep 17 00:00:00 2001 From: Paco Xu Date: Fri, 16 Dec 2022 23:46:47 +0800 Subject: [PATCH] cleanup: EphemeralContainers feature gate related codes Kubernetes-commit: 70e56fa71af5aa4f3d1448fcbc26e86309cd0cf3 --- pkg/cmd/debug/debug.go | 7 +------ .../i18n/translations/kubectl/default/LC_MESSAGES/k8s.po | 8 -------- .../i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.po | 8 -------- pkg/util/i18n/translations/kubectl/template.pot | 4 ---- testdata/openapi/swagger.json | 6 +++--- 5 files changed, 4 insertions(+), 29 deletions(-) diff --git a/pkg/cmd/debug/debug.go b/pkg/cmd/debug/debug.go index 9dc622a26..bd25c64ff 100644 --- a/pkg/cmd/debug/debug.go +++ b/pkg/cmd/debug/debug.go @@ -75,11 +75,9 @@ var ( debugExample = templates.Examples(i18n.T(` # Create an interactive debugging session in pod mypod and immediately attach to it. - # (requires the EphemeralContainers feature to be enabled in the cluster) kubectl debug mypod -it --image=busybox # Create a debug container named debugger using a custom automated debugging image. - # (requires the EphemeralContainers feature to be enabled in the cluster) kubectl debug --image=myproj/debug-tools -c debugger mypod # Create a copy of mypod adding a debug container and attach to it @@ -296,9 +294,6 @@ func (o *DebugOptions) Validate() error { return fmt.Errorf("--target is incompatible with --copy-to. Use --share-processes instead.") } if !o.Quiet { - // If the runtime doesn't support container namespace targeting this will fail silently, which has caused - // some confusion (ex: https://issues.k8s.io/98362), so print a warning. This can be removed when - // EphemeralContainers are generally available. fmt.Fprintf(o.Out, "Targeting container %q. If you don't see processes from this container it may be because the container runtime doesn't support this feature.\n", o.TargetContainer) // TODO(verb): Add a list of supported container runtimes to https://kubernetes.io/docs/concepts/workloads/pods/ephemeral-containers/ and then link here. } @@ -447,7 +442,7 @@ func (o *DebugOptions) debugByEphemeralContainer(ctx context.Context, pod *corev // The apiserver will return a 404 when the EphemeralContainers feature is disabled because the `/ephemeralcontainers` subresource // is missing. Unlike the 404 returned by a missing pod, the status details will be empty. if serr, ok := err.(*errors.StatusError); ok && serr.Status().Reason == metav1.StatusReasonNotFound && serr.ErrStatus.Details.Name == "" { - return nil, "", fmt.Errorf("ephemeral containers are disabled for this cluster (error from server: %q).", err) + return nil, "", fmt.Errorf("ephemeral containers are disabled for this cluster (error from server: %q)", err) } // The Kind used for the /ephemeralcontainers subresource changed in 1.22. When presented with an unexpected diff --git a/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.po b/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.po index c0952d13c..538c7b2d5 100644 --- a/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.po +++ b/pkg/util/i18n/translations/kubectl/default/LC_MESSAGES/k8s.po @@ -712,14 +712,10 @@ msgid "" "\n" "\t\t# Create an interactive debugging session in pod mypod and immediately " "attach to it.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug mypod -it --image=busybox\n" "\n" "\t\t# Create a debug container named debugger using a custom automated " "debugging image.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n" "\n" "\t\t# Create a copy of mypod adding a debug container and attach to it\n" @@ -746,14 +742,10 @@ msgstr "" "\n" "\t\t# Create an interactive debugging session in pod mypod and immediately " "attach to it.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug mypod -it --image=busybox\n" "\n" "\t\t# Create a debug container named debugger using a custom automated " "debugging image.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n" "\n" "\t\t# Create a copy of mypod adding a debug container and attach to it\n" diff --git a/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.po b/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.po index 90ea088d6..d07da117b 100644 --- a/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.po +++ b/pkg/util/i18n/translations/kubectl/en_US/LC_MESSAGES/k8s.po @@ -712,14 +712,10 @@ msgid "" "\n" "\t\t# Create an interactive debugging session in pod mypod and immediately " "attach to it.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug mypod -it --image=busybox\n" "\n" "\t\t# Create a debug container named debugger using a custom automated " "debugging image.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n" "\n" "\t\t# Create a copy of mypod adding a debug container and attach to it\n" @@ -746,14 +742,10 @@ msgstr "" "\n" "\t\t# Create an interactive debugging session in pod mypod and immediately " "attach to it.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug mypod -it --image=busybox\n" "\n" "\t\t# Create a debug container named debugger using a custom automated " "debugging image.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n" "\n" "\t\t# Create a copy of mypod adding a debug container and attach to it\n" diff --git a/pkg/util/i18n/translations/kubectl/template.pot b/pkg/util/i18n/translations/kubectl/template.pot index 8fd30a104..d5ec942a6 100644 --- a/pkg/util/i18n/translations/kubectl/template.pot +++ b/pkg/util/i18n/translations/kubectl/template.pot @@ -409,14 +409,10 @@ msgid "" "\n" "\t\t# Create an interactive debugging session in pod mypod and immediately " "attach to it.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug mypod -it --image=busybox\n" "\n" "\t\t# Create a debug container named debugger using a custom automated " "debugging image.\n" -"\t\t# (requires the EphemeralContainers feature to be enabled in the " -"cluster)\n" "\t\tkubectl debug --image=myproj/debug-tools -c debugger mypod\n" "\n" "\t\t# Create a copy of mypod adding a debug container and attach to it\n" diff --git a/testdata/openapi/swagger.json b/testdata/openapi/swagger.json index 92d01e8ac..592962f8d 100644 --- a/testdata/openapi/swagger.json +++ b/testdata/openapi/swagger.json @@ -6447,7 +6447,7 @@ "type": "object" }, "io.k8s.api.core.v1.EphemeralContainer": { - "description": "An EphemeralContainer is a container that may be added temporarily to an existing pod for user-initiated activities such as debugging. Ephemeral containers have no resource or scheduling guarantees, and they will not be restarted when they exit or when a pod is removed or restarted. If an ephemeral container causes a pod to exceed its resource allocation, the pod may be evicted. Ephemeral containers may not be added by directly updating the pod spec. They must be added via the pod's ephemeralcontainers subresource, and they will appear in the pod spec once added. This is an alpha feature enabled by the EphemeralContainers feature flag.", + "description": "An EphemeralContainer is a container that may be added temporarily to an existing pod for user-initiated activities such as debugging. Ephemeral containers have no resource or scheduling guarantees, and they will not be restarted when they exit or when a pod is removed or restarted. If an ephemeral container causes a pod to exceed its resource allocation, the pod may be evicted. Ephemeral containers may not be added by directly updating the pod spec. They must be added via the pod's ephemeralcontainers subresource, and they will appear in the pod spec once added.", "properties": { "args": { "description": "Arguments to the entrypoint. The container image's CMD is used if this is not provided. Variable references $(VAR_NAME) are expanded using the container's environment. If a variable cannot be resolved, the reference in the input string will be unchanged. The $(VAR_NAME) syntax can be escaped with a double $$, ie: $$(VAR_NAME). Escaped references will never be expanded, regardless of whether the variable exists or not. Cannot be updated. More info: https://kubernetes.io/docs/tasks/inject-data-application/define-command-argument-container/#running-a-command-in-a-shell", @@ -8819,7 +8819,7 @@ "type": "boolean" }, "ephemeralContainers": { - "description": "List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource. This field is alpha-level and is only honored by servers that enable the EphemeralContainers feature.", + "description": "List of ephemeral containers run in this pod. Ephemeral containers may be run in an existing pod to perform user-initiated actions such as debugging. This list cannot be specified when creating a pod, and it cannot be modified by updating the pod spec. In order to add an ephemeral container to an existing pod, use the pod's ephemeralcontainers subresource.", "items": { "$ref": "#/definitions/io.k8s.api.core.v1.EphemeralContainer" }, @@ -9005,7 +9005,7 @@ "type": "array" }, "ephemeralContainerStatuses": { - "description": "Status for any ephemeral containers that have run in this pod. This field is alpha-level and is only populated by servers that enable the EphemeralContainers feature.", + "description": "Status for any ephemeral containers that have run in this pod.", "items": { "$ref": "#/definitions/io.k8s.api.core.v1.ContainerStatus" },