-
Notifications
You must be signed in to change notification settings - Fork 25
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
ASC-402: Modify NSTemplateTierSpec to support SA token copy #380
Conversation
Signed-off-by: Kartikey Mamgain <[email protected]>
Signed-off-by: Kartikey Mamgain <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't see any of the generated files to be modified as part of this PR - when you run make generate
then it should update zz_generated.deepcopy.go
zz_generated.openapi.go
(doesn't have to be both - it depends on the type of the changes)
api/v1alpha1/nstemplatetier_types.go
Outdated
|
||
// flag to signify whether to copy SA token or not | ||
// +optional | ||
CopySaToken bool `json:"copySaToken,omitempty"` |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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"
}
|
@Kartikey-star yes, it's recommended to clone all the projects into this folder structure in order for the
same for the other repos host-operator|registration-service|member-operator|toolchain-e2e .... |
Signed-off-by: Kartikey Mamgain <[email protected]>
Thanks @mfrancisc , I had cloned the repos outside my GOPATH..Fixing that seems to work. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you please add/fix the comments of the params and the new struct to describe the purpose of it?
SpaceRequestConfigName SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` | ||
} | ||
|
||
type SpaceRequestConfig struct { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
type SpaceRequestConfig struct { | |
// +k8s:openapi-gen=true | |
type SpaceRequestConfig struct { |
Signed-off-by: Kartikey Mamgain <[email protected]>
Signed-off-by: Kartikey Mamgain <[email protected]>
api/v1alpha1/nstemplatetier_types.go
Outdated
@@ -22,6 +22,17 @@ type NSTemplateTierSpec struct { | |||
// +optional | |||
// +mapType=atomic | |||
SpaceRoles map[string]NSTemplateTierSpaceRole `json:"spaceRoles,omitempty"` | |||
|
|||
// Provides the name of the Service Account whose token is to be copied |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor thing - but I guess this comment relates more to the SaTokenToCopy
field, while the struct comment could be something generic like: "SpaceRequestConfigName stores all the configuration related to the Space Request feature".
WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same for the comment on the struct at line 31.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That seems better to me .Updated .
Signed-off-by: Kartikey Mamgain <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good 👍
Thanks for addressing my comments!
Signed-off-by: Kartikey Mamgain <[email protected]>
api/v1alpha1/nstemplatetier_types.go
Outdated
// SpaceRequestConfigName stores all the configuration related to the Space Request feature | ||
// +optional | ||
SpaceRequestConfigName *SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is there the "Name" suffix?
It should be
// SpaceRequestConfigName stores all the configuration related to the Space Request feature | |
// +optional | |
SpaceRequestConfigName *SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` | |
// SpaceRequestConfig stores all the configuration related to the Space Request feature | |
// +optional | |
SpaceRequestConfig *SpaceRequestConfig `json:"spaceRequestConfig,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed that there is .DS_Store
included in the PR - what is it? could you please remove it?
This file does exists on the main branch itself https://github.com/codeready-toolchain/api, it got altered hence committed. Shall i delete it? |
Signed-off-by: Kartikey Mamgain <[email protected]>
Kudos, SonarCloud Quality Gate passed! 0 Bugs No Coverage information |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks a lot for the additional changes 🙏 🥇
Description
A few sentences describing the overall goals of the pull request's commits.
Checks
Did you run
make generate
target? YesDid
make generate
change anything in other projects (host-operator, member-operator)? YesIn case of new CRD, did you the following? yes/no
resources/setup/roles/host.yaml
in the sandbox-sre repositoryPROJECT
file: https://github.com/codeready-toolchain/host-operator/blob/master/PROJECTCSV
file: https://github.com/codeready-toolchain/host-operator/blob/master/config/manifests/bases/host-operator.clusterserviceversion.yamlIn case other projects are changed, please provides PR links.