operator: Upgrade k8s.io, sigs.k8s.io and openshift deps (#11718)

pull/11513/head^2
Periklis Tsirakidis 2 years ago committed by GitHub
parent 0ed536cd7a
commit 71d3ab8c54
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 1
      operator/CHANGELOG.md
  2. 2
      operator/apis/loki/go.mod
  3. 4
      operator/apis/loki/go.sum
  4. 218
      operator/apis/loki/v1beta1/rulerconfig_types_test.go
  5. 2
      operator/bundle/community-openshift/manifests/loki-operator.clusterserviceversion.yaml
  6. 2
      operator/bundle/community/manifests/loki-operator.clusterserviceversion.yaml
  7. 2
      operator/bundle/openshift/manifests/loki-operator.clusterserviceversion.yaml
  8. 63
      operator/go.mod
  9. 872
      operator/go.sum
  10. 32
      operator/internal/config/options.go
  11. 2
      operator/internal/handlers/dashboards_create.go
  12. 6
      operator/internal/handlers/lokistack_check_cert_expiry_test.go
  13. 14
      operator/internal/handlers/lokistack_create_or_update_test.go
  14. 14
      operator/internal/handlers/lokistack_rotate_certs_test.go
  15. 8
      operator/internal/manifests/compactor.go
  16. 86
      operator/internal/manifests/config_test.go
  17. 4
      operator/internal/manifests/distributor.go
  18. 6
      operator/internal/manifests/gateway.go
  19. 8
      operator/internal/manifests/indexgateway.go
  20. 10
      operator/internal/manifests/ingester.go
  21. 22
      operator/internal/manifests/internal/config/build_test.go
  22. 24
      operator/internal/manifests/mutate_test.go
  23. 6
      operator/internal/manifests/openshift/configure.go
  24. 4
      operator/internal/manifests/openshift/route.go
  25. 4
      operator/internal/manifests/openshift/serviceaccount.go
  26. 4
      operator/internal/manifests/querier.go
  27. 4
      operator/internal/manifests/query-frontend.go
  28. 10
      operator/internal/manifests/ruler.go
  29. 6
      operator/internal/manifests/securitycontext.go
  30. 4
      operator/internal/manifests/serviceaccount.go
  31. 4
      operator/internal/manifests/storage/configure.go
  32. 6
      operator/internal/manifests/storage/configure_test.go
  33. 8
      operator/internal/manifests/storage/var.go
  34. 5
      operator/internal/manifests/var.go
  35. 30
      operator/internal/validation/rulerconfig_test.go
  36. 28
      operator/main.go

@ -1,5 +1,6 @@
## Main
- [11718](https://github.com/grafana/loki/pull/11718) **periklis**: Upgrade k8s.io, sigs.k8s.io and openshift deps
- [11671](https://github.com/grafana/loki/pull/11671) **JoaoBraveCoding**: Update mixins to fix structured metadata dashboards
- [11624](https://github.com/grafana/loki/pull/11624) **xperimental**: React to changes in ConfigMap used for storage CA
- [11481](https://github.com/grafana/loki/pull/11481) **JoaoBraveCoding**: Adds AWS STS support

@ -6,7 +6,7 @@ require (
github.com/stretchr/testify v1.8.2
k8s.io/api v0.26.9
k8s.io/apimachinery v0.26.9
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
sigs.k8s.io/controller-runtime v0.14.5
)

@ -82,8 +82,8 @@ k8s.io/apimachinery v0.26.9 h1:5yAV9cFR7Z4gIorKcAjWnx4uxtxiFsERwq4Pvmx0CCg=
k8s.io/apimachinery v0.26.9/go.mod h1:qYzLkrQ9lhrZRh0jNKo2cfvf/R1/kQONnSiyB7NUJU0=
k8s.io/klog/v2 v2.80.1 h1:atnLQ121W371wYYFawwYx1aEY2eUfs4l3J72wtgAwV4=
k8s.io/klog/v2 v2.80.1/go.mod h1:y1WjHnz7Dj687irZUWR/WLkLc5N1YHtjLdmgWjndZn0=
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749 h1:xMMXJlJbsU8w3V5N2FLDQ8YgU8s1EoULdbQBcAeNJkY=
k8s.io/utils v0.0.0-20230313181309-38a27ef9d749/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e h1:eQ/4ljkx21sObifjzXwlPKpdGLrCfRziVtos3ofG/sQ=
k8s.io/utils v0.0.0-20240102154912-e7106e64919e/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
sigs.k8s.io/controller-runtime v0.14.5 h1:6xaWFqzT5KuAQ9ufgUaj1G/+C4Y1GRkhrxl+BJ9i+5s=
sigs.k8s.io/controller-runtime v0.14.5/go.mod h1:WqIdsAY6JBsjfc/CqO0CORmNtoCtE4S6qbPc9s68h+0=
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 h1:iXTIw73aPyC+oRdyqqvVJuloN1p0AC/kzH07hu3NE+k=

@ -7,7 +7,7 @@ import (
"github.com/grafana/loki/operator/apis/loki/v1beta1"
"github.com/stretchr/testify/require"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)
func TestConvertToV1_RulerConfig(t *testing.T) {
@ -79,19 +79,19 @@ func TestConvertToV1_RulerConfig(t *testing.T) {
},
Client: &v1beta1.AlertManagerClientConfig{
TLS: &v1beta1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path"),
ServerName: pointer.String("server"),
CertPath: pointer.String("/tls/cert/path"),
KeyPath: pointer.String("/tls/key/path"),
CAPath: ptr.To("/tls/ca/path"),
ServerName: ptr.To("server"),
CertPath: ptr.To("/tls/cert/path"),
KeyPath: ptr.To("/tls/key/path"),
},
HeaderAuth: &v1beta1.AlertManagerClientHeaderAuth{
Type: pointer.String("type"),
Credentials: pointer.String("creds"),
CredentialsFile: pointer.String("creds-file"),
Type: ptr.To("type"),
Credentials: ptr.To("creds"),
CredentialsFile: ptr.To("creds-file"),
},
BasicAuth: &v1beta1.AlertManagerClientBasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
},
},
@ -175,19 +175,19 @@ func TestConvertToV1_RulerConfig(t *testing.T) {
},
Client: &v1beta1.AlertManagerClientConfig{
TLS: &v1beta1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1beta1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1beta1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},
@ -234,19 +234,19 @@ func TestConvertToV1_RulerConfig(t *testing.T) {
},
Client: &v1beta1.AlertManagerClientConfig{
TLS: &v1beta1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1beta1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1beta1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},
@ -322,19 +322,19 @@ func TestConvertToV1_RulerConfig(t *testing.T) {
},
Client: &v1.AlertManagerClientConfig{
TLS: &v1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path"),
ServerName: pointer.String("server"),
CertPath: pointer.String("/tls/cert/path"),
KeyPath: pointer.String("/tls/key/path"),
CAPath: ptr.To("/tls/ca/path"),
ServerName: ptr.To("server"),
CertPath: ptr.To("/tls/cert/path"),
KeyPath: ptr.To("/tls/key/path"),
},
HeaderAuth: &v1.AlertManagerClientHeaderAuth{
Type: pointer.String("type"),
Credentials: pointer.String("creds"),
CredentialsFile: pointer.String("creds-file"),
Type: ptr.To("type"),
Credentials: ptr.To("creds"),
CredentialsFile: ptr.To("creds-file"),
},
BasicAuth: &v1.AlertManagerClientBasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
},
},
@ -418,19 +418,19 @@ func TestConvertToV1_RulerConfig(t *testing.T) {
},
Client: &v1.AlertManagerClientConfig{
TLS: &v1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},
@ -477,19 +477,19 @@ func TestConvertToV1_RulerConfig(t *testing.T) {
},
Client: &v1.AlertManagerClientConfig{
TLS: &v1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},
@ -593,19 +593,19 @@ func TestConvertFromV1_RulerConfig(t *testing.T) {
},
Client: &v1.AlertManagerClientConfig{
TLS: &v1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path"),
ServerName: pointer.String("server"),
CertPath: pointer.String("/tls/cert/path"),
KeyPath: pointer.String("/tls/key/path"),
CAPath: ptr.To("/tls/ca/path"),
ServerName: ptr.To("server"),
CertPath: ptr.To("/tls/cert/path"),
KeyPath: ptr.To("/tls/key/path"),
},
HeaderAuth: &v1.AlertManagerClientHeaderAuth{
Type: pointer.String("type"),
Credentials: pointer.String("creds"),
CredentialsFile: pointer.String("creds-file"),
Type: ptr.To("type"),
Credentials: ptr.To("creds"),
CredentialsFile: ptr.To("creds-file"),
},
BasicAuth: &v1.AlertManagerClientBasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
},
},
@ -689,19 +689,19 @@ func TestConvertFromV1_RulerConfig(t *testing.T) {
},
Client: &v1.AlertManagerClientConfig{
TLS: &v1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},
@ -748,19 +748,19 @@ func TestConvertFromV1_RulerConfig(t *testing.T) {
},
Client: &v1.AlertManagerClientConfig{
TLS: &v1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},
@ -836,19 +836,19 @@ func TestConvertFromV1_RulerConfig(t *testing.T) {
},
Client: &v1beta1.AlertManagerClientConfig{
TLS: &v1beta1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path"),
ServerName: pointer.String("server"),
CertPath: pointer.String("/tls/cert/path"),
KeyPath: pointer.String("/tls/key/path"),
CAPath: ptr.To("/tls/ca/path"),
ServerName: ptr.To("server"),
CertPath: ptr.To("/tls/cert/path"),
KeyPath: ptr.To("/tls/key/path"),
},
HeaderAuth: &v1beta1.AlertManagerClientHeaderAuth{
Type: pointer.String("type"),
Credentials: pointer.String("creds"),
CredentialsFile: pointer.String("creds-file"),
Type: ptr.To("type"),
Credentials: ptr.To("creds"),
CredentialsFile: ptr.To("creds-file"),
},
BasicAuth: &v1beta1.AlertManagerClientBasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
},
},
@ -932,19 +932,19 @@ func TestConvertFromV1_RulerConfig(t *testing.T) {
},
Client: &v1beta1.AlertManagerClientConfig{
TLS: &v1beta1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1beta1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1beta1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},
@ -991,19 +991,19 @@ func TestConvertFromV1_RulerConfig(t *testing.T) {
},
Client: &v1beta1.AlertManagerClientConfig{
TLS: &v1beta1.AlertManagerClientTLSConfig{
CAPath: pointer.String("/tls/ca/path-1"),
ServerName: pointer.String("server-1"),
CertPath: pointer.String("/tls/cert/path-1"),
KeyPath: pointer.String("/tls/key/path-1"),
CAPath: ptr.To("/tls/ca/path-1"),
ServerName: ptr.To("server-1"),
CertPath: ptr.To("/tls/cert/path-1"),
KeyPath: ptr.To("/tls/key/path-1"),
},
HeaderAuth: &v1beta1.AlertManagerClientHeaderAuth{
Type: pointer.String("type-1"),
Credentials: pointer.String("creds-1"),
CredentialsFile: pointer.String("creds-file-1"),
Type: ptr.To("type-1"),
Credentials: ptr.To("creds-1"),
CredentialsFile: ptr.To("creds-file-1"),
},
BasicAuth: &v1beta1.AlertManagerClientBasicAuth{
Username: pointer.String("user-1"),
Password: pointer.String("pass-1"),
Username: ptr.To("user-1"),
Password: ptr.To("pass-1"),
},
},
},

