Skip to content

Commit a3ca4c9

Browse files
solidDoWantcw-Guo
authored andcommitted
Added the ability to specify Fluentd service type
Signed-off-by: Fred Heinecke <[email protected]>
1 parent 7582c38 commit a3ca4c9

File tree

8 files changed

+47
-1
lines changed

8 files changed

+47
-1
lines changed

apis/fluentd/v1alpha1/fluentd_types.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ type FluentDService struct {
131131
Annotations map[string]string `json:"annotations,omitempty"`
132132
// Labels to add to each FluentD service
133133
Labels map[string]string `json:"labels,omitempty"`
134+
// Type is the service type to deploy.
135+
// +kubebuilder:validation:Enum:=ClusterIP;NodePort;LoadBalancer;ExternalName
136+
Type *corev1.ServiceType `json:"type,omitempty"`
134137
}
135138

136139
type BufferVolume struct {

apis/fluentd/v1alpha1/zz_generated.deepcopy.go

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

charts/fluent-operator/charts/fluentd-crds/crds/fluentd.fluent.io_fluentds.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5336,6 +5336,14 @@ spec:
53365336
name:
53375337
description: Name is the name of the FluentD service.
53385338
type: string
5339+
type:
5340+
description: Type is the service type to deploy.
5341+
enum:
5342+
- ClusterIP
5343+
- NodePort
5344+
- LoadBalancer
5345+
- ExternalName
5346+
type: string
53395347
type: object
53405348
serviceAccountAnnotations:
53415349
additionalProperties:

config/crd/bases/fluentd.fluent.io_fluentds.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5336,6 +5336,14 @@ spec:
53365336
name:
53375337
description: Name is the name of the FluentD service.
53385338
type: string
5339+
type:
5340+
description: Type is the service type to deploy.
5341+
enum:
5342+
- ClusterIP
5343+
- NodePort
5344+
- LoadBalancer
5345+
- ExternalName
5346+
type: string
53395347
type: object
53405348
serviceAccountAnnotations:
53415349
additionalProperties:

docs/fluentd.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ FluentDService the service of the FluentD
241241
| name | Name is the name of the FluentD service. | string |
242242
| annotations | Annotations to add to each FluentD service. | map[string]string |
243243
| labels | Labels to add to each FluentD service | map[string]string |
244+
| type | Type is the service type to deploy. | *[corev1.ServiceType](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.31/#servicetype-v1-core) |
244245

245246
[Back to TOC](#table-of-contents)
246247
# Fluentd

manifests/setup/fluent-operator-crd.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29570,6 +29570,14 @@ spec:
2957029570
name:
2957129571
description: Name is the name of the FluentD service.
2957229572
type: string
29573+
type:
29574+
description: Type is the service type to deploy.
29575+
enum:
29576+
- ClusterIP
29577+
- NodePort
29578+
- LoadBalancer
29579+
- ExternalName
29580+
type: string
2957329581
type: object
2957429582
serviceAccountAnnotations:
2957529583
additionalProperties:

manifests/setup/setup.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29570,6 +29570,14 @@ spec:
2957029570
name:
2957129571
description: Name is the name of the FluentD service.
2957229572
type: string
29573+
type:
29574+
description: Type is the service type to deploy.
29575+
enum:
29576+
- ClusterIP
29577+
- NodePort
29578+
- LoadBalancer
29579+
- ExternalName
29580+
type: string
2957329581
type: object
2957429582
serviceAccountAnnotations:
2957529583
additionalProperties:

pkg/operator/fluentd-service.go

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,11 @@ func MakeFluentdService(fd fluentdv1alpha1.Fluentd) *corev1.Service {
3333
}
3434
}
3535

36+
serviceType := corev1.ServiceTypeClusterIP
37+
if fd.Spec.Service.Type != nil {
38+
serviceType = *fd.Spec.Service.Type
39+
}
40+
3641
svc := corev1.Service{
3742
ObjectMeta: metav1.ObjectMeta{
3843
Name: name,
@@ -41,7 +46,7 @@ func MakeFluentdService(fd fluentdv1alpha1.Fluentd) *corev1.Service {
4146
},
4247
Spec: corev1.ServiceSpec{
4348
Selector: labels,
44-
Type: corev1.ServiceTypeClusterIP,
49+
Type: serviceType,
4550
},
4651
}
4752

0 commit comments

Comments
 (0)