Skip to content

Commit

Permalink
feat(azure): add azure --instance-type
Browse files Browse the repository at this point in the history
  • Loading branch information
jkoelker committed Apr 24, 2022
1 parent 1ecef8c commit f5e1940
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 0 deletions.
7 changes: 7 additions & 0 deletions cmd/konvoy-image/cmd/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -132,4 +132,11 @@ func addAzureArgs(fs *flag.FlagSet, azure *app.AzureArgs) {
"",
"the tenant id to use for the build",
)

fs.StringVar(
&azure.InstanceType,
"instance-type",
"Standard_D2ds_v5",
"the Instance Type to use for the build",
)
}
1 change: 1 addition & 0 deletions docs/cli/konvoy-image_build_azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ azure --location westus2 --subscription-id <sub_id> images/azure/centos-7.yaml
--gallery-image-sku string the gallery image sku to set
--gallery-name string the gallery name to publish the image in (default "dkp")
-h, --help help for azure
--instance-type string the Instance Type to use for the build (default "Standard_D2ds_v5")
--kubernetes-version string The version of kubernetes to install. Example: 1.21.6
--location string the location in which to build the image (default "westus2")
--overrides strings a comma separated list of override YAML files
Expand Down
1 change: 1 addition & 0 deletions docs/cli/konvoy-image_generate_azure.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ azure --location westus2 --subscription-id <sub_id> images/azure/centos-7.yaml
--gallery-image-sku string the gallery image sku to set
--gallery-name string the gallery name to publish the image in (default "dkp")
-h, --help help for azure
--instance-type string the Instance Type to use for the build (default "Standard_D2ds_v5")
--kubernetes-version string The version of kubernetes to install. Example: 1.21.6
--location string the location in which to build the image (default "westus2")
--overrides strings a comma separated list of override YAML files
Expand Down
2 changes: 2 additions & 0 deletions pkg/app/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ type AmazonArgs struct {
type AzureArgs struct {
ClientID string

InstanceType string

GalleryImageLocations []string
GalleryImageName string
GalleryImageOffer string
Expand Down
4 changes: 4 additions & 0 deletions pkg/app/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,10 @@ func MergeAzureUserArgs(config Config, azureArgs *AzureArgs) error {
return fmt.Errorf("failed to set %s: %w", PackerAzureTenantIDPath, err)
}

if err := config.Set(PackerAzureInstanceType, azureArgs.InstanceType); err != nil {
return fmt.Errorf("failed to set %s: %w", PackerAzureInstanceType, err)
}

galleryImageLocations := azureArgs.GalleryImageLocations
if len(galleryImageLocations) == 0 {
galleryImageLocations = []string{azureArgs.Location}
Expand Down
1 change: 1 addition & 0 deletions pkg/app/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const (

PackerAzureClientIDPath = "/packer/client_id"
PackerAzureDistributionVersionPath = "/packer/distribution_version"
PackerAzureInstanceType = "/packer/vm_size"
PackerAzureGalleryLocations = "/packer/gallery_image_locations"
PackerAzureGalleryImageNamePath = "/packer/gallery_image_name"
PackerAzureGalleryImageOfferPath = "/packer/gallery_image_offer"
Expand Down

0 comments on commit f5e1940

Please sign in to comment.