@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: docker.io/grafana/loki-operator:0.5.0
createdAt: "2024-01-10T18:25:00Z"
createdAt: "2024-01-19T14:20:59Z"
description: The Community Loki Operator provides Kubernetes native deployment
and management of Loki and related logging components.
features.operators.openshift.io/disconnected: "true"

@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: docker.io/grafana/loki-operator:0.5.0
createdAt: "2024-01-10T18:24:59Z"
createdAt: "2024-01-19T14:20:57Z"
description: The Community Loki Operator provides Kubernetes native deployment
and management of Loki and related logging components.
operators.operatorframework.io/builder: operator-sdk-unknown

@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: quay.io/openshift-logging/loki-operator:0.1.0
createdAt: "2024-01-10T18:25:02Z"
createdAt: "2024-01-19T14:21:01Z"
description: |
The Loki Operator for OCP provides a means for configuring and managing a Loki stack for cluster logging.
## Prerequisites and Requirements

@ -11,21 +11,21 @@ require (
github.com/grafana/loki/operator/apis/loki v0.0.0-00010101000000-000000000000
github.com/imdario/mergo v0.3.13
github.com/maxbrunsfeld/counterfeiter/v6 v6.7.0
github.com/openshift/api v0.0.0-20231031181504-3be12e93388f // release-4.14
github.com/openshift/library-go v0.0.0-20231103161458-0ec67489d123
github.com/openshift/api v0.0.0-20240116035456-11ed2fbcb805 // release-4.15
github.com/openshift/library-go v0.0.0-20240117151256-95b334bccb5d // release-4.15
github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring v0.67.1
github.com/prometheus/client_golang v1.17.0
github.com/prometheus/common v0.44.0
github.com/prometheus/prometheus v0.42.0
github.com/stretchr/testify v1.8.4
gopkg.in/yaml.v2 v2.4.0
k8s.io/api v0.27.7
k8s.io/apimachinery v0.27.7
k8s.io/apiserver v0.27.7
k8s.io/client-go v0.27.7
k8s.io/component-base v0.27.7
k8s.io/utils v0.0.0-20230505201702-9f6742963106
sigs.k8s.io/controller-runtime v0.15.3
k8s.io/api v0.28.6
k8s.io/apimachinery v0.28.6
k8s.io/apiserver v0.28.6
k8s.io/client-go v0.28.6
k8s.io/component-base v0.28.6
k8s.io/utils v0.0.0-20240102154912-e7106e64919e
sigs.k8s.io/controller-runtime v0.16.3
sigs.k8s.io/yaml v1.3.0
)
@ -40,13 +40,13 @@ require (
github.com/beorn7/perks v1.0.1 // indirect
github.com/buger/jsonparser v1.1.1 // indirect
github.com/cespare/xxhash/v2 v2.2.0 // indirect
github.com/coreos/go-semver v0.3.0 // indirect
github.com/coreos/go-systemd/v22 v22.4.0 // indirect
github.com/coreos/go-semver v0.3.1 // indirect
github.com/coreos/go-systemd/v22 v22.5.0 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/dennwc/varint v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.0 // indirect
github.com/dustin/go-humanize v1.0.1 // indirect
github.com/edsrzf/mmap-go v1.1.0 // indirect
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
github.com/evanphx/json-patch/v5 v5.6.0 // indirect
github.com/fatih/color v1.14.1 // indirect
github.com/felixge/httpsnoop v1.0.3 // indirect
@ -55,7 +55,7 @@ require (
github.com/go-logfmt/logfmt v0.6.0 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.1 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.3 // indirect
github.com/gogo/googleapis v1.4.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
@ -64,7 +64,7 @@ require (
github.com/golang/protobuf v1.5.3 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/gnostic v0.5.7-v3refs // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/grafana/dskit v0.0.0-20230201083518-528d8a7d52f2 // indirect
@ -122,39 +122,44 @@ require (
github.com/uber/jaeger-lib v2.4.1+incompatible // indirect
github.com/weaveworks/common v0.0.0-20221201103051-7c2720a9024d // indirect
github.com/weaveworks/promrus v1.2.0 // indirect
go.etcd.io/etcd/api/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.7 // indirect
go.etcd.io/etcd/client/v3 v3.5.7 // indirect
go.etcd.io/etcd/api/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/pkg/v3 v3.5.9 // indirect
go.etcd.io/etcd/client/v3 v3.5.9 // indirect
go.opentelemetry.io/otel v1.11.2 // indirect
go.opentelemetry.io/otel/trace v1.11.2 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/goleak v1.2.1 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.24.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
go.uber.org/zap v1.25.0 // indirect
go4.org/netipx v0.0.0-20230125063823-8449b0a6169f // indirect
golang.org/x/crypto v0.17.0 // indirect
golang.org/x/exp v0.0.0-20230124195608-d38c7dcee874 // indirect
golang.org/x/mod v0.12.0 // indirect
golang.org/x/net v0.17.0 // indirect
golang.org/x/mod v0.14.0 // indirect
golang.org/x/net v0.19.0 // indirect
golang.org/x/oauth2 v0.8.0 // indirect
golang.org/x/sync v0.3.0 // indirect
golang.org/x/sync v0.5.0 // indirect
golang.org/x/sys v0.15.0 // indirect
golang.org/x/term v0.15.0 // indirect
golang.org/x/text v0.14.0 // indirect
golang.org/x/time v0.3.0 // indirect
golang.org/x/tools v0.12.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.3.0 // indirect
golang.org/x/tools v0.16.1 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230124163310-31e0e69b6fc2 // indirect
google.golang.org/grpc v1.52.3 // indirect
google.golang.org/genproto v0.0.0-20230526161137-0005af68ea54 // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20230525234035-dd9d682886f9 // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20230525234030-28d5490b6b19 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.31.0 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/apiextensions-apiserver v0.27.7 // indirect
k8s.io/apiextensions-apiserver v0.28.3 // indirect
k8s.io/klog/v2 v2.100.1 // indirect
k8s.io/kube-openapi v0.0.0-20230501164219-8b0f38b5fd1f // indirect
k8s.io/kube-openapi v0.0.0-20230717233707-2695361300d9 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
)
replace github.com/grafana/loki/operator/apis/loki => ./apis/loki
// Replace v2.4.0+incompatible indirect refs with v5.1.1 for compatibility with google.golang.org/grpc >=v1.56.3
replace github.com/sercand/kuberesolver => github.com/sercand/kuberesolver/v5 v5.1.1

File diff suppressed because it is too large Load Diff

@ -2,6 +2,8 @@ package config
import (
"fmt"
"net/http"
"net/http/pprof"
"reflect"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
@ -33,23 +35,33 @@ func LoadConfig(scheme *runtime.Scheme, configFile string) (*configv1.ProjectCon
func mergeOptionsFromFile(o manager.Options, cfg *configv1.ProjectConfig) manager.Options {
o = setLeaderElectionConfig(o, cfg.ControllerManagerConfigurationSpec)
if o.MetricsBindAddress == "" && cfg.Metrics.BindAddress != "" {
o.MetricsBindAddress = cfg.Metrics.BindAddress
if o.Metrics.BindAddress == "" && cfg.Metrics.BindAddress != "" {
o.Metrics.BindAddress = cfg.Metrics.BindAddress
endpoints := map[string]http.HandlerFunc{
"/debug/pprof/": pprof.Index,
"/debug/pprof/cmdline": pprof.Cmdline,
"/debug/pprof/profile": pprof.Profile,
"/debug/pprof/symbol": pprof.Symbol,
"/debug/pprof/trace": pprof.Trace,
}
if o.Metrics.ExtraHandlers == nil {
o.Metrics.ExtraHandlers = map[string]http.Handler{}
}
for path, handler := range endpoints {
o.Metrics.ExtraHandlers[path] = handler
}
}
if o.HealthProbeBindAddress == "" && cfg.Health.HealthProbeBindAddress != "" {
o.HealthProbeBindAddress = cfg.Health.HealthProbeBindAddress
}
//nolint:staticcheck
if o.Port == 0 && cfg.Webhook.Port != nil {
o.Port = *cfg.Webhook.Port
}
//nolint:staticcheck
if o.WebhookServer == nil {
if cfg.Webhook.Port != nil {
o.WebhookServer = webhook.NewServer(webhook.Options{
Port: o.Port,
Port: *cfg.Webhook.Port,
})
}

@ -8,7 +8,7 @@ import (
"github.com/go-logr/logr"
"k8s.io/apimachinery/pkg/runtime"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client" //nolint:typecheck
ctrlutil "sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
"github.com/grafana/loki/operator/internal/external/k8s"

@ -12,7 +12,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
@ -158,8 +158,8 @@ func TestCheckCertExpiry_WhenGetOptionsReturnsCABUndleNotFound_DoesNotError(t *t
Kind: "LokiStack",
Name: "my-stack",
UID: "b23f9a38-9672-499f-8c29-15ede74d3ece",
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
},
},
},

@ -21,7 +21,7 @@ import (
"k8s.io/apimachinery/pkg/types"
utilruntime "k8s.io/apimachinery/pkg/util/runtime"
clientgoscheme "k8s.io/client-go/kubernetes/scheme"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
@ -304,8 +304,8 @@ func TestCreateOrUpdateLokiStack_SetsOwnerRefOnAllObjects(t *testing.T) {
Kind: stack.Kind,
Name: stack.Name,
UID: stack.UID,
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
}
k.CreateStub = func(_ context.Context, o client.Object, _ ...client.CreateOption) error {
@ -451,8 +451,8 @@ func TestCreateOrUpdateLokiStack_WhenGetReturnsNoError_UpdateObjects(t *testing.
Kind: "LokiStack",
Name: "my-stack",
UID: "b23f9a38-9672-499f-8c29-15ede74d3ece",
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
},
},
},
@ -620,8 +620,8 @@ func TestCreateOrUpdateLokiStack_WhenUpdateReturnsError_ContinueWithOtherObjects
Kind: "LokiStack",
Name: "someStack",
UID: "b23f9a38-9672-499f-8c29-15ede74d3ece",
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
},
},
},

@ -12,7 +12,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/types"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
@ -230,8 +230,8 @@ func TestCreateOrRotateCertificates_SetsOwnerRefOnAllObjects(t *testing.T) {
Kind: stack.Kind,
Name: stack.Name,
UID: stack.UID,
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
}
k.CreateStub = func(_ context.Context, o client.Object, _ ...client.CreateOption) error {
@ -376,8 +376,8 @@ func TestCreateOrRotateCertificates_WhenGetReturnsNoError_UpdateObjects(t *testi
Kind: "LokiStack",
Name: "my-stack",
UID: "b23f9a38-9672-499f-8c29-15ede74d3ece",
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
},
},
},
@ -530,8 +530,8 @@ func TestCreateOrRotateCertificates_WhenUpdateReturnsError_ContinueWithOtherObje
Kind: "LokiStack",
Name: "someStack",
UID: "b23f9a38-9672-499f-8c29-15ede74d3ece",
Controller: pointer.Bool(true),
BlockOwnerDeletion: pointer.Bool(true),
Controller: ptr.To(true),
BlockOwnerDeletion: ptr.To(true),
},
},
},

