github.com/containerd/nerdctl@v1.7.7/pkg/containerutil/container_network_manager_other.go (about)

     1  //go:build darwin || freebsd || netbsd || openbsd
     2  
     3  /*
     4     Copyright The containerd Authors.
     5  
     6     Licensed under the Apache License, Version 2.0 (the "License");
     7     you may not use this file except in compliance with the License.
     8     You may obtain a copy of the License at
     9  
    10         http://www.apache.org/licenses/LICENSE-2.0
    11  
    12     Unless required by applicable law or agreed to in writing, software
    13     distributed under the License is distributed on an "AS IS" BASIS,
    14     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    15     See the License for the specific language governing permissions and
    16     limitations under the License.
    17  */
    18  
    19  package containerutil
    20  
    21  import (
    22  	"context"
    23  	"fmt"
    24  	"runtime"
    25  
    26  	"github.com/containerd/containerd"
    27  	"github.com/containerd/containerd/oci"
    28  	"github.com/containerd/nerdctl/pkg/api/types"
    29  )
    30  
    31  type cniNetworkManagerPlatform struct {
    32  }
    33  
    34  // Verifies that the internal network settings are correct.
    35  func (m *cniNetworkManager) VerifyNetworkOptions(_ context.Context) error {
    36  	return fmt.Errorf("CNI networking currently unsupported on %s", runtime.GOOS)
    37  }
    38  
    39  // Performs setup actions required for the container with the given ID.
    40  func (m *cniNetworkManager) SetupNetworking(_ context.Context, _ string) error {
    41  	return fmt.Errorf("CNI networking currently unsupported on %s", runtime.GOOS)
    42  }
    43  
    44  // Performs any required cleanup actions for the given container.
    45  // Should only be called to revert any setup steps performed in setupNetworking.
    46  func (m *cniNetworkManager) CleanupNetworking(_ context.Context, _ containerd.Container) error {
    47  	return fmt.Errorf("CNI networking currently unsupported on %s", runtime.GOOS)
    48  }
    49  
    50  // Returns the set of NetworkingOptions which should be set as labels on the container.
    51  func (m *cniNetworkManager) InternalNetworkingOptionLabels(_ context.Context) (types.NetworkOptions, error) {
    52  	return m.netOpts, fmt.Errorf("CNI networking currently unsupported on %s", runtime.GOOS)
    53  }
    54  
    55  // Returns a slice of `oci.SpecOpts` and `containerd.NewContainerOpts` which represent
    56  // the network specs which need to be applied to the container with the given ID.
    57  func (m *cniNetworkManager) ContainerNetworkingOpts(_ context.Context, _ string) ([]oci.SpecOpts, []containerd.NewContainerOpts, error) {
    58  	return []oci.SpecOpts{}, []containerd.NewContainerOpts{}, fmt.Errorf("CNI networking currently unsupported on %s", runtime.GOOS)
    59  }