Skip to content

Commit aba76ed

Browse files
committed
Add ServicePort type
Signed-off-by: Shiva Krishna, Merla <smerla@nvidia.com>
1 parent 9e25d9d commit aba76ed

24 files changed

Lines changed: 254 additions & 1143 deletions

api/apps/v1alpha1/common_types.go

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,25 @@ type Service struct {
4848
// +kubebuilder:deprecatedversion
4949
Port int32 `json:"port,omitempty"`
5050
// Defines multiple ports for the service
51-
Ports []corev1.ServicePort `json:"ports,omitempty"`
52-
Annotations map[string]string `json:"annotations,omitempty"`
51+
Ports []ServicePort `json:"ports,omitempty"`
52+
Annotations map[string]string `json:"annotations,omitempty"`
53+
}
54+
55+
// ServicePort defines attributes to setup the service ports
56+
type ServicePort struct {
57+
// The name of this port within the service.
58+
Name string `json:"name,omitempty"`
59+
60+
// The IP protocol for this port. Supports "TCP", "UDP", and "SCTP".
61+
// Default is TCP.
62+
// +kubebuilder:validation:Enum=TCP;UDP;SCTP
63+
// +kubebuilder:default="TCP"
64+
Protocol corev1.Protocol `json:"protocol,omitempty"`
65+
66+
// The port that will be exposed by this service.
67+
// +kubebuilder:validation:Minimum=1
68+
// +kubebuilder:validation:Maximum=65535
69+
Port int32 `json:"port"`
5370
}
5471

5572
// Metrics defines attributes to setup metrics collection

api/apps/v1alpha1/zz_generated.deepcopy.go

Lines changed: 17 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

