Documentation ¶
Index ¶
- Constants
- Variables
- func DiscoverServiceCIDRByInvalidServiceCreation(ctx context.Context, k8sClient client.Client, namespace string) (string, error)
- func FilterEndpointSubsets(subsets []corev1.EndpointSubset) []corev1.EndpointSubset
- func GetServiceEndpointPorts(ports []corev1.ServicePort) []corev1.EndpointPort
- func GetServiceEndpointSubset(svc *corev1.Service) corev1.EndpointSubset
- func HashLabelIdentity(l string) string
- func IsMulticlusterService(service *corev1.Service) bool
- func NamespacedName(namespace, name string) string
- func NewClusterInfoResourceExportName(clusterID string) string
- func RemoveStringFromSlice(slice []string, s string) (result []string)
- func StringExistsInSlice(slice []string, s string) bool
- func ToMCResourceName(originalResourceName string) string
- func ValidateLocalClusterClaim(c client.Client, clusterSet *multiclusterv1alpha1.ClusterSet) (clusterID ClusterID, clusterSetID ClusterSetID, err error)
- type ClusterID
- type ClusterSetID
Constants ¶
View Source
const ( AntreaMCServiceAnnotation = "multicluster.antrea.io/imported-service" AntreaMCACNPAnnotation = "multicluster.antrea.io/imported-acnp" GatewayAnnotation = "multicluster.antrea.io/gateway" GatewayIPAnnotation = "multicluster.antrea.io/gateway-ip" AntreaMCSPrefix = "antrea-mc-" InvalidClusterID = ClusterID("invalid") InvalidClusterSetID = ClusterSetID("invalid") DefaultWorkerCount = 5 )
Variables ¶
View Source
var ( LocalClusterID = "cluster-a" LeaderNamespace = "default" SvcPort80 = corev1.ServicePort{ Name: "http", Protocol: corev1.ProtocolTCP, Port: 80, } SvcPort8080 = corev1.ServicePort{ Name: "http", Protocol: corev1.ProtocolTCP, Port: 8080, } SvcNginxSpec = corev1.ServiceSpec{ ClusterIP: "192.168.2.3", ClusterIPs: []string{"192.168.2.3"}, Ports: []corev1.ServicePort{ SvcPort80, }, Type: corev1.ServiceTypeClusterIP, } SvcNginx = &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: "nginx", Namespace: "default", }, Spec: SvcNginxSpec, } EPNginxSubset = []corev1.EndpointSubset{ { Addresses: []corev1.EndpointAddress{ addr1, }, Ports: epPorts80, }, } EPNginxSubset2 = []corev1.EndpointSubset{ { Addresses: []corev1.EndpointAddress{ addr2, }, Ports: epPorts80, }, } EPNginx = &corev1.Endpoints{ ObjectMeta: metav1.ObjectMeta{ Name: "nginx", Namespace: "default", }, Subsets: EPNginxSubset, } TestCtx = context.Background() TestScheme = runtime.NewScheme() )
Functions ¶
func DiscoverServiceCIDRByInvalidServiceCreation ¶ added in v1.11.0
func DiscoverServiceCIDRByInvalidServiceCreation(ctx context.Context, k8sClient client.Client, namespace string) (string, error)
DiscoverServiceCIDRByInvalidServiceCreation creates an invalid Service to get returned error, and analyzes the error message to get Service CIDR. TODO: add dual-stack support.
func FilterEndpointSubsets ¶
func FilterEndpointSubsets(subsets []corev1.EndpointSubset) []corev1.EndpointSubset
FilterEndpointSubsets keeps IPs only and removes other fields from EndpointSubset which are unnecessary information for other member clusters.
func GetServiceEndpointPorts ¶ added in v1.7.0
func GetServiceEndpointPorts(ports []corev1.ServicePort) []corev1.EndpointPort
GetServiceEndpointPorts converts Service's port to EndpointPort
func GetServiceEndpointSubset ¶ added in v1.7.0
func GetServiceEndpointSubset(svc *corev1.Service) corev1.EndpointSubset
func HashLabelIdentity ¶ added in v1.9.0
HashLabelIdentity generates a hash value for label identity string.
func IsMulticlusterService ¶ added in v1.11.0
func NamespacedName ¶
TODO: Use NamespacedName stringer method instead of this. e.g. nsName.String()
func NewClusterInfoResourceExportName ¶ added in v1.11.0
func RemoveStringFromSlice ¶
func StringExistsInSlice ¶
func ToMCResourceName ¶ added in v1.10.0
func ValidateLocalClusterClaim ¶ added in v1.11.0
func ValidateLocalClusterClaim(c client.Client, clusterSet *multiclusterv1alpha1.ClusterSet) (clusterID ClusterID, clusterSetID ClusterSetID, err error)
Types ¶
type ClusterSetID ¶
type ClusterSetID string
Click to show internal directories.
Click to hide internal directories.