SHA-4096 commented on code in PR #286:
URL: https://github.com/apache/dubbo-kubernetes/pull/286#discussion_r1609491201
##########
pkg/admin/model/instance.go:
##########
@@ -73,3 +78,105 @@ type State struct {
Tip string `json:"tip"`
Value string `json:"value"`
}
+
+type InstanceDetailResp struct {
+ RpcPort []string `json:"rpcPort"`
+ Ip []string `json:"ip"`
+ AppName []string `json:"appName"`
+ WorkloadName []string `json:"workloadName"`
+ Labels []string `json:"labels"`
+ CreateTime []string `json:"createTime"`
+ ReadyTime []string `json:"readyTime"`
+ RegisterTime []string `json:"registerTime"`
+ RegisterCluster []string `json:"registerCluster"`
+ DeployCluster []string `json:"deployCluster"`
+ Node []string `json:"node"`
+ Image []string `json:"image"`
+ Probes struct {
+ StartupProbe struct {
+ Type string `json:"type"`
+ Port int `json:"port"`
+ Open bool `json:"open"`
+ } `json:"startupProbe"`
+ ReadinessProbe struct {
+ Type string `json:"type"`
+ Port int `json:"port"`
+ Open bool `json:"open"`
+ } `json:"readinessProbe"`
+ LivenessProbe struct {
+ Type string `json:"type"`
+ Port int `json:"port"`
+ Open bool `json:"open"`
+ } `json:"livenessProbe"`
+ } `json:"probes"`
+}
+
+func (r *InstanceDetailResp) FromInstanceDetail(id *InstanceDetail)
*InstanceDetailResp {
+ r.AppName = id.AppName.Values()
+ r.RpcPort = id.RpcPort.Values()
+ r.Ip = id.Ip.Values()
+ r.WorkloadName = id.WorkloadName.Values()
+ r.Labels = id.Labels.Values()
+ r.CreateTime = id.CreateTime.Values()
+ r.ReadyTime = id.ReadyTime.Values()
+ r.RegisterTime = id.RegisterTime.Values()
+ r.RegisterCluster = id.RegisterClusters.Values()
+ r.DeployCluster = id.DeployCluster.Values()
+ r.Node = id.Node.Values()
+ r.Image = id.Image.Values()
+ return r
+}
+
+type InstanceDetail struct {
+ RpcPort Set
+ Ip Set
+ AppName Set
+ WorkloadName Set
+ Labels Set
+ CreateTime Set
+ ReadyTime Set
+ RegisterTime Set
+ RegisterClusters Set
+ DeployCluster Set
+ Node Set
+ Image Set
+}
Review Comment:
#https://github.com/apache/dubbo-kubernetes/blob/f493d76f1a41b5ac5b30bfb0a51155b2dfe5c274/pkg/admin/model/application.go#L60
I referenced the ApplicationDetail Struct to write InstanceDetail, but it
seems that it's indeed not a good practice.
This interface would return something like this for now:
```json
"data": [
{
"rpcPort": [
"20000"
],
"ip": [
"172.23.237.86:20000"
],
}
]
```
I'll have it changed soon.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]