reconcilers

package
v0.0.0-...-d3538c1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 8, 2024 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuditLogForTeam

func AuditLogForTeam(ctx context.Context, apiclient *apiclient.APIClient, reconciler Reconciler, action, teamSlug, msg string, a ...any)

func AuditLogForTeamAndUser

func AuditLogForTeamAndUser(ctx context.Context, apiclient *apiclient.APIClient, reconciler Reconciler, action, teamSlug, user, msg string, a ...any)

func GetTeamMembers

func GetTeamMembers(ctx context.Context, client protoapi.TeamsClient, teamSlug string) ([]*protoapi.TeamMember, error)

GetTeamMembers retrieves all members of a team from the NAIS API

Types

type InFlight

type InFlight interface {
	Set(teamSlug string) bool
	Remove(teamSlug string)
}

func NewInFlight

func NewInFlight() InFlight

type Input

type Input struct {
	CorrelationID string
	TraceID       string
	TeamSlug      string
	Delete        bool
}

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

func NewManager

func NewManager(ctx context.Context, c *apiclient.APIClient, enableDuringRegistration []string, pubsubSubscriptionID, pubsubProjectID string, log logrus.FieldLogger) *Manager

NewManager creates a new Manager instance

func (*Manager) AddReconciler

func (m *Manager) AddReconciler(r Reconciler)

AddReconciler will add a reconciler to the manager.

func (*Manager) Close

func (m *Manager) Close()

Close will close the manager and all its resources.

func (*Manager) ListenForEvents

func (m *Manager) ListenForEvents(ctx context.Context)

ListenForEvents will listen for events on the pubsub subscription, if configured. This function will block until the context is canceled.

func (*Manager) RegisterReconcilersWithAPI

func (m *Manager) RegisterReconcilersWithAPI(ctx context.Context) error

RegisterReconcilersWithAPI will register all reconcilers with the NAIS API.

func (*Manager) Run

func (m *Manager) Run(ctx context.Context)

Run will pull an entry from the queue and start a reconcile process. This function will block until the context is canceled.

func (*Manager) SyncAllTeams

func (m *Manager) SyncAllTeams(ctx context.Context, fullSyncInterval time.Duration) error

SyncAllTeams will schedule all teams for reconciliation at a regular interval. This function will block until the context is canceled.

type MockReconciler

type MockReconciler struct {
	mock.Mock
}

MockReconciler is an autogenerated mock type for the Reconciler type

func NewMockReconciler

func NewMockReconciler(t interface {
	mock.TestingT
	Cleanup(func())
},
) *MockReconciler

NewMockReconciler creates a new instance of MockReconciler. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockReconciler) Configuration

func (_m *MockReconciler) Configuration() *protoapi.NewReconciler

Configuration provides a mock function with given fields:

func (*MockReconciler) Delete

func (_m *MockReconciler) Delete(ctx context.Context, client *apiclient.APIClient, naisTeam *protoapi.Team, log logrus.FieldLogger) error

Delete provides a mock function with given fields: ctx, client, naisTeam, log

func (*MockReconciler) EXPECT

func (*MockReconciler) Name

func (_m *MockReconciler) Name() string

Name provides a mock function with given fields:

func (*MockReconciler) Reconcile

func (_m *MockReconciler) Reconcile(ctx context.Context, client *apiclient.APIClient, naisTeam *protoapi.Team, log logrus.FieldLogger) error

Reconcile provides a mock function with given fields: ctx, client, naisTeam, log

type MockReconciler_Configuration_Call

type MockReconciler_Configuration_Call struct {
	*mock.Call
}

MockReconciler_Configuration_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Configuration'

func (*MockReconciler_Configuration_Call) Return

func (*MockReconciler_Configuration_Call) Run

func (*MockReconciler_Configuration_Call) RunAndReturn

type MockReconciler_Delete_Call

type MockReconciler_Delete_Call struct {
	*mock.Call
}

MockReconciler_Delete_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Delete'

func (*MockReconciler_Delete_Call) Return

func (*MockReconciler_Delete_Call) Run

func (*MockReconciler_Delete_Call) RunAndReturn

type MockReconciler_Expecter

type MockReconciler_Expecter struct {
	// contains filtered or unexported fields
}

func (*MockReconciler_Expecter) Configuration

Configuration is a helper method to define mock.On call

func (*MockReconciler_Expecter) Delete

func (_e *MockReconciler_Expecter) Delete(ctx interface{}, client interface{}, naisTeam interface{}, log interface{}) *MockReconciler_Delete_Call

Delete is a helper method to define mock.On call

  • ctx context.Context
  • client *apiclient.APIClient
  • naisTeam *protoapi.Team
  • log logrus.FieldLogger

func (*MockReconciler_Expecter) Name

Name is a helper method to define mock.On call

func (*MockReconciler_Expecter) Reconcile

func (_e *MockReconciler_Expecter) Reconcile(ctx interface{}, client interface{}, naisTeam interface{}, log interface{}) *MockReconciler_Reconcile_Call

Reconcile is a helper method to define mock.On call

  • ctx context.Context
  • client *apiclient.APIClient
  • naisTeam *protoapi.Team
  • log logrus.FieldLogger

type MockReconciler_Name_Call

type MockReconciler_Name_Call struct {
	*mock.Call
}

MockReconciler_Name_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Name'

func (*MockReconciler_Name_Call) Return

func (*MockReconciler_Name_Call) Run

func (*MockReconciler_Name_Call) RunAndReturn

func (_c *MockReconciler_Name_Call) RunAndReturn(run func() string) *MockReconciler_Name_Call

type MockReconciler_Reconcile_Call

type MockReconciler_Reconcile_Call struct {
	*mock.Call
}

MockReconciler_Reconcile_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Reconcile'

func (*MockReconciler_Reconcile_Call) Return

func (*MockReconciler_Reconcile_Call) Run

func (*MockReconciler_Reconcile_Call) RunAndReturn

type Queue

type Queue interface {
	Add(Input) error
	Close()
}

func NewQueue

func NewQueue() (Queue, <-chan Input)

type Reconciler

type Reconciler interface {
	Configuration() *protoapi.NewReconciler
	Name() string
	Reconcile(ctx context.Context, client *apiclient.APIClient, naisTeam *protoapi.Team, log logrus.FieldLogger) error
	Delete(ctx context.Context, client *apiclient.APIClient, naisTeam *protoapi.Team, log logrus.FieldLogger) error
}

Directories

Path Synopsis
azure
github
google
cdn
gar
gcp
nais

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL