Skip to content

Conversation

aniruddha2000
Copy link
Contributor

@aniruddha2000 aniruddha2000 commented May 31, 2023

What type of PR is this?
/kind api-change

What this PR does / why we need it:
This PR contains the necessary API changes for GCPManagedControlPlane types to support additional fields.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Part of #906

Special notes for your reviewer:

  • Do we need to rename ClusterNetwork.Pod to a more reasonable name? Because it is quite ambiguous to the upstream k8s Pod.
  • CidrBlock map[string]string `json:"cidrBlock,omitempty" must not be greater than 10. What should be the kubebuilder validation?

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation

Release note:

Add necessary API changes for GCPManagedControlPlane types to support additional fields.

/cc @akshay196 @richardcase @cpanato

@k8s-ci-robot k8s-ci-robot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label May 31, 2023
@k8s-ci-robot k8s-ci-robot requested a review from richardcase May 31, 2023 04:26
@k8s-ci-robot k8s-ci-robot added the kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API label May 31, 2023
@k8s-ci-robot
Copy link
Contributor

@aniruddha2000: GitHub didn't allow me to request PR reviews from the following users: akshay196.

Note that only kubernetes-sigs members and repo collaborators can review this PR, and authors cannot review their own PRs.

In response to this:

What type of PR is this?
/kind api-change

What this PR does / why we need it:
This PR contains the necessary API changes for GCPManagedControlPlane types to support additional fields.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Part of #906

Special notes for your reviewer:

Do we need to rename ClusterNetwork.Pod to a more reasonable name? Because it is quite ambiguous to the upstream k8s Pod.

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

Add necessary API changes for GCPManagedControlPlane types to support additional fields.

/cc @akshay196 @richardcase @cpanato

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@k8s-ci-robot k8s-ci-robot requested a review from cpanato May 31, 2023 04:26
@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label May 31, 2023
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by: aniruddha2000
Once this PR has been reviewed and has the lgtm label, please assign neolit123 for approval. For more information see the Kubernetes Code Review Process.

The full list of commands accepted by this bot can be found 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

@k8s-ci-robot k8s-ci-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label May 31, 2023
@aniruddha2000 aniruddha2000 force-pushed the ani/add-gcpmanagedcontrolplane-additional-type branch from 497c7f0 to e19a9b6 Compare May 31, 2023 06:12
- Description
- Cluster Network
  - PrivateCluster
  - UseIPAliases
  - AuthorizedNetwork
  - Pod
  - Service
- Cluster Security
  - WorkloadIdentityConfig
  - AuthenticatorGroupConfig
  - EnableLagacyAuthorization
  - IssueClientCertificate
- AddonsConfig
- LoggingConfig
- MonitoringConfig

Signed-off-by: Aniruddha Basak <[email protected]>
@aniruddha2000 aniruddha2000 force-pushed the ani/add-gcpmanagedcontrolplane-additional-type branch from e19a9b6 to 08bc033 Compare May 31, 2023 06:37
@k8s-ci-robot k8s-ci-robot added size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. and removed size/L Denotes a PR that changes 100-499 lines, ignoring generated files. labels May 31, 2023
Copy link
Contributor

@akshay196 akshay196 left a comment

Choose a reason for hiding this comment

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

@aniruddha2000 Few minor comments.

Do we need to rename ClusterNetwork.Pod to a more reasonable name? Because it is quite ambiguous to the upstream k8s Pod.

ClusterNetwork.Pod and ClusterNetwork.Service names are inspired by Cluster.ClusterNetwork section in Cluster-API. However we can rename it to something like PodConfig and ServiceConfig as it encapsulates pod and service networking configuration.

CidrBlock map[string]string `json:"cidrBlock,omitempty" must not be greater than 10. What should be the kubebuilder validation?

