// manageFlatNetwork is the core logic to manage a flat typed network object
manageFlatNetwork is the core logic to manage a flat typed network object
// manageFlatNetwork is the core logic to manage a flat typed network object
func manageFlatNetwork(net *v1.Network, netClient arktos.Interface, svcClient kubernetes.Interface, toDeployDNS bool, domainName, kubeAPIServerIP, kubeAPIServerPort, saltSuffix string) error {
	if net.DeletionTimestamp != nil {
		return ensureTerminatingPhase(net, netClient)
	}
	if len(net.Status.DNSServiceIP) != 0 {
		klog.V(5).Infof("network %s/%s/%s already have DNS service IP %s; skipped", net.Tenant, net.Namespace, net.Name, net.Status.DNSServiceIP)
		return nil
	}
	dnsSvc, err := createOrGetDNSService(net, svcClient)
	if err != nil {
		return fmt.Errorf("failed to get or create per-network DNS service in tenant %s for network %s: %v", net.Tenant, net.Name, err)
	}
	if toDeployDNS {
		if err = deployDNSForNetwork(net, svcClient, saltSuffix, domainName, kubeAPIServerIP, kubeAPIServerPort); err != nil {
			return fmt.Errorf("failed to deploy per-network DNS: %v", err)
		}
	}
	if _, err := createOrGetKubernetesService(net, svcClient); err != nil {
		return fmt.Errorf("failed to get or create per-network Kubernetes service: %v", err)
	}
	netReady := net.DeepCopy()
	netReady.Status.Phase = v1.NetworkReady
	netReady.Status.DNSServiceIP = dnsSvc.Spec.ClusterIP
	netReady.Status.Message = "DNS service ready; network ready"
	_, err = netClient.ArktosV1().NetworksWithMultiTenancy(netReady.Tenant).UpdateStatus(netReady)
	return err
}
func manageFlatNetwork ( net * v1 . Network , netClient arktos . Interface , svcClient kubernetes . Interface , toDeployDNS bool , domainName , kubeAPIServerIP , kubeAPIServerPort , saltSuffix string ) error { if net . DeletionTimestamp != nil { return ensureTerminatingPhase ( net , netClient ) } if len ( net . Status . DNSServiceIP ) != 0 { klog . V ( 5 ) . Infof ( " " , net . Tenant , net . Namespace , net . Name , net . Status . DNSServiceIP ) return nil } dnsSvc , err := createOrGetDNSService ( net , svcClient ) if err != nil { return fmt . Errorf ( " " , net . Tenant , net . Name , err ) } if toDeployDNS { if err = deployDNSForNetwork ( net , svcClient , saltSuffix , domainName , kubeAPIServerIP , kubeAPIServerPort ) ; err != nil { return fmt . Errorf ( " " , err ) } } if _ , err := createOrGetKubernetesService ( net , svcClient ) ; err != nil { return fmt . Errorf ( " " , err ) } netReady := net . DeepCopy ( ) netReady . Status . Phase = v1 . NetworkReady netReady . Status . DNSServiceIP = dnsSvc . Spec . ClusterIP netReady . Status . Message = " " _ , err = netClient . ArktosV1 ( ) . NetworksWithMultiTenancy ( netReady . Tenant ) . UpdateStatus ( netReady ) return err }
manageFlatNetwork is the core logic to manage a flat typed network object
manageFlatNetwork is the core logic to manage a flat typed network object
// since dns service is in place, flat type network is Ready now