k8s.io/kubernetes@v1.29.3/pkg/proxy/ipvs/netlink_unsupported.go (about)

     1  //go:build !linux
     2  // +build !linux
     3  
     4  /*
     5  Copyright 2017 The Kubernetes Authors.
     6  
     7  Licensed under the Apache License, Version 2.0 (the "License");
     8  you may not use this file except in compliance with the License.
     9  You may obtain a copy of the License at
    10  
    11      http://www.apache.org/licenses/LICENSE-2.0
    12  
    13  Unless required by applicable law or agreed to in writing, software
    14  distributed under the License is distributed on an "AS IS" BASIS,
    15  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    16  See the License for the specific language governing permissions and
    17  limitations under the License.
    18  */
    19  
    20  package ipvs
    21  
    22  import (
    23  	"fmt"
    24  	"net"
    25  
    26  	"k8s.io/apimachinery/pkg/util/sets"
    27  )
    28  
    29  // The type must match the one in proxier_test.go
    30  type netlinkHandle struct {
    31  	isIPv6 bool
    32  }
    33  
    34  // NewNetLinkHandle will create an EmptyHandle
    35  func NewNetLinkHandle(ipv6 bool) NetLinkHandle {
    36  	return &netlinkHandle{}
    37  }
    38  
    39  // EnsureAddressBind checks if address is bound to the interface and, if not, binds it. If the address is already bound, return true.
    40  func (h *netlinkHandle) EnsureAddressBind(address, devName string) (exist bool, err error) {
    41  	return false, fmt.Errorf("netlink not supported for this platform")
    42  }
    43  
    44  // UnbindAddress unbind address from the interface
    45  func (h *netlinkHandle) UnbindAddress(address, devName string) error {
    46  	return fmt.Errorf("netlink not supported for this platform")
    47  }
    48  
    49  // EnsureDummyDevice is part of interface
    50  func (h *netlinkHandle) EnsureDummyDevice(devName string) (bool, error) {
    51  	return false, fmt.Errorf("netlink is not supported in this platform")
    52  }
    53  
    54  // DeleteDummyDevice is part of interface.
    55  func (h *netlinkHandle) DeleteDummyDevice(devName string) error {
    56  	return fmt.Errorf("netlink is not supported in this platform")
    57  }
    58  
    59  // ListBindAddress is part of interface.
    60  func (h *netlinkHandle) ListBindAddress(devName string) ([]string, error) {
    61  	return nil, fmt.Errorf("netlink is not supported in this platform")
    62  }
    63  
    64  // GetAllLocalAddresses is part of interface.
    65  func (h *netlinkHandle) GetAllLocalAddresses() (sets.Set[string], error) {
    66  	return nil, fmt.Errorf("netlink is not supported in this platform")
    67  }
    68  
    69  // GetLocalAddresses is part of interface.
    70  func (h *netlinkHandle) GetLocalAddresses(dev string) (sets.Set[string], error) {
    71  	return nil, fmt.Errorf("netlink is not supported in this platform")
    72  }
    73  
    74  // GetAllLocalAddressesExcept is part of interface.
    75  func (h *netlinkHandle) GetAllLocalAddressesExcept(dev string) (sets.Set[string], error) {
    76  	return nil, fmt.Errorf("netlink is not supported in this platform")
    77  }
    78  
    79  // Must match the one in proxier_test.go
    80  func (h *netlinkHandle) isValidForSet(ip net.IP) bool {
    81  	return false
    82  }