// updateClusterInfoMap updates the cluster info config map or creates it
// if it doesn't exist yet.
updateClusterInfoMap updates the cluster info config map or creates it
if it doesn't exist yet.
// updateClusterInfoMap updates the cluster info config map or creates it // if it doesn ' t exist yet .
func (p *updatePhaseInit) updateClusterInfoMap() error {
	p.Infof("Update %v config map.", constants.ClusterInfoMap)
	_, err := p.Client.CoreV1().ConfigMaps(constants.KubeSystemNamespace).
		Get(context.TODO(), constants.ClusterInfoMap, metav1.GetOptions{})
	if err == nil {
		p.Infof("Config map %v already exists.", constants.ClusterInfoMap)
		return nil
	}
	err = rigging.ConvertError(err)
	if !trace.IsNotFound(err) {
		return trace.Wrap(err)
	}
	configMap := ops.MakeClusterInfoMap(ops.ConvertOpsSite(p.Cluster))
	_, err = p.Client.CoreV1().ConfigMaps(constants.KubeSystemNamespace).
		Create(context.TODO(), configMap, metav1.CreateOptions{})
	if err != nil {
		return rigging.ConvertError(err)
	}
	p.Infof("Created %v config map.", configMap.Name)
	return nil
}
func ( p * updatePhaseInit ) updateClusterInfoMap ( ) error { p . Infof ( " " , constants . ClusterInfoMap ) _ , err := p . Client . CoreV1 ( ) . ConfigMaps ( constants . KubeSystemNamespace ) . Get ( context . TODO ( ) , constants . ClusterInfoMap , metav1 . GetOptions { } ) if err == nil { p . Infof ( " " , constants . ClusterInfoMap ) return nil } err = rigging . ConvertError ( err ) if ! trace . IsNotFound ( err ) { return trace . Wrap ( err ) } configMap := ops . MakeClusterInfoMap ( ops . ConvertOpsSite ( p . Cluster ) ) _ , err = p . Client . CoreV1 ( ) . ConfigMaps ( constants . KubeSystemNamespace ) . Create ( context . TODO ( ) , configMap , metav1 . CreateOptions { } ) if err != nil { return rigging . ConvertError ( err ) } p . Infof ( " " , configMap . Name ) return nil }
updateClusterInfoMap updates the cluster info config map or creates it
if it doesn't exist yet.
updateClusterInfoMap updates the cluster info config map or creates it if it doesn ' t exist yet .
// Cluster info config map doesn't exist yet, create it.