Skip to content
Snippets Groups Projects
Select Git revision
  • 6a5f1277f5c9dca549db33391737a0003f705cee
  • master default protected
  • v1.14.7
  • v1.14.6
  • v1.14.5
  • v1.14.4
  • v1.14.3
  • v1.14.2
  • v1.14.1
  • v1.14.0
  • v1.13.2
  • v1.13.1
  • v1.13.0
  • v1.12.1
  • v1.12.0
  • v1.11.1
  • v1.11.0
  • v1.10.0
  • v1.9.2
  • v1.9.1
  • v1.9.0
  • v1.8.4
22 results

README-hostgroup.md

Blame
  • Vagrantfile 12.59 KiB
    # -*- mode: ruby -*-
    # # vi: set ft=ruby :
    
    # For help on using kubespray with vagrant, check out docs/developers/vagrant.md
    
    require 'fileutils'
    
    Vagrant.require_version ">= 2.0.0"
    
    CONFIG = File.join(File.dirname(__FILE__), ENV['KUBESPRAY_VAGRANT_CONFIG'] || 'vagrant/config.rb')
    
    FLATCAR_URL_TEMPLATE = "https://%s.release.flatcar-linux.net/amd64-usr/current/flatcar_production_vagrant.json"
    
    # Uniq disk UUID for libvirt
    DISK_UUID = Time.now.utc.to_i
    
    SUPPORTED_OS = {
      "flatcar-stable"      => {box: "flatcar-stable",             user: "core", box_url: FLATCAR_URL_TEMPLATE % ["stable"]},
      "flatcar-beta"        => {box: "flatcar-beta",               user: "core", box_url: FLATCAR_URL_TEMPLATE % ["beta"]},
      "flatcar-alpha"       => {box: "flatcar-alpha",              user: "core", box_url: FLATCAR_URL_TEMPLATE % ["alpha"]},
      "flatcar-edge"        => {box: "flatcar-edge",               user: "core", box_url: FLATCAR_URL_TEMPLATE % ["edge"]},
      "ubuntu2004"          => {box: "generic/ubuntu2004",         user: "vagrant"},
      "ubuntu2204"          => {box: "generic/ubuntu2204",         user: "vagrant"},
      "ubuntu2404"          => {box: "bento/ubuntu-24.04",         user: "vagrant"},
      "centos8"             => {box: "centos/8",                   user: "vagrant"},
      "centos8-bento"       => {box: "bento/centos-8",             user: "vagrant"},
      "almalinux8"          => {box: "almalinux/8",                user: "vagrant"},
      "almalinux8-bento"    => {box: "bento/almalinux-8",          user: "vagrant"},
      "rockylinux8"         => {box: "rockylinux/8",               user: "vagrant"},
      "rockylinux9"         => {box: "rockylinux/9",               user: "vagrant"},
      "fedora39"            => {box: "fedora/39-cloud-base",       user: "vagrant"},
      "fedora40"            => {box: "fedora/40-cloud-base",       user: "vagrant"},
      "fedora39-arm64"      => {box: "bento/fedora-39-arm64",      user: "vagrant"},
      "fedora40-arm64"      => {box: "bento/fedora-40",            user: "vagrant"},
      "opensuse"            => {box: "opensuse/Leap-15.4.x86_64",  user: "vagrant"},
      "opensuse-tumbleweed" => {box: "opensuse/Tumbleweed.x86_64", user: "vagrant"},
      "oraclelinux"         => {box: "generic/oracle7",            user: "vagrant"},
      "oraclelinux8"        => {box: "generic/oracle8",            user: "vagrant"},
      "rhel8"               => {box: "generic/rhel8",              user: "vagrant"},
      "debian11"            => {box: "debian/bullseye64",          user: "vagrant"},
      "debian12"            => {box: "debian/bookworm64",          user: "vagrant"},
    }
    
    if File.exist?(CONFIG)
      require CONFIG
    end
    
    # Defaults for config options defined in CONFIG
    $num_instances ||= 3
    $instance_name_prefix ||= "k8s"
    $vm_gui ||= false
    $vm_memory ||= 2048
    $vm_cpus ||= 2
    $shared_folders ||= {}
    $forwarded_ports ||= {}
    $subnet ||= "172.18.8"
    $subnet_ipv6 ||= "fd3c:b398:0698:0756"
    $os ||= "ubuntu2004"
    $network_plugin ||= "flannel"
    $inventory ||= "inventory/sample"
    $inventories ||= [$inventory]
    # Setting multi_networking to true will install Multus: https://github.com/k8snetworkplumbingwg/multus-cni
    $multi_networking ||= "False"
    $download_run_once ||= "True"
    $download_force_cache ||= "False"
    # The first three nodes are etcd servers
    $etcd_instances ||= [$num_instances, 3].min
    # The first two nodes are kube masters
    $kube_master_instances ||= [$num_instances, 2].min
    # All nodes are kube nodes