...

Source file src/edge-infra.dev/pkg/sds/ien/containers/versions.go

Documentation: edge-infra.dev/pkg/sds/ien/containers

     1  package containers
     2  
     3  import (
     4  	"github.com/spf13/afero"
     5  	"gopkg.in/yaml.v3"
     6  )
     7  
     8  // path to the container versions yaml file
     9  const VersionsPath string = "/etc/kubernetes/container-versions.yaml"
    10  
    11  type Versions struct {
    12  	Containers `yaml:"containers"`
    13  }
    14  
    15  // Containers defines a map of container images
    16  // with the corresponding container image tag.
    17  type Containers struct {
    18  	CalicoOperator            string `yaml:"operator"`
    19  	CalicoTypha               string `yaml:"typha"`
    20  	CalicoCtl                 string `yaml:"ctl"`
    21  	CalicoNode                string `yaml:"node"`
    22  	CalicoCNI                 string `yaml:"cni"`
    23  	CalicoAPIServer           string `yaml:"apiserver"`
    24  	CalicoKubeControllers     string `yaml:"kube-controllers"`
    25  	CalicoDikastes            string `yaml:"dikastes"`
    26  	CalicoPod2DaemonFlexvol   string `yaml:"pod2daemon-flexvol"`
    27  	CalicoCSI                 string `yaml:"csi"`
    28  	CalicoNodeDriverRegistrar string `yaml:"node-driver-registrar"`
    29  	KubeVIP                   string `yaml:"kube-vip"`
    30  	KubeAPIServer             string `yaml:"kube-apiserver"`
    31  	KubeControllerManager     string `yaml:"kube-controller-manager"`
    32  	KubeScheduler             string `yaml:"kube-scheduler"`
    33  	KubeProxy                 string `yaml:"kube-proxy"`
    34  	Pause                     string `yaml:"pause"`
    35  	Etcd                      string `yaml:"etcd"`
    36  	CoreDNS                   string `yaml:"coredns"`
    37  }
    38  
    39  // ParseVersions reads the container-versions.yaml file
    40  // and returns Versions struct
    41  func ParseVersions(fs afero.Fs, path string) (*Versions, error) {
    42  	content, err := afero.ReadFile(fs, path)
    43  	if err != nil {
    44  		return nil, err
    45  	}
    46  
    47  	var versions Versions
    48  	err = yaml.Unmarshal(content, &versions)
    49  	return &versions, err
    50  }
    51  

View as plain text