Skip to content

Commit

Permalink
fix(api): make LocalObjectReference.Name and HostAlias.IP required (#…
Browse files Browse the repository at this point in the history
…124553)

* fix(api): LocalObjectReference Name a "" default and make HostAlias.IP required

* chore(api): add LocalObjectReference comment

* chore(api): add omitempty to LocalObjectReference's Name

* chore(api): add kubebuilder:default annotation

* chore(api): ./hack/update-codegen.sh

Kubernetes-commit: 37e7cbdd3a6e9dd1044408b157226c53c76fdf71
  • Loading branch information
pmalek authored and k8s-publishing-bot committed May 3, 2024
1 parent d014286 commit 15001b5
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
9 changes: 8 additions & 1 deletion core/v1/generated.proto

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

11 changes: 9 additions & 2 deletions core/v1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -4113,7 +4113,8 @@ const (
// pod's hosts file.
type HostAlias struct {
// IP address of the host file entry.
IP string `json:"ip,omitempty" protobuf:"bytes,1,opt,name=ip"`
// +required
IP string `json:"ip" protobuf:"bytes,1,opt,name=ip"`
// Hostnames for the above IP address.
// +listType=atomic
Hostnames []string `json:"hostnames,omitempty" protobuf:"bytes,2,rep,name=hostnames"`
Expand Down Expand Up @@ -6553,9 +6554,15 @@ type ObjectReference struct {
// +structType=atomic
type LocalObjectReference struct {
// Name of the referent.
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
// This field is effectively required, but due to backwards compatibility is
// allowed to be empty. Instances of this type with an empty value here are
// almost certainly wrong.
// TODO: Add other useful fields. apiVersion, kind, uid?
// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
// +optional
// +default=""
// +kubebuilder:default=""
// TODO: Drop `kubebuilder:default` when controller-gen doesn't need it https://github.com/kubernetes-sigs/kubebuilder/issues/3896.
Name string `json:"name,omitempty" protobuf:"bytes,1,opt,name=name"`
}

Expand Down
2 changes: 1 addition & 1 deletion core/v1/types_swagger_doc_generated.go
Original file line number Diff line number Diff line change
Expand Up @@ -1032,7 +1032,7 @@ func (LoadBalancerStatus) SwaggerDoc() map[string]string {

var map_LocalObjectReference = map[string]string{
"": "LocalObjectReference contains enough information to let you locate the referenced object inside the same namespace.",
"name": "Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
"name": "Name of the referent. This field is effectively required, but due to backwards compatibility is allowed to be empty. Instances of this type with an empty value here are almost certainly wrong. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names",
}

func (LocalObjectReference) SwaggerDoc() map[string]string {
Expand Down

0 comments on commit 15001b5

Please sign in to comment.