Skip to content

Commit

Permalink
feat: explicit image overrides for syslog-ng containers
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Wilcsinszky <[email protected]>
  • Loading branch information
pepov committed Sep 27, 2024
1 parent 922a9ec commit fcf8e37
Show file tree
Hide file tree
Showing 12 changed files with 246 additions and 35 deletions.
28 changes: 28 additions & 0 deletions charts/logging-operator/crds/logging.banzaicloud.io_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13020,6 +13020,13 @@ spec:
timeout:
type: string
type: object
bufferVolumeMetricsImage:
properties:
repository:
type: string
tag:
type: string
type: object
bufferVolumeMetricsService:
properties:
metadata:
Expand Down Expand Up @@ -16664,6 +16671,13 @@ spec:
type: object
type: array
type: object
configReloadImage:
properties:
repository:
type: string
tag:
type: string
type: object
globalOptions:
properties:
log_level:
Expand Down Expand Up @@ -16938,6 +16952,13 @@ spec:
timeout:
type: string
type: object
metricsExporterImage:
properties:
repository:
type: string
tag:
type: string
type: object
metricsService:
properties:
metadata:
Expand Down Expand Up @@ -20962,6 +20983,13 @@ spec:
type: array
type: object
type: object
syslogNGImage:
properties:
repository:
type: string
tag:
type: string
type: object
tls:
properties:
enabled:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ spec:
timeout:
type: string
type: object
bufferVolumeMetricsImage:
properties:
repository:
type: string
tag:
type: string
type: object
bufferVolumeMetricsService:
properties:
metadata:
Expand Down Expand Up @@ -3924,6 +3931,13 @@ spec:
type: object
type: array
type: object
configReloadImage:
properties:
repository:
type: string
tag:
type: string
type: object
globalOptions:
properties:
log_level:
Expand Down Expand Up @@ -4198,6 +4212,13 @@ spec:
timeout:
type: string
type: object
metricsExporterImage:
properties:
repository:
type: string
tag:
type: string
type: object
metricsService:
properties:
metadata:
Expand Down Expand Up @@ -8222,6 +8243,13 @@ spec:
type: array
type: object
type: object
syslogNGImage:
properties:
repository:
type: string
tag:
type: string
type: object
tls:
properties:
enabled:
Expand Down
28 changes: 28 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_loggings.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13020,6 +13020,13 @@ spec:
timeout:
type: string
type: object
bufferVolumeMetricsImage:
properties:
repository:
type: string
tag:
type: string
type: object
bufferVolumeMetricsService:
properties:
metadata:
Expand Down Expand Up @@ -16664,6 +16671,13 @@ spec:
type: object
type: array
type: object
configReloadImage:
properties:
repository:
type: string
tag:
type: string
type: object
globalOptions:
properties:
log_level:
Expand Down Expand Up @@ -16938,6 +16952,13 @@ spec:
timeout:
type: string
type: object
metricsExporterImage:
properties:
repository:
type: string
tag:
type: string
type: object
metricsService:
properties:
metadata:
Expand Down Expand Up @@ -20962,6 +20983,13 @@ spec:
type: array
type: object
type: object
syslogNGImage:
properties:
repository:
type: string
tag:
type: string
type: object
tls:
properties:
enabled:
Expand Down
28 changes: 28 additions & 0 deletions config/crd/bases/logging.banzaicloud.io_syslogngconfigs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,13 @@ spec:
timeout:
type: string
type: object
bufferVolumeMetricsImage:
properties:
repository:
type: string
tag:
type: string
type: object
bufferVolumeMetricsService:
properties:
metadata:
Expand Down Expand Up @@ -3924,6 +3931,13 @@ spec:
type: object
type: array
type: object
configReloadImage:
properties:
repository:
type: string
tag:
type: string
type: object
globalOptions:
properties:
log_level:
Expand Down Expand Up @@ -4198,6 +4212,13 @@ spec:
timeout:
type: string
type: object
metricsExporterImage:
properties:
repository:
type: string
tag:
type: string
type: object
metricsService:
properties:
metadata:
Expand Down Expand Up @@ -8222,6 +8243,13 @@ spec:
type: array
type: object
type: object
syslogNGImage:
properties:
repository:
type: string
tag:
type: string
type: object
tls:
properties:
enabled:
Expand Down
11 changes: 11 additions & 0 deletions docs/configuration/crds/v1beta1/common_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,17 @@ weight: 200
generated_file: true
---

