Skip to content

Commit

Permalink
refactor(yurt-manager): 更新 CRD 分类并移除 YurtAppDaemon 相关代码 (#2320)
Browse files Browse the repository at this point in the history
- 将 CRD 的 categories 从 "all" 修改为 "yurt",以更好地组织 OpenYurt 资源
- 移除了 YurtAppDaemon 相关的控制器和类型定义
- 更新了所有受影响的 CRD 文件和 Go 源码文件
  • Loading branch information
luc99hen authored Feb 18, 2025
1 parent 115d0c7 commit f6b8aad
Show file tree
Hide file tree
Showing 24 changed files with 20 additions and 324 deletions.
2 changes: 1 addition & 1 deletion charts/yurt-manager/crds/apps.openyurt.io_nodebuckets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
group: apps.openyurt.io
names:
categories:
- all
- yurt
kind: NodeBucket
listKind: NodeBucketList
plural: nodebuckets
Expand Down
2 changes: 1 addition & 1 deletion charts/yurt-manager/crds/apps.openyurt.io_nodepools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
group: apps.openyurt.io
names:
categories:
- all
- yurt
kind: NodePool
listKind: NodePoolList
plural: nodepools
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
group: apps.openyurt.io
names:
categories:
- all
- yurt
kind: YurtAppDaemon
listKind: YurtAppDaemonList
plural: yurtappdaemons
Expand Down
2 changes: 1 addition & 1 deletion charts/yurt-manager/crds/apps.openyurt.io_yurtappsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
group: apps.openyurt.io
names:
categories:
- all
- yurt
kind: YurtAppSet
listKind: YurtAppSetList
plural: yurtappsets
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
group: iot.openyurt.io
names:
categories:
- all
- yurt
kind: PlatformAdmin
listKind: PlatformAdminList
plural: platformadmins
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
group: network.openyurt.io
names:
categories:
- all
- yurt
kind: PoolService
listKind: PoolServiceList
plural: poolservices
Expand Down
2 changes: 1 addition & 1 deletion charts/yurt-manager/crds/raven.openyurt.io_gateways.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ spec:
group: raven.openyurt.io
names:
categories:
- all
- yurt
kind: Gateway
listKind: GatewayList
plural: gateways
Expand Down
2 changes: 0 additions & 2 deletions cmd/yurt-manager/names/controller_names.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ const (
ServiceTopologyEndpointsController = "service-topology-endpoints-controller"
ServiceTopologyEndpointSliceController = "service-topology-endpointslice-controller"
YurtAppSetController = "yurt-app-set-controller"
YurtAppDaemonController = "yurt-app-daemon-controller"
YurtStaticSetController = "yurt-static-set-controller"
DelegateLeaseController = "delegate-lease-controller"
PodBindingController = "pod-binding-controller"
Expand All @@ -50,7 +49,6 @@ func YurtManagerControllerAliases() map[string]string {
"servicetopologyendpoints": ServiceTopologyEndpointsController,
"servicetopologyendpointslices": ServiceTopologyEndpointSliceController,
"yurtappset": YurtAppSetController,
"yurtappdaemon": YurtAppDaemonController,
"yurtstaticset": YurtStaticSetController,
"delegatelease": DelegateLeaseController,
"podbinding": PodBindingController,
Expand Down
2 changes: 1 addition & 1 deletion hack/make-rules/add_controller.sh
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ type ${KIND_FIRST_UPPER}Status struct {
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=${SCOPE},path=${KIND_PLURAL},shortName=${SHORTNAME},categories=all
// +kubebuilder:resource:scope=${SCOPE},path=${KIND_PLURAL},shortName=${SHORTNAME},categories=yurt
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC."
// ${KIND_FIRST_UPPER} is the Schema for the samples API
Expand Down
22 changes: 0 additions & 22 deletions pkg/apis/apps/v1alpha1/default.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,28 +223,6 @@ func SetDefaultsYurtStaticSet(obj *YurtStaticSet) {
obj.Spec.Template.Namespace = obj.Namespace
}

// SetDefaultsYurtAppDaemon set default values for YurtAppDaemon.
func SetDefaultsYurtAppDaemon(obj *YurtAppDaemon) {

if obj.Spec.RevisionHistoryLimit == nil {
obj.Spec.RevisionHistoryLimit = utilpointer.To[int32](10)
}

if obj.Spec.WorkloadTemplate.StatefulSetTemplate != nil {
SetDefaultPodSpec(&obj.Spec.WorkloadTemplate.StatefulSetTemplate.Spec.Template.Spec)
for i := range obj.Spec.WorkloadTemplate.StatefulSetTemplate.Spec.VolumeClaimTemplates {
a := &obj.Spec.WorkloadTemplate.StatefulSetTemplate.Spec.VolumeClaimTemplates[i]
v1.SetDefaults_PersistentVolumeClaim(a)
v1.SetDefaults_ResourceList(&a.Spec.Resources.Limits)
v1.SetDefaults_ResourceList(&a.Spec.Resources.Requests)
v1.SetDefaults_ResourceList(&a.Status.Capacity)
}
}
if obj.Spec.WorkloadTemplate.DeploymentTemplate != nil {
SetDefaultPodSpec(&obj.Spec.WorkloadTemplate.DeploymentTemplate.Spec.Template.Spec)
}
}

// SetDefaultsNodeBucket set default values for NodeBucket.
func SetDefaultsNodeBucket(obj *NodeBucket) {
// example for set default value for NodeBucket
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/apps/v1alpha1/nodebucket_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ type Node struct {
// +k8s:openapi-gen=true
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster,path=nodebuckets,shortName=nb,categories=all
// +kubebuilder:resource:scope=Cluster,path=nodebuckets,shortName=nb,categories=yurt
// +kubebuilder:printcolumn:name="NUM-NODES",type="integer",JSONPath=".numNodes",description="NumNodes represents the number of nodes in the NodeBucket."
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp",description="CreationTimestamp is a timestamp representing the server time when this object was created. It is not guaranteed to be set in happens-before order across separate operations. Clients may not set this value. It is represented in RFC3339 form and is in UTC."

Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/apps/v1alpha1/nodepool_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ type NodePoolStatus struct {

// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:resource:scope=Cluster,path=nodepools,shortName=np,categories=all
// +kubebuilder:resource:scope=Cluster,path=nodepools,shortName=np,categories=yurt
// +kubebuilder:subresource:status
// +kubebuilder:deprecatedversion:warning="apps.openyurt.io/v1alpha1 NodePool is deprecated in v1.0.0+; use apps.openyurt.io/v1beta1 NodePool"
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type",description="The type of nodepool"
Expand Down
137 changes: 0 additions & 137 deletions pkg/apis/apps/v1alpha1/yurtappdaemon_types.go

This file was deleted.

2 changes: 1 addition & 1 deletion pkg/apis/apps/v1alpha1/yurtappset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ type YurtAppSetCondition struct {

// +genclient
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=yas,categories=all
// +kubebuilder:resource:shortName=yas,categories=yurt
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="READY",type="integer",JSONPath=".status.readyReplicas",description="The number of pods ready."
// +kubebuilder:printcolumn:name="WorkloadTemplate",type="string",JSONPath=".status.templateType",description="The WorkloadTemplate Type."
Expand Down
Loading

0 comments on commit f6b8aad

Please sign in to comment.