apiserver identity: use persistent identity format based on hostname

Signed-off-by: Andrew Sy Kim <andrewsy@google.com>
This commit is contained in:
Andrew Sy Kim
2022-10-24 11:24:26 -04:00
parent 208b2b7ca9
commit 21507902ba
2 changed files with 19 additions and 1 deletions

View File

@@ -21,6 +21,7 @@ import (
"fmt"
"net"
"net/http"
"os"
"reflect"
"strconv"
"time"
@@ -515,6 +516,14 @@ func labelAPIServerHeartbeat(lease *coordinationapiv1.Lease) error {
}
// This label indicates that kube-apiserver owns this identity lease object
lease.Labels[IdentityLeaseComponentLabelKey] = KubeAPIServer
hostname, err := os.Hostname()
if err != nil {
return err
}
// convenience label to easily map a lease object to a specific apiserver
lease.Labels[apiv1.LabelHostname] = hostname
return nil
}