Skip to content

Added the ability to specify Fluentd service type #1564

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 3 additions & 0 deletions apis/fluentd/v1alpha1/fluentd_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ type FluentDService struct {
Annotations map[string]string `json:"annotations,omitempty"`
// Labels to add to each FluentD service
Labels map[string]string `json:"labels,omitempty"`
// Type is the service type to deploy.
// +kubebuilder:validation:Enum:=ClusterIP;NodePort;LoadBalancer;ExternalName
Type *corev1.ServiceType `json:"type,omitempty"`
}

type BufferVolume struct {
Expand Down
5 changes: 5 additions & 0 deletions apis/fluentd/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -5336,6 +5336,14 @@ spec:
name:
description: Name is the name of the FluentD service.
type: string
type:
description: Type is the service type to deploy.
enum:
- ClusterIP
- NodePort
- LoadBalancer
- ExternalName
type: string
type: object
serviceAccountAnnotations:
additionalProperties:
Expand Down
8 changes: 8 additions & 0 deletions config/crd/bases/fluentd.fluent.io_fluentds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5336,6 +5336,14 @@ spec:
name:
description: Name is the name of the FluentD service.
type: string
type:
description: Type is the service type to deploy.
enum:
- ClusterIP
- NodePort
- LoadBalancer
- ExternalName
type: string
type: object
serviceAccountAnnotations:
additionalProperties:
Expand Down
1 change: 1 addition & 0 deletions docs/fluentd.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,7 @@ FluentDService the service of the FluentD
| name | Name is the name of the FluentD service. | string |
| annotations | Annotations to add to each FluentD service. | map[string]string |
| labels | Labels to add to each FluentD service | map[string]string |
| type | Type is the service type to deploy. | *[corev1.ServiceType](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#servicetype-v1-core) |

[Back to TOC](#table-of-contents)
# Fluentd
Expand Down
8 changes: 8 additions & 0 deletions manifests/setup/fluent-operator-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29553,6 +29553,14 @@ spec:
name:
description: Name is the name of the FluentD service.
type: string
type:
description: Type is the service type to deploy.
enum:
- ClusterIP
- NodePort
- LoadBalancer
- ExternalName
type: string
type: object
serviceAccountAnnotations:
additionalProperties:
Expand Down
8 changes: 8 additions & 0 deletions manifests/setup/setup.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29553,6 +29553,14 @@ spec:
name:
description: Name is the name of the FluentD service.
type: string
type:
description: Type is the service type to deploy.
enum:
- ClusterIP
- NodePort
- LoadBalancer
- ExternalName
type: string
type: object
serviceAccountAnnotations:
additionalProperties:
Expand Down
7 changes: 6 additions & 1 deletion pkg/operator/fluentd-service.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ func MakeFluentdService(fd fluentdv1alpha1.Fluentd) *corev1.Service {
}
}

serviceType := corev1.ServiceTypeClusterIP
if fd.Spec.Service.Type != nil {
serviceType = *fd.Spec.Service.Type
}

svc := corev1.Service{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Expand All @@ -41,7 +46,7 @@ func MakeFluentdService(fd fluentdv1alpha1.Fluentd) *corev1.Service {
},
Spec: corev1.ServiceSpec{
Selector: labels,
Type: corev1.ServiceTypeClusterIP,
Type: serviceType,
},
}

Expand Down
Loading