Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ASC-402: Modify NSTemplateTierSpec to support SA token copy #380

Merged
merged 11 commits into from
Oct 17, 2023
4 changes: 4 additions & 0 deletions api/v1alpha1/nstemplatetier_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ type NSTemplateTierSpec struct {
// +optional
// +mapType=atomic
SpaceRoles map[string]NSTemplateTierSpaceRole `json:"spaceRoles,omitempty"`

// flag to signify whether to copy SA token or not
// +optional
CopySaToken bool `json:"copySaToken,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a SpaceRequest specific configuration (it's used only when the Space is created based on SpaceRequest CR), not a generic one. I would structure it so it's easy to understand - something like this:

	// +optional
	SpaceRequestConfig SpaceRequestConfig `json:"spaceRequestConfig, omitempty"`
}

type SpaceRequestConfig struct {
	// +optional
	CopySaToken bool `json:"copySaToken,omitempty"`
}

if needed, we could easily extend the part by other values in the future, for example:

type SpaceRequestConfig struct {
	// +optional
	CopySaToken bool `json:"copySaToken,omitempty"`
	// +optional
	ManagerSaName string `json:"managerSaName,omitempty"`
}

another approach would be:

type SpaceRequestConfig struct {
	// +optional
	SaTokenToCopy string `json:"saTokenToCopy,omitempty"`
}

if nothing is provided, then the controller wouldn't copy anything, otherwise, it would contain the name of the SA whose token should be copied - ie. namespace-manager

WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's go with the last one . Looks better.
type SpaceRequestConfig struct {
// +optional
SaTokenToCopy string json:"saTokenToCopy,omitempty"
}

}

// NSTemplateTierNamespace the namespace definition in an NSTemplateTier resource
Expand Down