Skip to content

Commit

Permalink
ci: fix debug flag assertion for mkosi image-debug
Browse files Browse the repository at this point in the history
The CI wasn't building debug images, due string/bool mismatch.

Signed-off-by: Magnus Kulke <[email protected]>
  • Loading branch information
mkulke committed Jan 7, 2025
1 parent eb58725 commit 6b24c6c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
5 changes: 2 additions & 3 deletions .github/workflows/podvm_mkosi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ jobs:
with:
version: ${{ env.ORAS_VERSION }}


- name: Build binaries
id: build_binaries
working-directory: src/cloud-api-adaptor/podvm-mkosi
Expand All @@ -150,12 +149,12 @@ jobs:
run: nix build .#devShells.x86_64-linux.podvm-mkosi

- name: Build mkosi debug image
if: ${{ inputs.debug == 'true' }}
if: ${{ inputs.debug == true }}
working-directory: src/cloud-api-adaptor/podvm-mkosi
run: make image-debug

- name: Build mkosi image
if: ${{ inputs.debug != 'true' }}
if: ${{ inputs.debug != true }}
working-directory: src/cloud-api-adaptor/podvm-mkosi
run: make image

Expand Down
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/cmd/cloud-api-adaptor/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ func (cfg *daemonConfig) Setup() (cmd.Starter, error) {
flags.StringVar(&cfg.serverConfig.Initdata, "initdata", "", "Default initdata for all Pods")
flags.BoolVar(&cfg.serverConfig.EnableCloudConfigVerify, "cloud-config-verify", false, "Enable cloud config verify - should use it for production")
flags.IntVar(&cfg.serverConfig.PeerPodsLimitPerNode, "peerpods-limit-per-node", 10, "peer pods limit per node (default=10)")
flags.Uint64Var(&cfg.serverConfig.DiskSize, "disk-size", 0, "Disk size in GB. Default is 0, which implies the default image disk size")
flags.Uint64Var(&cfg.serverConfig.RootVolumeSize, "root-volume-size", 0, "Root volume size in GB. Default is 0, which implies the default image disk size")

cloud.ParseCmd(flags)
})
Expand Down
2 changes: 1 addition & 1 deletion src/cloud-api-adaptor/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ optionals+=""
[[ "${SECURE_COMMS_PP_OUTBOUNDS}" ]] && optionals+="-secure-comms-pp-outbounds ${SECURE_COMMS_PP_OUTBOUNDS} "
[[ "${SECURE_COMMS_KBS_ADDR}" ]] && optionals+="-secure-comms-kbs ${SECURE_COMMS_KBS_ADDR} "
[[ "${PEERPODS_LIMIT_PER_NODE}" ]] && optionals+="-peerpods-limit-per-node ${PEERPODS_LIMIT_PER_NODE} "
[[ "${DISK_SIZE}" ]] && optionals+="-disk-size ${DISK_SIZE} "

test_vars() {
for i in "$@"; do
Expand Down Expand Up @@ -78,6 +77,7 @@ azure() {
[[ "${TAGS}" ]] && optionals+="-tags ${TAGS} " # Custom tags applied to pod vm
[[ "${ENABLE_SECURE_BOOT}" == "true" ]] && optionals+="-enable-secure-boot "
[[ "${USE_PUBLIC_IP}" == "true" ]] && optionals+="-use-public-ip "
[[ "${ROOT_VOLUME_SIZE}" ]] && optionals+="-root-volume-size ${ROOT_VOLUME_SIZE} " # OS disk size in GB

set -x
exec cloud-api-adaptor azure \
Expand Down
11 changes: 5 additions & 6 deletions src/cloud-api-adaptor/pkg/adaptor/cloud/cloud.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,7 @@ type ServerConfig struct {
SecureCommsPpOutbounds string
SecureCommsKbsAddress string
PeerPodsLimitPerNode int
UseEncryptedDisk bool
DiskSize uint64
RootVolumeSize uint64
}

var logger = log.New(log.Writer(), "[adaptor/cloud] ", log.LstdFlags|log.Lmsgprefix)
Expand Down Expand Up @@ -227,8 +226,8 @@ func (s *cloudService) CreateVM(ctx context.Context, req *pb.CreateVMRequest) (r
resources := util.GetPodVMResourcesFromAnnotation(req.Annotations)

// Add disk size to resources if set
if s.serverConfig.DiskSize > 0 {
resources.Storage = int64(s.serverConfig.DiskSize)
if s.serverConfig.RootVolumeSize > 0 {
resources.Storage = int64(s.serverConfig.RootVolumeSize)
}

// Get Pod VM image from annotations
Expand Down Expand Up @@ -337,8 +336,8 @@ func (s *cloudService) CreateVM(ctx context.Context, req *pb.CreateVMRequest) (r
},
}

if s.serverConfig.DiskSize > 0 {
// Write an empty file to indicate that we want to use available space as sandbox storage
if s.serverConfig.RootVolumeSize > 0 {
// Write an empty file to indicate that we want to use available space as sandbox storage
cloudConfig.WriteFiles = append(cloudConfig.WriteFiles, cloudinit.WriteFile{
Path: UseScratchPath,
Content: "",
Expand Down

0 comments on commit 6b24c6c

Please sign in to comment.