Skip to content

Commit

Permalink
Add legacy networking API group for backward compatibility (#1243)
Browse files Browse the repository at this point in the history
Package networking is superseded by package controlplane in v0.9.3, to
keep backward compatibility with up to two minor versions of
antrea-agents, the API group should remain for two more minor releases.

This patch adds the APIs back and serves them with the same storage as
controlplane API. Also, kind tests are added to make sure basic
functionalities are not broken when only controller is upgraded.
  • Loading branch information
tnqn authored Sep 17, 2020
1 parent 6160ff5 commit fd47097
Show file tree
Hide file tree
Showing 25 changed files with 472 additions and 71 deletions.
62 changes: 62 additions & 0 deletions .github/workflows/kind_upgrade.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,65 @@ jobs:
- name: Run test
run: |
./ci/kind/test-upgrade-antrea.sh --from-version-n-minus 2
compatible-N-1:
name: API compatible with client version N-1
needs: build-antrea-image
runs-on: [ubuntu-18.04]
steps:
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
df -h
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Download Antrea image from previous job
uses: actions/download-artifact@v1
with:
name: antrea-ubuntu
- name: Load Antrea image
run: docker load -i antrea-ubuntu/antrea-ubuntu.tar
- name: Install Kind
env:
KIND_VERSION: v0.7.0
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
- name: Run test
run: |
./ci/kind/test-upgrade-antrea.sh --from-version-n-minus 1 --controller-only
compatible-N-2:
name: API compatible with client version N-2
needs: build-antrea-image
runs-on: [ubuntu-18.04]
steps:
- name: Free disk space
# https://github.com/actions/virtual-environments/issues/709
run: |
sudo apt-get clean
df -h
- uses: actions/checkout@v2
- uses: actions/setup-go@v1
with:
go-version: 1.13
- name: Download Antrea image from previous job
uses: actions/download-artifact@v1
with:
name: antrea-ubuntu
- name: Load Antrea image
run: docker load -i antrea-ubuntu/antrea-ubuntu.tar
- name: Install Kind
env:
KIND_VERSION: v0.7.0
run: |
curl -Lo ./kind https://github.com/kubernetes-sigs/kind/releases/download/${KIND_VERSION}/kind-$(uname)-amd64
chmod +x ./kind
sudo mv kind /usr/local/bin
- name: Run test
run: |
./ci/kind/test-upgrade-antrea.sh --from-version-n-minus 2 --controller-only
26 changes: 18 additions & 8 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ metadata:
rules:
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -730,6 +731,7 @@ rules:
- delete
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -861,19 +863,12 @@ rules:
resourceNames:
- v1beta1.system.antrea.tanzu.vmware.com
- v1beta1.controlplane.antrea.tanzu.vmware.com
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- get
- update
- apiGroups:
- apiregistration.k8s.io
resourceNames:
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- delete
- apiGroups:
- security.antrea.tanzu.vmware.com
resources:
Expand Down Expand Up @@ -1227,6 +1222,21 @@ spec:
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
name: v1beta1.networking.antrea.tanzu.vmware.com
spec:
group: networking.antrea.tanzu.vmware.com
groupPriorityMinimum: 100
service:
name: antrea
namespace: kube-system
version: v1beta1
versionPriority: 100
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
Expand Down
26 changes: 18 additions & 8 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ metadata:
rules:
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -730,6 +731,7 @@ rules:
- delete
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -861,19 +863,12 @@ rules:
resourceNames:
- v1beta1.system.antrea.tanzu.vmware.com
- v1beta1.controlplane.antrea.tanzu.vmware.com
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- get
- update
- apiGroups:
- apiregistration.k8s.io
resourceNames:
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- delete
- apiGroups:
- security.antrea.tanzu.vmware.com
resources:
Expand Down Expand Up @@ -1227,6 +1222,21 @@ spec:
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
name: v1beta1.networking.antrea.tanzu.vmware.com
spec:
group: networking.antrea.tanzu.vmware.com
groupPriorityMinimum: 100
service:
name: antrea
namespace: kube-system
version: v1beta1
versionPriority: 100
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
Expand Down
26 changes: 18 additions & 8 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ metadata:
rules:
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -730,6 +731,7 @@ rules:
- delete
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -861,19 +863,12 @@ rules:
resourceNames:
- v1beta1.system.antrea.tanzu.vmware.com
- v1beta1.controlplane.antrea.tanzu.vmware.com
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- get
- update
- apiGroups:
- apiregistration.k8s.io
resourceNames:
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- delete
- apiGroups:
- security.antrea.tanzu.vmware.com
resources:
Expand Down Expand Up @@ -1227,6 +1222,21 @@ spec:
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
name: v1beta1.networking.antrea.tanzu.vmware.com
spec:
group: networking.antrea.tanzu.vmware.com
groupPriorityMinimum: 100
service:
name: antrea
namespace: kube-system
version: v1beta1
versionPriority: 100
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
Expand Down
26 changes: 18 additions & 8 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ metadata:
rules:
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -730,6 +731,7 @@ rules:
- delete
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -861,19 +863,12 @@ rules:
resourceNames:
- v1beta1.system.antrea.tanzu.vmware.com
- v1beta1.controlplane.antrea.tanzu.vmware.com
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- get
- update
- apiGroups:
- apiregistration.k8s.io
resourceNames:
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- delete
- apiGroups:
- security.antrea.tanzu.vmware.com
resources:
Expand Down Expand Up @@ -1241,6 +1236,21 @@ spec:
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
name: v1beta1.networking.antrea.tanzu.vmware.com
spec:
group: networking.antrea.tanzu.vmware.com
groupPriorityMinimum: 100
service:
name: antrea
namespace: kube-system
version: v1beta1
versionPriority: 100
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
Expand Down
26 changes: 18 additions & 8 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@ metadata:
rules:
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -730,6 +731,7 @@ rules:
- delete
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down Expand Up @@ -861,19 +863,12 @@ rules:
resourceNames:
- v1beta1.system.antrea.tanzu.vmware.com
- v1beta1.controlplane.antrea.tanzu.vmware.com
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- get
- update
- apiGroups:
- apiregistration.k8s.io
resourceNames:
- v1beta1.networking.antrea.tanzu.vmware.com
resources:
- apiservices
verbs:
- delete
- apiGroups:
- security.antrea.tanzu.vmware.com
resources:
Expand Down Expand Up @@ -1232,6 +1227,21 @@ spec:
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
name: v1beta1.networking.antrea.tanzu.vmware.com
spec:
group: networking.antrea.tanzu.vmware.com
groupPriorityMinimum: 100
service:
name: antrea
namespace: kube-system
version: v1beta1
versionPriority: 100
---
apiVersion: apiregistration.k8s.io/v1
kind: APIService
metadata:
labels:
app: antrea
Expand Down
1 change: 1 addition & 0 deletions build/yamls/base/agent-rbac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ rules:
- delete
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down
1 change: 1 addition & 0 deletions build/yamls/base/antctl.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ metadata:
rules:
- apiGroups:
- controlplane.antrea.tanzu.vmware.com
- networking.antrea.tanzu.vmware.com
resources:
- networkpolicies
- appliedtogroups
Expand Down
11 changes: 1 addition & 10 deletions build/yamls/base/controller-rbac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,19 +88,10 @@ rules:
resourceNames:
- v1beta1.system.antrea.tanzu.vmware.com
- v1beta1.controlplane.antrea.tanzu.vmware.com
- v1beta1.networking.antrea.tanzu.vmware.com
verbs:
- get
- update
- apiGroups:
- apiregistration.k8s.io
resources:
- apiservices
resourceNames:
# Add the APIServices for the deprecated APIGroups here. antrea-controller
# will try to delete the APIServices if they are registered.
- v1beta1.networking.antrea.tanzu.vmware.com
verbs:
- delete
- apiGroups:
- security.antrea.tanzu.vmware.com
resources:
Expand Down
Loading

0 comments on commit fd47097

Please sign in to comment.