forked from confidential-containers/cloud-api-adaptor
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmanager.go
More file actions
50 lines (39 loc) · 2.54 KB
/
Copy pathmanager.go
File metadata and controls
50 lines (39 loc) · 2.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
// (C) Copyright Confidential Containers Contributors
// SPDX-License-Identifier: Apache-2.0
package ibmcloudpowervs
import (
"flag"
"time"
provider "github.com/confidential-containers/cloud-api-adaptor/src/cloud-providers"
)
var ibmcloudPowerVSConfig Config
type Manager struct{}
func init() {
provider.AddCloudProvider("ibmcloud-powervs", &Manager{})
}
func (*Manager) ParseCmd(flags *flag.FlagSet) {
reg := provider.NewFlagRegistrar(flags)
// Flags with environment variable support
reg.StringWithEnv(&ibmcloudPowerVSConfig.APIKey, "api-key", "", "IBMCLOUD_API_KEY", "IBM Cloud API key", provider.Secret(), provider.Required())
reg.StringWithEnv(&ibmcloudPowerVSConfig.Zone, "zone", "", "POWERVS_ZONE", "PowerVS zone name", provider.Required())
reg.StringWithEnv(&ibmcloudPowerVSConfig.ServiceInstanceID, "service-instance-id", "", "POWERVS_SERVICE_INSTANCE_ID", "ID of the PowerVS Service Instance", provider.Required())
reg.StringWithEnv(&ibmcloudPowerVSConfig.NetworkID, "network-id", "", "POWERVS_NETWORK_ID", "ID of the network instance", provider.Required())
reg.StringWithEnv(&ibmcloudPowerVSConfig.ImageID, "image-id", "", "POWERVS_IMAGE_ID", "ID of the boot image", provider.Required())
reg.StringWithEnv(&ibmcloudPowerVSConfig.SSHKey, "ssh-key", "", "POWERVS_SSH_KEY_NAME", "Name of the SSH Key")
reg.StringWithEnv(&ibmcloudPowerVSConfig.ProcessorType, "proc-type", "shared", "POWERVS_PROCESSOR_TYPE", "Name of the processor type")
reg.StringWithEnv(&ibmcloudPowerVSConfig.SystemType, "sys-type", "s1022", "POWERVS_SYSTEM_TYPE", "Name of the system type")
reg.Float64WithEnv(&ibmcloudPowerVSConfig.Memory, "memory", 2, "POWERVS_MEMORY", "Amount of memory in GB")
reg.Float64WithEnv(&ibmcloudPowerVSConfig.Processors, "cpu", 0.5, "POWERVS_PROCESSORS", "Number of processors allocated")
reg.BoolWithEnv(&ibmcloudPowerVSConfig.UsePublicIP, "use-public-ip", false, "USE_PUBLIC_IP", "Use Public IP for connecting to the agent-protocol-forwarder inside the Pod VM")
reg.DurationWithEnv(&ibmcloudPowerVSConfig.BuildTimeout, "build-timeout", 150*time.Second, "POWERVS_BUILD_TIMEOUT", "Maximum timeout to build the VM")
reg.DurationWithEnv(&ibmcloudPowerVSConfig.DHCPTimeout, "dhcp-timeout", 750*time.Second, "POWERVS_DHCP_TIMEOUT", "Maximum timeout to wait for DHCP IP assignment")
}
func (*Manager) LoadEnv() {
// No longer needed - environment variables are handled in ParseCmd
}
func (*Manager) NewProvider() (provider.Provider, error) {
return NewProvider(&ibmcloudPowerVSConfig)
}
func (*Manager) GetConfig() (config *Config) {
return &ibmcloudPowerVSConfig
}