Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Align with upstream repo / packaging changes #55

Merged
merged 1 commit into from
Sep 15, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion baski-example.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,12 @@ build:
crictl-version: "1.26.0"
# The CNI version.
cni-version: "1.2.0"
# The specific version of the CNI Debian package ('kubernetes-cni') to install
cni-deb-version: "1.2.0-2.1"
# The Kubernetes version.
kubernetes-version: "1.26.3"
kubernetes-version: "1.28.2"
# The specific version of the Kubernetes Debian packages ('kubeadm', 'kubelet') to install
kubernetes-deb-version: "1.28.2-1.1"
# Any additional debs to install. Currently, Baski only supports ubuntu and flatcar and this will only work with Ubuntu
extra-debs: "nfs-common"
# Whether to add Trivy into the image.
Expand Down
6 changes: 6 additions & 0 deletions pkg/cmd/util/flags/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ type BuildOptions struct {
ImageRepoBranch string
CrictlVersion string
CniVersion string
CniDebVersion string
KubeVersion string
KubeRpmVersion string
KubeDebVersion string
ExtraDebs string
AdditionalImages []string
AddFalco bool
Expand All @@ -44,7 +47,10 @@ func (o *BuildOptions) SetOptionsFromViper() {
o.ImageRepoBranch = viper.GetString(fmt.Sprintf("%s.image-repo-branch", viperBuildPrefix))
o.CrictlVersion = viper.GetString(fmt.Sprintf("%s.crictl-version", viperBuildPrefix))
o.CniVersion = viper.GetString(fmt.Sprintf("%s.cni-version", viperBuildPrefix))
o.CniDebVersion = viper.GetString(fmt.Sprintf("%s.cni-deb-version", viperBuildPrefix))
o.KubeVersion = viper.GetString(fmt.Sprintf("%s.kubernetes-version", viperBuildPrefix))
o.KubeDebVersion = viper.GetString(fmt.Sprintf("%s.kubernetes-deb-version", viperBuildPrefix))
o.KubeRpmVersion = viper.GetString(fmt.Sprintf("%s.kubernetes-rpm-version", viperBuildPrefix))
o.ExtraDebs = viper.GetString(fmt.Sprintf("%s.extra-debs", viperBuildPrefix))
o.AdditionalImages = viper.GetStringSlice(fmt.Sprintf("%s.additional-images", viperBuildPrefix))
o.AddFalco = viper.GetBool(fmt.Sprintf("%s.add-falco", viperBuildPrefix))
Expand Down
18 changes: 13 additions & 5 deletions pkg/openstack/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@ package ostack
import (
"encoding/json"
"fmt"
"github.com/eschercloudai/baski/pkg/cmd/util/flags"
"io"
"log"
"os"
"path/filepath"
"regexp"
"strconv"
"strings"
"time"

"github.com/eschercloudai/baski/pkg/cmd/util/flags"

"github.com/google/uuid"
"gopkg.in/yaml.v3"
)
Expand Down Expand Up @@ -117,6 +119,12 @@ func (c *OpenstackClouds) SetOpenstackEnvs(cloudName string) {
}
}

// Extract Kubernetes series with the assumption we want vX.XX
func truncateVersion(version string) string {
re := regexp.MustCompile(`v\d+\.\d+`)
return re.FindString(version)
}

// InitPackerConfig takes the application inputs and converts it into a PackerBuildConfig.
func InitPackerConfig(o *flags.BuildOptions) *PackerBuildConfig {
buildConfig := &PackerBuildConfig{
Expand All @@ -127,13 +135,13 @@ func InitPackerConfig(o *flags.BuildOptions) *PackerBuildConfig {
UseFloatingIp: strconv.FormatBool(o.UseFloatingIP),
FloatingIpNetwork: o.FloatingIPNetworkName,
CniVersion: "v" + o.CniVersion,
CniDebVersion: o.CniVersion + "-00",
CniDebVersion: o.CniDebVersion,
CrictlVersion: o.CrictlVersion,
ImageVisibility: o.ImageVisibility,
KubernetesSemver: "v" + o.KubeVersion,
KubernetesSeries: "v" + o.KubeVersion,
KubernetesRpmVersion: o.KubeVersion + "-0",
KubernetesDebVersion: o.KubeVersion + "-00",
KubernetesSeries: truncateVersion("v" + o.KubeVersion),
KubernetesRpmVersion: o.KubeRpmVersion,
KubernetesDebVersion: o.KubeDebVersion,
ExtraDebs: o.ExtraDebs,
ImageDiskFormat: o.ImageDiskFormat,
VolumeType: o.VolumeType,
Expand Down