Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ kube-ovn.yaml
!/charts/kube-ovn-v2/crds/kube-ovn-crd.yaml
!/charts/kube-ovn/templates/kube-ovn-crd.yaml
kube-ovn-crd.yaml
yamls/crds
ovn.yaml
ovn-ic-controller.yaml
ovn-ic-server.yaml
Expand Down
14 changes: 14 additions & 0 deletions hack/update-codegen-crd.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash
set -eux
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

To ensure the script runs correctly regardless of the directory from which it is called, it's a good practice to change the directory to the project root at the beginning of the script. This makes the script more robust.

Suggested change
set -eux
set -eux
cd "$(dirname "$0")/.."

# usage: bash ./hack/update-codegen-crd.sh

# set GOPROXY you like
export GOPROXY=${GOPROXY:-"https://goproxy.cn"}
# use controller-gen to generate CRDs
# ensure controller-gen is installed
CONTROLLER_TOOLS_VERSION=${CONTROLLER_TOOLS_VERSION:-"v0.17.3"}
go install sigs.k8s.io/controller-tools/cmd/controller-gen@"${CONTROLLER_TOOLS_VERSION}"
go mod tidy

# generate CRDs
controller-gen crd:allowDangerousTypes=true paths=./pkg/apis/kubeovn/v1 output:crd:artifacts:config=./yamls/crds
13 changes: 9 additions & 4 deletions pkg/apis/kubeovn/v1/ippool.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,19 @@ type IPPoolSpec struct {
}

type IPPoolStatus struct {
// TODO:// make Subnet and IP Pool AvailableIPs and UsingIPs type consistent
// +kubebuilder:validation:Type=string
V4AvailableIPs internal.BigInt `json:"v4AvailableIPs"`
V4AvailableIPRange string `json:"v4AvailableIPRange"`
V4UsingIPs internal.BigInt `json:"v4UsingIPs"`
V4UsingIPRange string `json:"v4UsingIPRange"`
// +kubebuilder:validation:Type=string
V4UsingIPs internal.BigInt `json:"v4UsingIPs"`
V4UsingIPRange string `json:"v4UsingIPRange"`
// +kubebuilder:validation:Type=string
V6AvailableIPs internal.BigInt `json:"v6AvailableIPs"`
V6AvailableIPRange string `json:"v6AvailableIPRange"`
V6UsingIPs internal.BigInt `json:"v6UsingIPs"`
V6UsingIPRange string `json:"v6UsingIPRange"`
// +kubebuilder:validation:Type=string
V6UsingIPs internal.BigInt `json:"v6UsingIPs"`
V6UsingIPRange string `json:"v6UsingIPRange"`

// Conditions represents the latest state of the object
// +optional
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/kubeovn/v1/provider-network.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ type ProviderNetworkSpec struct {
type ProviderNetworkCondition struct {
// Node name
Node string `json:"node"`
Condition

Condition `json:"condition"`
}

type ProviderNetworkStatus struct {
Expand Down
3 changes: 2 additions & 1 deletion pkg/apis/kubeovn/v1/subnet.go
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,8 @@ type NatOutGoingPolicyMatch struct {

type NatOutgoingPolicyRuleStatus struct {
RuleID string `json:"ruleID"`
NatOutgoingPolicyRule

NatOutgoingPolicyRule `json:"natOutgoingPolicyRule"`
}
type SubnetStatus struct {
// Conditions represents the latest state of the object
Expand Down
Loading