2022-09-05 03:06:08 -04:00
|
|
|
/*
|
|
|
|
Copyright (c) Edgeless Systems GmbH
|
|
|
|
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2022-06-28 10:08:05 -04:00
|
|
|
package gcp
|
|
|
|
|
|
|
|
import (
|
2022-09-21 07:47:57 -04:00
|
|
|
"github.com/edgelesssys/constellation/v2/internal/role"
|
2022-06-28 10:08:05 -04:00
|
|
|
)
|
|
|
|
|
|
|
|
const roleMetadataKey = "constellation-role"
|
|
|
|
|
|
|
|
// extractRole extracts role from cloud provider metadata.
|
|
|
|
func extractRole(metadata map[string]string) role.Role {
|
|
|
|
switch metadata[roleMetadataKey] {
|
2022-06-29 09:26:29 -04:00
|
|
|
case role.ControlPlane.String():
|
|
|
|
return role.ControlPlane
|
|
|
|
case role.Worker.String():
|
|
|
|
return role.Worker
|
2022-06-28 10:08:05 -04:00
|
|
|
default:
|
|
|
|
return role.Unknown
|
|
|
|
}
|
|
|
|
}
|