@ -10,7 +10,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -147,8 +147,8 @@ func NewCompactorStatefulSet(opts Options) *appsv1.StatefulSet {
},
Spec: appsv1.StatefulSetSpec{
PodManagementPolicy: appsv1.OrderedReadyPodManagement,
RevisionHistoryLimit: pointer.Int32(10),
Replicas: pointer.Int32(opts.Stack.Template.Compactor.Replicas),
RevisionHistoryLimit: ptr.To(defaultRevHistoryLimit),
Replicas: ptr.To(opts.Stack.Template.Compactor.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: labels.Merge(l, GossipLabels()),
},
@ -177,7 +177,7 @@ func NewCompactorStatefulSet(opts Options) *appsv1.StatefulSet {
},
},
VolumeMode: &volumeFileSystemMode,
StorageClassName: pointer.String(opts.Stack.StorageClassName),
StorageClassName: ptr.To(opts.Stack.StorageClassName),
},
},
},

@ -10,7 +10,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
lokiv1 "github.com/grafana/loki/operator/apis/loki/v1"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -118,7 +118,7 @@ func randomConfigOptions() Options {
Operator: corev1.TolerationOpEqual,
Value: uuid.New().String(),
Effect: corev1.TaintEffectNoExecute,
TolerationSeconds: pointer.Int64(rand.Int63()),
TolerationSeconds: ptr.To[int64](rand.Int63()),
},
},
},
@ -133,7 +133,7 @@ func randomConfigOptions() Options {
Operator: corev1.TolerationOpEqual,
Value: uuid.New().String(),
Effect: corev1.TaintEffectNoExecute,
TolerationSeconds: pointer.Int64(rand.Int63()),
TolerationSeconds: ptr.To[int64](rand.Int63()),
},
},
},
@ -148,7 +148,7 @@ func randomConfigOptions() Options {
Operator: corev1.TolerationOpEqual,
Value: uuid.New().String(),
Effect: corev1.TaintEffectNoExecute,
TolerationSeconds: pointer.Int64(rand.Int63()),
TolerationSeconds: ptr.To[int64](rand.Int63()),
},
},
},
@ -163,7 +163,7 @@ func randomConfigOptions() Options {
Operator: corev1.TolerationOpEqual,
Value: uuid.New().String(),
Effect: corev1.TaintEffectNoExecute,
TolerationSeconds: pointer.Int64(rand.Int63()),
TolerationSeconds: ptr.To[int64](rand.Int63()),
},
},
},
@ -178,7 +178,7 @@ func randomConfigOptions() Options {
Operator: corev1.TolerationOpEqual,
Value: uuid.New().String(),
Effect: corev1.TaintEffectNoExecute,
TolerationSeconds: pointer.Int64(rand.Int63()),
TolerationSeconds: ptr.To[int64](rand.Int63()),
},
},
},
@ -193,7 +193,7 @@ func randomConfigOptions() Options {
Operator: corev1.TolerationOpEqual,
Value: uuid.New().String(),
Effect: corev1.TaintEffectNoExecute,
TolerationSeconds: pointer.Int64(rand.Int63()),
TolerationSeconds: ptr.To[int64](rand.Int63()),
},
},
},
@ -723,12 +723,12 @@ func TestConfigOptions_RulerOverrides_OCPApplicationTenant(t *testing.T) {
RefreshInterval: "1m",
Notifier: &config.NotifierConfig{
TLS: config.TLSConfig{
ServerName: pointer.String("alertmanager-user-workload.openshift-user-workload-monitoring.svc.cluster.local"),
CAPath: pointer.String("/var/run/ca/alertmanager/service-ca.crt"),
ServerName: ptr.To("alertmanager-user-workload.openshift-user-workload-monitoring.svc.cluster.local"),
CAPath: ptr.To("/var/run/ca/alertmanager/service-ca.crt"),
},
HeaderAuth: config.HeaderAuth{
Type: pointer.String("Bearer"),
CredentialsFile: pointer.String("/var/run/secrets/kubernetes.io/serviceaccount/token"),
Type: ptr.To("Bearer"),
CredentialsFile: ptr.To("/var/run/secrets/kubernetes.io/serviceaccount/token"),
},
},
},
@ -848,14 +848,14 @@ func TestConfigOptions_RulerOverrides(t *testing.T) {
},
Client: &lokiv1.AlertManagerClientConfig{
TLS: &lokiv1.AlertManagerClientTLSConfig{
ServerName: pointer.String("application.svc"),
CAPath: pointer.String("/tenant/application/alertmanager/ca.crt"),
CertPath: pointer.String("/tenant/application/alertmanager/cert.crt"),
KeyPath: pointer.String("/tenant/application/alertmanager/cert.key"),
ServerName: ptr.To("application.svc"),
CAPath: ptr.To("/tenant/application/alertmanager/ca.crt"),
CertPath: ptr.To("/tenant/application/alertmanager/cert.crt"),
KeyPath: ptr.To("/tenant/application/alertmanager/cert.key"),
},
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
Type: pointer.String("Bearer"),
Credentials: pointer.String("letmeinplz"),
Type: ptr.To("Bearer"),
Credentials: ptr.To("letmeinplz"),
},
},
},
@ -872,14 +872,14 @@ func TestConfigOptions_RulerOverrides(t *testing.T) {
},
Client: &lokiv1.AlertManagerClientConfig{
TLS: &lokiv1.AlertManagerClientTLSConfig{
ServerName: pointer.String("other.svc"),
CAPath: pointer.String("/tenant/other/alertmanager/ca.crt"),
CertPath: pointer.String("/tenant/other/alertmanager/cert.crt"),
KeyPath: pointer.String("/tenant/other/alertmanager/cert.key"),
ServerName: ptr.To("other.svc"),
CAPath: ptr.To("/tenant/other/alertmanager/ca.crt"),
CertPath: ptr.To("/tenant/other/alertmanager/cert.crt"),
KeyPath: ptr.To("/tenant/other/alertmanager/cert.key"),
},
BasicAuth: &lokiv1.AlertManagerClientBasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
},
},
@ -906,14 +906,14 @@ func TestConfigOptions_RulerOverrides(t *testing.T) {
ExternalLabels: map[string]string{"external": "label"},
Notifier: &config.NotifierConfig{
TLS: config.TLSConfig{
ServerName: pointer.String("application.svc"),
CAPath: pointer.String("/tenant/application/alertmanager/ca.crt"),
CertPath: pointer.String("/tenant/application/alertmanager/cert.crt"),
KeyPath: pointer.String("/tenant/application/alertmanager/cert.key"),
ServerName: ptr.To("application.svc"),
CAPath: ptr.To("/tenant/application/alertmanager/ca.crt"),
CertPath: ptr.To("/tenant/application/alertmanager/cert.crt"),
KeyPath: ptr.To("/tenant/application/alertmanager/cert.key"),
},
HeaderAuth: config.HeaderAuth{
Type: pointer.String("Bearer"),
Credentials: pointer.String("letmeinplz"),
Type: ptr.To("Bearer"),
Credentials: ptr.To("letmeinplz"),
},
},
},
@ -930,14 +930,14 @@ func TestConfigOptions_RulerOverrides(t *testing.T) {
ExternalLabels: map[string]string{"external1": "label1"},
Notifier: &config.NotifierConfig{
TLS: config.TLSConfig{
ServerName: pointer.String("other.svc"),
CAPath: pointer.String("/tenant/other/alertmanager/ca.crt"),
CertPath: pointer.String("/tenant/other/alertmanager/cert.crt"),
KeyPath: pointer.String("/tenant/other/alertmanager/cert.key"),
ServerName: ptr.To("other.svc"),
CAPath: ptr.To("/tenant/other/alertmanager/ca.crt"),
CertPath: ptr.To("/tenant/other/alertmanager/cert.crt"),
KeyPath: ptr.To("/tenant/other/alertmanager/cert.key"),
},
BasicAuth: config.BasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
},
},
@ -1072,12 +1072,12 @@ func TestConfigOptions_RulerOverrides_OCPUserWorkloadOnlyEnabled(t *testing.T) {
RefreshInterval: "1m",
Notifier: &config.NotifierConfig{
TLS: config.TLSConfig{
ServerName: pointer.String("alertmanager-user-workload.openshift-user-workload-monitoring.svc.cluster.local"),
CAPath: pointer.String("/var/run/ca/alertmanager/service-ca.crt"),
ServerName: ptr.To("alertmanager-user-workload.openshift-user-workload-monitoring.svc.cluster.local"),
CAPath: ptr.To("/var/run/ca/alertmanager/service-ca.crt"),
},
HeaderAuth: config.HeaderAuth{
Type: pointer.String("Bearer"),
CredentialsFile: pointer.String("/var/run/secrets/kubernetes.io/serviceaccount/token"),
Type: ptr.To("Bearer"),
CredentialsFile: ptr.To("/var/run/secrets/kubernetes.io/serviceaccount/token"),
},
},
},
@ -1150,12 +1150,12 @@ func TestConfigOptions_RulerOverrides_OCPUserWorkloadOnlyEnabled(t *testing.T) {
RefreshInterval: "1m",
Notifier: &config.NotifierConfig{
TLS: config.TLSConfig{
ServerName: pointer.String("alertmanager-user-workload.openshift-user-workload-monitoring.svc.cluster.local"),
CAPath: pointer.String("/var/run/ca/alertmanager/service-ca.crt"),
ServerName: ptr.To("alertmanager-user-workload.openshift-user-workload-monitoring.svc.cluster.local"),
CAPath: ptr.To("/var/run/ca/alertmanager/service-ca.crt"),
},
HeaderAuth: config.HeaderAuth{
Type: pointer.String("Bearer"),
CredentialsFile: pointer.String("/var/run/secrets/kubernetes.io/serviceaccount/token"),
Type: ptr.To("Bearer"),
CredentialsFile: ptr.To("/var/run/secrets/kubernetes.io/serviceaccount/token"),
},
},
},

