[node operator] Use environment variable to specify CSP

Signed-off-by: Malte Poll <mp@edgeless.systems>
This commit is contained in:
Malte Poll 2022-07-26 10:32:01 +02:00 committed by Malte Poll
parent 50ed6777c8
commit e267102c92

View File

@ -36,6 +36,8 @@ var (
const (
defaultAzureCloudConfigPath = "/etc/azure/azure.json"
// constellationCSP is the environment variable stating which Cloud Service Provider Constellation is running on.
constellationCSP = "CONSTEL_CSP"
)
func init() {
@ -46,12 +48,10 @@ func init() {
}
func main() {
var csp string
var cloudConfigPath string
var metricsAddr string
var enableLeaderElection bool
var probeAddr string
flag.StringVar(&csp, "csp", "", "Cloud Service Provider the image is running on")
flag.StringVar(&cloudConfigPath, "cloud-config", "", "Path to provider specific cloud config. Optional.")
flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
@ -68,7 +68,8 @@ func main() {
var cspClient cspAPI
var clientErr error
switch strings.ToLower(csp) {
csp := strings.ToLower(os.Getenv(constellationCSP))
switch csp {
case "azure":
if cloudConfigPath == "" {
cloudConfigPath = defaultAzureCloudConfigPath