17
17
package bean
18
18
19
19
import (
20
+ "github.com/devtron-labs/common-lib/utils/k8s/commonBean"
20
21
remoteConnectionBean "github.com/devtron-labs/common-lib/utils/remoteConnection/bean"
21
22
client "github.com/devtron-labs/kubelink/grpc"
22
- v1 "k8s.io/api/core/v1"
23
23
"k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
24
24
"k8s.io/apimachinery/pkg/runtime/schema"
25
25
"time"
@@ -36,13 +36,13 @@ type HelmAppValues struct {
36
36
}
37
37
38
38
type AppDetail struct {
39
- ApplicationStatus * HealthStatusCode `json:"applicationStatus"`
40
- ReleaseStatus * ReleaseStatus `json:"releaseStatus"`
41
- LastDeployed time.Time `json:"lastDeployed"`
42
- ChartMetadata * ChartMetadata `json:"chartMetadata"`
43
- ResourceTreeResponse * ResourceTreeResponse `json:"resourceTreeResponse"`
44
- EnvironmentDetails * client.EnvironmentDetails `json:"environmentDetails"`
45
- ReleaseExists bool `json:"releaseExists"`
39
+ ApplicationStatus * commonBean. HealthStatusCode `json:"applicationStatus"`
40
+ ReleaseStatus * ReleaseStatus `json:"releaseStatus"`
41
+ LastDeployed time.Time `json:"lastDeployed"`
42
+ ChartMetadata * ChartMetadata `json:"chartMetadata"`
43
+ ResourceTreeResponse * ResourceTreeResponse `json:"resourceTreeResponse"`
44
+ EnvironmentDetails * client.EnvironmentDetails `json:"environmentDetails"`
45
+ ReleaseExists bool `json:"releaseExists"`
46
46
}
47
47
48
48
type ReleaseStatus struct {
@@ -75,16 +75,6 @@ const (
75
75
// StatusPendingRollback indicates that an rollback operation is underway.
76
76
StatusPendingRollback HelmReleaseStatus = "pending-rollback"
77
77
)
78
- const (
79
- ContainersType = "Containers"
80
- ContainersNamesType = "ContainerNames"
81
- InitContainersNamesType = "InitContainerNames"
82
- EphemeralContainersInfoType = "EphemeralContainerInfo"
83
- EphemeralContainersStatusType = "EphemeralContainerStatuses"
84
- StatusReason = "Status Reason"
85
- Node = "Node"
86
- RestartCount = "Restart Count"
87
- )
88
78
89
79
type ChartMetadata struct {
90
80
// The name of the chart
@@ -103,94 +93,12 @@ type ChartMetadata struct {
103
93
104
94
type ResourceTreeResponse struct {
105
95
* ApplicationTree
106
- PodMetadata []* PodMetadata `json:"podMetadata"`
96
+ PodMetadata []* commonBean. PodMetadata `json:"podMetadata"`
107
97
}
108
98
109
99
// ApplicationTree holds nodes which belongs to the application
110
100
type ApplicationTree struct {
111
- Nodes []* ResourceNode `json:"nodes,omitempty" protobuf:"bytes,1,rep,name=nodes"`
112
- }
113
-
114
- // ResourceNode contains information about live resource and its children
115
- type ResourceNode struct {
116
- * ResourceRef `json:",inline" protobuf:"bytes,1,opt,name=resourceRef"`
117
- ParentRefs []* ResourceRef `json:"parentRefs,omitempty" protobuf:"bytes,2,opt,name=parentRefs"`
118
- NetworkingInfo * ResourceNetworkingInfo `json:"networkingInfo,omitempty" protobuf:"bytes,4,opt,name=networkingInfo"`
119
- ResourceVersion string `json:"resourceVersion,omitempty" protobuf:"bytes,5,opt,name=resourceVersion"`
120
- Health * HealthStatus `json:"health,omitempty" protobuf:"bytes,7,opt,name=health"`
121
- IsHibernated bool `json:"isHibernated"`
122
- CanBeHibernated bool `json:"canBeHibernated"`
123
- Info []InfoItem `json:"info,omitempty"`
124
- Port []int64 `json:"port,omitempty"`
125
- CreatedAt string `json:"createdAt,omitempty"`
126
- IsHook bool `json:"isHook,omitempty"`
127
- HookType string `json:"hookType,omitempty"`
128
- // UpdateRevision is used when a pod's owner is a StatefulSet for identifying if the pod is new or old
129
- UpdateRevision string `json:"updateRevision,omitempty"`
130
- // DeploymentPodHash is the podHash in deployment manifest and is used to compare replicaSet's podHash for identifying new vs old pod
131
- DeploymentPodHash string `json:"deploymentPodHash,omitempty"`
132
- DeploymentCollisionCount * int32 `json:"deploymentCollisionCount,omitempty"`
133
- // RolloutCurrentPodHash is the podHash in rollout manifest and is used to compare replicaSet's podHash for identifying new vs old pod
134
- RolloutCurrentPodHash string `json:"rolloutCurrentPodHash,omitempty"`
135
- }
136
-
137
- // ResourceRef includes fields which unique identify resource
138
- type ResourceRef struct {
139
- Group string `json:"group,omitempty" protobuf:"bytes,1,opt,name=group"`
140
- Version string `json:"version,omitempty" protobuf:"bytes,2,opt,name=version"`
141
- Kind string `json:"kind,omitempty" protobuf:"bytes,3,opt,name=kind"`
142
- Namespace string `json:"namespace,omitempty" protobuf:"bytes,4,opt,name=namespace"`
143
- Name string `json:"name,omitempty" protobuf:"bytes,5,opt,name=name"`
144
- UID string `json:"uid,omitempty" protobuf:"bytes,6,opt,name=uid"`
145
- Manifest unstructured.Unstructured `json:"-"`
146
- }
147
-
148
- func (r * ResourceRef ) GetGvk () schema.GroupVersionKind {
149
- if r == nil {
150
- return schema.GroupVersionKind {}
151
- }
152
- return schema.GroupVersionKind {
153
- Group : r .Group ,
154
- Version : r .Version ,
155
- Kind : r .Kind ,
156
- }
157
- }
158
-
159
- // ResourceNetworkingInfo holds networking resource related information
160
- type ResourceNetworkingInfo struct {
161
- Labels map [string ]string `json:"labels,omitempty" protobuf:"bytes,3,opt,name=labels"`
162
- }
163
-
164
- type HealthStatus struct {
165
- Status HealthStatusCode `json:"status,omitempty" protobuf:"bytes,1,opt,name=status"`
166
- Message string `json:"message,omitempty" protobuf:"bytes,2,opt,name=message"`
167
- }
168
-
169
- type HealthStatusCode = string
170
-
171
- const (
172
- HealthStatusUnknown HealthStatusCode = "Unknown"
173
- HealthStatusProgressing HealthStatusCode = "Progressing"
174
- HealthStatusHealthy HealthStatusCode = "Healthy"
175
- HealthStatusSuspended HealthStatusCode = "Suspended"
176
- HealthStatusDegraded HealthStatusCode = "Degraded"
177
- HealthStatusMissing HealthStatusCode = "Missing"
178
- HealthStatusHibernated HealthStatusCode = "Hibernated"
179
- HealthStatusPartiallyHibernated HealthStatusCode = "Partially Hibernated"
180
- )
181
-
182
- type PodMetadata struct {
183
- Name string `json:"name"`
184
- UID string `json:"uid"`
185
- Containers []string `json:"containers"`
186
- InitContainers []string `json:"initContainers"`
187
- IsNew bool `json:"isNew"`
188
- EphemeralContainers []* EphemeralContainerData `json:"ephemeralContainers"`
189
- }
190
-
191
- type EphemeralContainerData struct {
192
- Name string `json:"name"`
193
- IsExternal bool `json:"isExternal"`
101
+ Nodes []* commonBean.ResourceNode `json:"nodes,omitempty" protobuf:"bytes,1,rep,name=nodes"`
194
102
}
195
103
196
104
type HelmReleaseDetailRequest struct {
@@ -231,25 +139,6 @@ type DesiredOrLiveManifest struct {
231
139
LiveManifestFetchErrorCode int32 `json:"liveManifestFetchErrorCode"`
232
140
}
233
141
234
- // use value field as generic type
235
- // InfoItem contains arbitrary, human readable information about an application
236
- type InfoItem struct {
237
- // Name is a human readable title for this piece of information.
238
- Name string `json:"name,omitempty"`
239
- // Value is human readable content.
240
- Value interface {} `json:"value,omitempty"`
241
- }
242
-
243
- type EphemeralContainerInfo struct {
244
- Name string
245
- Command []string
246
- }
247
-
248
- type EphemeralContainerStatusesInfo struct {
249
- Name string
250
- State v1.ContainerState
251
- }
252
-
253
142
type ClusterInfo struct {
254
143
ClusterId int `json:"clusterId"`
255
144
ClusterName string `json:"clusterName"`
0 commit comments