Skip to content

Commit 7b1ca8d

Browse files
authored
operator: Move cli flags to component config (grafana#6433)
1 parent 4f4b42b commit 7b1ca8d

File tree

98 files changed

+563
-187
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

98 files changed

+563
-187
lines changed

operator/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
## Main
22

33
- [6411](https://github.com/grafana/loki/pull/6411) **Red-GV**: Extend schema validation in LokiStack webhook
4+
- [6334](https://github.com/grafana/loki/pull/6433) **periklis**: Move operator cli flags to component config
45
- [6224](https://github.com/grafana/loki/pull/6224) **periklis**: Add support for GRPC over TLS for Loki components
56
- [5952](https://github.com/grafana/loki/pull/5952) **Red-GV**: Add api to change storage schema version
67
- [6363](https://github.com/grafana/loki/pull/6363) **periklis**: Allow optional installation of webhooks (Kind)

operator/Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ RUN go mod download
1111

1212
# Copy the go source
1313
COPY main.go main.go
14-
COPY api/ api/
14+
COPY apis/ apis/
1515
COPY controllers/ controllers/
1616
COPY internal/ internal/
1717

operator/PROJECT

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
componentConfig: true
12
domain: grafana.com
23
layout:
34
- go.kubebuilder.io/v3
5+
multigroup: true
46
plugins:
57
manifests.sdk.operatorframework.io/v2: {}
68
scorecard.sdk.operatorframework.io/v2: {}
@@ -14,7 +16,7 @@ resources:
1416
domain: grafana.com
1517
group: loki
1618
kind: LokiStack
17-
path: github.com/grafana/loki/operator/api/v1beta1
19+
path: github.com/grafana/loki/operator/apis/loki/v1beta1
1820
version: v1beta1
1921
- api:
2022
crdVersion: v1
@@ -23,7 +25,7 @@ resources:
2325
domain: grafana.com
2426
group: loki
2527
kind: AlertingRule
26-
path: github.com/grafana/loki/operator/api/v1beta1
28+
path: github.com/grafana/loki/operator/apis/loki/v1beta1
2729
version: v1beta1
2830
webhooks:
2931
validation: true
@@ -35,7 +37,7 @@ resources:
3537
domain: grafana.com
3638
group: loki
3739
kind: RecordingRule
38-
path: github.com/grafana/loki/operator/api/v1beta1
40+
path: github.com/grafana/loki/operator/apis/loki/v1beta1
3941
version: v1beta1
4042
webhooks:
4143
validation: true
@@ -47,6 +49,6 @@ resources:
4749
domain: grafana.com
4850
group: loki
4951
kind: RulerConfig
50-
path: github.com/grafana/loki/operator/api/v1beta1
52+
path: github.com/grafana/loki/operator/apis/loki/v1beta1
5153
version: v1beta1
5254
version: "3"
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Package v1 contains API Schema definitions for the config v1 API group
2+
//+kubebuilder:object:generate=true
3+
//+groupName=config.loki.grafana.com
4+
package v1
5+
6+
import (
7+
"k8s.io/apimachinery/pkg/runtime/schema"
8+
"sigs.k8s.io/controller-runtime/pkg/scheme"
9+
)
10+
11+
var (
12+
// GroupVersion is group version used to register these objects
13+
GroupVersion = schema.GroupVersion{Group: "config.loki.grafana.com", Version: "v1"}
14+
15+
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
16+
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}
17+
18+
// AddToScheme adds the types in this group-version to the given scheme.
19+
AddToScheme = SchemeBuilder.AddToScheme
20+
)
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
package v1
2+
3+
import (
4+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
5+
cfg "sigs.k8s.io/controller-runtime/pkg/config/v1alpha1"
6+
)
7+
8+
// FeatureFlags is a set of operator feature flags.
9+
type FeatureFlags struct {
10+
EnableCertificateSigningService bool `json:"enableCertSigningService,omitempty"`
11+
EnableServiceMonitors bool `json:"enableServiceMonitors,omitempty"`
12+
EnableTLSServiceMonitorConfig bool `json:"enableTlsServiceMonitorConfig,omitempty"`
13+
EnableTLSGRPCServices bool `json:"enableTlsGrpcServices,omitempty"`
14+
EnablePrometheusAlerts bool `json:"enableLokiStackAlerts,omitempty"`
15+
EnableGateway bool `json:"enableLokiStackGateway,omitempty"`
16+
EnableGatewayRoute bool `json:"enableLokiStackGatewayRoute,omitempty"`
17+
EnableGrafanaLabsStats bool `json:"enableGrafanaLabsStats,omitempty"`
18+
EnableLokiStackWebhook bool `json:"enableLokiStackWebhook,omitempty"`
19+
EnableAlertingRuleWebhook bool `json:"enableAlertingRuleWebhook,omitempty"`
20+
EnableRecordingRuleWebhook bool `json:"enableRecordingRuleWebhook,omitempty"`
21+
}
22+
23+
//+kubebuilder:object:root=true
24+
25+
// ProjectConfig is the Schema for the projectconfigs API
26+
type ProjectConfig struct {
27+
metav1.TypeMeta `json:",inline"`
28+
29+
// ControllerManagerConfigurationSpec returns the contfigurations for controllers
30+
cfg.ControllerManagerConfigurationSpec `json:",inline"`
31+
32+
Flags FeatureFlags `json:"featureFlags,omitempty"`
33+
}
34+
35+
func init() {
36+
SchemeBuilder.Register(&ProjectConfig{})
37+
}

operator/apis/config/v1/zz_generated.deepcopy.go

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

operator/api/v1beta1/alertingrule_webhook_test.go renamed to operator/apis/loki/v1beta1/alertingrule_webhook_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package v1beta1_test
33
import (
44
"testing"
55

6-
"github.com/grafana/loki/operator/api/v1beta1"
6+
"github.com/grafana/loki/operator/apis/loki/v1beta1"
77
"github.com/stretchr/testify/require"
88

99
apierrors "k8s.io/apimachinery/pkg/api/errors"

0 commit comments

Comments
 (0)