【修改】k8s 配置

This commit is contained in:
PandaGoAdmin
2022-01-22 17:07:04 +08:00
parent c6ebe89865
commit 33cc74711d
439 changed files with 9936 additions and 21687 deletions

View File

@@ -0,0 +1,33 @@
package endpoint
import (
v1 "k8s.io/api/core/v1"
"pandax/apps/devops/entity/k8s"
)
type EndpointList struct {
ListMeta k8s.ListMeta `json:"listMeta"`
// List of endpoints
Endpoints []Endpoint `json:"endpoints"`
}
// toEndpointList converts array of api events to endpoint List structure
func toEndpointList(endpoints []v1.Endpoints) *EndpointList {
endpointList := EndpointList{
Endpoints: make([]Endpoint, 0),
ListMeta: k8s.ListMeta{TotalItems: len(endpoints)},
}
for _, endpoint := range endpoints {
for _, subSets := range endpoint.Subsets {
for _, address := range subSets.Addresses {
endpointList.Endpoints = append(endpointList.Endpoints, *toEndpoint(address, subSets.Ports, true))
}
for _, notReadyAddress := range subSets.NotReadyAddresses {
endpointList.Endpoints = append(endpointList.Endpoints, *toEndpoint(notReadyAddress, subSets.Ports, false))
}
}
}
return &endpointList
}