bundle/manifests/apps.nvidia.com_nemocustomizers.yaml

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -541,72 +541,28 @@ spec:
541541
ports:
542542
description: Defines multiple ports for the service
543543
items:
544-
description: ServicePort contains information on service's
545-
port.
544+
description: ServicePort defines attributes to setup the
545+
service ports
546546
properties:
547-
appProtocol:
548-
description: |-
549-
The application protocol for this port.
550-
This is used as a hint for implementations to offer richer behavior for protocols that they understand.
551-
This field follows standard Kubernetes label syntax.
552-
Valid values are either:
553-
554-
* Un-prefixed protocol names - reserved for IANA standard service names (as per
555-
RFC-6335 and https://www.iana.org/assignments/service-names).
556-
557-
* Kubernetes-defined prefixed names:
558-
* 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior-
559-
* 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455
560-
* 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455
561-
562-
* Other protocols should use implementation-defined prefixed names such as
563-
mycompany.com/my-custom-protocol.
564-
type: string
565547
name:
566-
description: |-
567-
The name of this port within the service. This must be a DNS_LABEL.
568-
All ports within a ServiceSpec must have unique names. When considering
569-
the endpoints for a Service, this must match the 'name' field in the
570-
EndpointPort.
571-
Optional if only one ServicePort is defined on this service.
548+
description: The name of this port within the service.
572549
type: string
573-
nodePort:
574-
description: |-
575-
The port on each node on which this service is exposed when type is
576-
NodePort or LoadBalancer. Usually assigned by the system. If a value is
577-
specified, in-range, and not in use it will be used, otherwise the
578-
operation will fail. If not specified, a port will be allocated if this
579-
Service requires one. If this field is specified when creating a
580-
Service which does not need it, creation will fail. This field will be
581-
wiped when updating a Service to no longer need it (e.g. changing type
582-
from NodePort to ClusterIP).
583-
More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
584-
format: int32
585-
type: integer
586550
port:
587551
description: The port that will be exposed by this service.
588552
format: int32
553+
maximum: 65535
554+
minimum: 1
589555
type: integer
590556
protocol:
591557
default: TCP
592558
description: |-
593559
The IP protocol for this port. Supports "TCP", "UDP", and "SCTP".
594560
Default is TCP.
561+
enum:
562+
- TCP
563+
- UDP
564+
- SCTP
595565
type: string
596-
targetPort:
597-
anyOf:
598-
- type: integer
599-
- type: string
600-
description: |-
601-
Number or name of the port to access on the pods targeted by the service.
602-
Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
603-
If this is a string, it will be looked up as a named port in the
604-
target Pod's container ports. If this is not specified, the value
605-
of the 'port' field is used (an identity map).
606-
This field is ignored for services with clusterIP=None, and should be
607-
omitted or set equal to the 'port' field.
608-
More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
609-
x-kubernetes-int-or-string: true
610566
required:
611567
- port
612568
type: object

bundle/manifests/apps.nvidia.com_nemodatastores.yaml

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -540,72 +540,28 @@ spec:
540540
ports:
541541
description: Defines multiple ports for the service
542542
items:
543-
description: ServicePort contains information on service's
544-
port.
543+
description: ServicePort defines attributes to setup the
544+
service ports
545545
properties:
546-
appProtocol:
547-
description: |-
548-
The application protocol for this port.
549-
This is used as a hint for implementations to offer richer behavior for protocols that they understand.
550-
This field follows standard Kubernetes label syntax.
551-
Valid values are either:
552-
553-
* Un-prefixed protocol names - reserved for IANA standard service names (as per
554-
RFC-6335 and https://www.iana.org/assignments/service-names).
555-
556-
* Kubernetes-defined prefixed names:
557-
* 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior-
558-
* 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455
559-
* 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455
560-
561-
* Other protocols should use implementation-defined prefixed names such as
562-
mycompany.com/my-custom-protocol.
563-
type: string
564546
name:
565-
description: |-
566-
The name of this port within the service. This must be a DNS_LABEL.
567-
All ports within a ServiceSpec must have unique names. When considering
568-
the endpoints for a Service, this must match the 'name' field in the
569-
EndpointPort.
570-
Optional if only one ServicePort is defined on this service.
547+
description: The name of this port within the service.
571548
type: string
572-
nodePort:
573-
description: |-
574-
The port on each node on which this service is exposed when type is
575-
NodePort or LoadBalancer. Usually assigned by the system. If a value is
576-
specified, in-range, and not in use it will be used, otherwise the
577-
operation will fail. If not specified, a port will be allocated if this
578-
Service requires one. If this field is specified when creating a
579-
Service which does not need it, creation will fail. This field will be
580-
wiped when updating a Service to no longer need it (e.g. changing type
581-
from NodePort to ClusterIP).
582-
More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
583-
format: int32
584-
type: integer
585549
port:
586550
description: The port that will be exposed by this service.
587551
format: int32
552+
maximum: 65535
553+
minimum: 1
588554
type: integer
589555
protocol:
590556
default: TCP
591557
description: |-
592558
The IP protocol for this port. Supports "TCP", "UDP", and "SCTP".
593559
Default is TCP.
560+
enum:
561+
- TCP
562+
- UDP
563+
- SCTP
594564
type: string
595-
targetPort:
596-
anyOf:
597-
- type: integer
598-
- type: string
599-
description: |-
600-
Number or name of the port to access on the pods targeted by the service.
601-
Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
602-
If this is a string, it will be looked up as a named port in the
603-
target Pod's container ports. If this is not specified, the value
604-
of the 'port' field is used (an identity map).
605-
This field is ignored for services with clusterIP=None, and should be
606-
omitted or set equal to the 'port' field.
607-
More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
608-
x-kubernetes-int-or-string: true
609565
required:
610566
- port
611567
type: object

bundle/manifests/apps.nvidia.com_nemoentitystores.yaml

Lines changed: 9 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -538,72 +538,28 @@ spec:
538538
ports:
539539
description: Defines multiple ports for the service
540540
items:
541-
description: ServicePort contains information on service's
542-
port.
541+
description: ServicePort defines attributes to setup the
542+
service ports
543543
properties:
544-
appProtocol:
545-
description: |-
546-
The application protocol for this port.
547-
This is used as a hint for implementations to offer richer behavior for protocols that they understand.
548-
This field follows standard Kubernetes label syntax.
549-
Valid values are either:
550-
551-
* Un-prefixed protocol names - reserved for IANA standard service names (as per
552-
RFC-6335 and https://www.iana.org/assignments/service-names).
553-
554-
* Kubernetes-defined prefixed names:
555-
* 'kubernetes.io/h2c' - HTTP/2 prior knowledge over cleartext as described in https://www.rfc-editor.org/rfc/rfc9113.html#name-starting-http-2-with-prior-
556-
* 'kubernetes.io/ws' - WebSocket over cleartext as described in https://www.rfc-editor.org/rfc/rfc6455
557-
* 'kubernetes.io/wss' - WebSocket over TLS as described in https://www.rfc-editor.org/rfc/rfc6455
558-
559-
* Other protocols should use implementation-defined prefixed names such as
560-
mycompany.com/my-custom-protocol.
561-
type: string
562544
name:
563-
description: |-
564-
The name of this port within the service. This must be a DNS_LABEL.
565-
All ports within a ServiceSpec must have unique names. When considering
566-
the endpoints for a Service, this must match the 'name' field in the
567-
EndpointPort.
568-
Optional if only one ServicePort is defined on this service.
545+
description: The name of this port within the service.
569546
type: string
570-
nodePort:
571-
description: |-
572-
The port on each node on which this service is exposed when type is
573-
NodePort or LoadBalancer. Usually assigned by the system. If a value is
574-
specified, in-range, and not in use it will be used, otherwise the
575-
operation will fail. If not specified, a port will be allocated if this
576-
Service requires one. If this field is specified when creating a
577-
Service which does not need it, creation will fail. This field will be
578-
wiped when updating a Service to no longer need it (e.g. changing type
579-
from NodePort to ClusterIP).
580-
More info: https://kubernetes.io/docs/concepts/services-networking/service/#type-nodeport
581-
format: int32
582-
type: integer
583547
port:
584548
description: The port that will be exposed by this service.
585549
format: int32
550+
maximum: 65535
551+
minimum: 1
586552
type: integer
587553
protocol:
588554
default: TCP
589555
description: |-
590556
The IP protocol for this port. Supports "TCP", "UDP", and "SCTP".
591557
Default is TCP.
558+
enum:
559+
- TCP
560+
- UDP
561+
- SCTP
592562
type: string
593-
targetPort:
594-
anyOf:
595-
- type: integer
596-
- type: string
597-
description: |-
598-
Number or name of the port to access on the pods targeted by the service.
599-
Number must be in the range 1 to 65535. Name must be an IANA_SVC_NAME.
600-
If this is a string, it will be looked up as a named port in the
601-
target Pod's container ports. If this is not specified, the value
602-
of the 'port' field is used (an identity map).
603-
This field is ignored for services with clusterIP=None, and should be
604-
omitted or set equal to the 'port' field.
605-
More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
606-
x-kubernetes-int-or-string: true
607563
required:
608564
- port
609565
type: object

0 commit comments

Comments
 (0)