Skip to content

Commit 1b4af65

Browse files
authored
Increase the minimum supported Kubernetes version to 1.23 (#7564)
K8s 1.23 is the release where the IPv6DualStack feature gate became GA and locked to true. By increasing the minimum supported version to 1.23, we can assume that some dual-stack fields (e.g., spec.ipFamilies` for Services) are always present and populated correctly. K8s 1.23 is also the release were the EndpointSlice feature gate became GA and locked to true. Additionally, because NamespaceDefaultLabelName was removed in K8s 1.23, we can furthermore remove some code / documentation that is no longer needed. However, we do not drop support for `antrea.io/metadata.name` (yet?) - we just stop mentioning it in the Antrea NetworkPolicy documentation. Note that K8s 1.23 was released at the end of 2021. Signed-off-by: Antonin Bas <[email protected]>
1 parent e992305 commit 1b4af65

File tree

15 files changed

+26
-132
lines changed

15 files changed

+26
-132
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Network Policies in a very efficient manner.
2727

2828
## Prerequisites
2929

30-
Antrea has been tested with Kubernetes clusters running version 1.19 or later.
30+
Antrea has been tested with Kubernetes clusters running version 1.23 or later.
3131

3232
* `NodeIPAMController` must be enabled in the Kubernetes cluster.\
3333
When deploying a cluster with kubeadm the `--pod-network-cidr <cidr>`

build/charts/antrea/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ displayName: Antrea
55
home: https://antrea.io/
66
version: 0.0.0
77
appVersion: latest
8-
kubeVersion: ">= 1.19.0-0"
8+
kubeVersion: ">= 1.23.0-0"
99
icon: https://raw.githubusercontent.com/antrea-io/antrea/main/docs/assets/logo/antrea_logo.svg
1010
description: Kubernetes networking based on Open vSwitch
1111
keywords:

build/charts/antrea/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Kubernetes networking based on Open vSwitch
1212

1313
## Requirements
1414

15-
Kubernetes: `>= 1.19.0-0`
15+
Kubernetes: `>= 1.23.0-0`
1616

1717
## Values
1818

build/charts/flow-aggregator/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ displayName: Antrea Flow Aggregator
55
home: https://antrea.io/
66
version: 0.0.0
77
appVersion: latest
8-
kubeVersion: ">= 1.19.0-0"
8+
kubeVersion: ">= 1.23.0-0"
99
icon: https://raw.githubusercontent.com/antrea-io/antrea/main/docs/assets/logo/antrea_logo.svg
1010
description: Antrea Flow Aggregator
1111
keywords:

build/charts/flow-aggregator/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ Antrea Flow Aggregator
1212

1313
## Requirements
1414

15-
Kubernetes: `>= 1.19.0-0`
15+
Kubernetes: `>= 1.23.0-0`
1616

1717
## Values
1818

ci/jenkins/test.sh

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -942,9 +942,6 @@ function redeploy_k8s_if_ip_mode_changes() {
942942
POD_SUBNET_STRING="${POD_SUBNET_IPV4},${POD_SUBNET_IPV6}"
943943
SERVICE_SUBNET_STRING="${SERVICE_SUBNET_IPV4},${SERVICE_SUBNET_IPV6}"
944944
ADVERTISE_ADDRESS_STRING=${CONTROL_PLANE_IPV4}
945-
if [[ ${K8S_VERSION} =~ 1.19. ]] || [[ ${K8S_VERSION} =~ 1.20. ]]; then
946-
FEATURE_GATES_STRING=`echo -e "featureGates:\n IPv6DualStack: true"`
947-
fi
948945
APISERVER_IP_STRING=${ADVERTISE_ADDRESS_STRING}
949946
fi
950947
cat <<EOF | tee ${WORKDIR}/kubeadm.conf

docs/antrea-network-policy.md

Lines changed: 3 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
- [Rule enforcement based on priorities](#rule-enforcement-based-on-priorities)
3737
- [Advanced peer selection mechanisms of Antrea-native Policies](#advanced-peer-selection-mechanisms-of-antrea-native-policies)
3838
- [Selecting Namespace by Name](#selecting-namespace-by-name)
39-
- [K8s clusters with version 1.21 and above](#k8s-clusters-with-version-121-and-above)
40-
- [K8s clusters with version 1.20 and below](#k8s-clusters-with-version-120-and-below)
4139
- [Selecting Pods in the same Namespace with Self](#selecting-pods-in-the-same-namespace-with-self)
4240
- [Selecting Namespaces with the same label values using SameLabels](#selecting-namespaces-with-the-same-label-values-using-samelabels)
4341
- [FQDN based filtering](#fqdn-based-filtering)
@@ -1171,11 +1169,8 @@ workloads from Namespaces with the use of a label selector (i.e. `namespaceSelec
11711169
However, it is often desirable to be able to select Namespaces directly by their `name`
11721170
as opposed to using the `labels` associated with the Namespaces.
11731171

1174-
#### K8s clusters with version 1.21 and above
1175-
1176-
Starting with K8s v1.21, all Namespaces are labeled with the `kubernetes.io/metadata.name: <namespaceName>`
1177-
[label](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#automatic-labelling)
1178-
provided that the `NamespaceDefaultLabelName` feature gate (enabled by default) is not disabled in K8s.
1172+
Namespaces are labeled with the `kubernetes.io/metadata.name: <namespaceName>`
1173+
[label](https://kubernetes.io/docs/concepts/overview/working-with-objects/namespaces/#automatic-labelling).
11791174
K8s NetworkPolicy and Antrea-native policy users can take advantage of this reserved label
11801175
to select Namespaces directly by their `name` in `namespaceSelectors` as follows:
11811176

@@ -1207,83 +1202,8 @@ spec:
12071202
name: AllowToCoreDNS
12081203
```
12091204

1210-
**Note**: `NamespaceDefaultLabelName` feature gate is scheduled to be removed in K8s v1.24, thereby
1211-
ensuring that labeling Namespaces by their name cannot be disabled.
1212-
1213-
#### K8s clusters with version 1.20 and below
1214-
1215-
In order to select Namespaces by name, Antrea labels Namespaces with a reserved label `antrea.io/metadata.name`,
1216-
whose value is set to the Namespace's name. Users can then use this label in the
1217-
`namespaceSelector` field, in both K8s NetworkPolicies and Antrea-native policies to
1218-
select Namespaces by name. By default, Namespaces are not labeled with the reserved name label.
1219-
In order for the Antrea controller to label the Namespaces, the `labelsmutator.antrea.io`
1220-
`MutatingWebhookConfiguration` must be enabled. This can be done by applying the following
1221-
webhook configuration YAML:
1222-
1223-
```yaml
1224-
apiVersion: admissionregistration.k8s.io/v1
1225-
kind: MutatingWebhookConfiguration
1226-
metadata:
1227-
# Do not edit this name.
1228-
name: "labelsmutator.antrea.io"
1229-
# Do not remove these labels.
1230-
labels:
1231-
app: antrea
1232-
served-by: antrea-controller
1233-
webhooks:
1234-
- name: "namelabelmutator.antrea.io"
1235-
clientConfig:
1236-
service:
1237-
name: "antrea"
1238-
namespace: "kube-system"
1239-
path: "/mutate/namespace"
1240-
rules:
1241-
- operations: ["CREATE", "UPDATE"]
1242-
apiGroups: [""]
1243-
apiVersions: ["v1"]
1244-
resources: ["namespaces"]
1245-
scope: "Cluster"
1246-
admissionReviewVersions: ["v1", "v1beta1"]
1247-
sideEffects: None
1248-
timeoutSeconds: 5
1249-
```
1250-
1251-
**Note**: `antrea-controller` Pod must be restarted after applying this YAML.
1252-
1253-
Once the webhook is configured, Antrea will start labeling all new and updated
1254-
Namespaces with the `antrea.io/metadata.name: <namespaceName>` label. Users may now
1255-
use this reserved label to select Namespaces by name as follows:
1256-
1257-
```yaml
1258-
apiVersion: crd.antrea.io/v1beta1
1259-
kind: NetworkPolicy
1260-
metadata:
1261-
name: test-annp-by-name
1262-
namespace: default
1263-
spec:
1264-
priority: 5
1265-
tier: application
1266-
appliedTo:
1267-
- podSelector: {}
1268-
egress:
1269-
- action: Allow
1270-
to:
1271-
- podSelector:
1272-
matchLabels:
1273-
k8s-app: kube-dns
1274-
namespaceSelector:
1275-
matchLabels:
1276-
antrea.io/metadata.name: kube-system
1277-
ports:
1278-
- protocol: TCP
1279-
port: 53
1280-
- protocol: UDP
1281-
port: 53
1282-
name: AllowToCoreDNS
1283-
```
1284-
12851205
The above example allows all Pods from Namespace "default" to connect to all "kube-dns"
1286-
Pods from Namespace "kube-system" on TCP port 53.
1206+
Pods from Namespace "kube-system" on TCP port 53 and UDP port 53.
12871207

12881208
### Selecting Pods in the same Namespace with Self
12891209

docs/antrea-proxy.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,9 +102,7 @@ To remove kube-proxy from an existing cluster, you can use the following steps:
102102
# Delete the kube-proxy DaemonSet
103103
kubectl -n kube-system delete ds/kube-proxy
104104
# Delete the kube-proxy ConfigMap to prevent kube-proxy from being re-deployed
105-
# by kubeadm during "upgrade apply". This workaround will not take effect for
106-
# kubeadm versions older than v1.19 as the following patch is required:
107-
# https://github.com/kubernetes/kubernetes/pull/89593
105+
# by kubeadm during "upgrade apply".
108106
kubectl -n kube-system delete cm/kube-proxy
109107
# Delete existing kube-proxy rules; there are several options for doing that
110108
# Option 1 (if using kube-proxy in iptables mode), run the following on each Node:

multicluster/controllers/multicluster/member/labelidentity_controller.go

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -356,12 +356,6 @@ func (r *LabelIdentityReconciler) getLabelIdentityResourceExport(name, normalize
356356
}
357357

358358
func GetNormalizedLabel(nsLabels, podLabels map[string]string, ns string) string {
359-
if _, ok := nsLabels[v1.LabelMetadataName]; !ok {
360-
// NamespaceDefaultLabelName is supported from K8s v1.21. For K8s versions before v1.21,
361-
// we append the Namespace name label to the Namespace label set, so that the exported
362-
// label is guaranteed to have Namespace name information.
363-
nsLabels[v1.LabelMetadataName] = ns
364-
}
365359
return "ns:" + labels.Set(nsLabels).String() + "&pod:" + labels.Set(podLabels).String()
366360
}
367361

multicluster/controllers/multicluster/member/labelidentity_controller_test.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -266,18 +266,11 @@ func TestGetNormalizedLabel(t *testing.T) {
266266
map[string]string{v1.LabelMetadataName: "test-ns"},
267267
"ns:kubernetes.io/metadata.name=test-ns&pod:purpose=test",
268268
},
269-
{
270-
"no Namespace default name label",
271-
"test-ns",
272-
map[string]string{"purpose": "test"},
273-
map[string]string{"region": "west"},
274-
"ns:kubernetes.io/metadata.name=test-ns,region=west&pod:purpose=test",
275-
},
276269
{
277270
"no Pod label",
278271
"test-ns",
279272
map[string]string{},
280-
map[string]string{"region": "west"},
273+
map[string]string{v1.LabelMetadataName: "test-ns", "region": "west"},
281274
"ns:kubernetes.io/metadata.name=test-ns,region=west&pod:",
282275
},
283276
}

0 commit comments

Comments
 (0)