Skip to content

Commit

Permalink
Add select egress's owner node and assign egress-ip to node for egres…
Browse files Browse the repository at this point in the history
…s failover feature, Add egress status of api and Update codegen of egress status

Signed-off-by: wenqiq <wenqiq@vmware.com>
  • Loading branch information
wenqiq committed Jun 4, 2021
1 parent 7e01f29 commit 2135405
Show file tree
Hide file tree
Showing 19 changed files with 493 additions and 14 deletions.
19 changes: 19 additions & 0 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- description: The Owner Node of egress IP
jsonPath: .status.nodeName
name: Status
type: string
name: v1alpha2
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1405,15 +1409,27 @@ spec:
- format: ipv4
- format: ipv6
type: string
failoverPolicy:
enum:
- Auto
- None
type: string
required:
- appliedTo
- egressIP
type: object
status:
properties:
nodeName:
type: string
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -3195,10 +3211,13 @@ rules:
- crd.antrea.io
resources:
- egresses
- egresses/status
verbs:
- get
- watch
- list
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
19 changes: 19 additions & 0 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- description: The Owner Node of egress IP
jsonPath: .status.nodeName
name: Status
type: string
name: v1alpha2
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1405,15 +1409,27 @@ spec:
- format: ipv4
- format: ipv6
type: string
failoverPolicy:
enum:
- Auto
- None
type: string
required:
- appliedTo
- egressIP
type: object
status:
properties:
nodeName:
type: string
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -3195,10 +3211,13 @@ rules:
- crd.antrea.io
resources:
- egresses
- egresses/status
verbs:
- get
- watch
- list
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
19 changes: 19 additions & 0 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- description: The Owner Node of egress IP
jsonPath: .status.nodeName
name: Status
type: string
name: v1alpha2
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1405,15 +1409,27 @@ spec:
- format: ipv4
- format: ipv6
type: string
failoverPolicy:
enum:
- Auto
- None
type: string
required:
- appliedTo
- egressIP
type: object
status:
properties:
nodeName:
type: string
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -3195,10 +3211,13 @@ rules:
- crd.antrea.io
resources:
- egresses
- egresses/status
verbs:
- get
- watch
- list
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
19 changes: 19 additions & 0 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- description: The Owner Node of egress IP
jsonPath: .status.nodeName
name: Status
type: string
name: v1alpha2
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1405,15 +1409,27 @@ spec:
- format: ipv4
- format: ipv6
type: string
failoverPolicy:
enum:
- Auto
- None
type: string
required:
- appliedTo
- egressIP
type: object
status:
properties:
nodeName:
type: string
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -3195,10 +3211,13 @@ rules:
- crd.antrea.io
resources:
- egresses
- egresses/status
verbs:
- get
- watch
- list
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
19 changes: 19 additions & 0 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -1345,6 +1345,10 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- description: The Owner Node of egress IP
jsonPath: .status.nodeName
name: Status
type: string
name: v1alpha2
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -1405,15 +1409,27 @@ spec:
- format: ipv4
- format: ipv6
type: string
failoverPolicy:
enum:
- Auto
- None
type: string
required:
- appliedTo
- egressIP
type: object
status:
properties:
nodeName:
type: string
type: object
required:
- spec
type: object
served: true
storage: true
subresources:
status: {}
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
Expand Down Expand Up @@ -3195,10 +3211,13 @@ rules:
- crd.antrea.io
resources:
- egresses
- egresses/status
verbs:
- get
- watch
- list
- update
- patch
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
Expand Down
3 changes: 3 additions & 0 deletions build/yamls/base/agent-rbac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,10 +146,13 @@ rules:
- crd.antrea.io
resources:
- egresses
- egresses/status
verbs:
- get
- watch
- list
- update
- patch
---
kind: ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
Expand Down
16 changes: 16 additions & 0 deletions build/yamls/base/crds.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,16 @@ spec:
oneOf:
- format: ipv4
- format: ipv6
failoverPolicy:
type: string
enum:
- Auto
- None
status:
type: object
properties:
nodeName:
type: string
additionalPrinterColumns:
- description: Specifies the SNAT IP address for the selected workloads.
jsonPath: .spec.egressIP
Expand All @@ -83,6 +93,12 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- description: The Owner Node of egress IP
jsonPath: .status.nodeName
name: Status
type: string
subresources:
status: {}
scope: Cluster
names:
plural: egresses
Expand Down
17 changes: 11 additions & 6 deletions cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -224,13 +224,19 @@ func run(o *Options) error {
}

var egressController *egress.EgressController
var cluster *memberlist.Cluster
if features.DefaultFeatureGate.Enabled(features.Egress) {
egressController = egress.NewEgressController(ofClient, egressInformer, antreaClientProvider, ifaceStore, routeClient, nodeConfig.Name)
cluster, err = memberlist.NewCluster(o.config.ClusterPort, nodeInformer, nodeConfig)
if err != nil {
return fmt.Errorf("initializing egress node memberlist cluster error: %v", err)
// turn on the egress auto failover switch, to-do
nodeAutoFailoverSupport := true
var cluster *memberlist.Cluster
if nodeAutoFailoverSupport {
cluster, err = memberlist.NewCluster(o.config.ClusterPort, nodeInformer, nodeConfig)
if err != nil {
return fmt.Errorf("initializing egress node memberlist cluster error: %v", err)
}
}
egressController = egress.NewEgressController(
ofClient, egressInformer, antreaClientProvider, ifaceStore, routeClient,
nodeConfig.Name, cluster, crdClient, nodeAutoFailoverSupport)
}
isChaining := false
if networkConfig.TrafficEncapMode.IsNetworkPolicyOnly() {
Expand Down Expand Up @@ -305,7 +311,6 @@ func run(o *Options) error {

if features.DefaultFeatureGate.Enabled(features.Egress) {
go egressController.Run(stopCh)
go cluster.Run(stopCh)
}

if features.DefaultFeatureGate.Enabled(features.NetworkPolicyStats) {
Expand Down
Loading

0 comments on commit 2135405

Please sign in to comment.