mirror of
https://github.com/go-micro/go-micro.git
synced 2024-12-06 08:16:03 +02:00
get k8s pod (#2173)
This commit is contained in:
parent
ca2014bf8e
commit
62112b015f
@ -25,6 +25,7 @@ type Meta struct {
|
||||
Name string `json:"name,omitempty"`
|
||||
Labels map[string]*string `json:"labels,omitempty"`
|
||||
Annotations map[string]*string `json:"annotations,omitempty"`
|
||||
DeletionTimestamp string `json:"deletionTimestamp,omitempty"`
|
||||
}
|
||||
|
||||
// Status ...
|
||||
|
@ -191,7 +191,7 @@ func (c *kregistry) GetService(name string, opts ...registry.GetOption) ([]*regi
|
||||
|
||||
// loop through items
|
||||
for _, pod := range pods.Items {
|
||||
if pod.Status.Phase != podRunning {
|
||||
if pod.Status.Phase != podRunning || pod.Meta.DeletionTimestamp != "" {
|
||||
continue
|
||||
}
|
||||
// get serialised service from annotation
|
||||
@ -235,7 +235,7 @@ func (c *kregistry) ListServices(opts ...registry.ListOption) ([]*registry.Servi
|
||||
svcs := make(map[string]bool)
|
||||
|
||||
for _, pod := range pods.Items {
|
||||
if pod.Status.Phase != podRunning {
|
||||
if pod.Status.Phase != podRunning || pod.Meta.DeletionTimestamp != "" {
|
||||
continue
|
||||
}
|
||||
for k, v := range pod.Metadata.Annotations {
|
||||
|
@ -155,7 +155,7 @@ func (k *k8sWatcher) handleEvent(event watch.Event) {
|
||||
|
||||
for _, result := range results {
|
||||
// pod isnt running
|
||||
if pod.Status.Phase != podRunning {
|
||||
if pod.Status.Phase != podRunning || pod.Meta.DeletionTimestamp != "" {
|
||||
result.Action = "delete"
|
||||
}
|
||||
k.next <- result
|
||||
|
Loading…
Reference in New Issue
Block a user