Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add status info to YurtAppSet/YurtAppDaemon #1702

Merged
merged 48 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
48 commits
Select commit Hold shift + click to select a range
bebc599
adjust CRD and add wildcard
vie-serendipity Aug 24, 2023
a968b4a
add configuration of deployment webhook
vie-serendipity Aug 25, 2023
4544f78
add register of webhook and controller
vie-serendipity Aug 25, 2023
4e98daf
call deployment webhook directly
vie-serendipity Aug 28, 2023
c69eb7e
remove flatternYaml and add more info
vie-serendipity Aug 28, 2023
15a5d09
modify deployment webhook failurePolicy
vie-serendipity Aug 30, 2023
dd9c1f1
do some modifies
vie-serendipity Aug 30, 2023
286a0ff
rename missing configrender to overrider
vie-serendipity Aug 30, 2023
1f80a99
remove the outer of *
vie-serendipity Aug 30, 2023
5904bd9
pull origin master
vie-serendipity Aug 30, 2023
a75de1f
fix problems in the comments
vie-serendipity Sep 4, 2023
0c5175e
sync with master
vie-serendipity Sep 4, 2023
c3f4156
fix error in e2e of yurtappoverrider
vie-serendipity Sep 6, 2023
4ab54bb
fix error in e2e of yurtappoverrider
vie-serendipity Sep 6, 2023
75e0f27
fix error in validating webhook of yurtappoverrider
vie-serendipity Sep 6, 2023
a2b58fa
add more UT
vie-serendipity Sep 6, 2023
bbb72d2
gci writting ut
vie-serendipity Sep 6, 2023
c1d8dbc
fix error in ut
vie-serendipity Sep 6, 2023
eb6b971
add more UT
vie-serendipity Sep 6, 2023
ad5a926
supplement status
vie-serendipity Sep 11, 2023
3fbce6c
supplement status of yurtappset
vie-serendipity Sep 12, 2023
eb2450b
add status info to yurtappset/yurtappdaemon
vie-serendipity Sep 14, 2023
a3ea01e
feat: manifests
Sep 14, 2023
dc7cff7
fix some problems
vie-serendipity Sep 14, 2023
bf08027
sync with master
vie-serendipity Sep 14, 2023
1f4ca9a
feat: refactor import
Sep 14, 2023
209de32
Merge branch 'openyurtio:master' into supplement_status
vie-serendipity Sep 14, 2023
ec9e383
fix error of image scan
vie-serendipity Sep 14, 2023
8f0efb7
Merge branch 'supplement_status' of github.com:vie-serendipity/openyu…
vie-serendipity Sep 14, 2023
2cf0294
fix errors in github checks
vie-serendipity Sep 14, 2023
2856021
go mod tidy
vie-serendipity Sep 14, 2023
beaa6d7
feat: manifests
Sep 14, 2023
125d9f3
fix errors in the comments
vie-serendipity Sep 14, 2023
1d13e05
fix errors in the comments
vie-serendipity Sep 14, 2023
0fd641c
fix errors in the comments
vie-serendipity Sep 14, 2023
d86c406
fix gci problems
vie-serendipity Sep 14, 2023
1306702
add poolReplicas field to YurtAppSet
vie-serendipity Sep 16, 2023
c0788b4
feat: manifests
Sep 16, 2023
c9b0677
Merge branch 'supplement_status' of github.com:vie-serendipity/openyu…
vie-serendipity Sep 16, 2023
ae1b2a6
feat: manifests
Sep 16, 2023
3c015c4
delete useless files
vie-serendipity Sep 16, 2023
d02ba5e
fix errors in the comments
vie-serendipity Sep 16, 2023
e86e3e1
add workloadsummaries to yurtappdaemon
vie-serendipity Sep 16, 2023
bf89290
feat: manifests
Sep 16, 2023
d4d0ca1
fix problems in the UT file
vie-serendipity Sep 16, 2023
6a1882c
fix golangci-lint
vie-serendipity Sep 16, 2023
491d1f1
add omitempty
vie-serendipity Sep 16, 2023
af41a75
feat: manifests
Sep 16, 2023
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
27 changes: 27 additions & 0 deletions charts/yurt-manager/crds/apps.openyurt.io_yurtappdaemons.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ spec:
jsonPath: .metadata.creationTimestamp
name: AGE
type: date
- description: The name of overrider bound to this yurtappdaemon
jsonPath: .status.overriderRef
name: OverriderRef
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -225,9 +229,32 @@ spec:
which is updated on mutation by the API Server.
format: int64
type: integer
overriderRef:
type: string
templateType:
description: TemplateType indicates the type of PoolTemplate
type: string
workloadSummary:
description: Records the topology detailed information of each workload.
items:
properties:
availableCondition:
type: string
readyReplicas:
format: int32
type: integer
replicas:
format: int32
type: integer
workloadName:
type: string
required:
- availableCondition
- readyReplicas
- replicas
- workloadName
type: object
type: array
required:
- currentRevision
- templateType
Expand Down
27 changes: 27 additions & 0 deletions charts/yurt-manager/crds/apps.openyurt.io_yurtappsets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ spec:
jsonPath: .metadata.creationTimestamp
name: AGE
type: date
- description: The name of overrider bound to this yurtappset
jsonPath: .status.overriderRef
name: OverriderRef
type: string
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -329,6 +333,8 @@ spec:
which is updated on mutation by the API Server.
format: int64
type: integer
overriderRef:
type: string
poolReplicas:
additionalProperties:
format: int32
Expand All @@ -347,6 +353,27 @@ spec:
templateType:
description: TemplateType indicates the type of PoolTemplate
type: string
workloadSummary:
description: Records the topology detailed information of each workload.
items:
properties:
availableCondition:
type: string
readyReplicas:
format: int32
type: integer
replicas:
format: int32
type: integer
workloadName:
type: string
required:
- availableCondition
- readyReplicas
- replicas
- workloadName
type: object
type: array
required:
- currentRevision
- replicas
Expand Down
12 changes: 6 additions & 6 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ require (
go.etcd.io/etcd/api/v3 v3.5.0
go.etcd.io/etcd/client/pkg/v3 v3.5.0
go.etcd.io/etcd/client/v3 v3.5.0
golang.org/x/net v0.14.0
golang.org/x/sys v0.11.0
golang.org/x/net v0.15.0
golang.org/x/sys v0.12.0
google.golang.org/grpc v1.57.0
gopkg.in/cheggaaa/pb.v1 v1.0.28
gopkg.in/square/go-jose.v2 v2.6.0
Expand Down Expand Up @@ -150,11 +150,11 @@ require (
go.uber.org/atomic v1.9.0 // indirect
go.uber.org/multierr v1.6.0 // indirect
go.uber.org/zap v1.24.0 // indirect
golang.org/x/crypto v0.12.0 // indirect
golang.org/x/crypto v0.13.0 // indirect
golang.org/x/oauth2 v0.7.0 // indirect
golang.org/x/sync v0.1.0 // indirect
golang.org/x/term v0.11.0 // indirect
golang.org/x/text v0.12.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/term v0.12.0 // indirect
golang.org/x/text v0.13.0 // indirect
golang.org/x/time v0.3.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.2.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
Expand Down
24 changes: 12 additions & 12 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -773,8 +773,8 @@ golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8U
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20201002170205-7f63de1d35b0/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I=
golang.org/x/crypto v0.12.0 h1:tFM/ta59kqch6LlvYnPa0yx5a83cL2nHflFhYKvv9Yk=
golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw=
golang.org/x/crypto v0.13.0 h1:mvySKfSWJ+UKUii46M40LOvyWfN0s2U+46/jDd0e6Ck=
golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc=
golang.org/x/exp v0.0.0-20180321215751-8460e604b9de/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20180807140117-3d87b88a115f/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
Expand Down Expand Up @@ -855,8 +855,8 @@ golang.org/x/net v0.0.0-20210405180319-a5a99cb37ef4/go.mod h1:p54w0d4576C0XHj96b
golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT/9KSuxbyM7479/AVlXFRxuMCk=
golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.0.0-20211029224645-99673261e6eb/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
golang.org/x/net v0.14.0 h1:BONx9s002vGdD9umnlX1Po8vOZmrgH34qlHcD1MfK14=
golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI=
golang.org/x/net v0.15.0 h1:ugBLEUaxABaB5AJqW9enI0ACdci2RUd4eP51NTBvuJ8=
golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
Expand All @@ -873,8 +873,8 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20201207232520-09787c993a3a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.1.0 h1:wsuoTGHzEhffawBOhz5CYhcrV4IdKZbEyZjBMuTp12o=
golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
Expand Down Expand Up @@ -939,13 +939,13 @@ golang.org/x/sys v0.0.0-20210906170528-6f6e22806c34/go.mod h1:oPkhp1MJrh7nUepCBc
golang.org/x/sys v0.0.0-20211025201205-69cdffdb9359/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20211116061358-0a5406a5449c/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.0.0-20220908164124-27713097b956/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.11.0 h1:eG7RXZHdqOJ1i+0lgLgCpSXAp6M3LYlAo6osgSi0xOM=
golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw=
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
golang.org/x/term v0.11.0 h1:F9tnn/DA/Im8nCwm+fX+1/eBwi4qFjRT++MhtVC4ZX0=
golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU=
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
Expand All @@ -954,8 +954,8 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.4/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
golang.org/x/text v0.12.0 h1:k+n5B8goJNdU7hSvEtMUz3d1Q6D/XW4COJSJR6fN0mc=
golang.org/x/text v0.12.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/text v0.13.0 h1:ablQoSUd0tRdKxZewP80B+BaqeKJuVhuRxj/dkrun3k=
golang.org/x/text v0.13.0/go.mod h1:TvPlkZtksWOMsz7fbANvkp4WM8x/WCo/om8BMLbz+aE=
golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
Expand Down
7 changes: 7 additions & 0 deletions pkg/apis/apps/v1alpha1/yurtappdaemon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,12 @@ type YurtAppDaemonStatus struct {
// +optional
Conditions []YurtAppDaemonCondition `json:"conditions,omitempty"`

OverriderRef string `json:"overriderRef,omitempty"`

// Records the topology detailed information of each workload.
// +optional
WorkloadSummaries []WorkloadSummary `json:"workloadSummary,omitempty"`

rambohe-ch marked this conversation as resolved.
Show resolved Hide resolved
// TemplateType indicates the type of PoolTemplate
TemplateType TemplateType `json:"templateType"`

Expand Down Expand Up @@ -105,6 +111,7 @@ type YurtAppDaemonCondition struct {
// +kubebuilder:resource:scope=Namespaced,path=yurtappdaemons,shortName=yad,categories=all
// +kubebuilder:printcolumn:name="WorkloadTemplate",type="string",JSONPath=".status.templateType",description="The WorkloadTemplate Type."
// +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."
// +kubebuilder:printcolumn:name="OverriderRef",type="string",JSONPath=".status.overriderRef",description="The name of overrider bound to this yurtappdaemon"

// YurtAppDaemon is the Schema for the samples API
type YurtAppDaemon struct {
Expand Down
14 changes: 14 additions & 0 deletions pkg/apis/apps/v1alpha1/yurtappset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,12 @@ type YurtAppSetStatus struct {
// +optional
Conditions []YurtAppSetCondition `json:"conditions,omitempty"`

// Records the topology detailed information of each workload.
// +optional
WorkloadSummaries []WorkloadSummary `json:"workloadSummary,omitempty"`

OverriderRef string `json:"overriderRef,omitempty"`

// Records the topology detail information of the replicas of each pool.
// +optional
PoolReplicas map[string]int32 `json:"poolReplicas,omitempty"`
Expand All @@ -178,6 +184,13 @@ type YurtAppSetStatus struct {
TemplateType TemplateType `json:"templateType"`
}

type WorkloadSummary struct {
AvailableCondition corev1.ConditionStatus `json:"availableCondition"`
Replicas int32 `json:"replicas"`
ReadyReplicas int32 `json:"readyReplicas"`
WorkloadName string `json:"workloadName"`
}

// YurtAppSetCondition describes current state of a YurtAppSet.
type YurtAppSetCondition struct {
// Type of in place set condition.
Expand All @@ -203,6 +216,7 @@ type YurtAppSetCondition struct {
// +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."
// +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."
// +kubebuilder:printcolumn:name="OverriderRef",type="string",JSONPath=".status.overriderRef",description="The name of overrider bound to this yurtappset"

// YurtAppSet is the Schema for the yurtAppSets API
type YurtAppSet struct {
Expand Down
25 changes: 25 additions & 0 deletions pkg/apis/apps/v1alpha1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions pkg/yurtmanager/controller/yurtappdaemon/util.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@
return nil
}

// RemoveYurtAppDaemonCondition removes the YurtAppDaemon condition with the provided type.
func RemoveYurtAppDaemonCondition(status *unitv1alpha1.YurtAppDaemonStatus, condType unitv1alpha1.YurtAppDaemonConditionType) {
status.Conditions = filterOutCondition(status.Conditions, condType)

Check warning on line 62 in pkg/yurtmanager/controller/yurtappdaemon/util.go

View check run for this annotation

Codecov / codecov/patch

pkg/yurtmanager/controller/yurtappdaemon/util.go#L61-L62

Added lines #L61 - L62 were not covered by tests
}

// SetYurtAppDaemonCondition updates the YurtAppDaemon to include the provided condition. If the condition that
// we are about to add already exists and has the same status, reason and message then we are not going to update.
func SetYurtAppDaemonCondition(status *unitv1alpha1.YurtAppDaemonStatus, condition *unitv1alpha1.YurtAppDaemonCondition) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
"errors"

appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/types"
Expand Down Expand Up @@ -185,6 +186,13 @@
for i, o := range objs {
deploy := o.(*appsv1.Deployment)
spec := deploy.Spec
var availableCondition corev1.ConditionStatus
for _, condition := range deploy.Status.Conditions {
if condition.Type == appsv1.DeploymentAvailable {
availableCondition = condition.Status
break

Check warning on line 193 in pkg/yurtmanager/controller/yurtappdaemon/workloadcontroller/deployment_controller.go

View check run for this annotation

Codecov / codecov/patch

pkg/yurtmanager/controller/yurtappdaemon/workloadcontroller/deployment_controller.go#L191-L193

Added lines #L191 - L193 were not covered by tests
}
}
w := &Workload{
Name: o.GetName(),
Namespace: o.GetNamespace(),
Expand All @@ -194,6 +202,11 @@
NodeSelector: spec.Template.Spec.NodeSelector,
Tolerations: spec.Template.Spec.Tolerations,
},
Status: WorkloadStatus{
Replicas: deploy.Status.Replicas,
ReadyReplicas: deploy.Status.ReadyReplicas,
AvailableCondition: availableCondition,
},
}
workloads = append(workloads, w)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ type WorkloadSpec struct {

// WorkloadStatus stores the observed state of the Workload.
type WorkloadStatus struct {
Replicas int32
ReadyReplicas int32
AvailableCondition corev1.ConditionStatus
}

func (w *Workload) GetRevision() string {
Expand Down
Loading
Loading