See if +kubebuilder:validation:MaxProperties is useful here? (ref: https://book.kubebuilder.io/reference/markers/crd-validation.html)
Otherwise we may add webhook validation.

@k8s-ci-robot
Copy link
Contributor

@akshay196: changing LGTM is restricted to collaborators

In response to this:

@aniruddha2000 Few minor comments.

Do we need to rename ClusterNetwork.Pod to a more reasonable name? Because it is quite ambiguous to the upstream k8s Pod.

ClusterNetwork.Pod and ClusterNetwork.Service names are inspired by Cluster.ClusterNetwork section in Cluster-API. However we can rename it to something like PodConfig and ServiceConfig as it encapsulates pod and service networking configuration.

CidrBlock map[string]string `json:"cidrBlock,omitempty" must not be greater than 10. What should be the kubebuilder validation?

See if +kubebuilder:validation:MaxProperties is useful here? Otherwise we may add webhook validation. (ref: https://book.kubebuilder.io/reference/markers/crd-validation.html)

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@akshay196
Copy link
Contributor

Regarding apidiff CI check,

   Incompatible changes:
  - GCPManagedControlPlaneSpec: old is comparable, new is not 

The struct is comparable if all fields are comparable (go spec). So converting fields like ClusterNetwork to pointer (*ClusterNetwork) would fix it. However DefaultNodeLocation is a slice. Slice types are not comparable.

@richardcase Any idea how to resolve this?

@richardcase
Copy link
Member

So we don't merge too early, without the controller changes (which will be done in another PR):

/hold

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 5, 2023
@richardcase
Copy link
Member

As this is for GKE and it's experimental, we can ignore apidiff changes:

/override pull-cluster-api-provider-gcp-apidiff

@k8s-ci-robot
Copy link
Contributor

@richardcase: Overrode contexts on behalf of richardcase: pull-cluster-api-provider-gcp-apidiff

In response to this:

As this is for GKE and it's experimental, we can ignore apidiff changes:

/override pull-cluster-api-provider-gcp-apidiff

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

type PrivateCluster struct {
// Enabled defines weather a cluster is private or not. If disabled cluster network is public.
// +optional
Enabled bool `json:"enabled,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

Should we split this into nodes and endpoint?

If a user declares privateCluster (which is optional) in their yaml then we can assume they want a private network, so we could add a validation to the webhook to check that one of private nodes or private endpoint is true.

We could also add a validating webhook, that is

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good Idea!

Just to clarify, are you talking about

        // ControlPlaneCidrBlock is the IP range in CIDR notation to use for the hosted master network. This range must not
	// overlap with any other ranges in use within the cluster's network. Honored when enabled is true.
	// +optional
	ControlPlaneCidrBlock string `json:"controlPlaneCidrBlock,omitempty"`

	// ControlPlaneGlobalAccess is whenever master is accessible globally or not. Honored when enabled is true.
	// +optional
	ControlPlaneGlobalAccess bool `json:"controlPlaneGlobalAccess,omitempty"`

these two fields in the Node and last two ControlPlanePrivateEndpoint & DisableDefaultSNAT in the Network, if I am not wrong.

Copy link
Contributor

Choose a reason for hiding this comment

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

@richardcase Sorry I don't quite understand what you mean by splitting into nodes and endpoint. Can you please explain further or give an example?
The private cluster has 4 properties shown in picture out of which ContolPlaneCidrBlock is mandatory. I clubbed them into private cluster group.

Screenshot from 2023-06-06 22-11-43

Copy link
Member

Choose a reason for hiding this comment

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

}