@ -10,7 +10,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -146,7 +146,7 @@ func NewDistributorDeployment(opts Options) *appsv1.Deployment {
Labels: l,
},
Spec: appsv1.DeploymentSpec{
Replicas: pointer.Int32(opts.Stack.Template.Distributor.Replicas),
Replicas: ptr.To(opts.Stack.Template.Distributor.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: labels.Merge(l, GossipLabels()),
},

@ -15,7 +15,7 @@ import (
policyv1 "k8s.io/api/policy/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/grafana/loki/operator/internal/manifests/internal/gateway"
@ -244,7 +244,7 @@ func NewGatewayDeployment(opts Options, sha1C string) *appsv1.Deployment {
Labels: l,
},
Spec: appsv1.DeploymentSpec{
Replicas: pointer.Int32(opts.Stack.Template.Gateway.Replicas),
Replicas: ptr.To(opts.Stack.Template.Gateway.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: l,
},
@ -354,7 +354,7 @@ func NewServiceAccount(opts Options) client.Object {
Name: GatewayName(opts.Name),
Namespace: opts.Namespace,
},
AutomountServiceAccountToken: pointer.Bool(true),
AutomountServiceAccountToken: ptr.To(true),
}
}

@ -11,7 +11,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -153,8 +153,8 @@ func NewIndexGatewayStatefulSet(opts Options) *appsv1.StatefulSet {
},
Spec: appsv1.StatefulSetSpec{
PodManagementPolicy: appsv1.OrderedReadyPodManagement,
RevisionHistoryLimit: pointer.Int32(10),
Replicas: pointer.Int32(opts.Stack.Template.IndexGateway.Replicas),
RevisionHistoryLimit: ptr.To(defaultRevHistoryLimit),
Replicas: ptr.To(opts.Stack.Template.IndexGateway.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: labels.Merge(l, GossipLabels()),
},
@ -182,7 +182,7 @@ func NewIndexGatewayStatefulSet(opts Options) *appsv1.StatefulSet {
corev1.ResourceStorage: opts.ResourceRequirements.IndexGateway.PVCSize,
},
},
StorageClassName: pointer.String(opts.Stack.StorageClassName),
StorageClassName: ptr.To(opts.Stack.StorageClassName),
VolumeMode: &volumeFileSystemMode,
},
},

