mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-05-05 07:45:27 -04:00
cli: install helm charts in cli instead of bootstrapper (#2136)
* init * fixup! init * gcp working? * fixup! fixup! init * azure cfg for microService installation * fixup! azure cfg for microService installation * fixup! azure cfg for microService installation * cleanup bootstrapper code * cleanup helminstall code * fixup! cleanup helminstall code * Update internal/deploy/helm/install.go Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com> * daniel feedback * TODO add provider (also to CreateCluster) so we can ensure that provider specific output * fixup! daniel feedback * use debugLog in helm installer * placeholderHelmInstaller * rename to stub --------- Co-authored-by: Daniel Weiße <66256922+daniel-weisse@users.noreply.github.com>
This commit is contained in:
parent
ef60d00a60
commit
26305e8f80
38 changed files with 775 additions and 970 deletions
|
@ -9,13 +9,21 @@ package azureshared
|
|||
import (
|
||||
"fmt"
|
||||
"net/url"
|
||||
"regexp"
|
||||
"strings"
|
||||
)
|
||||
|
||||
var (
|
||||
subscriptionPattern = regexp.MustCompile(`subscriptions/([^/]+)/`)
|
||||
rgPattern = regexp.MustCompile(`resourceGroups/([^/]+)/`)
|
||||
)
|
||||
|
||||
// ApplicationCredentials is a set of Azure API credentials.
|
||||
// It can contain a client secret and carries the preferred authentication method.
|
||||
// It is the equivalent of a service account key in other cloud providers.
|
||||
type ApplicationCredentials struct {
|
||||
SubscriptionID string
|
||||
ResourceGroup string
|
||||
TenantID string
|
||||
AppClientID string
|
||||
ClientSecretValue string
|
||||
|
@ -37,8 +45,14 @@ func ApplicationCredentialsFromURI(cloudServiceAccountURI string) (ApplicationCr
|
|||
return ApplicationCredentials{}, fmt.Errorf("invalid service account URI: invalid host: %s", uri.Host)
|
||||
}
|
||||
query := uri.Query()
|
||||
|
||||
subscriptionID := getFirstMatchOrEmpty(subscriptionPattern, query.Get("uami_resource_id"))
|
||||
resourceGroup := getFirstMatchOrEmpty(rgPattern, query.Get("uami_resource_id"))
|
||||
|
||||
preferredAuthMethod := FromString(query.Get("preferred_auth_method"))
|
||||
return ApplicationCredentials{
|
||||
SubscriptionID: subscriptionID,
|
||||
ResourceGroup: resourceGroup,
|
||||
TenantID: query.Get("tenant_id"),
|
||||
AppClientID: query.Get("client_id"),
|
||||
ClientSecretValue: query.Get("client_secret"),
|
||||
|
@ -48,6 +62,15 @@ func ApplicationCredentialsFromURI(cloudServiceAccountURI string) (ApplicationCr
|
|||
}, nil
|
||||
}
|
||||
|
||||
func getFirstMatchOrEmpty(pattern *regexp.Regexp, str string) string {
|
||||
subscriptionMatches := pattern.FindStringSubmatch(str)
|
||||
var subscriptionID string
|
||||
if len(subscriptionMatches) > 1 {
|
||||
subscriptionID = subscriptionMatches[1]
|
||||
}
|
||||
return subscriptionID
|
||||
}
|
||||
|
||||
// ToCloudServiceAccountURI converts the ApplicationCredentials into a cloud service account URI.
|
||||
func (c ApplicationCredentials) ToCloudServiceAccountURI() string {
|
||||
query := url.Values{}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue