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

feat: add types and mapping functions for IAPSettings #2785

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

jingyih
Copy link
Collaborator

@jingyih jingyih commented Sep 25, 2024

Generate types and mapping functions for IAPSettings.

This PR also includes tooling enhancements for handling "google.protobuf.StringValue" and "google.protobuf.BoolValue".

@jingyih jingyih force-pushed the IAPSettings branch 5 times, most recently from c258e5e to 798ec69 Compare September 26, 2024 23:59
@jingyih jingyih changed the title WIP: add types and mapping functions for IAPSettings feat: add types and mapping functions for IAPSettings Sep 27, 2024
Copy link
Collaborator

@yuwenma yuwenma left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve
/hold

one comment about the deprecated google.golang.org/protobuf/types/known/wrapperspb, not a blocker. Feel free to unhold

// IAPSettingsSpec defines the desired state of IAPSettings
// +kcc:proto=google.cloud.iap.v1.IapSettings
type IAPSettingsSpec struct {
// +kubebuilder:validation:XValidation:rule="self == oldSelf",message="ResourceID field is immutable"
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest not using immutable check for resourceID (maybe we can specifically call it out in the scifi guide, here)

Copy link
Collaborator Author

@jingyih jingyih Jan 14, 2025

Choose a reason for hiding this comment

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

I ended up regenerating the types and mappings from scratch using the updated templates, this immutable check is no longer present.

// +kcc:proto=google.cloud.iap.v1.AccessDeniedPageSettings
type AccessDeniedPageSettings struct {
// The URI to be redirected to when access is denied.
AccessDeniedPageUri *string `json:"accessDeniedPageUri,omitempty"`
Copy link
Collaborator

Choose a reason for hiding this comment

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

nit: uri --> URI. Could you also add it to the TestCRDsAcronyms test

Copy link
Collaborator Author

@jingyih jingyih Jan 14, 2025

Choose a reason for hiding this comment

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

This is fixed by 67bde89.

@@ -55,7 +55,7 @@ go run ./scripts/crd-tools reflow-descriptions --dir apis/config/crd/

# excluded_resources are resources that are under development for a direct conversion
# we don't modify the CRD just yet for those but will in the future
excluded_resources=("securesourcemanagerinstance")
excluded_resources=("securesourcemanagerinstance" "iapsettings")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is there a reason on adding this alpha resource here?

Copy link
Collaborator Author

@jingyih jingyih Jan 14, 2025

Choose a reason for hiding this comment

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

This ensures that we don't generate the CRD for IAPSettings before the direct controller is added.

@@ -26,6 +26,7 @@ import (
"google.golang.org/protobuf/reflect/protoreflect"
"google.golang.org/protobuf/types/known/durationpb"
"google.golang.org/protobuf/types/known/timestamppb"
"google.golang.org/protobuf/types/known/wrapperspb"
Copy link
Collaborator

Choose a reason for hiding this comment

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

So this library is already deprecated, I was not sure if we should support it or not. Now it is more obvious that we do want to support it. Could you add the other wrapperspb functions in this lib or improve the mapper generator to consider the types from wrapperspb (as a bonus)?

Copy link
Collaborator Author

@jingyih jingyih Jan 14, 2025

Choose a reason for hiding this comment

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

Sure, do you mean 37d57a0?


// IAPSettingsSpec defines the desired state of IAPSettings
// +kcc:proto=google.cloud.iap.v1.IapSettings
type IAPSettingsObservedState struct {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggest adding the configurable fields here as well (does IapSettings has any output-only field?)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

There is currently no output only field in the proto. So I commented out the ObservedState for now.

Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: yuwenma

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

Copy link
Contributor

New changes are detected. LGTM label has been removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants