...

Source file src/k8s.io/kubernetes/pkg/kubelet/cadvisor/cadvisor_windows.go

Documentation: k8s.io/kubernetes/pkg/kubelet/cadvisor

     1  //go:build windows
     2  // +build windows
     3  
     4  /*
     5  Copyright 2015 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 cadvisor
    21  
    22  import (
    23  	cadvisorapi "github.com/google/cadvisor/info/v1"
    24  	cadvisorapiv2 "github.com/google/cadvisor/info/v2"
    25  	"k8s.io/kubernetes/pkg/kubelet/winstats"
    26  )
    27  
    28  type cadvisorClient struct {
    29  	rootPath       string
    30  	winStatsClient winstats.Client
    31  }
    32  
    33  var _ Interface = new(cadvisorClient)
    34  
    35  // New creates a cAdvisor and exports its API on the specified port if port > 0.
    36  func New(imageFsInfoProvider ImageFsInfoProvider, rootPath string, cgroupRoots []string, usingLegacyStats, localStorageCapacityIsolation bool) (Interface, error) {
    37  	client, err := winstats.NewPerfCounterClient()
    38  	return &cadvisorClient{
    39  		rootPath:       rootPath,
    40  		winStatsClient: client,
    41  	}, err
    42  }
    43  
    44  func (cu *cadvisorClient) Start() error {
    45  	return nil
    46  }
    47  
    48  // ContainerInfoV2 is only expected to be used for the root container. Returns info for all containers in the node.
    49  func (cu *cadvisorClient) ContainerInfoV2(name string, options cadvisorapiv2.RequestOptions) (map[string]cadvisorapiv2.ContainerInfo, error) {
    50  	return cu.winStatsClient.WinContainerInfos()
    51  }
    52  
    53  func (cu *cadvisorClient) GetRequestedContainersInfo(containerName string, options cadvisorapiv2.RequestOptions) (map[string]*cadvisorapi.ContainerInfo, error) {
    54  	return nil, nil
    55  }
    56  
    57  func (cu *cadvisorClient) MachineInfo() (*cadvisorapi.MachineInfo, error) {
    58  	return cu.winStatsClient.WinMachineInfo()
    59  }
    60  
    61  func (cu *cadvisorClient) VersionInfo() (*cadvisorapi.VersionInfo, error) {
    62  	return cu.winStatsClient.WinVersionInfo()
    63  }
    64  
    65  func (cu *cadvisorClient) ImagesFsInfo() (cadvisorapiv2.FsInfo, error) {
    66  	return cadvisorapiv2.FsInfo{}, nil
    67  }
    68  
    69  func (cu *cadvisorClient) ContainerFsInfo() (cadvisorapiv2.FsInfo, error) {
    70  	return cadvisorapiv2.FsInfo{}, nil
    71  }
    72  
    73  func (cu *cadvisorClient) RootFsInfo() (cadvisorapiv2.FsInfo, error) {
    74  	return cu.GetDirFsInfo(cu.rootPath)
    75  }
    76  
    77  func (cu *cadvisorClient) GetDirFsInfo(path string) (cadvisorapiv2.FsInfo, error) {
    78  	return cu.winStatsClient.GetDirFsInfo(path)
    79  }
    80  

View as plain text