Skip to content

Commit 6b68521

Browse files
authored
Merge pull request #2035 from kube-logging/feat/axosyslog-api
feat: initial axosyslog api implementation
2 parents bfdb928 + eaf9ac6 commit 6b68521

File tree

11 files changed

+721
-10
lines changed

11 files changed

+721
-10
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.17.3
7+
{{- with .Values.annotations }}
8+
{{- toYaml . | nindent 4 }}
9+
{{- end }}
10+
name: axosyslogs.logging.banzaicloud.io
11+
spec:
12+
group: logging.banzaicloud.io
13+
names:
14+
categories:
15+
- logging-all
16+
kind: AxoSyslog
17+
listKind: AxoSyslogList
18+
plural: axosyslogs
19+
singular: axosyslog
20+
scope: Namespaced
21+
versions:
22+
- additionalPrinterColumns:
23+
- description: Number of problems
24+
jsonPath: .status.problemsCount
25+
name: Problems
26+
type: integer
27+
name: v1beta1
28+
schema:
29+
openAPIV3Schema:
30+
properties:
31+
apiVersion:
32+
type: string
33+
kind:
34+
type: string
35+
metadata:
36+
type: object
37+
spec:
38+
properties:
39+
destinations:
40+
items:
41+
properties:
42+
config:
43+
type: string
44+
name:
45+
type: string
46+
type: object
47+
type: array
48+
logPaths:
49+
items:
50+
properties:
51+
destination:
52+
type: string
53+
filterx:
54+
type: string
55+
type: object
56+
type: array
57+
type: object
58+
status:
59+
properties:
60+
problems:
61+
items:
62+
type: string
63+
type: array
64+
problemsCount:
65+
type: integer
66+
sources:
67+
items:
68+
properties:
69+
otlp:
70+
properties:
71+
endpoint:
72+
type: string
73+
type: object
74+
type: object
75+
type: array
76+
type: object
77+
type: object
78+
served: true
79+
storage: true
80+
subresources:
81+
status: {}
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.17.3
7+
name: axosyslogs.logging.banzaicloud.io
8+
spec:
9+
group: logging.banzaicloud.io
10+
names:
11+
categories:
12+
- logging-all
13+
kind: AxoSyslog
14+
listKind: AxoSyslogList
15+
plural: axosyslogs
16+
singular: axosyslog
17+
scope: Namespaced
18+
versions:
19+
- additionalPrinterColumns:
20+
- description: Number of problems
21+
jsonPath: .status.problemsCount
22+
name: Problems
23+
type: integer
24+
name: v1beta1
25+
schema:
26+
openAPIV3Schema:
27+
properties:
28+
apiVersion:
29+
type: string
30+
kind:
31+
type: string
32+
metadata:
33+
type: object
34+
spec:
35+
properties:
36+
destinations:
37+
items:
38+
properties:
39+
config:
40+
type: string
41+
name:
42+
type: string
43+
type: object
44+
type: array
45+
logPaths:
46+
items:
47+
properties:
48+
destination:
49+
type: string
50+
filterx:
51+
type: string
52+
type: object
53+
type: array
54+
type: object
55+
status:
56+
properties:
57+
problems:
58+
items:
59+
type: string
60+
type: array
61+
problemsCount:
62+
type: integer
63+
sources:
64+
items:
65+
properties:
66+
otlp:
67+
properties:
68+
endpoint:
69+
type: string
70+
type: object
71+
type: object
72+
type: array
73+
type: object
74+
type: object
75+
served: true
76+
storage: true
77+
subresources:
78+
status: {}

charts/logging-operator/templates/clusterrole.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,7 @@ rules:
156156
- apiGroups:
157157
- logging.banzaicloud.io
158158
resources:
159+
- axosyslogs
159160
- clusterflows
160161
- clusteroutputs
161162
- flows
@@ -181,6 +182,7 @@ rules:
181182
- apiGroups:
182183
- logging.banzaicloud.io
183184
resources:
185+
- axosyslogs/status
184186
- clusterflows/status
185187
- clusteroutputs/status
186188
- flows/status
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
---
2+
apiVersion: apiextensions.k8s.io/v1
3+
kind: CustomResourceDefinition
4+
metadata:
5+
annotations:
6+
controller-gen.kubebuilder.io/version: v0.17.3
7+
name: axosyslogs.logging.banzaicloud.io
8+
spec:
9+
group: logging.banzaicloud.io
10+
names:
11+
categories:
12+
- logging-all
13+
kind: AxoSyslog
14+
listKind: AxoSyslogList
15+
plural: axosyslogs
16+
singular: axosyslog
17+
scope: Namespaced
18+
versions:
19+
- additionalPrinterColumns:
20+
- description: Number of problems
21+
jsonPath: .status.problemsCount
22+
name: Problems
23+
type: integer
24+
name: v1beta1
25+
schema:
26+
openAPIV3Schema:
27+
properties:
28+
apiVersion:
29+
type: string
30+
kind:
31+
type: string
32+
metadata:
33+
type: object
34+
spec:
35+
properties:
36+
destinations:
37+
items:
38+
properties:
39+
config:
40+
type: string
41+
name:
42+
type: string
43+
type: object
44+
type: array
45+
logPaths:
46+
items:
47+
properties:
48+
destination:
49+
type: string
50+
filterx:
51+
type: string
52+
type: object
53+
type: array
54+
type: object
55+
status:
56+
properties:
57+
problems:
58+
items:
59+
type: string
60+
type: array
61+
problemsCount:
62+
type: integer
63+
sources:
64+
items:
65+
properties:
66+
otlp:
67+
properties:
68+
endpoint:
69+
type: string
70+
type: object
71+
type: object
72+
type: array
73+
type: object
74+
type: object
75+
served: true
76+
storage: true
77+
subresources:
78+
status: {}

