-
Notifications
You must be signed in to change notification settings - Fork 375
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[ExternalNode] Handle ExternalNode from Antrea agent side
1. Provide an example RBAC yaml file for Antrea agent running on VM with definitions of ClusterRole, ServiceAccount and ClusterRoleBinding. 2. Add ExternalNodeController to monitor ExternalNode CRUD, invoke interfaces to operate OVS and update interface store with ExternalEntitiyInterface. 3. Implement OVS interactions related to ExternalNode CRUD. 4. Add a channel for receiving ExternalNode updates from ExternalNodeController and notifying NetworkPolicyController to reconcile rules related to the updated ExternalNodes. This is to handle the case when NetworkPolicyController reconciles rules before ExternalEntitityInterface is realized in the interface store. 5. Update NetworkPolicy reconciler to invoke GetInterfacesByEntity() and GetContainerInterfacesByPod() for ExternalEntity and Pod separately. Signed-off-by: Mengdie Song <[email protected]> Co-authored-by: Wenying Dong <[email protected]>
- Loading branch information
1 parent
cd93bd3
commit 5557fdd
Showing
26 changed files
with
1,301 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: ServiceAccount | ||
metadata: | ||
name: vm-agent | ||
namespace: test-ns # Change the namespace to where vm-agent is expected to run. | ||
--- | ||
kind: ClusterRole | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: vm-agent | ||
rules: | ||
# antrea-controller distributes the CA certificate as a ConfigMap named `antrea-ca` in the Antrea deployment Namespace. | ||
# vm-agent needs to access `antrea-ca` to connect with antrea-controller. | ||
- apiGroups: | ||
- "" | ||
resources: | ||
- configmaps | ||
resourceNames: | ||
- antrea-ca | ||
verbs: | ||
- get | ||
- watch | ||
- list | ||
# This is the content of built-in role kube-system/extension-apiserver-authentication-reader. | ||
# But it doesn't have list/watch permission before K8s v1.17.0 so the extension apiserver (vm-agent) will | ||
# have permission issue after bumping up apiserver library to a version that supports dynamic authentication. | ||
# See https://github.com/kubernetes/kubernetes/pull/85375 | ||
# To support K8s clusters older than v1.17.0, we grant the required permissions directly instead of relying on | ||
# the extension-apiserver-authentication role. | ||
- apiGroups: | ||
- "" | ||
resourceNames: | ||
- extension-apiserver-authentication | ||
resources: | ||
- configmaps | ||
verbs: | ||
- get | ||
- list | ||
- watch | ||
- apiGroups: | ||
- crd.antrea.io | ||
resourceNames: | ||
- VM1 # Change the ExternalNode name which vm-agent is expected to update. | ||
resources: | ||
- antreaagentinfos | ||
verbs: | ||
- get | ||
- update | ||
- apiGroups: | ||
- controlplane.antrea.io | ||
resources: | ||
- networkpolicies | ||
- appliedtogroups | ||
- addressgroups | ||
verbs: | ||
- get | ||
- watch | ||
- list | ||
- apiGroups: | ||
- controlplane.antrea.io | ||
resources: | ||
- nodestatssummaries | ||
verbs: | ||
- create | ||
- apiGroups: | ||
- controlplane.antrea.io | ||
resources: | ||
- networkpolicies/status | ||
verbs: | ||
- create | ||
- get | ||
- apiGroups: | ||
- crd.antrea.io | ||
resources: | ||
- externalentities | ||
verbs: | ||
- get | ||
- watch | ||
- list | ||
- apiGroups: | ||
- crd.antrea.io | ||
resources: | ||
- externalnodes | ||
verbs: | ||
- get | ||
- watch | ||
- list | ||
--- | ||
kind: ClusterRoleBinding | ||
apiVersion: rbac.authorization.k8s.io/v1 | ||
metadata: | ||
name: vm-agent | ||
roleRef: | ||
apiGroup: rbac.authorization.k8s.io | ||
kind: ClusterRole | ||
name: vm-agent | ||
subjects: | ||
- kind: ServiceAccount | ||
name: vm-agent | ||
namespace: test-ns # Change the namespace to where vm-agent is expected to run. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.