1717package bean
1818
1919import (
20+ "github.com/devtron-labs/common-lib/utils/k8s/commonBean"
2021 remoteConnectionBean "github.com/devtron-labs/common-lib/utils/remoteConnection/bean"
2122 client "github.com/devtron-labs/kubelink/grpc"
22- v1 "k8s.io/api/core/v1"
2323 "k8s.io/apimachinery/pkg/apis/meta/v1/unstructured"
2424 "k8s.io/apimachinery/pkg/runtime/schema"
2525 "time"
@@ -36,13 +36,13 @@ type HelmAppValues struct {
3636}
3737
3838type 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"`
4646}
4747
4848type ReleaseStatus struct {
@@ -75,16 +75,6 @@ const (
7575 // StatusPendingRollback indicates that an rollback operation is underway.
7676 StatusPendingRollback HelmReleaseStatus = "pending-rollback"
7777)
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- )
8878
8979type ChartMetadata struct {
9080 // The name of the chart
@@ -103,94 +93,12 @@ type ChartMetadata struct {
10393
10494type ResourceTreeResponse struct {
10595 * ApplicationTree
106- PodMetadata []* PodMetadata `json:"podMetadata"`
96+ PodMetadata []* commonBean. PodMetadata `json:"podMetadata"`
10797}
10898
10999// ApplicationTree holds nodes which belongs to the application
110100type 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"`
194102}
195103
196104type HelmReleaseDetailRequest struct {
@@ -231,25 +139,6 @@ type DesiredOrLiveManifest struct {
231139 LiveManifestFetchErrorCode int32 `json:"liveManifestFetchErrorCode"`
232140}
233141
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-
253142type ClusterInfo struct {
254143 ClusterId int `json:"clusterId"`
255144 ClusterName string `json:"clusterName"`
0 commit comments