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

Installer Dual Stack Enhancement #1731

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

barbacbd
Copy link

@barbacbd barbacbd commented Jan 3, 2025

The dual stack enablement enhancement for:

  • AWS
  • GCP
  • Azure

The feature proposes changes to the:

  • cluster api providers
  • Openshift API
  • Openshift Installer

@openshift-ci openshift-ci bot requested review from syed and TrilokGeer January 3, 2025 19:12
Copy link
Contributor

openshift-ci bot commented Jan 3, 2025

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
Once this PR has been reviewed and has the lgtm label, please assign patrickdillon for approval. For more information see the 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

@barbacbd
Copy link
Author

barbacbd commented Jan 3, 2025

/cc @sadasu
/cc @JoelSpeed
/cc @patrickdillon
/cc @jhixson74

- AWS
- GCP
- Azure

The feature proposes changes to the:

- cluster api providers
- Openshift API
- Openshift Installer
@barbacbd barbacbd force-pushed the installer_dual_stack_enablement branch from 5b62c12 to 8e4e270 Compare January 6, 2025 14:39
Copy link
Contributor

openshift-ci bot commented Jan 6, 2025

@barbacbd: all tests passed!

Full PR test history. Your PR dashboard.

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-sigs/prow repository. I understand the commands that are listed here.

Copy link
Contributor

@everettraven everettraven left a comment

Choose a reason for hiding this comment

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

Leaving some thoughts on the API

variable.

```go
// StackType: The stack type for the subnet. If set to IPV4_ONLY, new VMs in
Copy link
Contributor

Choose a reason for hiding this comment

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

In OpenShift, it is convention to use the JSON field name in the godoc instead of the Go field name (ref: https://github.com/openshift/enhancements/blob/master/dev-guide/api-conventions.md#use-json-field-names-in-godoc)

This is to make the end-user experience of using something like oc explain better by aligning the generated documentation with the field name the end-user sees.

Comment on lines +109 to +119
// StackType: The stack type for the subnet. If set to IPV4_ONLY, new VMs in
// the subnet are assigned IPv4 addresses only. If set to IPV4_IPV6, new VMs in
// the subnet can be assigned both IPv4 and IPv6 addresses. If not specified,
// IPV4_ONLY is used. This field can be both set at resource creation time and
// updated using patch.
//
// Possible values:
// "IPV4_IPV6" - New VMs in this subnet can have both IPv4 and IPv6
// addresses.
// "IPV4_ONLY" - New VMs in this subnet will only be assigned IPv4 addresses.
// "IPV6_ONLY" - New VMs in this subnet will only be assigned IPv6 addresses.
Copy link
Contributor

Choose a reason for hiding this comment

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

The textual description and possible values feels repetitive. It might make sense to do something of the form:

stackType represents the stack type for the subnet.

Allowed values are IPV4_ONLY, IPV6_ONLY, IPV4_IPV6

When set to IPV4_ONLY ....
When set to IPV6_ONLY ...
...

// "IPV6_ONLY" - New VMs in this subnet will only be assigned IPv6 addresses.
// +kubebuilder:validation:Enum=IPV4_ONLY;IPV4_IPV6;IPV6_ONLY
// +kubebuilder:default=IPV4_ONLY
// +optional
Copy link
Contributor

Choose a reason for hiding this comment

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

I would recommend explicitly calling out in the godoc that this field is optional towards the beginning of the godoc.

// addresses.
// "IPV4_ONLY" - New VMs in this subnet will only be assigned IPv4 addresses.
// "IPV6_ONLY" - New VMs in this subnet will only be assigned IPv6 addresses.
// +kubebuilder:validation:Enum=IPV4_ONLY;IPV4_IPV6;IPV6_ONLY
Copy link
Contributor

Choose a reason for hiding this comment

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

Are ipv4 and ipv6 the only stack types possible for the subnet across all platforms? Could there be new ones added in the future that we would need to support?

If we could have to support various stack type combinations/permutations, an enum may not be best suited for this field. Imagining a case where you add a third stack type, you would have to expand your allowed enum values quite a bit. For example, adding stack type FOO would mean you have to add enum values of FOO_ONLY, IPV4_IPV6_FOO, IPV4_FOO, IPV6_FOO to capture all possible combinations of the values.

If that scenario is likely/possible, maybe it makes sense to make this a unique list of values where the type used in the slice has an enum validation in place that forces values to only ever be something like IPV4, IPV6, etc.?

Copy link
Contributor

Choose a reason for hiding this comment

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

To further clarify, instead of having to do:

...
stackType: IPV4_IPV6
...

A user would do:

...
stackType:
  - IPV4
  - IPV6
...

// +kubebuilder:validation:Enum=IPV4_ONLY;IPV4_IPV6;IPV6_ONLY
// +kubebuilder:default=IPV4_ONLY
// +optional
StackType string `json:"stackType,omitempty"`
Copy link
Contributor

Choose a reason for hiding this comment

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

In OpenShift, it is convention for enumerated fields to have a distinct type. Instead of using a string type here, consider creating a type alias to a string and creating some constants for the allowed values like:

type StackType string

const (
    StackTypeIPV4 = "IPV4"
    ...
)

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.

2 participants