operator: Provide community operator bundle (#7308)

Co-authored-by: Robert Jacob <rojacob@redhat.com>
pull/8525/head^2
Periklis Tsirakidis 3 years ago committed by GitHub
parent 0394b56368
commit 099ca230b1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 91
      operator/Makefile
  2. 21
      operator/bundle/community/bundle.Dockerfile
  3. 24
      operator/bundle/community/manifests/loki-operator-controller-manager-metrics-service_v1_service.yaml
  4. 32
      operator/bundle/community/manifests/loki-operator-manager-config_v1_configmap.yaml
  5. 16
      operator/bundle/community/manifests/loki-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml
  6. 25
      operator/bundle/community/manifests/loki-operator-prometheus_rbac.authorization.k8s.io_v1_role.yaml
  7. 22
      operator/bundle/community/manifests/loki-operator-prometheus_rbac.authorization.k8s.io_v1_rolebinding.yaml
  8. 22
      operator/bundle/community/manifests/loki-operator-webhook-service_v1_service.yaml
  9. 1666
      operator/bundle/community/manifests/loki-operator.clusterserviceversion.yaml
  10. 194
      operator/bundle/community/manifests/loki.grafana.com_alertingrules.yaml
  11. 2478
      operator/bundle/community/manifests/loki.grafana.com_lokistacks.yaml
  12. 178
      operator/bundle/community/manifests/loki.grafana.com_recordingrules.yaml
  13. 693
      operator/bundle/community/manifests/loki.grafana.com_rulerconfigs.yaml
  14. 15
      operator/bundle/community/metadata/annotations.yaml
  15. 0
      operator/bundle/community/tests/scorecard/config.yaml
  16. 6
      operator/bundle/openshift/bundle.Dockerfile
  17. 0
      operator/bundle/openshift/manifests/loki-operator-controller-manager-metrics-service_v1_service.yaml
  18. 0
      operator/bundle/openshift/manifests/loki-operator-manager-config_v1_configmap.yaml
  19. 0
      operator/bundle/openshift/manifests/loki-operator-metrics-monitor_monitoring.coreos.com_v1_servicemonitor.yaml
  20. 0
      operator/bundle/openshift/manifests/loki-operator-metrics-reader_rbac.authorization.k8s.io_v1_clusterrole.yaml
  21. 0
      operator/bundle/openshift/manifests/loki-operator-prometheus_rbac.authorization.k8s.io_v1_role.yaml
  22. 0
      operator/bundle/openshift/manifests/loki-operator-prometheus_rbac.authorization.k8s.io_v1_rolebinding.yaml
  23. 0
      operator/bundle/openshift/manifests/loki-operator-webhook-service_v1_service.yaml
  24. 12
      operator/bundle/openshift/manifests/loki-operator.clusterserviceversion.yaml
  25. 0
      operator/bundle/openshift/manifests/loki.grafana.com_alertingrules.yaml
  26. 0
      operator/bundle/openshift/manifests/loki.grafana.com_lokistacks.yaml
  27. 0
      operator/bundle/openshift/manifests/loki.grafana.com_recordingrules.yaml
  28. 0
      operator/bundle/openshift/manifests/loki.grafana.com_rulerconfigs.yaml
  29. 0
      operator/bundle/openshift/metadata/annotations.yaml
  30. 0
      operator/bundle/openshift/metadata/properties.yaml
  31. 70
      operator/bundle/openshift/tests/scorecard/config.yaml
  32. 2
      operator/config/manager/kustomization.yaml
  33. 1477
      operator/config/manifests/community/bases/loki-operator.clusterserviceversion.yaml
  34. 4
      operator/config/manifests/community/kustomization.yaml
  35. 4
      operator/config/manifests/kustomization.yaml
  36. 6
      operator/config/manifests/openshift/bases/loki-operator.clusterserviceversion.yaml
  37. 4
      operator/config/manifests/openshift/kustomization.yaml
  38. 8
      operator/config/overlays/community/controller_manager_config.yaml
  39. 12
      operator/config/overlays/community/kustomization.yaml
  40. 25
      operator/config/overlays/community/manager_auth_proxy_patch.yaml
  41. 0
      operator/config/overlays/community/manager_related_image_patch.yaml
  42. 0
      operator/config/overlays/community/manager_run_flags_patch.yaml
  43. 2
      operator/config/overlays/community/manager_webhook_patch.yaml
  44. 14
      operator/config/overlays/community/prometheus_service_monitor_patch.yaml
  45. 0
      operator/config/overlays/community/webhookcainjection_patch.yaml
  46. 38
      operator/config/overlays/production/manager_auth_proxy_patch.yaml
  47. 18
      operator/config/overlays/production/prometheus_service_monitor_patch.yaml
  48. 8
      operator/docs/operator/hack_loki_operator.md
  49. 4
      operator/docs/operator/storage_size_calculator.md
  50. 2
      operator/docs/prologue/quickstart.md
  51. 51
      operator/hack/.operatorhub-pr-template.md
  52. 71
      operator/hack/operatorhub.sh

@ -10,15 +10,10 @@ WEBSITE_BASE_URL ?= https://loki-operator.dev
.DEFAULT_GOAL := default
default: all
# CLUSTER_LOGGING_VERSION
# defines the version of the OpenShift Cluster Logging product.
# Updates this value when a new version of the product should include this operator and its bundle.
CLUSTER_LOGGING_VERSION ?= 5.1.preview.1
# LOKI_OPERATOR_NS
# defines the default namespace of the Loki Operator in OpenShift.
# Loki Operator will be installed in this namespace.
LOKI_OPERATOR_NS ?= openshift-operators-redhat
LOKI_OPERATOR_NS ?= kubernetes-operators
# VERSION
# defines the project version for the bundle.
@ -26,9 +21,34 @@ LOKI_OPERATOR_NS ?= openshift-operators-redhat
# To re-generate a bundle for another specific version without changing the standard setup, you can:
# - use the VERSION as arg of the bundle target (e.g make bundle VERSION=0.0.2)
# - use environment variables to overwrite this value (e.g export VERSION=0.0.2)
VERSION ?= v0.0.1
CHANNELS ?= "stable"
DEFAULT_CHANNEL ?= "stable"
VERSION ?= v0.1.0
CHANNELS ?= "alpha"
DEFAULT_CHANNEL ?= "alpha"
SUPPORTED_OCP_VERSIONS="v4.10"
# REGISTRY_BASE
# defines the container registry and organization for the bundle and operator container images.
REGISTRY_BASE_COMMUNITY = docker.io/grafana
REGISTRY_BASE_OPENSHIFT = quay.io/openshift-logging
REGISTRY_BASE ?= $(REGISTRY_BASE_COMMUNITY)
# TODO(@periklis): Replace this image tag with VERSION once we have GH tags
MAIN_IMAGE_TAG = main-39f2856
# Customize for variants: community or openshift
VARIANT ?= community
ifeq ($(VARIANT), openshift)
ifeq ($(REGISTRY_BASE), $(REGISTRY_BASE_COMMUNITY))
REGISTRY_BASE = $(REGISTRY_BASE_OPENSHIFT)
endif
CHANNELS = stable
DEFAULT_CHANNEL = stable
LOKI_OPERATOR_NS = openshift-operators-redhat
MAIN_IMAGE_TAG = $(VERSION)
endif
# Image URL to use all building/pushing image targets
IMG ?= $(REGISTRY_BASE)/loki-operator:$(MAIN_IMAGE_TAG)
# CHANNELS define the bundle channels used in the bundle.
# Add a new line here if you would like to change its default config. (E.g CHANNELS = "preview,fast,stable")
@ -49,15 +69,17 @@ BUNDLE_DEFAULT_CHANNEL := --default-channel=$(DEFAULT_CHANNEL)
endif
BUNDLE_METADATA_OPTS ?= $(BUNDLE_CHANNELS) $(BUNDLE_DEFAULT_CHANNEL)
REGISTRY_ORG ?= openshift-logging
# BUNDLE_IMG defines the image:tag used for the bundle.
# You can use it as an arg. (E.g make bundle-build BUNDLE_IMG=<some-registry>/<project-name-bundle>:<tag>)
BUNDLE_IMG ?= quay.io/$(REGISTRY_ORG)/loki-operator-bundle:$(VERSION)
BUNDLE_IMG ?= $(REGISTRY_BASE)/loki-operator-bundle:$(VERSION)
# BUNDLE_GEN_FLAGS are the flags passed to the operator-sdk generate bundle command
BUNDLE_GEN_FLAGS ?= -q --overwrite --version $(subst v,,$(VERSION)) $(BUNDLE_METADATA_OPTS)
MANIFESTS_DIR = config/manifests/$(VARIANT)
BUNDLE_DIR = ./bundle/$(VARIANT)
BUNDLE_BUILD_GEN_FLAGS ?= $(BUNDLE_GEN_FLAGS) --output-dir . --kustomize-dir ../../$(MANIFESTS_DIR)
# USE_IMAGE_DIGESTS defines if images are resolved via tags or digests
# You can enable this value if you would like to use SHA Based Digests
# To enable set flag to true
@ -66,13 +88,10 @@ ifeq ($(USE_IMAGE_DIGESTS), true)
BUNDLE_GEN_FLAGS += --use-image-digests
endif
CALCULATOR_IMG ?= quay.io/$(REGISTRY_ORG)/storage-size-calculator:latest
CALCULATOR_IMG ?= $(REGISTRY_BASE)/storage-size-calculator:latest
GO_FILES := $(shell find . -type f -name '*.go')
# Image URL to use all building/pushing image targets
IMG ?= quay.io/$(REGISTRY_ORG)/loki-operator:$(VERSION)
# Get the currently used golang install path (in GOPATH/bin, unless GOBIN is set)
ifeq (,$(shell go env GOBIN))
GOBIN=$(shell go env GOPATH)/bin
@ -145,8 +164,9 @@ test-unit-prometheus: $(PROMTOOL) ## Run prometheus unit tests
@$(PROMTOOL) test rules ./internal/manifests/internal/alerts/testdata/test.yaml
.PHONY: scorecard
scorecard: generate go-generate bundle ## Run scorecard test
$(OPERATOR_SDK) scorecard bundle
scorecard: generate go-generate bundle-all ## Run scorecard tests for all bundles (community, openshift)
$(OPERATOR_SDK) scorecard -c ./bundle/community/tests/scorecard/config.yaml bundle/community
$(OPERATOR_SDK) scorecard -c ./bundle/openshift/tests/scorecard/config.yaml bundle/openshift
.PHONY: lint
lint: $(GOLANGCI_LINT) | generate ## Run golangci-lint on source code.
@ -168,16 +188,21 @@ oci-build: ## Build the image
oci-push: ## Push the image
$(OCI_RUNTIME) push ${IMG}
.PHONY: bundle ## Generate bundle manifests and metadata, then validate generated files.
bundle: manifests $(KUSTOMIZE) $(OPERATOR_SDK)
$(OPERATOR_SDK) generate kustomize manifests -q
.PHONY: bundle-all
bundle-all: ## Generate both bundles.
$(MAKE) bundle
$(MAKE) bundle VARIANT=openshift
.PHONY: bundle
bundle: manifests $(KUSTOMIZE) $(OPERATOR_SDK) ## Generate variant bundle manifests and metadata, then validate generated files.
$(OPERATOR_SDK) generate kustomize manifests -q --input-dir $(MANIFESTS_DIR) --output-dir $(MANIFESTS_DIR)
cd config/manager && $(KUSTOMIZE) edit set image controller=$(IMG)
$(KUSTOMIZE) build config/manifests | $(OPERATOR_SDK) generate bundle $(BUNDLE_GEN_FLAGS)
$(OPERATOR_SDK) bundle validate ./bundle
cd $(BUNDLE_DIR) && cp ../../PROJECT . && $(KUSTOMIZE) build ../../$(MANIFESTS_DIR) | $(OPERATOR_SDK) generate bundle $(BUNDLE_BUILD_GEN_FLAGS) && rm PROJECT
$(OPERATOR_SDK) bundle validate $(BUNDLE_DIR)
.PHONY: bundle-build
bundle-build: ## Build the bundle image.
$(OCI_RUNTIME) build -f bundle.Dockerfile -t $(BUNDLE_IMG) .
bundle-build: ## Build the community bundle image
$(OCI_RUNTIME) build -f $(BUNDLE_DIR)/bundle.Dockerfile -t $(BUNDLE_IMG) $(BUNDLE_DIR)
##@ Deployment
@ -231,7 +256,7 @@ olm-deploy-operator: oci-build oci-push
.PHONY: olm-deploy
ifeq ($(or $(findstring openshift-logging,$(IMG)),$(findstring openshift-logging,$(BUNDLE_IMG))),openshift-logging)
olm-deploy: ## Deploy the operator bundle and the operator via OLM into an Kubernetes cluster selected via KUBECONFIG.
$(error Set variable REGISTRY_ORG to use a custom container registry org account for local development)
$(error Set variable REGISTRY_BASE to use a custom container registry org account for local development)
else
olm-deploy: olm-deploy-bundle olm-deploy-operator $(OPERATOR_SDK)
$(OPERATOR_SDK) run bundle -n $(LOKI_OPERATOR_NS) --install-mode AllNamespaces $(BUNDLE_IMG)
@ -240,7 +265,7 @@ endif
.PHONY: olm-upgrade
ifeq ($(or $(findstring openshift-logging,$(IMG)),$(findstring openshift-logging,$(BUNDLE_IMG))),openshift-logging)
olm-upgrade: ## Upgrade the operator bundle and the operator via OLM into an Kubernetes cluster selected via KUBECONFIG.
$(error Set variable REGISTRY_ORG to use a custom container registry org account for local development)
$(error Set variable REGISTRY_BASE to use a custom container registry org account for local development)
else
olm-upgrade: olm-deploy-bundle olm-deploy-operator $(OPERATOR_SDK)
$(OPERATOR_SDK) run bundle-upgrade -n $(LOKI_OPERATOR_NS) $(BUNDLE_IMG)
@ -253,7 +278,7 @@ olm-undeploy: $(OPERATOR_SDK) ## Cleanup deployments of the operator bundle and
.PHONY: deploy-size-calculator
ifeq ($(findstring openshift-logging,$(CALCULATOR_IMG)),openshift-logging)
deploy-size-calculator: ## Deploy storage size calculator (OpenShift only!)
$(error Set variable REGISTRY_ORG to use a custom container registry org account for local development)
$(error Set variable REGISTRY_BASE to use a custom container registry org account for local development)
else
deploy-size-calculator: $(KUSTOMIZE) ## Deploy storage size calculator (OpenShift only!)
kubectl apply -f config/overlays/openshift/size-calculator/cluster_monitoring_config.yaml
@ -305,3 +330,13 @@ web: $(HUGO) | web-pre ## Run production build of the loki-operator.dev website
.PHONY: web-serve
web-serve: $(HUGO) | web-pre ## Run local preview version of the loki-operator.dev website
@cd $(WEBSITE_DIR) && $(HUGO) serve
.PHONY: operatorhub
operatorhub: check-operatorhub-pr-template
SUPPORTED_OCP_VERSIONS="$(SUPPORTED_OCP_VERSIONS)" ./hack/operatorhub.sh
.PHONY: check-operatorhub-pr-template
check-operatorhub-pr-template:
curl https://raw.githubusercontent.com/operator-framework/community-operators/master/docs/pull_request_template.md -o hack/.operatorhub-pr-template.md -s > /dev/null 2>&1
git diff -s --exit-code hack/.operatorhub-pr-template.md || (echo "Build failed: the PR template for OperatorHub has changed. Sync it and try again." && exit 1)

@ -0,0 +1,21 @@
FROM scratch
# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=loki-operator
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.bundle.channel.default.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-unknown
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=go.kubebuilder.io/v3
# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
# Copy files to locations specified by labels.
COPY ./manifests /manifests/
COPY ./metadata /metadata/
COPY ./tests/scorecard /tests/scorecard/

@ -0,0 +1,24 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: loki-operator-controller-manager-metrics-service
spec:
ports:
- name: https
port: 8443
protocol: TCP
targetPort: https
selector:
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
name: loki-operator-controller-manager
status:
loadBalancer: {}

@ -0,0 +1,32 @@
apiVersion: v1
data:
controller_manager_config.yaml: |
apiVersion: config.loki.grafana.com/v1
kind: ProjectConfig
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: 127.0.0.1:8080
webhook:
port: 9443
leaderElection:
leaderElect: false
resourceName: e3716011.grafana.com
featureGates:
lokiStackGateway: true
runtimeSeccompProfile: false
#
# Webhook feature gates
#
lokiStackWebhook: true
alertingRuleWebhook: true
recordingRuleWebhook: true
kind: ConfigMap
metadata:
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: loki-operator-manager-config

@ -0,0 +1,16 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: loki-operator-metrics-reader
rules:
- nonResourceURLs:
- /metrics
verbs:
- get

@ -0,0 +1,25 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: loki-operator-prometheus
rules:
- apiGroups:
- ""
resources:
- services
- endpoints
- pods
verbs:
- get
- list
- watch

@ -0,0 +1,22 @@
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
annotations:
include.release.openshift.io/self-managed-high-availability: "true"
include.release.openshift.io/single-node-developer: "true"
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: loki-operator-prometheus
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: Role
name: loki-operator-prometheus
subjects:
- kind: ServiceAccount
name: prometheus-k8s
namespace: openshift-monitoring

@ -0,0 +1,22 @@
apiVersion: v1
kind: Service
metadata:
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: loki-operator-webhook-service
spec:
ports:
- port: 443
protocol: TCP
targetPort: 9443
selector:
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
status:
loadBalancer: {}

File diff suppressed because one or more lines are too long

@ -0,0 +1,194 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: alertingrules.loki.grafana.com
spec:
group: loki.grafana.com
names:
kind: AlertingRule
listKind: AlertingRuleList
plural: alertingrules
singular: alertingrule
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: AlertingRule is the Schema for the alertingrules API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: AlertingRuleSpec defines the desired state of AlertingRule
properties:
groups:
description: List of groups for alerting rules.
items:
description: AlertingRuleGroup defines a group of Loki alerting
rules.
properties:
interval:
default: 1m
description: Interval defines the time interval between evaluation
of the given alerting rule.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
limit:
description: Limit defines the number of alerts an alerting
rule can produce. 0 is no limit.
format: int32
type: integer
name:
description: Name of the alerting rule group. Must be unique
within all alerting rules.
type: string
rules:
description: Rules defines a list of alerting rules
items:
description: AlertingRuleGroupSpec defines the spec for a
Loki alerting rule.
properties:
alert:
description: The name of the alert. Must be a valid label
value.
type: string
annotations:
additionalProperties:
type: string
description: Annotations to add to each alert.
type: object
expr:
description: The LogQL expression to evaluate. Every evaluation
cycle this is evaluated at the current time, and all
resultant time series become pending/firing alerts.
type: string
for:
description: Alerts are considered firing once they have
been returned for this long. Alerts which have not yet
fired for long enough are considered pending.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
labels:
additionalProperties:
type: string
description: Labels to add to each alert.
type: object
required:
- expr
type: object
type: array
required:
- name
- rules
type: object
type: array
tenantID:
description: TenantID of tenant where the alerting rules are evaluated
in.
type: string
required:
- tenantID
type: object
status:
description: AlertingRuleStatus defines the observed state of AlertingRule
properties:
conditions:
description: Conditions of the AlertingRule generation health.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null

@ -0,0 +1,178 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: recordingrules.loki.grafana.com
spec:
group: loki.grafana.com
names:
kind: RecordingRule
listKind: RecordingRuleList
plural: recordingrules
singular: recordingrule
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: RecordingRule is the Schema for the recordingrules API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: RecordingRuleSpec defines the desired state of RecordingRule
properties:
groups:
description: List of groups for recording rules.
items:
description: RecordingRuleGroup defines a group of Loki recording
rules.
properties:
interval:
default: 1m
description: Interval defines the time interval between evaluation
of the given recoding rule.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
limit:
description: Limit defines the number of series a recording
rule can produce. 0 is no limit.
format: int32
type: integer
name:
description: Name of the recording rule group. Must be unique
within all recording rules.
type: string
rules:
description: Rules defines a list of recording rules
items:
description: RecordingRuleGroupSpec defines the spec for a
Loki recording rule.
properties:
expr:
description: The LogQL expression to evaluate. Every evaluation
cycle this is evaluated at the current time, and all
resultant time series become pending/firing alerts.
type: string
record:
description: The name of the time series to output to.
Must be a valid metric name.
type: string
required:
- expr
type: object
type: array
required:
- name
- rules
type: object
type: array
tenantID:
description: TenantID of tenant where the recording rules are evaluated
in.
type: string
required:
- tenantID
type: object
status:
description: RecordingRuleStatus defines the observed state of RecordingRule
properties:
conditions:
description: Conditions of the RecordingRule generation health.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null

@ -0,0 +1,693 @@
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.10.0
creationTimestamp: null
labels:
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/managed-by: operator-lifecycle-manager
app.kubernetes.io/name: loki-operator
app.kubernetes.io/part-of: loki-operator
app.kubernetes.io/version: 0.1.0
name: rulerconfigs.loki.grafana.com
spec:
group: loki.grafana.com
names:
kind: RulerConfig
listKind: RulerConfigList
plural: rulerconfigs
singular: rulerconfig
scope: Namespaced
versions:
- name: v1beta1
schema:
openAPIV3Schema:
description: RulerConfig is the Schema for the rulerconfigs API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: RulerConfigSpec defines the desired state of Ruler
properties:
alertmanager:
description: Defines alert manager configuration to notify on firing
alerts.
properties:
client:
description: Client configuration for reaching the alertmanager
endpoint.
properties:
basicAuth:
description: Basic authentication configuration for reaching
the alertmanager endpoints.
properties:
password:
description: The subject's password for the basic authentication
configuration.
type: string
username:
description: The subject's username for the basic authentication
configuration.
type: string
type: object
headerAuth:
description: Header authentication configuration for reaching
the alertmanager endpoints.
properties:
credentials:
description: The credentials for the header authentication
configuration.
type: string
credentialsFile:
description: The credentials file for the Header authentication
configuration. It is mutually exclusive with `credentials`.
type: string
type:
description: The authentication type for the header authentication
configuration.
type: string
type: object
tls:
description: TLS configuration for reaching the alertmanager
endpoints.
properties:
caPath:
description: The CA certificate file path for the TLS
configuration.
type: string
certPath:
description: The client-side certificate file path for
the TLS configuration.
type: string
keyPath:
description: The client-side key file path for the TLS
configuration.
type: string
serverName:
description: The server name to validate in the alertmanager
server certificates.
type: string
type: object
type: object
discovery:
description: Defines the configuration for DNS-based discovery
of AlertManager hosts.
properties:
enableSRV:
description: Use DNS SRV records to discover Alertmanager
hosts.
type: boolean
refreshInterval:
default: 1m
description: How long to wait between refreshing DNS resolutions
of Alertmanager hosts.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
type: object
enableV2:
description: If enabled, then requests to Alertmanager use the
v2 API.
type: boolean
endpoints:
description: List of AlertManager URLs to send notifications to.
Each Alertmanager URL is treated as a separate group in the
configuration. Multiple Alertmanagers in HA per group can be
supported by using DNS resolution (See EnableDNSDiscovery).
items:
type: string
type: array
externalLabels:
additionalProperties:
type: string
description: Additional labels to add to all alerts.
type: object
externalUrl:
description: URL for alerts return path.
type: string
notificationQueue:
description: Defines the configuration for the notification queue
to AlertManager hosts.
properties:
capacity:
default: 10000
description: Capacity of the queue for notifications to be
sent to the Alertmanager.
format: int32
type: integer
forGracePeriod:
default: 10m
description: Minimum duration between alert and restored "for"
state. This is maintained only for alerts with configured
"for" time greater than the grace period.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
forOutageTolerance:
default: 1h
description: Max time to tolerate outage for restoring "for"
state of alert.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
resendDelay:
default: 1m
description: Minimum amount of time to wait before resending
an alert to Alertmanager.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
timeout:
default: 10s
description: HTTP timeout duration when sending notifications
to the Alertmanager.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
type: object
relabelConfigs:
description: List of alert relabel configurations.
items:
description: 'RelabelConfig allows dynamic rewriting of the
label set, being applied to samples before ingestion. It defines
`<metric_relabel_configs>` and `<alert_relabel_configs>` sections
of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
default: replace
description: Action to perform based on regex matching.
Default is 'replace'
enum:
- drop
- hashmod
- keep
- labeldrop
- labelkeep
- labelmap
- replace
type: string
modulus:
description: Modulus to take of the hash of the source label
values.
format: int64
type: integer
regex:
default: (.*)
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
default: $1
description: Replacement value against which a regex replace
is performed if the regular expression matches. Regex
capture groups are available. Default is '$1'
type: string
separator:
default: ;
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular expression
for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
required:
- sourceLabels
type: object
type: array
required:
- endpoints
type: object
evaluationInterval:
default: 1m
description: Interval on how frequently to evaluate rules.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
overrides:
additionalProperties:
description: RulerOverrides defines the overrides applied per-tenant.
properties:
alertmanager:
description: AlertManagerOverrides defines the overrides to
apply to the alertmanager config.
properties:
client:
description: Client configuration for reaching the alertmanager
endpoint.
properties:
basicAuth:
description: Basic authentication configuration for
reaching the alertmanager endpoints.
properties:
password:
description: The subject's password for the basic
authentication configuration.
type: string
username:
description: The subject's username for the basic
authentication configuration.
type: string
type: object
headerAuth:
description: Header authentication configuration for
reaching the alertmanager endpoints.
properties:
credentials:
description: The credentials for the header authentication
configuration.
type: string
credentialsFile:
description: The credentials file for the Header
authentication configuration. It is mutually exclusive
with `credentials`.
type: string
type:
description: The authentication type for the header
authentication configuration.
type: string
type: object
tls:
description: TLS configuration for reaching the alertmanager
endpoints.
properties:
caPath:
description: The CA certificate file path for the
TLS configuration.
type: string
certPath:
description: The client-side certificate file path
for the TLS configuration.
type: string
keyPath:
description: The client-side key file path for the
TLS configuration.
type: string
serverName:
description: The server name to validate in the
alertmanager server certificates.
type: string
type: object
type: object
discovery:
description: Defines the configuration for DNS-based discovery
of AlertManager hosts.
properties:
enableSRV:
description: Use DNS SRV records to discover Alertmanager
hosts.
type: boolean
refreshInterval:
default: 1m
description: How long to wait between refreshing DNS
resolutions of Alertmanager hosts.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
type: object
enableV2:
description: If enabled, then requests to Alertmanager use
the v2 API.
type: boolean
endpoints:
description: List of AlertManager URLs to send notifications
to. Each Alertmanager URL is treated as a separate group
in the configuration. Multiple Alertmanagers in HA per
group can be supported by using DNS resolution (See EnableDNSDiscovery).
items:
type: string
type: array
externalLabels:
additionalProperties:
type: string
description: Additional labels to add to all alerts.
type: object
externalUrl:
description: URL for alerts return path.
type: string
notificationQueue:
description: Defines the configuration for the notification
queue to AlertManager hosts.
properties:
capacity:
default: 10000
description: Capacity of the queue for notifications
to be sent to the Alertmanager.
format: int32
type: integer
forGracePeriod:
default: 10m
description: Minimum duration between alert and restored
"for" state. This is maintained only for alerts with
configured "for" time greater than the grace period.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
forOutageTolerance:
default: 1h
description: Max time to tolerate outage for restoring
"for" state of alert.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
resendDelay:
default: 1m
description: Minimum amount of time to wait before resending
an alert to Alertmanager.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
timeout:
default: 10s
description: HTTP timeout duration when sending notifications
to the Alertmanager.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
type: object
relabelConfigs:
description: List of alert relabel configurations.
items:
description: 'RelabelConfig allows dynamic rewriting of
the label set, being applied to samples before ingestion.
It defines `<metric_relabel_configs>` and `<alert_relabel_configs>`
sections of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
default: replace
description: Action to perform based on regex matching.
Default is 'replace'
enum:
- drop
- hashmod
- keep
- labeldrop
- labelkeep
- labelmap
- replace
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
default: (.*)
description: Regular expression against which the
extracted value is matched. Default is '(.*)'
type: string
replacement:
default: $1
description: Replacement value against which a regex
replace is performed if the regular expression matches.
Regex capture groups are available. Default is '$1'
type: string
separator:
default: ;
description: Separator placed between concatenated
source label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from
existing labels. Their content is concatenated using
the configured separator and matched against the
configured regular expression for the replace, keep,
and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is
written in a replace action. It is mandatory for
replace actions. Regex capture groups are available.
type: string
required:
- sourceLabels
type: object
type: array
required:
- endpoints
type: object
type: object
description: Overrides defines the config overrides to be applied
per-tenant.
type: object
pollInterval:
default: 1m
description: Interval on how frequently to poll for new rule definitions.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
remoteWrite:
description: Defines a remote write endpoint to write recording rule
metrics.
properties:
client:
description: Defines the configuration for remote write client.
properties:
additionalHeaders:
additionalProperties:
type: string
description: Additional HTTP headers to be sent along with
each remote write request.
type: object
authorization:
description: Type of authorzation to use to access the remote
write endpoint
enum:
- basic
- header
type: string
authorizationSecretName:
description: Name of a secret in the namespace configured
for authorization secrets.
type: string
followRedirects:
default: true
description: Configure whether HTTP requests follow HTTP 3xx
redirects.
type: boolean
name:
description: Name of the remote write config, which if specified
must be unique among remote write configs.
type: string
proxyUrl:
description: Optional proxy URL.
type: string
relabelConfigs:
description: List of remote write relabel configurations.
items:
description: 'RelabelConfig allows dynamic rewriting of
the label set, being applied to samples before ingestion.
It defines `<metric_relabel_configs>` and `<alert_relabel_configs>`
sections of Prometheus configuration. More info: https://prometheus.io/docs/prometheus/latest/configuration/configuration/#metric_relabel_configs'
properties:
action:
default: replace
description: Action to perform based on regex matching.
Default is 'replace'
enum:
- drop
- hashmod
- keep
- labeldrop
- labelkeep
- labelmap
- replace
type: string
modulus:
description: Modulus to take of the hash of the source
label values.
format: int64
type: integer
regex:
default: (.*)
description: Regular expression against which the extracted
value is matched. Default is '(.*)'
type: string
replacement:
default: $1
description: Replacement value against which a regex
replace is performed if the regular expression matches.
Regex capture groups are available. Default is '$1'
type: string
separator:
default: ;
description: Separator placed between concatenated source
label values. default is ';'.
type: string
sourceLabels:
description: The source labels select values from existing
labels. Their content is concatenated using the configured
separator and matched against the configured regular
expression for the replace, keep, and drop actions.
items:
type: string
type: array
targetLabel:
description: Label to which the resulting value is written
in a replace action. It is mandatory for replace actions.
Regex capture groups are available.
type: string
required:
- sourceLabels
type: object
type: array
timeout:
default: 30s
description: Timeout for requests to the remote write endpoint.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
url:
description: The URL of the endpoint to send samples to.
type: string
required:
- authorization
- authorizationSecretName
- name
- url
type: object
enabled:
description: Enable remote-write functionality.
type: boolean
queue:
description: Defines the configuration for remote write client
queue.
properties:
batchSendDeadline:
default: 5s
description: Maximum time a sample will wait in buffer.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
capacity:
default: 2500
description: Number of samples to buffer per shard before
we block reading of more
format: int32
type: integer
maxBackOffPeriod:
default: 100ms
description: Maximum retry delay.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
maxSamplesPerSend:
default: 500
description: Maximum number of samples per send.
format: int32
type: integer
maxShards:
default: 200
description: Maximum number of shards, i.e. amount of concurrency.
format: int32
type: integer
minBackOffPeriod:
default: 30ms
description: Initial retry delay. Gets doubled for every retry.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
minShards:
default: 200
description: Minimum number of shards, i.e. amount of concurrency.
format: int32
type: integer
type: object
refreshPeriod:
default: 10s
description: Minimum period to wait between refreshing remote-write
reconfigurations.
pattern: ((([0-9]+)y)?(([0-9]+)w)?(([0-9]+)d)?(([0-9]+)h)?(([0-9]+)m)?(([0-9]+)s)?(([0-9]+)ms)?|0)
type: string
type: object
type: object
status:
description: RulerConfigStatus defines the observed state of RulerConfig
properties:
conditions:
description: Conditions of the RulerConfig health.
items:
description: "Condition contains details for one aspect of the current
state of this API Resource. --- This struct is intended for direct
use as an array at the field path .status.conditions. For example,
\n type FooStatus struct{ // Represents the observations of a
foo's current state. // Known .status.conditions.type are: \"Available\",
\"Progressing\", and \"Degraded\" // +patchMergeKey=type // +patchStrategy=merge
// +listType=map // +listMapKey=type Conditions []metav1.Condition
`json:\"conditions,omitempty\" patchStrategy:\"merge\" patchMergeKey:\"type\"
protobuf:\"bytes,1,rep,name=conditions\"` \n // other fields }"
properties:
lastTransitionTime:
description: lastTransitionTime is the last time the condition
transitioned from one status to another. This should be when
the underlying condition changed. If that is not known, then
using the time when the API field changed is acceptable.
format: date-time
type: string
message:
description: message is a human readable message indicating
details about the transition. This may be an empty string.
maxLength: 32768
type: string
observedGeneration:
description: observedGeneration represents the .metadata.generation
that the condition was set based upon. For instance, if .metadata.generation
is currently 12, but the .status.conditions[x].observedGeneration
is 9, the condition is out of date with respect to the current
state of the instance.
format: int64
minimum: 0
type: integer
reason:
description: reason contains a programmatic identifier indicating
the reason for the condition's last transition. Producers
of specific condition types may define expected values and
meanings for this field, and whether the values are considered
a guaranteed API. The value should be a CamelCase string.
This field may not be empty.
maxLength: 1024
minLength: 1
pattern: ^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$
type: string
status:
description: status of the condition, one of True, False, Unknown.
enum:
- "True"
- "False"
- Unknown
type: string
type:
description: type of condition in CamelCase or in foo.example.com/CamelCase.
--- Many .condition.type values are consistent across resources
like Available, but because arbitrary conditions can be useful
(see .node.status.conditions), the ability to deconflict is
important. The regex it matches is (dns1123SubdomainFmt/)?(qualifiedNameFmt)
maxLength: 316
pattern: ^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$
type: string
required:
- lastTransitionTime
- message
- reason
- status
- type
type: object
type: array
type: object
type: object
served: true
storage: true
subresources:
status: {}
status:
acceptedNames:
kind: ""
plural: ""
conditions: null
storedVersions: null

@ -0,0 +1,15 @@
annotations:
# Core bundle annotations.
operators.operatorframework.io.bundle.mediatype.v1: registry+v1
operators.operatorframework.io.bundle.manifests.v1: manifests/
operators.operatorframework.io.bundle.metadata.v1: metadata/
operators.operatorframework.io.bundle.package.v1: loki-operator
operators.operatorframework.io.bundle.channels.v1: alpha
operators.operatorframework.io.bundle.channel.default.v1: alpha
operators.operatorframework.io.metrics.builder: operator-sdk-unknown
operators.operatorframework.io.metrics.mediatype.v1: metrics+v1
operators.operatorframework.io.metrics.project_layout: go.kubebuilder.io/v3
# Annotations for testing.
operators.operatorframework.io.test.mediatype.v1: scorecard+v1
operators.operatorframework.io.test.config.v1: tests/scorecard/

@ -16,6 +16,6 @@ LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/
# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
COPY ./manifests /manifests/
COPY ./metadata /metadata/
COPY ./tests/scorecard /tests/scorecard/

@ -172,7 +172,7 @@ metadata:
operatorframework.io/arch.arm64: supported
operatorframework.io/arch.ppc64le: supported
operatorframework.io/arch.s390x: supported
name: loki-operator.v0.0.1
name: loki-operator.v0.1.0
namespace: placeholder
spec:
apiservicedefinitions: {}
@ -1463,7 +1463,7 @@ spec:
value: quay.io/observatorium/api:latest
- name: RELATED_IMAGE_OPA
value: quay.io/observatorium/opa-openshift:latest
image: quay.io/openshift-logging/loki-operator:v0.0.1
image: quay.io/openshift-logging/loki-operator:v0.1.0
imagePullPolicy: IfNotPresent
livenessProbe:
httpGet:
@ -1572,12 +1572,12 @@ spec:
- name: Loki Operator
url: https://github.com/grafana/loki
maintainers:
- email: loki-operator-team@googlegroups.com
name: Grafana Loki SIG Operator
- email: team-logging@redhat.com
name: Red Hat, AOS Logging
maturity: alpha
minKubeVersion: 1.21.1
provider:
name: Grafana.com
name: Red Hat
relatedImages:
- image: quay.io/openshift-logging/loki:v2.7.3
name: loki
@ -1585,7 +1585,7 @@ spec:
name: gateway
- image: quay.io/observatorium/opa-openshift:latest
name: opa
version: 0.0.1
version: 0.1.0
webhookdefinitions:
- admissionReviewVersions:
- v1

@ -0,0 +1,70 @@
apiVersion: scorecard.operatorframework.io/v1alpha3
kind: Configuration
metadata:
name: config
stages:
- parallel: true
tests:
- entrypoint:
- scorecard-test
- basic-check-spec
image: quay.io/operator-framework/scorecard-test:v1.4.0
labels:
suite: basic
test: basic-check-spec-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-bundle-validation
image: quay.io/operator-framework/scorecard-test:v1.4.0
labels:
suite: olm
test: olm-bundle-validation-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-crds-have-validation
image: quay.io/operator-framework/scorecard-test:v1.4.0
labels:
suite: olm
test: olm-crds-have-validation-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-crds-have-resources
image: quay.io/operator-framework/scorecard-test:v1.4.0
labels:
suite: olm
test: olm-crds-have-resources-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-spec-descriptors
image: quay.io/operator-framework/scorecard-test:v1.4.0
labels:
suite: olm
test: olm-spec-descriptors-test
storage:
spec:
mountPath: {}
- entrypoint:
- scorecard-test
- olm-status-descriptors
image: quay.io/operator-framework/scorecard-test:v1.4.0
labels:
suite: olm
test: olm-status-descriptors-test
storage:
spec:
mountPath: {}
storage:
spec:
mountPath: {}

@ -6,4 +6,4 @@ kind: Kustomization
images:
- name: controller
newName: quay.io/openshift-logging/loki-operator
newTag: v0.0.1
newTag: v0.1.0

File diff suppressed because one or more lines are too long

@ -0,0 +1,4 @@
resources:
- ../../overlays/community
- ../../samples
- ../../scorecard

@ -1,4 +0,0 @@
resources:
- ../overlays/openshift
- ../samples
- ../scorecard

@ -1474,10 +1474,10 @@ spec:
- name: Loki Operator
url: https://github.com/grafana/loki
maintainers:
- email: loki-operator-team@googlegroups.com
name: Grafana Loki SIG Operator
- email: team-logging@redhat.com
name: Red Hat, AOS Logging
maturity: alpha
minKubeVersion: 1.21.1
provider:
name: Grafana.com
name: Red Hat
version: 0.0.0

@ -0,0 +1,4 @@
resources:
- ../../overlays/openshift
- ../../samples
- ../../scorecard

@ -3,7 +3,7 @@ kind: ProjectConfig
health:
healthProbeBindAddress: :8081
metrics:
bindAddress: :8080
bindAddress: 127.0.0.1:8080
webhook:
port: 9443
leaderElection:
@ -12,3 +12,9 @@ leaderElection:
featureGates:
lokiStackGateway: true
runtimeSeccompProfile: false
#
# Webhook feature gates
#
lokiStackWebhook: true
alertingRuleWebhook: true
recordingRuleWebhook: true

@ -4,7 +4,6 @@ resources:
- ../../manager
- ../../webhook
- ../../certmanager
- ../../prometheus
# Adds namespace to all resources.
namespace: loki-operator
@ -23,8 +22,8 @@ labels:
app.kubernetes.io/managed-by: operator-lifecycle-manager
includeSelectors: true
- pairs:
app.kubernetes.io/instance: loki-operator-v0.0.1
app.kubernetes.io/version: "0.0.1"
app.kubernetes.io/instance: loki-operator-v0.1.0
app.kubernetes.io/version: "0.1.0"
generatorOptions:
disableNameSuffixHash: true
@ -39,15 +38,12 @@ patchesStrategicMerge:
- manager_related_image_patch.yaml
- manager_run_flags_patch.yaml
- manager_webhook_patch.yaml
- prometheus_service_monitor_patch.yaml
- webhookcainjection_patch.yaml
images:
- name: controller
# Change this to docker.io/grafana/loki-operator once the following issue is resolved:
# https://github.com/grafana/loki/issues/5617
newName: quay.io/openshift-logging/loki-operator
newTag: v0.0.1
newName: docker.io/grafana/loki-operator
newTag: main-39f2856
# the following config is for teaching kustomize how to do var substitution
vars:

@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
spec:
template:
spec:
containers:
- name: kube-rbac-proxy
image: quay.io/openshift/origin-kube-rbac-proxy:latest
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--v=0"
ports:
- containerPort: 8443
name: https
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
securityContext:
runAsNonRoot: true

@ -19,4 +19,4 @@ spec:
- name: webhook-cert
secret:
defaultMode: 420
secretName: loki-operator-webhook-server-cert
secretName: loki-operator-controller-manager-service-cert

@ -0,0 +1,14 @@
# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
name: loki-operator
name: metrics-monitor
spec:
endpoints:
- path: /metrics
targetPort: 8443
scheme: http
interval: 30s
scrapeTimeout: 10s

@ -1,38 +0,0 @@
# This patch inject a sidecar container which is a HTTP proxy for the
# controller manager, it performs RBAC authorization against the Kubernetes API using SubjectAccessReviews.
apiVersion: apps/v1
kind: Deployment
metadata:
name: controller-manager
spec:
template:
spec:
containers:
- name: kube-rbac-proxy
image: gcr.io/kubebuilder/kube-rbac-proxy:v0.11.0
args:
- "--secure-listen-address=0.0.0.0:8443"
- "--upstream=http://127.0.0.1:8080/"
- "--logtostderr=true"
- "--tls-cert-file=/var/run/secrets/serving-cert/tls.crt"
- "--tls-private-key-file=/var/run/secrets/serving-cert/tls.key"
- "--v=0"
ports:
- containerPort: 8443
name: https
volumeMounts:
- mountPath: /var/run/secrets/serving-cert
name: loki-operator-metrics-cert
securityContext:
allowPrivilegeEscalation: false
capabilities:
drop:
- ALL
volumes:
- name: loki-operator-metrics-cert
secret:
defaultMode: 420
optional: true
secretName: loki-operator-metrics
securityContext:
runAsNonRoot: true

@ -1,18 +0,0 @@
# Prometheus Monitor Service (Metrics)
apiVersion: monitoring.coreos.com/v1
kind: ServiceMonitor
metadata:
labels:
name: loki-operator
name: metrics-monitor
spec:
endpoints:
- bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token
path: /metrics
targetPort: 8443
scheme: https
interval: 30s
scrapeTimeout: 10s
tlsConfig:
caFile: /etc/prometheus/configmaps/serving-certs-ca-bundle/service-ca.crt
serverName: loki-operator-controller-manager-metrics-service.loki-operator.svc

@ -30,10 +30,10 @@ Loki Operator is the Kubernetes Operator for [Loki](https://grafana.com/docs/lok
* Build and push the container image and then deploy the operator with:
```console
make oci-build oci-push deploy REGISTRY_ORG=$YOUR_QUAY_ORG VERSION=latest
make oci-build oci-push deploy REGISTRY_BASE=$YOUR_REPO_ORG VERSION=latest
```
where `$YOUR_QUAY_ORG` is your personal [quay.io](http://quay.io/) account where you can push container images.
where `$YOUR_REPO_ORG` is your personal registry location, for example a [quay.io](http://quay.io/) account where you can push container images.
The above command will deploy the operator to your active Kubernetes cluster defined by your local [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/). The operator will be running in the `default` namespace.
@ -108,10 +108,10 @@ It will undeploy controller from the configured Kubernetes cluster in [~/.kube/c
* Build and push the container image [2] and then deploy the operator with:
```console
make olm-deploy REGISTRY_ORG=$YOUR_QUAY_ORG VERSION=$VERSION
make olm-deploy REGISTRY_BASE=$YOUR_REPO_ORG VERSION=$VERSION
```
where `$YOUR_QUAY_ORG` is your personal [quay.io](http://quay.io/) account where you can push container images and `$VERSION` can be any random version number such as `v0.0.1`.
where `$YOUR_REPO_ORG` is your personal registry location, for example a [quay.io](http://quay.io/) account where you can push container images and `$VERSION` can be any random version number such as `v0.0.1`.
The above command will deploy the operator to your active Openshift cluster defined by your local [kubeconfig](https://kubernetes.io/docs/concepts/configuration/organize-cluster-access-kubeconfig/). The operator will be running in the `openshift-operators-redhat` namespace.

@ -26,7 +26,7 @@ Storage Size Calculator is used to have an idea on how to properly size a Loki c
* Deploy the storage size calculator by executing following command in the terminal:
```console
make deploy-size-calculator REGISTRY_ORG=$YOUR_QUAY_ORG
make deploy-size-calculator REGISTRY_ORG_OPENSHIFT=$YOUR_QUAY_ORG
```
where `$YOUR_QUAY_ORG` is your personal [quay.io](http://quay.io/) account where you can push container images.
@ -88,7 +88,7 @@ If you want to contribute to the storage size calculator, you can follow this lo
After replacing the image name, deploy the storage size calculator to test your changes:
```console
make deploy-size-calculator REGISTRY_ORG=$YOUR_QUAY_ORG
make deploy-size-calculator REGISTRY_ORG_OPENSHIFT=$YOUR_QUAY_ORG
```
where `$YOUR_QUAY_ORG` is your personal [quay.io](http://quay.io/) account where you pushed your container image.

@ -29,7 +29,7 @@ make quickstart
If you want to test local changes from your repository fork, you need to provide an image registry organization that you own that has an image repository name `loki-operator`, e.g. `quay.io/my-company-org/loki-operator`. The command to use your custom images is:
```shell
make quickstart REGISTRY_ORG=my-company-org
make quickstart REGISTRY_BASE=quay.io/my-company-org
```
## Further reading

@ -0,0 +1,51 @@
Thanks submitting your Operator. Please check below list before you create your Pull Request.
### New Submissions
* [ ] Are you familiar with our [contribution guidelines](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-via-pr.md)?
* [ ] Have you [packaged and deployed](https://github.com/operator-framework/community-operators/blob/master/docs/testing-operators.md) your Operator for Operator Framework?
* [ ] Have you tested your Operator with all Custom Resource Definitions?
* [ ] Have you tested your Operator in all supported [installation modes](https://github.com/operator-framework/operator-lifecycle-manager/blob/master/doc/design/building-your-csv.md#operator-metadata)?
* [ ] Have you considered whether you want use [semantic versioning order](https://github.com/operator-framework/community-operators/blob/master/docs/operator-ci-yaml.md#semver-mode)?
* [ ] Is your submission [signed](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-prerequisites.md#sign-your-work)?
* [ ] Is operator [icon](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#operator-icon) set?
### Updates to existing Operators
* [ ] Did you create a `ci.yaml` file according to the [update instructions](https://github.com/operator-framework/community-operators/blob/master/docs/operator-ci-yaml.md)?
* [ ] Is your new CSV pointing to the previous version with the `replaces` property if you chose `replaces-mode` via the `updateGraph` property in `ci.yaml`?
* [ ] Is your new CSV referenced in the [appropriate channel](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#channels) defined in the `package.yaml` or `annotations.yaml` ?
* [ ] Have you tested an update to your Operator when deployed via OLM?
* [ ] Is your submission [signed](https://github.com/operator-framework/community-operators/blob/master/docs/contributing-prerequisites.md#sign-your-work)?
### Your submission should not
* [ ] Modify more than one operator
* [ ] Modify an Operator you don't own
* [ ] Rename an operator - please remove and add with a different name instead
* [ ] Submit operators to both `upstream-community-operators` and `community-operators` at once
* [ ] Modify any files outside the above mentioned folders
* [ ] Contain more than one commit. **Please squash your commits.**
### Operator Description must contain (in order)
1. [ ] Description about the managed Application and where to find more information
2. [ ] Features and capabilities of your Operator and how to use it
3. [ ] Any manual steps about potential pre-requisites for using your Operator
### Operator Metadata should contain
* [ ] Human readable name and 1-liner description about your Operator
* [ ] Valid [category name](https://github.com/operator-framework/community-operators/blob/master/docs/packaging-operator.md#categories)<sup>1</sup>
* [ ] One of the pre-defined [capability levels](https://github.com/operator-framework/operator-courier/blob/4d1a25d2c8d52f7de6297ec18d8afd6521236aa2/operatorcourier/validate.py#L556)<sup>2</sup>
* [ ] Links to the maintainer, source code and documentation
* [ ] Example templates for all Custom Resource Definitions intended to be used
* [ ] A quadratic logo
Remember that you can preview your CSV [here](https://operatorhub.io/preview).
--
<sup>1</sup> If you feel your Operator does not fit any of the pre-defined categories, file an issue against this repo and explain your need
<sup>2</sup> For more information see [here](https://sdk.operatorframework.io/docs/overview/#operator-capability-level)

@ -0,0 +1,71 @@
#!/usr/bin/env bash
set -e -u -o pipefail
COMMUNITY_OPERATORS_REPOSITORY="k8s-operatorhub/community-operators"
UPSTREAM_REPOSITORY="redhat-openshift-ecosystem/community-operators-prod"
LOCAL_REPOSITORIES_PATH=${LOCAL_REPOSITORIES_PATH:-"$(dirname "$(dirname "$(dirname "$(pwd)")")")"}
if [[ ! -d "${LOCAL_REPOSITORIES_PATH}/${COMMUNITY_OPERATORS_REPOSITORY}" ]]; then
echo "${LOCAL_REPOSITORIES_PATH}/${COMMUNITY_OPERATORS_REPOSITORY} doesn't exist, aborting."
exit 1
fi
if [[ ! -d "${LOCAL_REPOSITORIES_PATH}/${UPSTREAM_REPOSITORY}" ]]; then
echo "${LOCAL_REPOSITORIES_PATH}/${UPSTREAM_REPOSITORY} doesn't exist, aborting."
exit 1
fi
SOURCE_DIR=$(pwd)
VERSION=$(grep "VERSION ?= " Makefile | awk -F= '{print $3}' | xargs)
for dest in ${COMMUNITY_OPERATORS_REPOSITORY} ${UPSTREAM_REPOSITORY}; do
(
cd "${LOCAL_REPOSITORIES_PATH}/${dest}" || exit
if ! git remote | grep upstream > /dev/null;
then
echo "Cannot find a remote named 'upstream'. Adding one."
git remote add upstream "git@github.com:${dest}.git"
fi
git fetch -q upstream
git checkout -q main
git rebase -q upstream/main
mkdir -p "operators/loki-operator/${VERSION}"
cp -r "${SOURCE_DIR}/bundle/community"/* "operators/loki-operator/${VERSION}/"
rm "operators/loki-operator/${VERSION}/bundle.Dockerfile"
if [[ "${dest}" = "${UPSTREAM_REPOSITORY}" ]]; then
python3 - << END
import os, yaml
with open("./operators/loki-operator/${VERSION}/metadata/annotations.yaml", 'r') as f:
y=yaml.safe_load(f) or {}
y['annotations']['com.redhat.openshift.versions'] = os.getenv('SUPPORTED_OCP_VERSIONS')
with open("./operators/loki-operator/${VERSION}/metadata/annotations.yaml", 'w') as f:
yaml.dump(y, f)
END
fi
if ! git checkout -q -b "update-loki-operator-to-${VERSION}";
then
echo "Cannot switch to the new branch update-loki-operator-${dest}-to-${VERSION}. Aborting"
exit 1
fi
git add .
git commit -sqm "Update loki-operator to v${VERSION}"
if ! command -v gh > /dev/null;
then
echo "'gh' command not found, can't submit the PR on your behalf."
exit 0
fi
echo "Submitting PR on your behalf via 'gh'"
gh pr create --title "Update loki-operator to v${VERSION}" --body-file "${SOURCE_DIR}/hack/.checked-pr-template.md"
)
done
echo "Completed."
Loading…
Cancel
Save