@ -11,7 +11,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -163,8 +163,8 @@ func NewIngesterStatefulSet(opts Options) *appsv1.StatefulSet {
},
Spec: appsv1.StatefulSetSpec{
PodManagementPolicy: appsv1.OrderedReadyPodManagement,
RevisionHistoryLimit: pointer.Int32(10),
Replicas: pointer.Int32(opts.Stack.Template.Ingester.Replicas),
RevisionHistoryLimit: ptr.To(defaultRevHistoryLimit),
Replicas: ptr.To(opts.Stack.Template.Ingester.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: labels.Merge(l, GossipLabels()),
},
@ -192,7 +192,7 @@ func NewIngesterStatefulSet(opts Options) *appsv1.StatefulSet {
corev1.ResourceStorage: opts.ResourceRequirements.Ingester.PVCSize,
},
},
StorageClassName: pointer.String(opts.Stack.StorageClassName),
StorageClassName: ptr.To(opts.Stack.StorageClassName),
VolumeMode: &volumeFileSystemMode,
},
},
@ -211,7 +211,7 @@ func NewIngesterStatefulSet(opts Options) *appsv1.StatefulSet {
corev1.ResourceStorage: opts.ResourceRequirements.WALStorage.PVCSize,
},
},
StorageClassName: pointer.String(opts.Stack.StorageClassName),
StorageClassName: ptr.To(opts.Stack.StorageClassName),
VolumeMode: &volumeFileSystemMode,
},
},

