Skip to content

Commit

Permalink
add missing scopes
Browse files Browse the repository at this point in the history
  • Loading branch information
christeredvartsen committed Feb 15, 2024
1 parent 4cb4289 commit 2a5c5ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
3 changes: 3 additions & 0 deletions internal/reconcilers/azure/group/reconciler.go
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,9 @@ func (r *azureGroupReconciler) updateClient(ctx context.Context, client *apiclie
ClientSecret: rc.clientSecret,
TokenURL: endpoint.TokenURL,
AuthStyle: endpoint.AuthStyle,
Scopes: []string{
"https://graph.microsoft.com/.default",
},
}

// Check if the client needs to be updated.
Expand Down
14 changes: 4 additions & 10 deletions internal/reconcilers/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -257,13 +257,9 @@ func (m *Manager) syncTeam(ctx context.Context, input Input) {
}

if input.Delete {
if err := m.deleteTeam(ctx, reconcilers, team, input); err != nil {
log.WithError(err).Error("delete team")
}
m.deleteTeam(ctx, reconcilers, team, input)
} else {
if err := m.reconcileTeam(ctx, reconcilers, team, input); err != nil {
log.WithError(err).Error("reconcile team")
}
m.reconcileTeam(ctx, reconcilers, team, input)
}
}

Expand All @@ -288,7 +284,7 @@ func (m *Manager) enabledReconcilers(ctx context.Context) ([]Reconciler, error)

// deleteTeam will pass the team through to all enabled reconcilers, effectively deleting the team from all configured
// external systems.
func (m *Manager) deleteTeam(ctx context.Context, reconcilers []Reconciler, naisTeam *protoapi.Team, input Input) error {
func (m *Manager) deleteTeam(ctx context.Context, reconcilers []Reconciler, naisTeam *protoapi.Team, input Input) {
teamStart := time.Now()
log := m.log.WithField("team", input.TeamSlug)

Expand Down Expand Up @@ -359,12 +355,11 @@ func (m *Manager) deleteTeam(ctx context.Context, reconcilers []Reconciler, nais
attribute.Bool("delete", true),
),
)
return nil
}

// reconcileTeam will pass the team through to all enabled reconcilers, effectively synchronizing the team to all
// configured external systems.
func (m *Manager) reconcileTeam(ctx context.Context, reconcilers []Reconciler, naisTeam *protoapi.Team, input Input) error {
func (m *Manager) reconcileTeam(ctx context.Context, reconcilers []Reconciler, naisTeam *protoapi.Team, input Input) {
teamStart := time.Now()
log := m.log.WithField("team", input.TeamSlug)

Expand Down Expand Up @@ -428,7 +423,6 @@ func (m *Manager) reconcileTeam(ctx context.Context, reconcilers []Reconciler, n
}

m.metricReconcileTeam.Record(ctx, time.Since(teamStart).Milliseconds())
return nil
}

// scheduleAllTeams will fetch all teams from the NAIS API and put them on the reconciler queue
Expand Down

0 comments on commit 2a5c5ce

Please sign in to comment.