Properly build-tag the Linux kube-proxy backend code

This had to be able to build on OS X before to make verify-typecheck
pass, but now that that's fixed we can tag the code properly as being
linux-only.
This commit is contained in:
Dan Winship 2023-12-18 20:12:51 -05:00
parent b69510b069
commit c1ce1e00ee
40 changed files with 105 additions and 206 deletions

View File

@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build linux
// +build linux
/*
Copyright 2018 The Kubernetes Authors.

View File

@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build linux
// +build linux
/*
Copyright 2014 The Kubernetes Authors.

View File

@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build linux
// +build linux
/*
Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2023 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2016 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2022 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build linux
// +build linux
/*
Copyright 2019 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,82 +0,0 @@
//go:build !linux
// +build !linux
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ipvs
import (
"fmt"
"net"
"k8s.io/apimachinery/pkg/util/sets"
)
// The type must match the one in proxier_test.go
type netlinkHandle struct {
isIPv6 bool
}
// NewNetLinkHandle will create an EmptyHandle
func NewNetLinkHandle(ipv6 bool) NetLinkHandle {
return &netlinkHandle{}
}
// EnsureAddressBind checks if address is bound to the interface and, if not, binds it. If the address is already bound, return true.
func (h *netlinkHandle) EnsureAddressBind(address, devName string) (exist bool, err error) {
return false, fmt.Errorf("netlink not supported for this platform")
}
// UnbindAddress unbind address from the interface
func (h *netlinkHandle) UnbindAddress(address, devName string) error {
return fmt.Errorf("netlink not supported for this platform")
}
// EnsureDummyDevice is part of interface
func (h *netlinkHandle) EnsureDummyDevice(devName string) (bool, error) {
return false, fmt.Errorf("netlink is not supported in this platform")
}
// DeleteDummyDevice is part of interface.
func (h *netlinkHandle) DeleteDummyDevice(devName string) error {
return fmt.Errorf("netlink is not supported in this platform")
}
// ListBindAddress is part of interface.
func (h *netlinkHandle) ListBindAddress(devName string) ([]string, error) {
return nil, fmt.Errorf("netlink is not supported in this platform")
}
// GetAllLocalAddresses is part of interface.
func (h *netlinkHandle) GetAllLocalAddresses() (sets.Set[string], error) {
return nil, fmt.Errorf("netlink is not supported in this platform")
}
// GetLocalAddresses is part of interface.
func (h *netlinkHandle) GetLocalAddresses(dev string) (sets.Set[string], error) {
return nil, fmt.Errorf("netlink is not supported in this platform")
}
// GetAllLocalAddressesExcept is part of interface.
func (h *netlinkHandle) GetAllLocalAddressesExcept(dev string) (sets.Set[string], error) {
return nil, fmt.Errorf("netlink is not supported in this platform")
}
// Must match the one in proxier_test.go
func (h *netlinkHandle) isValidForSet(ip net.IP) bool {
return false
}

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,5 +1,5 @@
//go:build !windows
// +build !windows
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,79 +0,0 @@
//go:build !linux
// +build !linux
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package ipvs
import (
"fmt"
"time"
)
// New returns a dummy Interface for unsupported platform.
func New() Interface {
return &runner{}
}
type runner struct {
}
func (runner *runner) Flush() error {
return fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) AddVirtualServer(*VirtualServer) error {
return fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) UpdateVirtualServer(*VirtualServer) error {
return fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) DeleteVirtualServer(*VirtualServer) error {
return fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) GetVirtualServer(*VirtualServer) (*VirtualServer, error) {
return nil, fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) GetVirtualServers() ([]*VirtualServer, error) {
return nil, fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) AddRealServer(*VirtualServer, *RealServer) error {
return fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) GetRealServers(*VirtualServer) ([]*RealServer, error) {
return nil, fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) DeleteRealServer(*VirtualServer, *RealServer) error {
return fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) UpdateRealServer(*VirtualServer, *RealServer) error {
return fmt.Errorf("IPVS not supported for this platform")
}
func (runner *runner) ConfigureTimeouts(time.Duration, time.Duration, time.Duration) error {
return fmt.Errorf("IPVS not supported for this platform")
}
var _ = Interface(&runner{})

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2017 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2014 The Kubernetes Authors.

View File

@ -1,33 +0,0 @@
//go:build !linux
// +build !linux
/*
Copyright 2017 The Kubernetes Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
package iptables
import (
"fmt"
"os"
)
func grabIptablesLocks(lock14filePath, lock16filePath string) (iptablesLocker, error) {
return nil, fmt.Errorf("iptables unsupported on this platform")
}
func grabIptablesFileLock(f *os.File) error {
return fmt.Errorf("iptables unsupported on this platform")
}

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2014 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2018 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2015 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2022 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2022 The Kubernetes Authors.

View File

@ -1,3 +1,6 @@
//go:build linux
// +build linux
/*
Copyright 2022 The Kubernetes Authors.