## BasicImageSpec

BasicImageSpec struct hold basic information about image specification

### repository (string, optional) {#basicimagespec-repository}


### tag (string, optional) {#basicimagespec-tag}



## ImageSpec

ImageSpec struct hold information about image specification
Expand Down
12 changes: 12 additions & 0 deletions docs/configuration/crds/v1beta1/syslogng_types.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ SyslogNGSpec defines the desired state of SyslogNG
### bufferVolumeMetrics (*BufferMetrics, optional) {#syslogngspec-buffervolumemetrics}


### bufferVolumeMetricsImage (*BasicImageSpec, optional) {#syslogngspec-buffervolumemetricsimage}


### bufferVolumeMetricsService (*typeoverride.Service, optional) {#syslogngspec-buffervolumemetricsservice}


Expand All @@ -22,6 +25,9 @@ Overrides the default logging level configCheck setup. This field is not used di
### configCheckPod (*typeoverride.PodSpec, optional) {#syslogngspec-configcheckpod}


### configReloadImage (*BasicImageSpec, optional) {#syslogngspec-configreloadimage}


### globalOptions (*GlobalOptions, optional) {#syslogngspec-globaloptions}


Expand All @@ -42,6 +48,9 @@ Available in Logging operator version 4.5 and later. Set the maximum number of c
### metrics (*Metrics, optional) {#syslogngspec-metrics}


### metricsExporterImage (*BasicImageSpec, optional) {#syslogngspec-metricsexporterimage}


### metricsService (*typeoverride.Service, optional) {#syslogngspec-metricsservice}


