Skip to content

Commit

Permalink
fix: crd reference issues
Browse files Browse the repository at this point in the history
Signed-off-by: wangyizhi1 <[email protected]>
  • Loading branch information
wangyizhi1 committed Nov 1, 2023
1 parent 929c1c4 commit 08e1717
Show file tree
Hide file tree
Showing 19 changed files with 391 additions and 236 deletions.
151 changes: 83 additions & 68 deletions deploy/crds/kosmos.io_clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ spec:
scope: Cluster
versions:
- additionalPrinterColumns:
- jsonPath: .spec.networkType
- jsonPath: .spec.clusterLinkOptions.networkType
name: NETWORK_TYPE
type: string
- jsonPath: .spec.ipFamily
- jsonPath: .spec.clusterLinkOptions.ipFamily
name: IP_FAMILY
type: string
name: v1alpha1
Expand All @@ -41,88 +41,103 @@ spec:
spec:
description: Spec is the specification for the behaviour of the cluster.
properties:
bridgeCIDRs:
default:
ip: 220.0.0.0/8
ip6: 9470::/16
clusterLinkOptions:
properties:
ip:
bridgeCIDRs:
default:
ip: 220.0.0.0/8
ip6: 9470::/16
properties:
ip:
type: string
ip6:
type: string
required:
- ip
- ip6
type: object
cni:
default: calico
type: string
defaultNICName:
default: '*'
type: string
ip6:
enable:
default: true
type: boolean
globalCIDRsMap:
additionalProperties:
type: string
type: object
ipFamily:
default: all
type: string
required:
- ip
- ip6
localCIDRs:
default:
ip: 210.0.0.0/8
ip6: 9480::/16
properties:
ip:
type: string
ip6:
type: string
required:
- ip
- ip6
type: object
networkType:
default: p2p
enum:
- p2p
- gateway
type: string
nicNodeNames:
items:
properties:
interfaceName:
type: string
nodeName:
items:
type: string
type: array
required:
- interfaceName
- nodeName
type: object
type: array
useIPPool:
default: false
type: boolean
type: object
cni:
default: calico
type: string
defaultNICName:
default: '*'
type: string
globalCIDRsMap:
additionalProperties:
type: string
clusterTreeOptions:
properties:
enable:
default: true
type: boolean
type: object
imageRepository:
type: string
ipFamily:
default: all
type: string
kubeconfig:
format: byte
type: string
localCIDRs:
default:
ip: 210.0.0.0/8
ip6: 9480::/16
properties:
ip:
type: string
ip6:
type: string
required:
- ip
- ip6
type: object
namespace:
default: clusterlink-system
type: string
networkType:
default: p2p
enum:
- p2p
- gateway
default: kosmos-system
type: string
nicNodeNames:
items:
properties:
interfaceName:
type: string
nodeName:
items:
type: string
type: array
required:
- interfaceName
- nodeName
type: object
type: array
useIPPool:
default: false
type: boolean
type: object
status:
description: Status describes the current status of a cluster.
properties:
podCIDRs:
items:
type: string
type: array
serviceCIDRs:
items:
type: string
type: array
clusterLinkStatus:
properties:
podCIDRs:
items:
type: string
type: array
serviceCIDRs:
items:
type: string
type: array
type: object
type: object
required:
- spec
Expand Down
3 changes: 3 additions & 0 deletions deploy/crds/kosmos.io_knodes.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,9 @@ spec:
properties:
disableTaint:
type: boolean
kubeAPIBurst:
default: 100
type: integer
kubeconfig:
format: byte
type: string
Expand Down
31 changes: 26 additions & 5 deletions pkg/apis/kosmos/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import (
// +genclient:nonNamespaced
// +kubebuilder:resource:scope="Cluster"
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:printcolumn:name="NETWORK_TYPE",type=string,JSONPath=`.spec.networkType`
// +kubebuilder:printcolumn:name="IP_FAMILY",type=string,JSONPath=`.spec.ipFamily`
// +kubebuilder:printcolumn:name="NETWORK_TYPE",type=string,JSONPath=`.spec.clusterLinkOptions.networkType`
// +kubebuilder:printcolumn:name="IP_FAMILY",type=string,JSONPath=`.spec.clusterLinkOptions.ipFamily`

type Cluster struct {
metav1.TypeMeta `json:",inline"`
Expand All @@ -27,6 +27,13 @@ type ClusterSpec struct {
// +optional
Kubeconfig []byte `json:"kubeconfig,omitempty"`

// +kubebuilder:default=kosmos-system
// +optional
Namespace string `json:"namespace"`

// +optional
ImageRepository string `json:"imageRepository,omitempty"`

// +optional
ClusterLinkOptions ClusterLinkOptions `json:"clusterLinkOptions,omitempty"`

Expand All @@ -35,40 +42,54 @@ type ClusterSpec struct {
}

type ClusterStatus struct {
ClusterLinkStatus ClusterLinkStatus
ClusterLinkStatus ClusterLinkStatus `json:"clusterLinkStatus,omitempty"`
}

type ClusterLinkOptions struct {
// +kubebuilder:default=true
// +optional
Enable bool `json:"enable"`

// +kubebuilder:default=calico
// +optional
CNI string `json:"cni"`

// +kubebuilder:validation:Enum=p2p;gateway
// +kubebuilder:default=p2p
// +optional
NetworkType NetworkType `json:"networkType"`

// +kubebuilder:default=all
// +optional
IPFamily IPFamilyType `json:"ipFamily"`
ImageRepository string `json:"imageRepository,omitempty"`
IPFamily IPFamilyType `json:"ipFamily"`

// +kubebuilder:default=false
// +optional
UseIPPool bool `json:"useIPPool,omitempty"`

// +kubebuilder:default={ip:"210.0.0.0/8",ip6:"9480::/16"}
// +optional
LocalCIDRs VxlanCIDRs `json:"localCIDRs,omitempty"`

// +kubebuilder:default={ip:"220.0.0.0/8",ip6:"9470::/16"}
// +optional
BridgeCIDRs VxlanCIDRs `json:"bridgeCIDRs,omitempty"`

// +optional
NICNodeNames []NICNodeNames `json:"nicNodeNames,omitempty"`

// +kubebuilder:default=*
// +optional
DefaultNICName string `json:"defaultNICName,omitempty"`

// +optional
GlobalCIDRsMap map[string]string `json:"globalCIDRsMap,omitempty"`
}

type ClusterTreeOptions struct {
// +kubebuilder:default=true
// +optional
Enable bool `json:"enable"`
}

type ClusterLinkStatus struct {
Expand Down
4 changes: 0 additions & 4 deletions pkg/apis/kosmos/v1alpha1/knode_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ type KnodeSpec struct {
// +optional
Kubeconfig []byte `json:"kubeconfig,omitempty"`

// +kubebuilder:default=50
// +optional
KubeAPIQPS float32 `json:"kubeAPIQPS,omitempty"`

// +kubebuilder:default=100
// +optional
KubeAPIBurst int `json:"kubeAPIBurst,omitempty"`
Expand Down
Loading

0 comments on commit 08e1717

Please sign in to comment.