Skip to content

Commit

Permalink
Modification for review.
Browse files Browse the repository at this point in the history
  • Loading branch information
hongliangl committed Mar 31, 2021
1 parent a06736a commit fd42f9d
Show file tree
Hide file tree
Showing 28 changed files with 630 additions and 528 deletions.
22 changes: 6 additions & 16 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,12 @@ rules:
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- apiGroups:
- apiregistration.k8s.io
resourceNames:
Expand Down Expand Up @@ -2255,22 +2261,6 @@ subjects:
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-ca
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-cluster-identity
namespace: kube-system
---
apiVersion: v1
data:
antrea-agent.conf: |
# FeatureGates is a map of feature names to bools that enable or disable experimental features.
Expand Down
22 changes: 6 additions & 16 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,12 @@ rules:
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- apiGroups:
- apiregistration.k8s.io
resourceNames:
Expand Down Expand Up @@ -2255,22 +2261,6 @@ subjects:
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-ca
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-cluster-identity
namespace: kube-system
---
apiVersion: v1
data:
antrea-agent.conf: |
# FeatureGates is a map of feature names to bools that enable or disable experimental features.
Expand Down
22 changes: 6 additions & 16 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,12 @@ rules:
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- apiGroups:
- apiregistration.k8s.io
resourceNames:
Expand Down Expand Up @@ -2255,22 +2261,6 @@ subjects:
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-ca
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-cluster-identity
namespace: kube-system
---
apiVersion: v1
data:
antrea-agent.conf: |
# FeatureGates is a map of feature names to bools that enable or disable experimental features.
Expand Down
22 changes: 6 additions & 16 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,12 @@ rules:
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- apiGroups:
- apiregistration.k8s.io
resourceNames:
Expand Down Expand Up @@ -2255,22 +2261,6 @@ subjects:
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-ca
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-cluster-identity
namespace: kube-system
---
apiVersion: v1
data:
antrea-agent.conf: |
# FeatureGates is a map of feature names to bools that enable or disable experimental features.
Expand Down
22 changes: 6 additions & 16 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2017,6 +2017,12 @@ rules:
verbs:
- get
- update
- apiGroups:
- ""
resources:
- configmaps
verbs:
- create
- apiGroups:
- apiregistration.k8s.io
resourceNames:
Expand Down Expand Up @@ -2255,22 +2261,6 @@ subjects:
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-ca
namespace: kube-system
---
apiVersion: v1
kind: ConfigMap
metadata:
labels:
app: antrea
name: antrea-cluster-identity
namespace: kube-system
---
apiVersion: v1
data:
antrea-agent.conf: |
# FeatureGates is a map of feature names to bools that enable or disable experimental features.
Expand Down
7 changes: 6 additions & 1 deletion cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,11 @@ func run(o *Options) error {
if err != nil {
return fmt.Errorf("error creating K8s clients: %v", err)
}
legacyCRDClient, err := k8s.CreateLegacyCRDClient(o.config.ClientConnection, o.config.KubeAPIServerOverride)
if err != nil {
return fmt.Errorf("error creating legacy CRD client: %v", err)
}

informerFactory := informers.NewSharedInformerFactory(k8sClient, informerDefaultResync)
crdInformerFactory := crdinformers.NewSharedInformerFactory(crdClient, informerDefaultResync)
traceflowInformer := crdInformerFactory.Crd().V1alpha1().Traceflows()
Expand Down Expand Up @@ -300,7 +305,7 @@ func run(o *Options) error {
networkPolicyController,
o.config.APIPort)

agentMonitor := monitor.NewAgentMonitor(crdClient, agentQuerier)
agentMonitor := monitor.NewAgentMonitor(crdClient, legacyCRDClient, agentQuerier)

go agentMonitor.Run(stopCh)

Expand Down
2 changes: 1 addition & 1 deletion cmd/antrea-controller/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ func run(o *Options) error {

controllerQuerier := querier.NewControllerQuerier(networkPolicyController, o.config.APIPort)

controllerMonitor := monitor.NewControllerMonitor(crdClient, nodeInformer, controllerQuerier)
controllerMonitor := monitor.NewControllerMonitor(crdClient, legacyCRDClient, nodeInformer, controllerQuerier)

var traceflowController *traceflow.Controller
if features.DefaultFeatureGate.Enabled(features.Traceflow) {
Expand Down
40 changes: 20 additions & 20 deletions docs/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,26 +11,26 @@ For information about the Antrea API versioning policy, please refer to this

These are the API group versions which are curently available when using Antrea.

| API group | API version | API Service? | Introduced in | Deprecated in / Planned Deprecation | Planned Removal |
| -------------------------------------------- | ----------- | ------------ | ------------- | ----------------------------------- | --------------- |
| `clusterinformation.antrea.tanzu.vmware.com` | `v1beta1` | No | v0.3.0 | v1.0.0 | Dec 2021 |
| `core.antrea.tanzu.vmware.com` | `v1alpha2` | No | v0.11.0 | v1.0.0 | Dec 2021 |
| `controlplane.antrea.tanzu.vmware.com` | `v1beta1` | Yes | v0.10.0 | v0.11.0 | Aug 2021 |
| `controlplane.antrea.tanzu.vmware.com` | `v1beta2` | Yes | v0.11.0 | v1.0.0 | Dec 2021 |
| `networking.antrea.tanzu.vmware.com` | `v1beta1` | Yes | v0.3.0 | v0.10.0 | Jun 2021 |
| `ops.antrea.tanzu.vmware.com` | `v1alpha1` | No | v0.8.0 | v1.0.0 | Dec 2021 |
| `security.antrea.tanzu.vmware.com` | `v1alpha1` | No | v0.8.0 | v1.0.0 | Dec 2021 |
| `stats.antrea.tanzu.vmware.com` | `v1alpha1` | Yes | v0.10.0 | v1.0.0 | Dec 2021 |
| `system.antrea.tanzu.vmware.com` | `v1beta1` | Yes | v0.5.0 | v1.0.0 | Dec 2021 |
| `crd.antrea.io` | `v1alpha1` | No | v1.0.0 | N/A | N/A |
| `crd.antrea.io` | `v1alpha2` | No | v1.0.0 | N/A | N/A |
| `crd.antrea.io` | `v1beta1` | No | v1.0.0 | N/A | N/A |
| `controlplane.antrea.io` | `v1beta2` | Yes | v1.0.0 | N/A | N/A |
| `stats.antrea.io` | `v1alpha1` | Yes | v1.0.0 | N/A | N/A |
| `system.antrea.io` | `v1beta1` | Yes | v1.0.0 | N/A | N/A |
| API group | API version | API Service? | Introduced in | Deprecated in / Planned Deprecation | Planned Removal |
|---|---|---|---|---|---|
| `clusterinformation.antrea.tanzu.vmware.com` | `v1beta1` | No | v0.3.0 | v1.0.0 | Dec 2021 |
| `core.antrea.tanzu.vmware.com` | `v1alpha2` | No | v0.11.0 | v1.0.0 | Dec 2021 |
| `controlplane.antrea.tanzu.vmware.com` | `v1beta1` | Yes | v0.10.0 | v0.11.0 | Aug 2021 |
| `controlplane.antrea.tanzu.vmware.com` | `v1beta2` | Yes | v0.11.0 | v1.0.0 | Dec 2021 |
| `networking.antrea.tanzu.vmware.com` | `v1beta1` | Yes | v0.3.0 | v0.10.0 | Jun 2021 |
| `ops.antrea.tanzu.vmware.com` | `v1alpha1` | No | v0.8.0 | v1.0.0 | Dec 2021 |
| `security.antrea.tanzu.vmware.com` | `v1alpha1` | No | v0.8.0 | v1.0.0 | Dec 2021 |
| `stats.antrea.tanzu.vmware.com` | `v1alpha1` | Yes | v0.10.0 | v1.0.0 | Dec 2021 |
| `system.antrea.tanzu.vmware.com` | `v1beta1` | Yes | v0.5.0 | v1.0.0 | Dec 2021 |
| `crd.antrea.io` | `v1alpha1` | No | v1.0.0 | N/A | N/A |
| `crd.antrea.io` | `v1alpha2` | No | v1.0.0 | N/A | N/A |
| `crd.antrea.io` | `v1beta1` | No | v1.0.0 | N/A | N/A |
| `controlplane.antrea.io` | `v1beta2` | Yes | v1.0.0 | N/A | N/A |
| `stats.antrea.io` | `v1alpha1` | Yes | v1.0.0 | N/A | N/A |
| `system.antrea.io` | `v1beta1` | Yes | v1.0.0 | N/A | N/A |

## Previously-supported

| API group | API version | API Service? | Introduced in | Deprecated in | Removed in |
| -------------------------------------------- | ----------- | ------------ | ------------- | ----------------------------------- | --------------- |
| `core.antrea.tanzu.vmware.com` | `v1alpha1` | No | v0.8.0 | v0.11.0 | v0.11.0 |
| API group | API version | API Service? | Introduced in | Deprecated in | Removed in |
|---|---|---|---|---|---|
| `core.antrea.tanzu.vmware.com` | `v1alpha1` | No | v0.8.0 | v0.11.0 | v0.11.0 |
2 changes: 1 addition & 1 deletion hack/update-codegen.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ set -o errexit
set -o nounset
set -o pipefail

ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"/..
ANTREA_ROOT="$( cd "$( dirname "${BASH_SOURCE[0]}" )/../" && pwd )"
IMAGE_NAME="antrea/codegen:kubernetes-1.18.4"

function docker_run() {
Expand Down
32 changes: 16 additions & 16 deletions pkg/agent/controller/traceflow/packetin.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,13 +101,13 @@ func (c *Controller) parsePacketIn(pktIn *ofctrl.PacketIn) (*opsv1alpha1.Tracefl

if isSender {
ob := new(opsv1alpha1.Observation)
ob.Component = opsv1alpha1.SpoofGuard
ob.Action = opsv1alpha1.Forwarded
ob.Component = opsv1alpha1.ComponentSpoofGuard
ob.Action = opsv1alpha1.ActionForwarded
obs = append(obs, *ob)
} else {
ob := new(opsv1alpha1.Observation)
ob.Component = opsv1alpha1.Forwarding
ob.Action = opsv1alpha1.Received
ob.Component = opsv1alpha1.ComponentForwarding
ob.Action = opsv1alpha1.ActionReceived
ob.ComponentInfo = openflow.GetFlowTableName(openflow.ClassifierTable)
obs = append(obs, *ob)
}
Expand Down Expand Up @@ -141,8 +141,8 @@ func (c *Controller) parsePacketIn(pktIn *ofctrl.PacketIn) (*opsv1alpha1.Tracefl
}
if isValidCtNw(ctNwDst) && ipDst != ctNwDst {
ob := &opsv1alpha1.Observation{
Component: opsv1alpha1.LB,
Action: opsv1alpha1.Forwarded,
Component: opsv1alpha1.ComponentLB,
Action: opsv1alpha1.ActionForwarded,
TranslatedDstIP: ipDst,
}
obs = append(obs, *ob)
Expand Down Expand Up @@ -219,19 +219,19 @@ func (c *Controller) parsePacketIn(pktIn *ofctrl.PacketIn) (*opsv1alpha1.Tracefl
}
if c.networkConfig.TrafficEncapMode.SupportsEncap() && outputPort == config.DefaultTunOFPort {
ob.TunnelDstIP = tunnelDstIP
ob.Action = opsv1alpha1.Forwarded
ob.Action = opsv1alpha1.ActionForwarded
} else if ipDst == gatewayIP.String() && outputPort == config.HostGatewayOFPort {
ob.Action = opsv1alpha1.Delivered
ob.Action = opsv1alpha1.ActionDelivered
} else if c.networkConfig.TrafficEncapMode.SupportsEncap() && outputPort == config.HostGatewayOFPort {
ob.Action = opsv1alpha1.ForwardedOutOfOverlay
ob.Action = opsv1alpha1.ActionForwardedOutOfOverlay
} else if outputPort == config.HostGatewayOFPort { // noEncap
ob.Action = opsv1alpha1.Forwarded
ob.Action = opsv1alpha1.ActionForwarded
} else {
// Output port is Pod port, packet is delivered.
ob.Action = opsv1alpha1.Delivered
ob.Action = opsv1alpha1.ActionDelivered
}
ob.ComponentInfo = openflow.GetFlowTableName(binding.TableIDType(tableID))
ob.Component = opsv1alpha1.Forwarding
ob.Component = opsv1alpha1.ComponentForwarding
obs = append(obs, *ob)
}

Expand Down Expand Up @@ -294,20 +294,20 @@ func getNetworkPolicyObservation(tableID uint8, ingress bool) *opsv1alpha1.Obser
case uint8(openflow.IngressMetricTable), uint8(openflow.IngressDefaultTable):
// Packet dropped by ANP/default drop rule
ob.ComponentInfo = openflow.GetFlowTableName(binding.TableIDType(tableID))
ob.Action = opsv1alpha1.Dropped
ob.Action = opsv1alpha1.ActionDropped
default:
ob.ComponentInfo = openflow.GetFlowTableName(openflow.IngressRuleTable)
ob.Action = opsv1alpha1.Forwarded
ob.Action = opsv1alpha1.ActionForwarded
}
} else {
switch tableID {
case uint8(openflow.EgressMetricTable), uint8(openflow.EgressDefaultTable):
// Packet dropped by ANP/default drop rule
ob.ComponentInfo = openflow.GetFlowTableName(binding.TableIDType(tableID))
ob.Action = opsv1alpha1.Dropped
ob.Action = opsv1alpha1.ActionDropped
default:
ob.ComponentInfo = openflow.GetFlowTableName(openflow.EgressRuleTable)
ob.Action = opsv1alpha1.Forwarded
ob.Action = opsv1alpha1.ActionForwarded
}
}
return ob
Expand Down
8 changes: 4 additions & 4 deletions pkg/agent/controller/traceflow/packetin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ func Test_getNetworkPolicyObservation(t *testing.T) {
want: &crdv1alpha1.Observation{
Component: crdv1alpha1.ComponentNetworkPolicy,
ComponentInfo: "IngressMetric",
Action: crdv1alpha1.Dropped,
Action: crdv1alpha1.ActionDropped,
},
},
{
Expand All @@ -53,7 +53,7 @@ func Test_getNetworkPolicyObservation(t *testing.T) {
want: &crdv1alpha1.Observation{
Component: crdv1alpha1.ComponentNetworkPolicy,
ComponentInfo: "IngressRule",
Action: crdv1alpha1.Forwarded,
Action: crdv1alpha1.ActionForwarded,
},
},
{
Expand All @@ -65,7 +65,7 @@ func Test_getNetworkPolicyObservation(t *testing.T) {
want: &crdv1alpha1.Observation{
Component: crdv1alpha1.ComponentNetworkPolicy,
ComponentInfo: "EgressDefaultRule",
Action: crdv1alpha1.Dropped,
Action: crdv1alpha1.ActionDropped,
},
},
{
Expand All @@ -77,7 +77,7 @@ func Test_getNetworkPolicyObservation(t *testing.T) {
want: &crdv1alpha1.Observation{
Component: crdv1alpha1.ComponentNetworkPolicy,
ComponentInfo: "EgressRule",
Action: crdv1alpha1.Forwarded,
Action: crdv1alpha1.ActionForwarded,
},
},
}
Expand Down
Loading

0 comments on commit fd42f9d

Please sign in to comment.