github.com/openshift/installer@v1.4.17/pkg/asset/tls/helper.go (about)

     1  package tls
     2  
     3  import (
     4  	"fmt"
     5  	"net"
     6  	"path/filepath"
     7  
     8  	"github.com/apparentlymart/go-cidr/cidr"
     9  
    10  	"github.com/openshift/installer/pkg/types"
    11  )
    12  
    13  const (
    14  	tlsDir = "tls"
    15  )
    16  
    17  func assetFilePath(filename string) string {
    18  	return filepath.Join(tlsDir, filename)
    19  }
    20  
    21  func apiAddress(cfg *types.InstallConfig) string {
    22  	return fmt.Sprintf("api.%s", cfg.ClusterDomain())
    23  }
    24  
    25  func internalAPIAddress(cfg *types.InstallConfig) string {
    26  	return fmt.Sprintf("api-int.%s", cfg.ClusterDomain())
    27  }
    28  
    29  func cidrhost(network net.IPNet, hostNum int) (string, error) {
    30  	ip, err := cidr.Host(&network, hostNum)
    31  	if err != nil {
    32  		return "", err
    33  	}
    34  
    35  	return ip.String(), nil
    36  }