From fe4de9f23111476e4e0217c6a82bbabda50afee9 Mon Sep 17 00:00:00 2001 From: Xunzhuo Date: Thu, 7 Mar 2024 22:27:42 +0800 Subject: [PATCH] remove: support for hostnetwork (#2815) --- api/v1alpha1/shared_types.go | 4 ---- .../crds/generated/gateway.envoyproxy.io_envoyproxies.yaml | 4 ---- internal/infrastructure/kubernetes/proxy/resource_provider.go | 1 - .../infrastructure/kubernetes/proxy/resource_provider_test.go | 1 - .../kubernetes/proxy/testdata/deployments/custom.yaml | 1 - .../infrastructure/kubernetes/ratelimit/resource_provider.go | 1 - .../kubernetes/ratelimit/resource_provider_test.go | 1 - .../kubernetes/ratelimit/testdata/deployments/custom.yaml | 1 - site/content/en/latest/api/extension_types.md | 1 - 9 files changed, 15 deletions(-) diff --git a/api/v1alpha1/shared_types.go b/api/v1alpha1/shared_types.go index 910f78cd3ff..4014014e9df 100644 --- a/api/v1alpha1/shared_types.go +++ b/api/v1alpha1/shared_types.go @@ -126,10 +126,6 @@ type KubernetesPodSpec struct { // +optional Volumes []corev1.Volume `json:"volumes,omitempty"` - // HostNetwork, If this is set to true, the pod will use host's network namespace. - // +optional - HostNetwork bool `json:"hostNetwork,omitempty"` - // ImagePullSecrets is an optional list of references to secrets // in the same namespace to use for pulling any of the images used by this PodSpec. // If specified, these secrets will be passed to individual puller implementations for them to use. diff --git a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml index f464dfca6d6..ad32967e71a 100644 --- a/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml +++ b/charts/gateway-helm/crds/generated/gateway.envoyproxy.io_envoyproxies.yaml @@ -3282,10 +3282,6 @@ spec: should be appended to the pods. By default, no pod annotations are appended. type: object - hostNetwork: - description: HostNetwork, If this is set to true, - the pod will use host's network namespace. - type: boolean imagePullSecrets: description: 'ImagePullSecrets is an optional list of references to secrets in the same namespace to diff --git a/internal/infrastructure/kubernetes/proxy/resource_provider.go b/internal/infrastructure/kubernetes/proxy/resource_provider.go index 7faccb252ea..2a11f7317d3 100644 --- a/internal/infrastructure/kubernetes/proxy/resource_provider.go +++ b/internal/infrastructure/kubernetes/proxy/resource_provider.go @@ -254,7 +254,6 @@ func (r *ResourceRender) Deployment() (*appsv1.Deployment, error) { RestartPolicy: corev1.RestartPolicyAlways, SchedulerName: "default-scheduler", SecurityContext: deploymentConfig.Pod.SecurityContext, - HostNetwork: deploymentConfig.Pod.HostNetwork, Affinity: deploymentConfig.Pod.Affinity, Tolerations: deploymentConfig.Pod.Tolerations, Volumes: expectedDeploymentVolumes(r.infra.Name, deploymentConfig), diff --git a/internal/infrastructure/kubernetes/proxy/resource_provider_test.go b/internal/infrastructure/kubernetes/proxy/resource_provider_test.go index 75d72583449..8f08c81084c 100644 --- a/internal/infrastructure/kubernetes/proxy/resource_provider_test.go +++ b/internal/infrastructure/kubernetes/proxy/resource_provider_test.go @@ -121,7 +121,6 @@ func TestDeployment(t *testing.T) { SecurityContext: &corev1.PodSecurityContext{ RunAsUser: ptr.To[int64](1000), }, - HostNetwork: true, }, Container: &egv1a1.KubernetesContainerSpec{ Image: ptr.To("envoyproxy/envoy:v1.2.3"), diff --git a/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml b/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml index a6d0110a152..e26fd3bb243 100644 --- a/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml +++ b/internal/infrastructure/kubernetes/proxy/testdata/deployments/custom.yaml @@ -279,7 +279,6 @@ spec: terminationMessagePath: /dev/termination-log terminationMessagePolicy: File dnsPolicy: ClusterFirst - hostNetwork: true restartPolicy: Always schedulerName: default-scheduler securityContext: diff --git a/internal/infrastructure/kubernetes/ratelimit/resource_provider.go b/internal/infrastructure/kubernetes/ratelimit/resource_provider.go index b7e8867e483..67c5312b5e3 100644 --- a/internal/infrastructure/kubernetes/ratelimit/resource_provider.go +++ b/internal/infrastructure/kubernetes/ratelimit/resource_provider.go @@ -217,7 +217,6 @@ func (r *ResourceRender) Deployment() (*appsv1.Deployment, error) { RestartPolicy: corev1.RestartPolicyAlways, SchedulerName: "default-scheduler", SecurityContext: r.rateLimitDeployment.Pod.SecurityContext, - HostNetwork: r.rateLimitDeployment.Pod.HostNetwork, Volumes: expectedDeploymentVolumes(r.rateLimit, r.rateLimitDeployment), Affinity: r.rateLimitDeployment.Pod.Affinity, Tolerations: r.rateLimitDeployment.Pod.Tolerations, diff --git a/internal/infrastructure/kubernetes/ratelimit/resource_provider_test.go b/internal/infrastructure/kubernetes/ratelimit/resource_provider_test.go index 6fc476e85d2..d322e8c925e 100644 --- a/internal/infrastructure/kubernetes/ratelimit/resource_provider_test.go +++ b/internal/infrastructure/kubernetes/ratelimit/resource_provider_test.go @@ -263,7 +263,6 @@ func TestDeployment(t *testing.T) { SecurityContext: &corev1.PodSecurityContext{ RunAsUser: ptr.To[int64](1000), }, - HostNetwork: true, }, Container: &egv1a1.KubernetesContainerSpec{ Image: ptr.To("custom-image"), diff --git a/internal/infrastructure/kubernetes/ratelimit/testdata/deployments/custom.yaml b/internal/infrastructure/kubernetes/ratelimit/testdata/deployments/custom.yaml index 216627b3d9b..5f0c2f8683f 100644 --- a/internal/infrastructure/kubernetes/ratelimit/testdata/deployments/custom.yaml +++ b/internal/infrastructure/kubernetes/ratelimit/testdata/deployments/custom.yaml @@ -132,7 +132,6 @@ spec: name: statsd-exporter-config readOnly: true dnsPolicy: ClusterFirst - hostNetwork: true restartPolicy: Always schedulerName: default-scheduler securityContext: diff --git a/site/content/en/latest/api/extension_types.md b/site/content/en/latest/api/extension_types.md index 70573bdd10f..a0b3f0047e6 100644 --- a/site/content/en/latest/api/extension_types.md +++ b/site/content/en/latest/api/extension_types.md @@ -1480,7 +1480,6 @@ _Appears in:_ | `affinity` | _[Affinity](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#affinity-v1-core)_ | false | If specified, the pod's scheduling constraints. | | `tolerations` | _[Toleration](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#toleration-v1-core) array_ | false | If specified, the pod's tolerations. | | `volumes` | _[Volume](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#volume-v1-core) array_ | false | Volumes that can be mounted by containers belonging to the pod. More info: https://kubernetes.io/docs/concepts/storage/volumes | -| `hostNetwork` | _boolean_ | false | HostNetwork, If this is set to true, the pod will use host's network namespace. | | `imagePullSecrets` | _[LocalObjectReference](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#localobjectreference-v1-core) array_ | false | ImagePullSecrets is an optional list of references to secrets in the same namespace to use for pulling any of the images used by this PodSpec. If specified, these secrets will be passed to individual puller implementations for them to use. More info: https://kubernetes.io/docs/concepts/containers/images#specifying-imagepullsecrets-on-a-pod | | `nodeSelector` | _object (keys:string, values:string)_ | false | NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node. More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/ | | `topologySpreadConstraints` | _[TopologySpreadConstraint](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.26/#topologyspreadconstraint-v1-core) array_ | false | TopologySpreadConstraints describes how a group of pods ought to spread across topology domains. Scheduler will schedule pods in a way which abides by the constraints. All topologySpreadConstraints are ANDed. |