@ -6,7 +6,7 @@ import (
"time"
"github.com/stretchr/testify/require"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
configv1 "github.com/grafana/loki/operator/apis/config/v1"
lokiv1 "github.com/grafana/loki/operator/apis/loki/v1"
@ -3247,20 +3247,20 @@ overrides:
},
Notifier: &NotifierConfig{
TLS: TLSConfig{
ServerName: pointer.String("custom-servername"),
CertPath: pointer.String("custom/path"),
KeyPath: pointer.String("custom/key"),
CAPath: pointer.String("custom/CA"),
InsecureSkipVerify: pointer.Bool(false),
ServerName: ptr.To("custom-servername"),
CertPath: ptr.To("custom/path"),
KeyPath: ptr.To("custom/key"),
CAPath: ptr.To("custom/CA"),
InsecureSkipVerify: ptr.To(false),
},
BasicAuth: BasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
HeaderAuth: HeaderAuth{
CredentialsFile: pointer.String("cred/file"),
Type: pointer.String("auth"),
Credentials: pointer.String("creds"),
CredentialsFile: ptr.To("cred/file"),
Type: ptr.To("auth"),
Credentials: ptr.To("creds"),
},
},
},

@ -13,7 +13,7 @@ import (
rbacv1 "k8s.io/api/rbac/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)
func TestGetMutateFunc_MutateObjectMeta(t *testing.T) {
@ -28,8 +28,8 @@ func TestGetMutateFunc_MutateObjectMeta(t *testing.T) {
OwnerReferences: []metav1.OwnerReference{
{
APIVersion: "loki.grafana.com/v1",
BlockOwnerDeletion: pointer.Bool(true),
Controller: pointer.Bool(true),
BlockOwnerDeletion: ptr.To(true),
Controller: ptr.To(true),
Kind: "LokiStack",
Name: "lokistack-testing",
UID: "6128aa83-de7f-47c0-abf2-4a380713b599",
@ -504,7 +504,7 @@ func TestMutateFuncFor_MutateDeploymentSpec(t *testing.T) {
"test": "test",
},
},
Replicas: pointer.Int32(1),
Replicas: ptr.To[int32](1),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -525,7 +525,7 @@ func TestMutateFuncFor_MutateDeploymentSpec(t *testing.T) {
"and": "another",
},
},
Replicas: pointer.Int32(2),
Replicas: ptr.To[int32](2),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -552,7 +552,7 @@ func TestMutateFuncFor_MutateDeploymentSpec(t *testing.T) {
"test": "test",
},
},
Replicas: pointer.Int32(1),
Replicas: ptr.To[int32](1),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -574,7 +574,7 @@ func TestMutateFuncFor_MutateDeploymentSpec(t *testing.T) {
"and": "another",
},
},
Replicas: pointer.Int32(2),
Replicas: ptr.To[int32](2),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -665,7 +665,7 @@ func TestMutateFuncFor_MutateStatefulSetSpec(t *testing.T) {
"test": "test",
},
},
Replicas: pointer.Int32(1),
Replicas: ptr.To[int32](1),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -693,7 +693,7 @@ func TestMutateFuncFor_MutateStatefulSetSpec(t *testing.T) {
"and": "another",
},
},
Replicas: pointer.Int32(2),
Replicas: ptr.To[int32](2),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -728,7 +728,7 @@ func TestMutateFuncFor_MutateStatefulSetSpec(t *testing.T) {
"test": "test",
},
},
Replicas: pointer.Int32(1),
Replicas: ptr.To[int32](1),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -757,7 +757,7 @@ func TestMutateFuncFor_MutateStatefulSetSpec(t *testing.T) {
"and": "another",
},
},
Replicas: pointer.Int32(2),
Replicas: ptr.To[int32](2),
Template: corev1.PodTemplateSpec{
Spec: corev1.PodSpec{
Containers: []corev1.Container{
@ -1108,7 +1108,7 @@ func TestGetMutateFunc_MutateRoute(t *testing.T) {
To: routev1.RouteTargetReference{
Kind: "Service",
Name: "a-service",
Weight: pointer.Int32(100),
Weight: ptr.To[int32](100),
},
TLS: &routev1.TLSConfig{
Termination: routev1.TLSTerminationReencrypt,

@ -8,7 +8,7 @@ import (
monitoringv1 "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
lokiv1 "github.com/grafana/loki/operator/apis/loki/v1"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -289,12 +289,12 @@ func configureUserWorkloadAM(configOpt *config.Options, token, caPath, monitorSe
RefreshInterval: "1m",
Notifier: &config.NotifierConfig{
TLS: config.TLSConfig{
ServerName: pointer.String(monitorServerName),
ServerName: ptr.To(monitorServerName),
CAPath: &caPath,
},
HeaderAuth: config.HeaderAuth{
CredentialsFile: &token,
Type: pointer.String("Bearer"),
Type: ptr.To("Bearer"),
},
},
}

@ -6,7 +6,7 @@ import (
routev1 "github.com/openshift/api/route/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
)
@ -29,7 +29,7 @@ func BuildRoute(opts Options) client.Object {
To: routev1.RouteTargetReference{
Kind: "Service",
Name: opts.BuildOpts.GatewaySvcName,
Weight: pointer.Int32(100),
Weight: ptr.To[int32](100),
},
Port: &routev1.RoutePort{
TargetPort: intstr.FromString(opts.BuildOpts.GatewaySvcTargetPort),

@ -3,7 +3,7 @@ package openshift
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
)
@ -21,6 +21,6 @@ func BuildRulerServiceAccount(opts Options) client.Object {
Name: rulerServiceAccountName(opts),
Namespace: opts.BuildOpts.LokiStackNamespace,
},
AutomountServiceAccountToken: pointer.Bool(true),
AutomountServiceAccountToken: ptr.To(true),
}
}

@ -11,7 +11,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -152,7 +152,7 @@ func NewQuerierDeployment(opts Options) *appsv1.Deployment {
Labels: l,
},
Spec: appsv1.DeploymentSpec{
Replicas: pointer.Int32(opts.Stack.Template.Querier.Replicas),
Replicas: ptr.To(opts.Stack.Template.Querier.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: labels.Merge(l, GossipLabels()),
},

@ -10,7 +10,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
"github.com/grafana/loki/operator/internal/manifests/internal/config"
@ -158,7 +158,7 @@ func NewQueryFrontendDeployment(opts Options) *appsv1.Deployment {
Labels: l,
},
Spec: appsv1.DeploymentSpec{
Replicas: pointer.Int32(opts.Stack.Template.QueryFrontend.Replicas),
Replicas: ptr.To(opts.Stack.Template.QueryFrontend.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: labels.Merge(l, GossipLabels()),
},

@ -11,7 +11,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/labels"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
lokiv1 "github.com/grafana/loki/operator/apis/loki/v1"
@ -202,8 +202,8 @@ func NewRulerStatefulSet(opts Options) *appsv1.StatefulSet {
UpdateStrategy: appsv1.StatefulSetUpdateStrategy{
Type: appsv1.RollingUpdateStatefulSetStrategyType,
},
RevisionHistoryLimit: pointer.Int32(10),
Replicas: pointer.Int32(opts.Stack.Template.Ruler.Replicas),
RevisionHistoryLimit: ptr.To(defaultRevHistoryLimit),
Replicas: ptr.To(opts.Stack.Template.Ruler.Replicas),
Selector: &metav1.LabelSelector{
MatchLabels: labels.Merge(l, GossipLabels()),
},
@ -231,7 +231,7 @@ func NewRulerStatefulSet(opts Options) *appsv1.StatefulSet {
corev1.ResourceStorage: opts.ResourceRequirements.Ruler.PVCSize,
},
},
StorageClassName: pointer.String(opts.Stack.StorageClassName),
StorageClassName: ptr.To(opts.Stack.StorageClassName),
VolumeMode: &volumeFileSystemMode,
},
},
@ -250,7 +250,7 @@ func NewRulerStatefulSet(opts Options) *appsv1.StatefulSet {
corev1.ResourceStorage: opts.ResourceRequirements.WALStorage.PVCSize,
},
},
StorageClassName: pointer.String(opts.Stack.StorageClassName),
StorageClassName: ptr.To(opts.Stack.StorageClassName),
VolumeMode: &volumeFileSystemMode,
},
},

@ -4,13 +4,13 @@ import (
"github.com/ViaQ/logerr/v2/kverrors"
"github.com/imdario/mergo"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
)
func configurePodSpecForRestrictedStandard(podSpec *corev1.PodSpec) error {
podSecurityContext := corev1.PodSpec{
SecurityContext: &corev1.PodSecurityContext{
RunAsNonRoot: pointer.Bool(true),
RunAsNonRoot: ptr.To(true),
SeccompProfile: &corev1.SeccompProfile{
Type: corev1.SeccompProfileTypeRuntimeDefault,
},
@ -19,7 +19,7 @@ func configurePodSpecForRestrictedStandard(podSpec *corev1.PodSpec) error {
containerSecurityContext := corev1.Container{
SecurityContext: &corev1.SecurityContext{
AllowPrivilegeEscalation: pointer.Bool(false),
AllowPrivilegeEscalation: ptr.To(false),
Capabilities: &corev1.Capabilities{
Drop: []corev1.Capability{"ALL"},
},

@ -3,7 +3,7 @@ package manifests
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
"sigs.k8s.io/controller-runtime/pkg/client"
)
@ -20,6 +20,6 @@ func BuildServiceAccount(opts Options) client.Object {
Namespace: opts.Namespace,
Labels: commonLabels(opts.Name),
},
AutomountServiceAccountToken: pointer.Bool(true),
AutomountServiceAccountToken: ptr.To(true),
}
}

@ -8,7 +8,7 @@ import (
"github.com/imdario/mergo"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
lokiv1 "github.com/grafana/loki/operator/apis/loki/v1"
)
@ -308,7 +308,7 @@ func saTokenVolume(opts Options) corev1.Volume {
Sources: []corev1.VolumeProjection{
{
ServiceAccountToken: &corev1.ServiceAccountTokenProjection{
ExpirationSeconds: pointer.Int64(saTokenExpiration),
ExpirationSeconds: ptr.To(saTokenExpiration),
Path: corev1.ServiceAccountTokenKey,
Audience: audience,
},

@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/require"
appsv1 "k8s.io/api/apps/v1"
corev1 "k8s.io/api/core/v1"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
lokiv1 "github.com/grafana/loki/operator/apis/loki/v1"
)
@ -376,7 +376,7 @@ func TestConfigureDeploymentForStorageType(t *testing.T) {
{
ServiceAccountToken: &corev1.ServiceAccountTokenProjection{
Audience: "test",
ExpirationSeconds: pointer.Int64(3600),
ExpirationSeconds: ptr.To[int64](3600),
Path: corev1.ServiceAccountTokenKey,
},
},
@ -469,7 +469,7 @@ func TestConfigureDeploymentForStorageType(t *testing.T) {
{
ServiceAccountToken: &corev1.ServiceAccountTokenProjection{
Audience: "openshift",
ExpirationSeconds: pointer.Int64(3600),
ExpirationSeconds: ptr.To[int64](3600),
Path: corev1.ServiceAccountTokenKey,
},
},

@ -101,10 +101,10 @@ const (
// KeySwiftPassword is the secret data key for the OpenStack Swift password.
KeySwiftUsername = "username"
saTokenVolumeK8sDirectory = "/var/run/secrets/kubernetes.io/serviceaccount"
saTokenVolumeOcpDirectory = "/var/run/secrets/openshift/serviceaccount"
saTokenVolumeName = "bound-sa-token"
saTokenExpiration = 3600
saTokenVolumeK8sDirectory = "/var/run/secrets/kubernetes.io/serviceaccount"
saTokenVolumeOcpDirectory = "/var/run/secrets/openshift/serviceaccount"
saTokenVolumeName = "bound-sa-token"
saTokenExpiration int64 = 3600
secretDirectory = "/etc/storage/secrets"
storageTLSVolume = "storage-tls"

@ -128,8 +128,9 @@ const (
var (
defaultTimeoutConfig = calculateHTTPTimeouts(lokiDefaultQueryTimeout)
defaultConfigMapMode = int32(420)
volumeFileSystemMode = corev1.PersistentVolumeFilesystem
defaultRevHistoryLimit int32 = 10
defaultConfigMapMode int32 = 420
volumeFileSystemMode = corev1.PersistentVolumeFilesystem
)
func commonAnnotations(configHash, objStoreHash, rotationRequiredAt string) map[string]string {

@ -9,7 +9,7 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime/schema"
"k8s.io/apimachinery/pkg/util/validation/field"
"k8s.io/utils/pointer"
"k8s.io/utils/ptr"
lokiv1 "github.com/grafana/loki/operator/apis/loki/v1"
"github.com/grafana/loki/operator/internal/validation"
@ -26,8 +26,8 @@ var rctt = []struct {
AlertManagerSpec: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
BasicAuth: &lokiv1.AlertManagerClientBasicAuth{
Username: pointer.String("user"),
Password: pointer.String("pass"),
Username: ptr.To("user"),
Password: ptr.To("pass"),
},
},
},
@ -36,8 +36,8 @@ var rctt = []struct {
AlertManagerOverrides: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
BasicAuth: &lokiv1.AlertManagerClientBasicAuth{
Username: pointer.String("user1"),
Password: pointer.String("pass1"),
Username: ptr.To("user1"),
Password: ptr.To("pass1"),
},
},
},
@ -51,7 +51,7 @@ var rctt = []struct {
AlertManagerSpec: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
Credentials: pointer.String("creds"),
Credentials: ptr.To("creds"),
},
},
},
@ -60,7 +60,7 @@ var rctt = []struct {
AlertManagerOverrides: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
Credentials: pointer.String("creds1"),
Credentials: ptr.To("creds1"),
},
},
},
@ -74,7 +74,7 @@ var rctt = []struct {
AlertManagerSpec: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
CredentialsFile: pointer.String("creds-file"),
CredentialsFile: ptr.To("creds-file"),
},
},
},
@ -83,7 +83,7 @@ var rctt = []struct {
AlertManagerOverrides: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
CredentialsFile: pointer.String("creds-file1"),
CredentialsFile: ptr.To("creds-file1"),
},
},
},
@ -97,7 +97,7 @@ var rctt = []struct {
AlertManagerSpec: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
Credentials: pointer.String("creds"),
Credentials: ptr.To("creds"),
},
},
},
@ -106,7 +106,7 @@ var rctt = []struct {
AlertManagerOverrides: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
CredentialsFile: pointer.String("creds-file1"),
CredentialsFile: ptr.To("creds-file1"),
},
},
},
@ -120,8 +120,8 @@ var rctt = []struct {
AlertManagerSpec: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
Credentials: pointer.String("creds"),
CredentialsFile: pointer.String("creds-file"),
Credentials: ptr.To("creds"),
CredentialsFile: ptr.To("creds-file"),
},
},
},
@ -130,8 +130,8 @@ var rctt = []struct {
AlertManagerOverrides: &lokiv1.AlertManagerSpec{
Client: &lokiv1.AlertManagerClientConfig{
HeaderAuth: &lokiv1.AlertManagerClientHeaderAuth{
Credentials: pointer.String("creds1"),
CredentialsFile: pointer.String("creds-file1"),
Credentials: ptr.To("creds1"),
CredentialsFile: ptr.To("creds-file1"),
},
},
},

@ -2,8 +2,6 @@ package main
import (
"flag"
"net/http"
"net/http/pprof"
"os"
"github.com/ViaQ/logerr/v2/kverrors"
@ -215,35 +213,9 @@ func main() {
logger.Info("registering metrics")
metrics.RegisterMetricCollectors()
logger.Info("Registering profiling endpoints.")
err = registerProfiler(mgr)
if err != nil {
logger.Error(err, "failed to register extra pprof handler")
os.Exit(1)
}
logger.Info("starting manager")
if err := mgr.Start(ctrl.SetupSignalHandler()); err != nil {
logger.Error(err, "problem running manager")
os.Exit(1)
}
}
func registerProfiler(m ctrl.Manager) error {
endpoints := map[string]http.HandlerFunc{
"/debug/pprof/": pprof.Index,
"/debug/pprof/cmdline": pprof.Cmdline,
"/debug/pprof/profile": pprof.Profile,
"/debug/pprof/symbol": pprof.Symbol,
"/debug/pprof/trace": pprof.Trace,
}
for path, handler := range endpoints {
err := m.AddMetricsExtraHandler(path, handler)
if err != nil {
return err
}
}
return nil
}

Loading…
Cancel
Save