Skip to content

Commit

Permalink
aws: rollback changes in LoadEnv in provider
Browse files Browse the repository at this point in the history
Fixes: #1454

Signed-off-by: Qi Feng Huo <huoqif@cn.ibm.com>
  • Loading branch information
Qi Feng Huo committed Sep 27, 2023
1 parent 7a3c62c commit 3de0679
Showing 1 changed file with 0 additions and 33 deletions.
33 changes: 0 additions & 33 deletions pkg/adaptor/cloud/aws/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ package aws

import (
"flag"
"strconv"

"github.com/confidential-containers/cloud-api-adaptor/pkg/adaptor/cloud"
)
Expand Down Expand Up @@ -39,40 +38,8 @@ func (_ *Manager) ParseCmd(flags *flag.FlagSet) {
}

func (_ *Manager) LoadEnv() {
// overwrite config set by cmd parameters in oci image with env might come from orchastration platform
cloud.DefaultToEnv(&awscfg.AccessKeyId, "AWS_ACCESS_KEY_ID", "")
cloud.DefaultToEnv(&awscfg.SecretKey, "AWS_SECRET_ACCESS_KEY", "")

cloud.DefaultToEnv(&awscfg.Region, "AWS_REGION", "")
cloud.DefaultToEnv(&awscfg.LaunchTemplateName, "PODVM_LAUNCHTEMPLATE_NAME", "")
cloud.DefaultToEnv(&awscfg.ImageId, "PODVM_AMI_ID", "")
cloud.DefaultToEnv(&awscfg.InstanceType, "PODVM_INSTANCE_TYPE", "")
cloud.DefaultToEnv(&awscfg.KeyName, "SSH_KP_NAME", "")
cloud.DefaultToEnv(&awscfg.SubnetId, "AWS_SUBNET_ID", "")

var sgIDsStr, instTypesStr, rootVolumSizeStr, usePublicIpStr string
cloud.DefaultToEnv(&sgIDsStr, "AWS_SG_IDS", "")
if sgIDsStr != "" {
_ = awscfg.SecurityGroupIds.Set(sgIDsStr)
}

cloud.DefaultToEnv(&instTypesStr, "PODVM_INSTANCE_TYPES", "")
if instTypesStr != "" {
_ = awscfg.InstanceTypes.Set(instTypesStr)
}

cloud.DefaultToEnv(&rootVolumSizeStr, "ROOT_VOLUME_SIZE", "")
if rootVolumSizeStr != "" {
awscfg.RootVolumeSize, _ = strconv.Atoi(rootVolumSizeStr)
}

cloud.DefaultToEnv(&usePublicIpStr, "USE_PUBLIC_IP", "")
if usePublicIpStr != "" {
awscfg.UsePublicIP, _ = strconv.ParseBool(usePublicIpStr)
}

// TBD
//cloud.DefaultToEnv(&awscfg.Tags, "TAGS", "")
}

func (_ *Manager) NewProvider() (cloud.Provider, error) {
Expand Down

0 comments on commit 3de0679

Please sign in to comment.