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

add PublicViewerConfig in ToolchainConfig #410

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

filariow
Copy link
Contributor

@filariow filariow commented Mar 22, 2024

Description

JIRA: https://issues.redhat.com/browse/ASC-492

Checks

  1. Did you run make generate target? yes

  2. Did make generate change anything in other projects (host-operator, member-operator)? yes

  • host-operator
  1. In case of new CRD, did you the following? N/A
  2. In case other projects are changed, please provides PR links.

Signed-off-by: Francesco Ilario <filario@redhat.com>
Signed-off-by: Francesco Ilario <filario@redhat.com>
Copy link
Contributor

@mfrancisc mfrancisc left a comment

Choose a reason for hiding this comment

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

Nice 👍 , thanks for creating the PRs!

I have few comments.

// +k8s:openapi-gen=true
type GlobalConfig struct {
// +optional
PublicViewer PublicViewerConfig `json:"publicViewer,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

It seems like a good idea to start introducing a Global/Common config but I'm wondering if we could add the PublicViewer struct to both HostConfig and Members, instead of creating a Global config? Is there any benefit for having this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This configuration is used by host operator and registration service. Neither HostConfig nor MembersConfig seemed appropriate to me.
Adding the configuration in both of them does not sound a good idea to me. It would become possible to have two different values for the same configuration and cause misbehavior.

As @MatousJobanek suggested here we could add this config under HostConfig. My only concern about going this path is related to Registration Service's future improvements. Indeed, as of now, the RegistrationService is thought to be installed on the Host cluster only, but it seems to me that it may be easily decoupled so that it can be executed on member clusters too. So, adding this configuration under HostConfig may cause breaking changes or duplication if we decide to decouple the RegistrationService from the Host Cluster. WDYT?

Copy link
Contributor

Choose a reason for hiding this comment

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

the RegistrationService is thought to be installed on the Host cluster only, but it seems to me that it may be easily decoupled so that it can be executed on member clusters too

Why would you want to install the reg service on a member cluster? I don't think we ever considered that. But maybe I missed something?
What would make sense is to decouple the proxy and reg-service so the proxy can be an optional component but it's still all about the host cluster components. Isn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Sorry, probably I didn't express myself correctly. I'm not saying that's something we are planning or we should plan. I'm saying that the fact that it's technically doable, makes me feel like we can find better place where to put this configuration 😄

api/v1alpha1/usersignup_types.go Outdated Show resolved Hide resolved
api/v1alpha1/toolchainconfig_types.go Show resolved Hide resolved
Comment on lines +51 to +52
// +kubebuilder:default:=false
Enabled bool `json:"enabled"`
Copy link
Contributor

Choose a reason for hiding this comment

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

what is the purpose of the boolean flag? Why the username is not sufficient? If the username is empty, then it's disabled, if it's not empty then it's enabled...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the username would be sufficient, but not explicit. Hence, the purpose of the boolean enabled field is to make the feature flag explicit

Copy link
Contributor

Choose a reason for hiding this comment

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

An alternative we could pursue down the line would be to have GlobalConfig have a pointer to an instance of this struct, with the nil case indicating that this particular feature isn't enabled. However, this has the downside of being less explicit about which features are enabled, and it breaks the encapsulation of PublicViewerConfig (i.e. if more stuff needs to be added to this struct orthogonal to the user, then we're going to need to reconsider our approach).

api/v1alpha1/toolchainconfig_types.go Show resolved Hide resolved
api/v1alpha1/toolchainconfig_types.go Outdated Show resolved Hide resolved
api/v1alpha1/toolchainconfig_types.go Outdated Show resolved Hide resolved
api/v1alpha1/toolchainconfig_types.go Outdated Show resolved Hide resolved
Signed-off-by: Francesco Ilario <filario@redhat.com>
Copy link
Contributor

@rajivnathan rajivnathan left a comment

Choose a reason for hiding this comment

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

@filariow Can you include a link to a JIRA that provides background for these changes? I'm pretty lost as to what these changes are about. Not sure what a public viewer is and not sure why we need a Global config struct when we have HostConfig and MemberConfigs.

@@ -26,6 +26,9 @@ const (

// SpaceBindingRequestProvisionedReason represents the reason for a successfully provisioned space binding request.
SpaceBindingRequestProvisionedReason = provisionedReason

// SpaceBindingRequestInvalidReason represents the reason for an invalid space binding request.
SpaceBindingRequestInvalidReason = invalidReason
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't the creation of the resource be blocked if it's invalid? Why allow creation of an invalid resource?

Copy link
Contributor Author

@filariow filariow Mar 25, 2024

Choose a reason for hiding this comment

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

great point, this check could be implemented in the ValidatingWebhook on member cluster. WDYT?

@filariow
Copy link
Contributor Author

@rajivnathan sorry, I forgot to add the link. Added it in the description.

Signed-off-by: Francesco Ilario <filario@redhat.com>
Copy link

sonarcloud bot commented Mar 25, 2024

Quality Gate Passed Quality Gate passed

Issues
0 New issues
0 Accepted issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

// +kubebuilder:validation:MinLength=1
// +kubebuilder:validation:MaxLength=63
// +kubebuilder:validation:Pattern=`^[a-z0-9]([-a-z0-9]*[a-z0-9])?$`
Username string `json:"username,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

What is this username used for? Can you please add a comment here describing this field.

@alexeykazakov
Copy link
Contributor

I forgot to add the link. Added it in the description.

Thanks for the JIRA link. However the JIRA and the attached feature refinement doc describes the high level desired UX. What would be really useful is a detailed technical design doc. It would help a lot with the review of the PR.
This is how we usually handle development of new features (unless it's a very simple feature):

  1. Some description and agreement of the overall desired UX. In this case it's done with the feature refinement doc.
  2. A technical design doc where we can discuss and agree on the overall approach of how we implement the feature. This is what is missing here.
  3. PRs with an implementation of that design.

@filariow filariow marked this pull request as draft March 26, 2024 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants