github.com/flanksource/konfigadm@v0.12.0/cmd/image_aliases.go (about)

     1  package cmd
     2  
     3  import (
     4  	"github.com/flanksource/konfigadm/pkg/types"
     5  	"github.com/flanksource/konfigadm/pkg/utils"
     6  )
     7  
     8  var images = map[string]Image{
     9  	"ubuntu2004": {
    10  		URL:            "https://cloud-images.ubuntu.com/releases/focal/release-{{.version}}/ubuntu-20.04-server-cloudimg-amd64.img",
    11  		DefaultVersion: "20200529.1",
    12  		Tags:           []types.Flag{types.UBUNTU, types.UBUNTU20, types.DEBIAN_LIKE},
    13  	},
    14  	"ubuntu1804": {
    15  		URL:            "https://cloud-images.ubuntu.com/releases/18.04/release-{{.version}}/ubuntu-18.04-server-cloudimg-amd64.img",
    16  		DefaultVersion: "20190617",
    17  		Tags:           []types.Flag{types.UBUNTU, types.UBUNTU18, types.DEBIAN_LIKE},
    18  	},
    19  	"ubuntu1604": {
    20  		URL:            "https://cloud-images.ubuntu.com/releases/16.04/release-{{.version}}/ubuntu-16.04-server-cloudimg-amd64-disk1.img",
    21  		DefaultVersion: "20190628",
    22  		Tags:           []types.Flag{types.UBUNTU, types.UBUNTU16, types.DEBIAN_LIKE},
    23  	},
    24  	"debian9": {
    25  		URL:            "https://cloud.debian.org/images/openstack/archive/{{.version}}/debian-{{.version}}-openstack-amd64.qcow2",
    26  		DefaultVersion: "9.9.3-20190618",
    27  		Tags:           []types.Flag{types.DEBIAN, types.DEBIAN9, types.DEBIAN_LIKE},
    28  	},
    29  	"centos7": {
    30  		URL:            "https://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud-{{.version}}.qcow2",
    31  		DefaultVersion: "1905",
    32  		Tags:           []types.Flag{types.CENTOS, types.CENTOS7, types.REDHAT_LIKE},
    33  	},
    34  	"amazonLinux": {
    35  		URL:            "https://cdn.amazonlinux.com/os-images/2.0.20190612/kvm/amzn2-kvm-2.0.{{.version}}-x86_64.xfs.gpt.qcow2",
    36  		DefaultVersion: "20190612",
    37  		Tags:           []types.Flag{types.AMAZON_LINUX, types.REDHAT_LIKE},
    38  	},
    39  	"fedora30": {
    40  		URL:            "https://download.fedoraproject.org/pub/fedora/linux/releases/{{.version}}/Cloud/x86_64/images/Fedora-Cloud-Base-{{.version}}-1.2.x86_64.qcow2",
    41  		DefaultVersion: "30",
    42  		Tags:           []types.Flag{types.FEDORA, types.FEDORA30},
    43  	},
    44  	"photon3": {
    45  		URL:            "https://packages.vmware.com/photon/{{.version}}/Rev3/ova/photon-hw13_uefi-{{.version}}-a383732.ova",
    46  		DefaultVersion: "3.0",
    47  		Tags:           []types.Flag{types.PHOTON, types.PHOTON3},
    48  	},
    49  }
    50  
    51  type Image struct {
    52  	Alias          string
    53  	URL            string
    54  	Tags           []types.Flag
    55  	Version        string
    56  	DefaultVersion string
    57  }
    58  
    59  func (i Image) GetURL() string {
    60  	vars := map[string]string{"version": i.DefaultVersion}
    61  	if i.Version != "" {
    62  		vars["version"] = i.Version
    63  	}
    64  	return utils.Interpolate(i.URL, vars)
    65  }