Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
added IPFamilies to the CRD
  • Loading branch information
Philip Hurst committed Jan 22, 2025
commit f8d311262878be249fbe031bb108095e1b0fc3a1
Original file line number Diff line number Diff line change
Expand Up @@ -14663,6 +14663,14 @@ spec:
- Local
maxLength: 10
type: string
ipFamilies:
items:
enum:
- IPv4
- IPv6
- foo
type: string
type: array
ipFamilyPolicy:
description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/'
enum:
Expand Down Expand Up @@ -15012,6 +15020,14 @@ spec:
- Local
maxLength: 10
type: string
ipFamilies:
items:
enum:
- IPv4
- IPv6
- foo
type: string
type: array
ipFamilyPolicy:
description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/'
enum:
Expand Down Expand Up @@ -15067,6 +15083,14 @@ spec:
- Local
maxLength: 10
type: string
ipFamilies:
items:
enum:
- IPv4
- IPv6
- foo
type: string
type: array
ipFamilyPolicy:
description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/'
enum:
Expand Down Expand Up @@ -16770,6 +16794,14 @@ spec:
- Local
maxLength: 10
type: string
ipFamilies:
items:
enum:
- IPv4
- IPv6
- foo
type: string
type: array
ipFamilyPolicy:
description: 'More info: https://kubernetes.io/docs/reference/kubernetes-api/service-resources/service-v1/'
enum:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,12 @@ type SchemalessObject map[string]any
// DeepCopy creates a new SchemalessObject by copying the receiver.
func (in SchemalessObject) DeepCopy() SchemalessObject {
return runtime.DeepCopyJSON(in)

}

// +kubebuilder:validation:Enum=IPv4;IPv6;foo
type IPFamily string

type ServiceSpec struct {
// +optional
Metadata *Metadata `json:"metadata,omitempty"`
Expand Down Expand Up @@ -50,6 +54,9 @@ type ServiceSpec struct {
// +kubebuilder:validation:Enum=SingleStack;PreferDualStack;RequireDualStack
IPFamilyPolicy string `json:"ipFamilyPolicy,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

❓ I think we can avoid the type conversions in the controller if we use the upstream type here. Similar regarding pointer. Does this generate the same YAML?

Suggested change
IPFamilyPolicy string `json:"ipFamilyPolicy,omitempty"`
IPFamilyPolicy *corev1.IPFamilyPolicy `json:"ipFamilyPolicy,omitempty"`

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 it does - thanks - refactoring


// +optional
IPFamilies []IPFamily `json:"ipFamilies,omitempty"`
Copy link
Member

Choose a reason for hiding this comment

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

❓ We should be able to use the upstream type and add the enum validation from here. Does this generate the same YAML?

Suggested change
// +optional
IPFamilies []IPFamily `json:"ipFamilies,omitempty"`
// +optional
// +kubebuilder:validation:items:Enum={IPv4,IPv6}
IPFamilies []corev1.IPFamily `json:"ipFamilies,omitempty"`

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 it does - thanks - refactoring


// More info: https://kubernetes.io/docs/concepts/services-networking/service/#traffic-policies
// ---
// Kubernetes assumes the evaluation cost of an enum value is very large.
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.