github.com/openshift/installer@v1.4.17/pkg/asset/manifests/gcp/clouduid.go (about)

     1  package gcp
     2  
     3  import (
     4  	corev1 "k8s.io/api/core/v1"
     5  	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
     6  
     7  	gcptypes "github.com/openshift/installer/pkg/types/gcp"
     8  )
     9  
    10  const (
    11  	// uidConfigMapName is the name of the config map that contains the cloud controller UID
    12  	uidConfigMapName = "ingress-uid"
    13  	// uidNamespace is the namespace which contains the above config map
    14  	uidNamespace = metav1.NamespaceSystem
    15  	// uidCluster is the data key for the clusters uid
    16  	uidCluster = "uid"
    17  	// uidProvider is the data key for the providers uid
    18  	uidProvider = "provider-uid"
    19  )
    20  
    21  // CloudControllerUID returns a configmap with a unique UID
    22  // per cluster used by the GCP cloud controller provider to name
    23  // load balancer resources.
    24  // This is based on GCP provider code that manages this configmap:
    25  // https://github.com/openshift/kubernetes/blob/a45281f7de40f996f67d0ee7b886add59e7b5e8d/pkg/cloudprovider/providers/gce/gce_clusterid.go#L38-L57
    26  func CloudControllerUID(infraID string) *corev1.ConfigMap {
    27  	uid := gcptypes.CloudControllerUID(infraID)
    28  	return &corev1.ConfigMap{
    29  		TypeMeta: metav1.TypeMeta{
    30  			APIVersion: corev1.SchemeGroupVersion.String(),
    31  			Kind:       "ConfigMap",
    32  		},
    33  		ObjectMeta: metav1.ObjectMeta{
    34  			Name:      uidConfigMapName,
    35  			Namespace: uidNamespace,
    36  		},
    37  		Data: map[string]string{
    38  			uidCluster:  uid,
    39  			uidProvider: uid,
    40  		},
    41  	}
    42  }