minder icon indicating copy to clipboard operation
minder copied to clipboard

Add a mechanism to add provider configuration on enrollment

Open jhrozek opened this issue 1 year ago • 2 comments

To handle cases such as:

  • a user adds a github app provider and wants the provider to be configured to auto-register new repositories
  • a user adds an OCI provider and wants to configure the base URL of the OCI registry

We should add the ability to pass provider configuration on enrollment instead of the current hardcoded empty config.

jhrozek avatar May 07 '24 13:05 jhrozek

Design: https://github.com/stacklok/minder/issues/3263

jhrozek avatar May 07 '24 13:05 jhrozek

Taking the auto-registration case into account we might need to extend the provider configuration along these lines:

message AutoRegistration {
	 // There is no difference between intentionally unset and undefined so for the "let's not auto-register anything" case we'd just let the repeated Entity empty
	repeated Entity enabled = 1;
}

message GitHubAppProviderConfig {
 // Endpoint is the GitHub API endpoint. If using the public GitHub API, Endpoint can be left blank.
 string endpoint = 1;
}

message ProviderConfig {
 	AutoRegistration auto_registration = 1;
	google.protobuf.Struct config = 2;
}

func ParseV1Config(rawCfg json.RawMessage) (*minderv1.ProviderConfig, error) {
type wrapper struct {
   GitHub *minderv1.GitHubProviderConfig `json:"github" yaml:"github" mapstructure:"github" validate:"required"`
}

and then expose storing the config through the provider enroll CLI -- for start as a JSON.

jhrozek avatar May 07 '24 14:05 jhrozek