config/rbac/role.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -149,6 +149,7 @@ rules:
149149
- apiGroups:
150150
- logging.banzaicloud.io
151151
resources:
152+
- axosyslogs
152153
- clusterflows
153154
- clusteroutputs
154155
- flows
@@ -174,6 +175,7 @@ rules:
174175
- apiGroups:
175176
- logging.banzaicloud.io
176177
resources:
178+
- axosyslogs/status
177179
- clusterflows/status
178180
- clusteroutputs/status
179181
- flows/status
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
// Copyright © 2025 Kube logging authors
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
package controllers
16+
17+
import (
18+
"context"
19+
20+
"github.com/go-logr/logr"
21+
ctrl "sigs.k8s.io/controller-runtime"
22+
"sigs.k8s.io/controller-runtime/pkg/client"
23+
24+
"github.com/kube-logging/logging-operator/pkg/sdk/logging/api/v1beta1"
25+
)
26+
27+
// NewAxoSyslogReconciler creates a new AxoSyslogReconciler instance
28+
func NewAxoSyslogReconciler(client client.Client, log logr.Logger) *AxoSyslogReconciler {
29+
return &AxoSyslogReconciler{
30+
Client: client,
31+
Log: log,
32+
}
33+
}
34+
35+
type AxoSyslogReconciler struct {
36+
client.Client
37+
Log logr.Logger
38+
}
39+
40+
// +kubebuilder:rbac:groups=logging.banzaicloud.io,resources=axosyslogs,verbs=get;list;watch;create;update;patch;delete
41+
// +kubebuilder:rbac:groups=logging.banzaicloud.io,resources=axosyslogs/status,verbs=get;update;patch
42+
// +kubebuilder:rbac:groups="",resources=configmaps;secrets,verbs=get;list;watch;create;update;patch;delete
43+
// +kubebuilder:rbac:groups=apps,resources=statefulsets,verbs=get;list;watch;create;update;patch;delete
44+
// +kubebuilder:rbac:groups="",resources=services;persistentvolumeclaims;serviceaccounts;pods,verbs=get;list;watch;create;update;patch;delete
45+
// +kubebuilder:rbac:groups="rbac.authorization.k8s.io",resources=clusterroles;clusterrolebindings;roles;rolebindings,verbs=get;list;watch;create;update;patch;delete
46+
47+
// Reconciles axosyslog resource
48+
func (r *AxoSyslogReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) {
49+
log := r.Log.WithValues("axosyslog", req.NamespacedName)
50+
51+
log.V(1).Info("Reconciling AxoSyslog")
52+
53+
var axosyslog v1beta1.AxoSyslog
54+
if err := r.Get(ctx, req.NamespacedName, &axosyslog); err != nil {
55+
return ctrl.Result{}, client.IgnoreNotFound(err)
56+
}
57+
58+
if err := axosyslog.SetDefaults(); err != nil {
59+
return ctrl.Result{}, err
60+
}
61+
62+
return ctrl.Result{}, nil
63+
}
64+
65+
func SetupAxoSyslogWithManager(mgr ctrl.Manager, logger logr.Logger) error {
66+
return ctrl.NewControllerManagedBy(mgr).
67+
For(&v1beta1.AxoSyslog{}).
68+
Named("AxoSyslogController").
69+
Complete(NewAxoSyslogReconciler(mgr.GetClient(), logger))
70+
}

docs/configuration/crds/v1beta1/_index.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ For more information please click on the name
1212
| **[](../extensions/v1alpha1/filetailer/)** | | extensions |
1313
| **[HostTailer](../extensions/v1alpha1/hosttailer_types/)** | HostTailer's main goal is to tail custom files and transmit their changes to stdout. This way the logging-operator is able to process them. | extensions |
1414
| **[](../extensions/v1alpha1/systemdtailer/)** | | extensions |
15+
| **[AxoSyslog](axosyslog_types/)** | | v1beta1 |
1516
| **[ClusterFlow](clusterflow_types/)** | ClusterFlow is the Schema for the clusterflows API | v1beta1 |
1617
| **[ClusterOutput](clusteroutput_types/)** | ClusterOutput is the Schema for the clusteroutputs API | v1beta1 |
1718
| **[Common](common_types/)** | ImageSpec Metrics Security | v1beta1 |

0 commit comments

Comments
 (0)