// AuthorizedNetworkCidrBlock defines the CIDR block configuration.
type AuthorizedNetworkCidrBlock struct {
Copy link
Member

Choose a reason for hiding this comment

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

If someone is specifying a cidr block i'm guessing that at least one of Name or CidrBlock is required.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, adding a MinProperties make sense right?

+ // +kubebuilder:validation:MinProperties=1
// +kubebuilder:validation:MaxProperties=10
// +optional
CidrBlock map[string]string `json:"cidrBlock,omitempty"`

Copy link
Contributor

Choose a reason for hiding this comment

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

GKE allows enabling authorized network with no cidr blocks. The spec with enable and empty cidr block would just behave same as this.

Screenshot from 2023-06-06 22-20-13

Copy link
Member

Choose a reason for hiding this comment

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

Thanks @akshay196 👍


// CidrBlocks defines the CIDR block configuration.
// +optional
CidrBlocks AuthorizedNetworkCidrBlock `json:"cidrBlocks,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

If we have an authorized network then i assume its required to specify cidr blocks?

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 CIDR block is independent in itself, there are multiple CIDR blocks in the same file that's why I prefixed it. Should I change it to CidrBlock?

// (in CIDR notation) within a network range, a mask, or leave this field blank to use a default range.
// This setting is permanent.
// +optional
CidrBlock string `json:"cidrBlock,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

How does this differ from the pod cidrblock on the CAPI Cluster?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the spreadsheet it is string and in the CAPI it is []string, does it count the diff? or using the CAPI one make more sense?

Copy link
Contributor

Choose a reason for hiding this comment

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

Note that GKE allows defining only single pod address range.

Copy link
Member

Choose a reason for hiding this comment

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

People may get confused if they can supply the pod cidr block on the CAPI Cluster and here.

I wonder if you just take the first if there are multiple and warn the user?

}

// AddonsConfig defines the enabled Cluster Addons.
type AddonsConfig struct {
Copy link
Member

Choose a reason for hiding this comment

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

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, I don't understand this :(

Copy link
Member

Choose a reason for hiding this comment

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

Signed-off-by: Aniruddha Basak <[email protected]>
@aniruddha2000 aniruddha2000 force-pushed the ani/add-gcpmanagedcontrolplane-additional-type branch from 08bc033 to db54842 Compare June 5, 2023 10:14
@k8s-ci-robot
Copy link
Contributor

k8s-ci-robot commented Jun 5, 2023

@aniruddha2000: The following test failed, say /retest to rerun all failed tests or /retest-required to rerun all mandatory failed tests:

Test name Commit Details Required Rerun command
pull-cluster-api-provider-gcp-apidiff 40ee48f link false /test pull-cluster-api-provider-gcp-apidiff

Full PR test history. Your PR dashboard. Please help us cut down on flakes by linking to an open issue when you hit one in your PR.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here.

@richardcase
Copy link
Member

This is great work 👍

@k8s-ci-robot k8s-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Sep 2, 2023
@k8s-ci-robot
Copy link
Contributor

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@akshay196
Copy link
Contributor

Hey @aniruddha2000 Hope you're doing good.
Are you still working on this PR? Me and @richardcase had a discussion while ago. It would be nice if we add new fields and also work on reconciliation logic of those fields in the same PR.

@aniruddha2000
Copy link
Contributor Author

@akshay196 hello, yes I am doing good, can you take this over from now if you have the bandwidth? because I don't have many windows to focus on it right now :(

@k8s-triage-robot
Copy link

The Kubernetes project currently lacks enough contributors to adequately respond to all PRs.

This bot triages PRs according to the following rules:

  • After 90d of inactivity, lifecycle/stale is applied
  • After 30d of inactivity since lifecycle/stale was applied, lifecycle/rotten is applied
  • After 30d of inactivity since lifecycle/rotten was applied, the PR is closed

You can:

  • Mark this PR as fresh with /remove-lifecycle stale
  • Close this PR with /close
  • Offer to help out with Issue Triage

Please send feedback to sig-contributor-experience at kubernetes/community.

/lifecycle stale

@k8s-ci-robot k8s-ci-robot added the lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. label Feb 27, 2024
@akshay196
Copy link
Contributor

New PR: #1186
We may close this.

/close

@k8s-ci-robot
Copy link
Contributor

@akshay196: Closed this PR.

In response to this:

New PR: #1186
We may close this.

/close

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. kind/api-change Categorizes issue or PR as related to adding, removing, or otherwise changing an API lifecycle/stale Denotes an issue or PR has remained open with no activity and has become stale. needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. release-note Denotes a PR that will be considered when it comes time to generate release notes. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants