Skip to content

Commit

Permalink
feat: support api query.
Browse files Browse the repository at this point in the history
  • Loading branch information
IRONICBo committed Jun 3, 2024
1 parent d414fe9 commit 63576b7
Show file tree
Hide file tree
Showing 31 changed files with 1,495 additions and 174 deletions.
1 change: 1 addition & 0 deletions build/charts/antrea/templates/antctl/clusterrole.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ rules:
- networkpolicystats
- antreaclusternetworkpolicystats
- antreanetworkpolicystats
- nodeiplatencystat
verbs:
- get
- list
Expand Down
2 changes: 1 addition & 1 deletion build/images/Dockerfile.build.agent.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WORKDIR /antrea
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download
go env -w GOPROXY=https://goproxy.cn,direct;go mod download

COPY . /antrea

Expand Down
2 changes: 1 addition & 1 deletion build/images/Dockerfile.build.agent.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WORKDIR /antrea
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download
go env -w GOPROXY=https://goproxy.cn,direct;go mod download

COPY . /antrea

Expand Down
2 changes: 1 addition & 1 deletion build/images/Dockerfile.build.controller.ubi
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WORKDIR /antrea
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download
go env -w GOPROXY=https://goproxy.cn,direct;go mod download

COPY . /antrea

Expand Down
2 changes: 1 addition & 1 deletion build/images/Dockerfile.build.controller.ubuntu
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ WORKDIR /antrea
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download
go env -w GOPROXY=https://goproxy.cn,direct;go mod download

COPY . /antrea

Expand Down
1 change: 1 addition & 0 deletions build/yamls/antrea-aks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4405,6 +4405,7 @@ rules:
- networkpolicystats
- antreaclusternetworkpolicystats
- antreanetworkpolicystats
- nodeiplatencystat
verbs:
- get
- list
Expand Down
1 change: 1 addition & 0 deletions build/yamls/antrea-eks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4405,6 +4405,7 @@ rules:
- networkpolicystats
- antreaclusternetworkpolicystats
- antreanetworkpolicystats
- nodeiplatencystat
verbs:
- get
- list
Expand Down
1 change: 1 addition & 0 deletions build/yamls/antrea-gke.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4405,6 +4405,7 @@ rules:
- networkpolicystats
- antreaclusternetworkpolicystats
- antreanetworkpolicystats
- nodeiplatencystat
verbs:
- get
- list
Expand Down
1 change: 1 addition & 0 deletions build/yamls/antrea-ipsec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4418,6 +4418,7 @@ rules:
- networkpolicystats
- antreaclusternetworkpolicystats
- antreanetworkpolicystats
- nodeiplatencystat
verbs:
- get
- list
Expand Down
1 change: 1 addition & 0 deletions build/yamls/antrea.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4405,6 +4405,7 @@ rules:
- networkpolicystats
- antreaclusternetworkpolicystats
- antreanetworkpolicystats
- nodeiplatencystat
verbs:
- get
- list
Expand Down
20 changes: 10 additions & 10 deletions cmd/antrea-agent/agent.go
Original file line number Diff line number Diff line change
Expand Up @@ -934,16 +934,16 @@ func run(o *Options) error {
}

// Start the node latency monitor.
if features.DefaultFeatureGate.Enabled(features.NodeLatencyMonitor) && o.nodeType == config.K8sNode {
nodeLatencyMonitor := monitortool.NewNodeLatencyMonitor(
antreaClientProvider,
nodeInformer,
nodeLatencyMonitorInformer,
nodeConfig,
networkConfig.TrafficEncapMode,
)
go nodeLatencyMonitor.Run(stopCh)
}
// if features.DefaultFeatureGate.Enabled(features.NodeLatencyMonitor) && o.nodeType == config.K8sNode {
nodeLatencyMonitor := monitortool.NewNodeLatencyMonitor(
antreaClientProvider,
nodeInformer,
nodeLatencyMonitorInformer,
nodeConfig,
networkConfig.TrafficEncapMode,
)
go nodeLatencyMonitor.Run(stopCh)
// }

<-stopCh
klog.Info("Stopping Antrea agent")
Expand Down
2 changes: 1 addition & 1 deletion multicluster/build/images/Dockerfile.build
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ WORKDIR /antrea
RUN --mount=type=cache,target=/go/pkg/mod/ \
--mount=type=bind,source=go.sum,target=go.sum \
--mount=type=bind,source=go.mod,target=go.mod \
go mod download
go env -w GOPROXY=https://goproxy.cn,direct;go mod download

COPY . /antrea

Expand Down
4 changes: 2 additions & 2 deletions multicluster/hack/update-codegen-dockerized.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,14 @@ function generate_multicluster_client_code {
--input "multicluster/v1alpha2" \
--output-package "${ANTREA_PKG}/multicluster/pkg/client/clientset" \
--go-header-file hack/boilerplate/license_header.go.txt

# Generate listers with K8s codegen tools.
$GOPATH/bin/lister-gen \
--input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \
--input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha2" \
--output-package "${ANTREA_PKG}/multicluster/pkg/client/listers" \
--go-header-file hack/boilerplate/license_header.go.txt

# Generate informers with K8s codegen tools.
$GOPATH/bin/informer-gen \
--input-dirs "${ANTREA_PKG}/multicluster/apis/multicluster/v1alpha1" \
Expand Down
1 change: 0 additions & 1 deletion pkg/apis/controlplane/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&SupportBundleCollection{},
&SupportBundleCollectionList{},
&SupportBundleCollectionStatus{},
// &NodeIPLatencyStat{},
)
return nil
}
25 changes: 0 additions & 25 deletions pkg/apis/controlplane/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -408,31 +408,6 @@ type NodeStatsSummary struct {
Multicast []MulticastGroupInfo
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// NodeIPLatencyStat contains the latency stat of a Node.
type NodeIPLatencyStat struct {
metav1.TypeMeta
metav1.ObjectMeta

// The list of NodeIPLatency.
NodeIPLatencyList []NodeIPLatencyEntry
}

// NodeIPLatencyEntry contains the latency stats of a Node.
type NodeIPLatencyEntry struct {
// The Node's name.
NodeName string
// The Node's target IP address.
TargetIP string
// The timestamp of the last send packet.
LastSendTime int64
// The timestamp of the last receive packet.
LastRecvTime int64
// The last valid rtt of the Node.
LastMeasuredRTT int64
}

// MulticastGroupInfo contains the list of Pods that have joined a multicast group, for a given Node.
type MulticastGroupInfo struct {
// Group is the IP of the multicast group.
Expand Down
Loading

0 comments on commit 63576b7

Please sign in to comment.