Skip to content

Commit

Permalink
updated
Browse files Browse the repository at this point in the history
  • Loading branch information
audrastump committed Nov 18, 2024
1 parent 9945538 commit c3059bf
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 16 deletions.
1 change: 1 addition & 0 deletions cmd/setup-gh.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ application and service principle, and will configure that application to trust
f.StringVarP(&sc.SubscriptionID, "subscription-id", "s", emptyDefaultFlagValue, "specify the Azure subscription ID")
f.StringVarP(&sc.ResourceGroupName, "resource-group", "r", emptyDefaultFlagValue, "specify the Azure resource group name")
f.StringVarP(&sc.Repo, "gh-repo", "g", emptyDefaultFlagValue, "specify the github repository link")

sc.Provider = provider
return cmd
}
Expand Down
16 changes: 9 additions & 7 deletions pkg/providers/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ type SetUpCmd struct {
tenantId string
appObjectId string
spObjectId string
Fleet string
AzClient AzClient
}

Expand Down Expand Up @@ -61,7 +60,7 @@ func InitiateAzureOIDCFlow(ctx context.Context, sc *SetUpCmd, s spinner.Spinner)
return err
}

if err := sc.assignSpRole(ctx); err != nil {
if err := sc.assignSpRoles(ctx); err != nil {
return err
}

Expand Down Expand Up @@ -165,12 +164,15 @@ func (sc *SetUpCmd) CreateServicePrincipal() error {
return nil
}

func (sc *SetUpCmd) assignSpRole(ctx context.Context) error {
if err := sc.assignRole(ctx, "b24988ac-6180-42a0-ab88-20f7382dd24c"); err != nil { // Contributor role ID
return err
func (sc *SetUpCmd) assignSpRoles(ctx context.Context) error {
var spRoles = []string{
"b24988ac-6180-42a0-ab88-20f7382dd24c", // Contributor role ID
"5af6afb3-c06c-4fa4-8848-71a8aee05683", // Azure Kubernetes Fleet Manager RBAC Writer role ID
}
if err := sc.assignRole(ctx, "5af6afb3-c06c-4fa4-8848-71a8aee05683"); err != nil { // Azure Kubernetes Fleet Manager RBAC Writer role ID
return err
for _, role := range spRoles {
if err := sc.assignRole(ctx, role); err != nil {
return err
}
}
log.Debug("Roles assigned successfully!")
return nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ env:
DOCKER_FILE: {{ .Config.GetVariableValue "DOCKERFILE" }}
BUILD_CONTEXT_PATH: {{ .Config.GetVariableValue "BUILDCONTEXTPATH" }}
NAMESPACE: {{ .Config.GetVariableValue "NAMESPACE" }}
FLEET_NAME: {{ .Config.GetVariableValue "FLEET_NAME" }}
FLEET_NAME: {{ .Config.GetVariableValue "FLEETNAME" }}
{{`
jobs:
buildImage:
Expand Down
9 changes: 1 addition & 8 deletions template/workflows/manifests/draft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,7 @@ variables:
value: "default"
description: "the Kubernetes namespace"
versions: ">=0.0.1"
- name: "FLEET"
type: "boolean"
kind: "boolean"
default:
value: false
description: "specifies whether or not this is a fleet deployment"
versions: ">=0.0.1"
- name: "FLEET_NAME"
- name: "FLEETNAME"
type: "string"
kind: "fleetName"
default:
Expand Down

0 comments on commit c3059bf

Please sign in to comment.