Skip to content

Commit

Permalink
update validationg default image for enterprise compoenents
Browse files Browse the repository at this point in the history
  • Loading branch information
radTuti committed Sep 27, 2024
1 parent d56be0f commit ffca9f6
Showing 1 changed file with 31 additions and 30 deletions.
61 changes: 31 additions & 30 deletions hack/gen-versions/components.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,37 +17,33 @@ package main
import (
"fmt"
"os"
"strings"
"text/template"

"gopkg.in/yaml.v2"
)

var defaultImages = map[string]string{
"calico/cni": "calico/cni",
"calico/cni-windows": "calico/cni-windows",
"calico/dikastes": "calico/dikastes",
"calico/kube-controllers": "calico/kube-controllers",
"calico/node": "calico/node",
"calico/node-windows": "calico/node-windows",
"calicoctl": "calico/ctl",
"flannel": "coreos/flannel",
"flexvol": "calico/pod2daemon-flexvol",
"calico/csi": "calico/csi",
"csi-node-driver-registrar": "calico/node-driver-registrar",
"typha": "calico/typha",
"key-cert-provisioner": "calico/key-cert-provisioner",
"eck-elasticsearch": "unused/image",
"eck-elasticsearch-operator": "unused/image",
"eck-kibana": "unused/image",
"coreos-prometheus": "unused/image",
"coreos-alertmanager": "unused/image",
"guardian": "tigera/guardian",
"cnx-node": "tigera/cnx-node",
"cnx-node-windows": "tigera/cnx-node-windows",
"tigera-cni": "tigera/cni",
"tigera-cni-windows": "tigera/cni-windows",
"calico/apiserver": "calico/apiserver",
"tigera/linseed": "tigera/linseed",
"calico/cni": "calico/cni",
"calico/cni-windows": "calico/cni-windows",
"calico/dikastes": "calico/dikastes",
"calico/kube-controllers": "calico/kube-controllers",
"calico/node": "calico/node",
"calico/node-windows": "calico/node-windows",
"calicoctl": "calico/ctl",
"flannel": "coreos/flannel",
"flexvol": "calico/pod2daemon-flexvol",
"calico/csi": "calico/csi",
"csi-node-driver-registrar": "calico/node-driver-registrar",
"typha": "calico/typha",
"key-cert-provisioner": "calico/key-cert-provisioner",
"guardian": "tigera/guardian",
"cnx-node": "tigera/cnx-node",
"cnx-node-windows": "tigera/cnx-node-windows",
"tigera-cni": "tigera/cni",
"tigera-cni-windows": "tigera/cni-windows",
"calico/apiserver": "calico/apiserver",
"tigera/linseed": "tigera/linseed",
}

var ignoredImages = map[string]struct{}{
Expand Down Expand Up @@ -94,12 +90,17 @@ func GetComponents(versionsPath string) (Release, error) {
}

if component.Image == "" {
image := defaultImages[key]
if image == "" {
return cv, fmt.Errorf("no image nor default image available for component '%s'. "+
"Either fill in the 'image' field or update this code with a defaultImage.", key)
if strings.HasPrefix(key, "eck-") || strings.HasPrefix(key, "coreos-") {
// Skip checking for default images for ECK and CoreOS components.
// These components are only used for their version field.
} else {
image := defaultImages[key]
if image == "" {
return cv, fmt.Errorf("no image nor default image available for component '%s'. "+
"Either fill in the 'image' field or update this code with a defaultImage.", key)
}
component.Image = image
}
component.Image = image
}

cv.Components[key] = component
Expand Down

0 comments on commit ffca9f6

Please sign in to comment.