Skip to content

Commit

Permalink
feat(service): add support for nodePort (#205)
Browse files Browse the repository at this point in the history
Closes #204

Signed-off-by: mueller-ma <[email protected]>
  • Loading branch information
mueller-ma authored Jul 1, 2024
1 parent 400c2b0 commit f66bfc4
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
5 changes: 5 additions & 0 deletions api/v1alpha1/dragonfly_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ type ServiceSpec struct {
// +kubebuilder:validation:Optional
Name string `json:"name,omitempty"`

// (Optional) Dragonfly Service nodePort
// +optional
// +kubebuilder:validation:Optional
NodePort int32 `json:"nodePort,omitempty"`

// (Optional) Dragonfly Service Annotations
// +optional
// +kubebuilder:validation:Optional
Expand Down
4 changes: 4 additions & 0 deletions config/crd/bases/dragonflydb.io_dragonflies.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1138,6 +1138,10 @@ spec:
name:
description: (Optional) Dragonfly Service name
type: string
nodePort:
description: (Optional) Dragonfly Service nodePort
format: int32
type: integer
type:
description: (Optional) Dragonfly Service type
type: string
Expand Down
1 change: 1 addition & 0 deletions internal/resources/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,7 @@ func GetDragonflyResources(ctx context.Context, df *resourcesv1.Dragonfly) ([]cl
service.Spec.Type = df.Spec.ServiceSpec.Type
service.Annotations = df.Spec.ServiceSpec.Annotations
service.Labels = df.Spec.ServiceSpec.Labels
service.Spec.Ports[0].NodePort = df.Spec.ServiceSpec.NodePort
}
if df.Spec.MemcachedPort != 0 {
service.Spec.Ports = append(service.Spec.Ports, corev1.ServicePort{
Expand Down

0 comments on commit f66bfc4

Please sign in to comment.