Documentation ¶
Index ¶
- Constants
- Variables
- func AppendTags(basicTags, extraTags []model.Tag) []model.Tag
- func BuildBasicTags(cluster string, obj interface{}, namespaceID types.UID) []model.Tag
- func CalculateIPFromCIDRs(IPAddresses []string) (int, error)
- func CalculateSubnetSize(mask int) int64
- func Capitalize(s string) string
- func CheckPodHasNamedPort(pod v1.Pod, reason string) bool
- func Contains(s []string, str string) bool
- func GenerateCertificate(subject *pkix.Name, validDays int) (string, string, error)
- func GenerateDisplayName(res_name, prefix, suffix, project, cluster string) string
- func GenerateID(res_id, prefix, suffix string, index string) string
- func GenerateTruncName(limit int, res_name, prefix, suffix, project, cluster string) string
- func GetCIDRRangesWithExcept(cidr string, excepts []string) ([]string, error)
- func GetIPPrefix(ipAddress string) (int, error)
- func GetMapValues(in interface{}) []string
- func GetSubnetMask(subnetLength int) (string, error)
- func If(condition bool, trueVal, falseVal interface{}) interface{}
- func IsSystemNamespace(c client.Client, ns string, obj *v1.Namespace) (bool, error)
- func NormalizeId(name string) string
- func NormalizeLabelKey(key string) string
- func NormalizeLabels(matchLabels *map[string]string) *map[string]string
- func NormalizeName(name string) string
- func RemoveDuplicateStr(strSlice []string) []string
- func RemoveIPPrefix(ipAddress string) (string, error)
- func Sha1(data string) string
- func ToUpper(obj interface{}) string
- func UpdateK8sResourceAnnotation(client client.Client, ctx *context.Context, k8sObj client.Object, ...) error
Constants ¶
const ( DefaultRSABits = 2048 // For now the ClusterControlPlane API doesn't support rotating certificate. We set long valid time to avoid certificate expiration. DefaultValidDays = 3650 DefaultValidDaysWithRotation = 365 DefaultRotateDays = 7 DefaultSerialNumberLength = 160 )
const ( HashLength int = 8 SubnetTypeSubnet = "subnet" SubnetTypeSubnetSet = "subnetset" )
Variables ¶
var ( DefaultSubject = pkix.Name{ Country: []string{"US"}, Organization: []string{"VMware"}, OrganizationalUnit: []string{"Antrea Cluster"}, Locality: []string{"Palo Alto"}, Province: []string{"CA"}, CommonName: "dummy", } )
var (
String = common.String
)
Functions ¶
func BuildBasicTags ¶
func CalculateIPFromCIDRs ¶
func CalculateSubnetSize ¶
func Capitalize ¶
func CheckPodHasNamedPort ¶
CheckPodHasNamedPort checks if the pod has a named port, it filters the pod events we don't want give concern.
func GenerateCertificate ¶
GenerateCertificate returns generated certificate and private key in PEM format
func GenerateDisplayName ¶
func GenerateID ¶
GenerateID generate id for nsx resource, some resources has complex index, so set it type to string
func GenerateTruncName ¶
func GetCIDRRangesWithExcept ¶
func GetIPPrefix ¶
GetIPPrefix get the prefix from an IP address, e.g. "1.2.3.4/24" -> 24
func GetMapValues ¶
func GetMapValues(in interface{}) []string
func GetSubnetMask ¶
GetSubnetMask get the mask for a given prefix length, e.g. 24 -> "255.255.255.0"
func IsSystemNamespace ¶
func NormalizeId ¶
func NormalizeLabelKey ¶
func NormalizeName ¶
func RemoveDuplicateStr ¶
func RemoveIPPrefix ¶
RemoveIPPrefix remove the prefix from an IP address, e.g. "1.2.3.4/24" -> "1.2.3.4"
func UpdateK8sResourceAnnotation ¶
func UpdateK8sResourceAnnotation(client client.Client, ctx *context.Context, k8sObj client.Object, changes map[string]string) error
the changes map contains key/value map that you want to change. if giving empty value for a key in changes map like: "mykey":"", that means removing this annotation from k8s resource
Types ¶
This section is empty.