Skip to content

Commit

Permalink
operator: Add support for memberlist bind network configuration (graf…
Browse files Browse the repository at this point in the history
…ana#8672)

Co-authored-by: Robert Jacob <xperimental@solidproject.de>
  • Loading branch information
periklis and xperimental authored Mar 17, 2023
1 parent a4d06ac commit 9b1a427
Show file tree
Hide file tree
Showing 26 changed files with 1,141 additions and 60 deletions.
1 change: 1 addition & 0 deletions operator/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
## Main

- [8672](https://github.com/grafana/loki/pull/8672) **periklis**: Add support for memberlist bind network configuration
- [8748](https://github.com/grafana/loki/pull/8748) **periklis**: Add alertingrule tenant id label for all rules
- [8743](https://github.com/grafana/loki/pull/8743) **periklis**: Add alerting style guide validation
- [8192](https://github.com/grafana/loki/pull/8192) **jotak**: Allow multiple matchers for multi-tenancy with Network tenant (OpenShift)
Expand Down
60 changes: 60 additions & 0 deletions operator/apis/loki/v1/lokistack_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,59 @@ type ClusterProxy struct {
NoProxy string `json:"noProxy,omitempty"`
}

// HashRingType defines the type of hash ring which can be used with the Loki cluster.
//
// +kubebuilder:validation:Enum=memberlist
type HashRingType string

const (
// HashRingMemberList when using memberlist for the distributed hash ring.
HashRingMemberList HashRingType = "memberlist"
)

// InstanceAddrType defines the type of pod network to use for advertising IPs to the ring.
//
// +kubebuilder:validation:Enum=default;podIP
type InstanceAddrType string

const (
// InstanceAddrDefault when using the first from any private network interfaces (RFC 1918 and RFC 6598).
InstanceAddrDefault InstanceAddrType = "default"
// InstanceAddrPodIP when using the public pod IP from the cluster's pod network.
InstanceAddrPodIP InstanceAddrType = "podIP"
)

// MemberListSpec defines the configuration for the memberlist based hash ring.
type MemberListSpec struct {
// InstanceAddrType defines the type of address to use to advertise to the ring.
// Defaults to the first address from any private network interfaces of the current pod.
// Alternatively the public pod IP can be used in case private networks (RFC 1918 and RFC 6598)
// are not available.
//
// +optional
// +kubebuilder:validation:optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:select:default","urn:alm:descriptor:com.tectonic.ui:select:podIP"},displayName="Instance Address"
InstanceAddrType InstanceAddrType `json:"instanceAddrType,omitempty"`
}

// HashRingSpec defines the hash ring configuration
type HashRingSpec struct {
// Type of hash ring implementation that should be used
//
// +required
// +kubebuilder:validation:Required
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:select:memberlist"},displayName="Type"
// +kubebuilder:default:=memberlist
Type HashRingType `json:"type"`

// MemberList configuration spec
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,displayName="Memberlist Config"
MemberList *MemberListSpec `json:"memberlist,omitempty"`
}

// ObjectStorageTLSSpec is the TLS configuration for reaching the object storage endpoint.
type ObjectStorageTLSSpec struct {
// Key is the data key of a ConfigMap containing a CA certificate.
Expand Down Expand Up @@ -674,6 +727,13 @@ type LokiStackSpec struct {
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors={"urn:alm:descriptor:com.tectonic.ui:select:1x.extra-small","urn:alm:descriptor:com.tectonic.ui:select:1x.small","urn:alm:descriptor:com.tectonic.ui:select:1x.medium"},displayName="LokiStack Size"
Size LokiStackSizeType `json:"size"`

// HashRing defines the spec for the distributed hash ring configuration.
//
// +optional
// +kubebuilder:validation:Optional
// +operator-sdk:csv:customresourcedefinitions:type=spec,xDescriptors="urn:alm:descriptor:com.tectonic.ui:advanced",displayName="Hash Ring"
HashRing *HashRingSpec `json:"hashRing,omitempty"`

// Storage defines the spec for the object storage endpoint to store logs.
//
// +required
Expand Down
40 changes: 40 additions & 0 deletions operator/apis/loki/v1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: docker.io/grafana/loki-operator:main-39f2856
createdAt: "2023-03-15T10:50:46Z"
createdAt: "2023-03-17T05:07:17Z"
description: The Community Loki Operator provides Kubernetes native deployment
and management of Loki and related logging components.
operators.operatorframework.io/builder: operator-sdk-unknown
Expand Down Expand Up @@ -257,6 +257,28 @@ spec:
name: ""
version: v1
specDescriptors:
- description: HashRing defines the spec for the distributed hash ring configuration.
displayName: Hash Ring
path: hashRing
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- description: MemberList configuration spec
displayName: Memberlist Config
path: hashRing.memberlist
- description: InstanceAddrType defines the type of address to use to advertise
to the ring. Defaults to the first address from any private network interfaces
of the current pod. Alternatively the public pod IP can be used in case
private networks (RFC 1918 and RFC 6598) are not available.
displayName: Instance Address
path: hashRing.memberlist.instanceAddrType
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:default
- urn:alm:descriptor:com.tectonic.ui:select:podIP
- description: Type of hash ring implementation that should be used
displayName: Type
path: hashRing.type
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:memberlist
- description: Limits defines the limits to be applied to log stream processing.
displayName: Rate Limiting
path: limits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ spec:
spec:
description: LokiStack CR spec field.
properties:
hashRing:
description: HashRing defines the spec for the distributed hash ring
configuration.
properties:
memberlist:
description: MemberList configuration spec
properties:
instanceAddrType:
description: InstanceAddrType defines the type of address
to use to advertise to the ring. Defaults to the first address
from any private network interfaces of the current pod.
Alternatively the public pod IP can be used in case private
networks (RFC 1918 and RFC 6598) are not available.
enum:
- default
- podIP
type: string
type: object
type:
default: memberlist
description: Type of hash ring implementation that should be used
enum:
- memberlist
type: string
required:
- type
type: object
limits:
description: Limits defines the limits to be applied to log stream
processing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ metadata:
categories: OpenShift Optional, Logging & Tracing
certified: "false"
containerImage: quay.io/openshift-logging/loki-operator:v0.1.0
createdAt: "2023-03-15T10:50:48Z"
createdAt: "2023-03-17T05:07:19Z"
description: |
The Loki Operator for OCP provides a means for configuring and managing a Loki stack for cluster logging.
## Prerequisites and Requirements
Expand Down Expand Up @@ -270,6 +270,28 @@ spec:
name: ""
version: v1
specDescriptors:
- description: HashRing defines the spec for the distributed hash ring configuration.
displayName: Hash Ring
path: hashRing
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- description: MemberList configuration spec
displayName: Memberlist Config
path: hashRing.memberlist
- description: InstanceAddrType defines the type of address to use to advertise
to the ring. Defaults to the first address from any private network interfaces
of the current pod. Alternatively the public pod IP can be used in case
private networks (RFC 1918 and RFC 6598) are not available.
displayName: Instance Address
path: hashRing.memberlist.instanceAddrType
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:default
- urn:alm:descriptor:com.tectonic.ui:select:podIP
- description: Type of hash ring implementation that should be used
displayName: Type
path: hashRing.type
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:memberlist
- description: Limits defines the limits to be applied to log stream processing.
displayName: Rate Limiting
path: limits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,33 @@ spec:
spec:
description: LokiStack CR spec field.
properties:
hashRing:
description: HashRing defines the spec for the distributed hash ring
configuration.
properties:
memberlist:
description: MemberList configuration spec
properties:
instanceAddrType:
description: InstanceAddrType defines the type of address
to use to advertise to the ring. Defaults to the first address
from any private network interfaces of the current pod.
Alternatively the public pod IP can be used in case private
networks (RFC 1918 and RFC 6598) are not available.
enum:
- default
- podIP
type: string
type: object
type:
default: memberlist
description: Type of hash ring implementation that should be used
enum:
- memberlist
type: string
required:
- type
type: object
limits:
description: Limits defines the limits to be applied to log stream
processing.
Expand Down
27 changes: 27 additions & 0 deletions operator/config/crd/bases/loki.grafana.com_lokistacks.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,33 @@ spec:
spec:
description: LokiStack CR spec field.
properties:
hashRing:
description: HashRing defines the spec for the distributed hash ring
configuration.
properties:
memberlist:
description: MemberList configuration spec
properties:
instanceAddrType:
description: InstanceAddrType defines the type of address
to use to advertise to the ring. Defaults to the first address
from any private network interfaces of the current pod.
Alternatively the public pod IP can be used in case private
networks (RFC 1918 and RFC 6598) are not available.
enum:
- default
- podIP
type: string
type: object
type:
default: memberlist
description: Type of hash ring implementation that should be used
enum:
- memberlist
type: string
required:
- type
type: object
limits:
description: Limits defines the limits to be applied to log stream
processing.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,28 @@ spec:
name: ""
version: v1
specDescriptors:
- description: HashRing defines the spec for the distributed hash ring configuration.
displayName: Hash Ring
path: hashRing
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- description: MemberList configuration spec
displayName: Memberlist Config
path: hashRing.memberlist
- description: InstanceAddrType defines the type of address to use to advertise
to the ring. Defaults to the first address from any private network interfaces
of the current pod. Alternatively the public pod IP can be used in case
private networks (RFC 1918 and RFC 6598) are not available.
displayName: Instance Address
path: hashRing.memberlist.instanceAddrType
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:default
- urn:alm:descriptor:com.tectonic.ui:select:podIP
- description: Type of hash ring implementation that should be used
displayName: Type
path: hashRing.type
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:memberlist
- description: Limits defines the limits to be applied to log stream processing.
displayName: Rate Limiting
path: limits
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,28 @@ spec:
name: ""
version: v1
specDescriptors:
- description: HashRing defines the spec for the distributed hash ring configuration.
displayName: Hash Ring
path: hashRing
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:advanced
- description: MemberList configuration spec
displayName: Memberlist Config
path: hashRing.memberlist
- description: InstanceAddrType defines the type of address to use to advertise
to the ring. Defaults to the first address from any private network interfaces
of the current pod. Alternatively the public pod IP can be used in case
private networks (RFC 1918 and RFC 6598) are not available.
displayName: Instance Address
path: hashRing.memberlist.instanceAddrType
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:default
- urn:alm:descriptor:com.tectonic.ui:select:podIP
- description: Type of hash ring implementation that should be used
displayName: Type
path: hashRing.type
x-descriptors:
- urn:alm:descriptor:com.tectonic.ui:select:memberlist
- description: Limits defines the limits to be applied to log stream processing.
displayName: Rate Limiting
path: limits
Expand Down
Loading

0 comments on commit 9b1a427

Please sign in to comment.