Expand Down Expand Up @@ -70,6 +79,9 @@ Available in Logging operator version 4.5 and later. Create [custom log metrics
### statefulSet (*typeoverride.StatefulSet, optional) {#syslogngspec-statefulset}


### syslogNGImage (*BasicImageSpec, optional) {#syslogngspec-syslogngimage}


### tls (SyslogNGTLS, optional) {#syslogngspec-tls}


Expand Down
2 changes: 1 addition & 1 deletion pkg/resources/syslogng/configcheck.go
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ func (r *Reconciler) newCheckPod(hashKey string) (*corev1.Pod, error) {
Containers: []corev1.Container{
{
Name: "syslog-ng",
Image: v1beta1.RepositoryWithTag(syslogngImageRepository, syslogngImageTag),
Image: r.syslogNGSpec.SyslogNGImage.RepositoryWithTag(),
ImagePullPolicy: corev1.PullIfNotPresent,
Command: containerCommand,
Args: containerArgs,
Expand Down
8 changes: 4 additions & 4 deletions pkg/resources/syslogng/statefulset.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ func (r *Reconciler) statefulset() (runtime.Object, reconciler.DesiredState, err
func syslogNGContainer(spec *v1beta1.SyslogNGSpec) corev1.Container {
return corev1.Container{
Name: ContainerName,
Image: v1beta1.RepositoryWithTag(syslogngImageRepository, syslogngImageTag),
Image: spec.SyslogNGImage.RepositoryWithTag(),
ImagePullPolicy: corev1.PullIfNotPresent,
Ports: []corev1.ContainerPort{{
Name: "syslog-ng-tcp",
Expand Down Expand Up @@ -232,7 +232,7 @@ func (r *Reconciler) syslogNGMetricsSidecarContainer() *corev1.Container {
return &corev1.Container{
Name: "exporter",
ImagePullPolicy: corev1.PullIfNotPresent,
Image: v1beta1.RepositoryWithTag(prometheusExporterImageRepository, prometheusExporterImageTag),
Image: r.syslogNGSpec.MetricsExporterImage.RepositoryWithTag(),
Ports: []corev1.ContainerPort{
{
Name: metricsPortName,
Expand Down Expand Up @@ -269,7 +269,7 @@ func (r *Reconciler) bufferMetricsSidecarContainer() *corev1.Container {

return &corev1.Container{
Name: "buffer-metrics-sidecar",
Image: v1beta1.RepositoryWithTag(bufferVolumeImageRepository, bufferVolumeImageTag),
Image: r.syslogNGSpec.BufferVolumeMetricsImage.RepositoryWithTag(),
ImagePullPolicy: corev1.PullIfNotPresent,
Args: []string{
"--port", "7358",
Expand Down Expand Up @@ -366,7 +366,7 @@ func configReloadContainer(spec *v1beta1.SyslogNGSpec) corev1.Container {
// TODO: ADD TLS reload watch
container := corev1.Container{
Name: "config-reloader",
Image: v1beta1.RepositoryWithTag(configReloaderImageRepository, configReloaderImageTag),
Image: spec.ConfigReloadImage.RepositoryWithTag(),
ImagePullPolicy: corev1.PullIfNotPresent,
Args: []string{
"-cfgjson",
Expand Down
52 changes: 22 additions & 30 deletions pkg/resources/syslogng/syslogng.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,36 +36,28 @@ import (
)

const (
ServiceName = "syslog-ng"
ServicePort = 601
configSecretName = "syslog-ng"
configKey = "syslog-ng.conf"
StatefulSetName = "syslog-ng"
outputSecretName = "syslog-ng-output"
OutputSecretPath = "/etc/syslog-ng/secret"
BufferPath = "/buffers"
serviceAccountName = "syslog-ng"
roleBindingName = "syslog-ng"
roleName = "syslog-ng"
clusterRoleBindingName = "syslog-ng"
clusterRoleName = "syslog-ng"
ContainerName = "syslog-ng"
defaultBufferVolumeMetricsPort = 9200
syslogngImageRepository = "ghcr.io/axoflow/axosyslog"
syslogngImageTag = "4.8.1-1"
prometheusExporterImageRepository = "ghcr.io/axoflow/axosyslog-metrics-exporter"
prometheusExporterImageTag = "0.0.7"
bufferVolumeImageRepository = "ghcr.io/kube-logging/node-exporter"
bufferVolumeImageTag = "v0.8.0"
configReloaderImageRepository = "ghcr.io/kube-logging/syslogng-reload"
configReloaderImageTag = "v1.5.0"
socketVolumeName = "socket"
socketPath = "/tmp/syslog-ng/syslog-ng.ctl"
configDir = "/etc/syslog-ng/config"
configVolumeName = "config"
tlsVolumeName = "tls"
metricsPortNumber = 9577
metricsPortName = "exporter"
ServiceName = "syslog-ng"
ServicePort = 601
configSecretName = "syslog-ng"
configKey = "syslog-ng.conf"
StatefulSetName = "syslog-ng"
outputSecretName = "syslog-ng-output"
OutputSecretPath = "/etc/syslog-ng/secret"
BufferPath = "/buffers"
serviceAccountName = "syslog-ng"
roleBindingName = "syslog-ng"
roleName = "syslog-ng"
clusterRoleBindingName = "syslog-ng"
clusterRoleName = "syslog-ng"
ContainerName = "syslog-ng"
defaultBufferVolumeMetricsPort = 9200
socketVolumeName = "socket"
socketPath = "/tmp/syslog-ng/syslog-ng.ctl"
configDir = "/etc/syslog-ng/config"
configVolumeName = "config"
tlsVolumeName = "tls"
metricsPortNumber = 9577
metricsPortName = "exporter"
)

// Reconciler holds info what resource to reconcile
Expand Down
Loading

0 comments on commit fcf8e37

Please sign in to comment.