Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Draft] operator: Gossip Ring support for IPv6 #9333

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -1740,6 +1740,8 @@ github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5t
github.com/yuin/gopher-lua v0.0.0-20180630135845-46796da1b0b4/go.mod h1:aEV29XrmTYFr3CiRxZeGHpkvbwq+prZduBqMaascyCU=
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64 h1:5mLPGnFdSsevFRFc9q3yYbBkB6tsm4aCwwQV/j1JQAQ=
github.com/yuin/gopher-lua v0.0.0-20220504180219-658193537a64/go.mod h1:GBR0iDaNXjAgGg9zfCvksxSRnQx76gclCIb7kdAd1Pw=
github.com/zalegrala/dskit v0.0.0-20230209210417-33303a08caf7 h1:vk35Z8mjYN2/fHgwjFPycpkJItvRnHc9xJliJ1nOz20=
github.com/zalegrala/dskit v0.0.0-20230209210417-33303a08caf7/go.mod h1:zj+5BNZAVmQafV583uLTAOzRr963KPdEm4d6NPmtbwg=
go.etcd.io/bbolt v1.3.3/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU=
go.etcd.io/bbolt v1.3.6 h1:/ecaJf0sk1l4l6V4awd65v2C3ILy7MSj+s/x1ADCIMU=
go.etcd.io/bbolt v1.3.6/go.mod h1:qXsaaIqmgQH0T+OPdb99Bf+PKfBBQVAdyD6TY9G8XM4=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ metadata:
operatorframework.io/arch.arm64: supported
operatorframework.io/arch.ppc64le: supported
operatorframework.io/arch.s390x: supported
name: loki-operator.v0.1.0
name: loki-operator.v0.0.3
namespace: placeholder
spec:
apiservicedefinitions: {}
Expand Down Expand Up @@ -1497,8 +1497,8 @@ 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.1.0
imagePullPolicy: IfNotPresent
image: quay.io/shwetaap/loki-operator:v0.0.3
imagePullPolicy: Always
livenessProbe:
httpGet:
path: /healthz
Expand Down Expand Up @@ -1619,7 +1619,7 @@ spec:
name: gateway
- image: quay.io/observatorium/opa-openshift:latest
name: opa
version: 0.1.0
version: 0.0.3
webhookdefinitions:
- admissionReviewVersions:
- v1
Expand Down
4 changes: 2 additions & 2 deletions operator/config/manager/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
images:
- name: controller
newName: quay.io/openshift-logging/loki-operator
newTag: v0.1.0
newName: quay.io/shwetaap/loki-operator
newTag: v0.0.3
2 changes: 1 addition & 1 deletion operator/config/manager/manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ spec:
- command:
- /manager
image: controller:latest
imagePullPolicy: IfNotPresent
imagePullPolicy: Always
name: manager
ports:
- containerPort: 8080
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ spec:
- name: manager
env:
- name: RELATED_IMAGE_LOKI
value: quay.io/openshift-logging/loki:v2.8.0
value: quay.io/shwetaap/loki:dev
- name: RELATED_IMAGE_GATEWAY
value: quay.io/observatorium/api:latest
- name: RELATED_IMAGE_OPA
Expand Down
2 changes: 1 addition & 1 deletion operator/hack/lokistack_gateway_ocp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ spec:
secret:
name: test
type: s3
storageClassName: gp2
storageClassName: nfs
tenants:
mode: openshift-logging
rules:
Expand Down
12 changes: 12 additions & 0 deletions operator/internal/manifests/compactor.go
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,7 @@ func NewCompactorStatefulSet(opts Options) *appsv1.StatefulSet {
func NewCompactorGRPCService(opts Options) *corev1.Service {
serviceName := serviceNameCompactorGRPC(opts.Name)
labels := ComponentLabels(LabelCompactorComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -196,6 +197,11 @@ func NewCompactorGRPCService(opts Options) *corev1.Service {
},
Spec: corev1.ServiceSpec{
ClusterIP: "None",
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiGRPCPortName,
Expand All @@ -213,6 +219,7 @@ func NewCompactorGRPCService(opts Options) *corev1.Service {
func NewCompactorHTTPService(opts Options) *corev1.Service {
serviceName := serviceNameCompactorHTTP(opts.Name)
labels := ComponentLabels(LabelCompactorComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -224,6 +231,11 @@ func NewCompactorHTTPService(opts Options) *corev1.Service {
Labels: labels,
},
Spec: corev1.ServiceSpec{
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiHTTPPortName,
Expand Down
1 change: 1 addition & 0 deletions operator/internal/manifests/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,7 @@ func gossipRingConfig(stackName, stackNs string, spec *lokiv1.HashRingSpec) conf
InstanceAddr: instanceAddr,
InstancePort: grpcPort,
BindPort: gossipPort,
BindAddr: gossipAddr,
MembersDiscoveryAddr: fqdn(BuildLokiGossipRingService(stackName).GetName(), stackNs),
}
}
Expand Down
12 changes: 12 additions & 0 deletions operator/internal/manifests/distributor.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,7 @@ func NewDistributorDeployment(opts Options) *appsv1.Deployment {
func NewDistributorGRPCService(opts Options) *corev1.Service {
serviceName := serviceNameDistributorGRPC(opts.Name)
labels := ComponentLabels(LabelDistributorComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -173,6 +174,11 @@ func NewDistributorGRPCService(opts Options) *corev1.Service {
},
Spec: corev1.ServiceSpec{
ClusterIP: "None",
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiGRPCPortName,
Expand All @@ -190,6 +196,7 @@ func NewDistributorGRPCService(opts Options) *corev1.Service {
func NewDistributorHTTPService(opts Options) *corev1.Service {
serviceName := serviceNameDistributorHTTP(opts.Name)
labels := ComponentLabels(LabelDistributorComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -201,6 +208,11 @@ func NewDistributorHTTPService(opts Options) *corev1.Service {
Labels: labels,
},
Spec: corev1.ServiceSpec{
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiHTTPPortName,
Expand Down
12 changes: 12 additions & 0 deletions operator/internal/manifests/indexgateway.go
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ func NewIndexGatewayStatefulSet(opts Options) *appsv1.StatefulSet {
func NewIndexGatewayGRPCService(opts Options) *corev1.Service {
serviceName := serviceNameIndexGatewayGRPC(opts.Name)
labels := ComponentLabels(LabelIndexGatewayComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -199,6 +200,11 @@ func NewIndexGatewayGRPCService(opts Options) *corev1.Service {
},
Spec: corev1.ServiceSpec{
ClusterIP: "None",
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiGRPCPortName,
Expand All @@ -216,6 +222,7 @@ func NewIndexGatewayGRPCService(opts Options) *corev1.Service {
func NewIndexGatewayHTTPService(opts Options) *corev1.Service {
serviceName := serviceNameIndexGatewayHTTP(opts.Name)
labels := ComponentLabels(LabelIndexGatewayComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -227,6 +234,11 @@ func NewIndexGatewayHTTPService(opts Options) *corev1.Service {
Labels: labels,
},
Spec: corev1.ServiceSpec{
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiHTTPPortName,
Expand Down
12 changes: 12 additions & 0 deletions operator/internal/manifests/ingester.go
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ func NewIngesterStatefulSet(opts Options) *appsv1.StatefulSet {
// NewIngesterGRPCService creates a k8s service for the ingester GRPC endpoint
func NewIngesterGRPCService(opts Options) *corev1.Service {
labels := ComponentLabels(LabelIngesterComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -226,6 +227,11 @@ func NewIngesterGRPCService(opts Options) *corev1.Service {
},
Spec: corev1.ServiceSpec{
ClusterIP: "None",
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiGRPCPortName,
Expand All @@ -243,6 +249,7 @@ func NewIngesterGRPCService(opts Options) *corev1.Service {
func NewIngesterHTTPService(opts Options) *corev1.Service {
serviceName := serviceNameIngesterHTTP(opts.Name)
labels := ComponentLabels(LabelIngesterComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -254,6 +261,11 @@ func NewIngesterHTTPService(opts Options) *corev1.Service {
Labels: labels,
},
Spec: corev1.ServiceSpec{
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiHTTPPortName,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@ ingester:
final_sleep: 0s
join_after: 30s
num_tokens: 512
enable_inet6: true
ring:
replication_factor: {{ .Stack.ReplicationFactor }}
max_transfer_retries: 0
Expand Down Expand Up @@ -187,6 +188,7 @@ memberlist:
advertise_addr: {{ . }}
{{- end }}
advertise_port: {{ .BindPort }}
bind_addr: {{ .BindAddr }}
bind_port: {{ .BindPort }}
join_members:
- {{ .MembersDiscoveryAddr }}:{{ .BindPort }}
Expand Down
2 changes: 2 additions & 0 deletions operator/internal/manifests/internal/config/options.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,8 @@ type GossipRing struct {
InstanceAddr string
// InstancePort is required
InstancePort int
// BindAddr is the addr for listening to gossip messages
BindAddr string
// BindPort is the port for listening to gossip messages
BindPort int
// MembersDiscoveryAddr is required
Expand Down
6 changes: 6 additions & 0 deletions operator/internal/manifests/memberlist.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (

// BuildLokiGossipRingService creates a k8s service for the gossip/memberlist members of the cluster
func BuildLokiGossipRingService(stackName string) *corev1.Service {
preferDual := corev1.IPFamilyPolicyPreferDualStack
return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Kind: "Service",
Expand All @@ -25,6 +26,11 @@ func BuildLokiGossipRingService(stackName string) *corev1.Service {
},
Spec: corev1.ServiceSpec{
ClusterIP: "None",
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiGossipPortName,
Expand Down
6 changes: 6 additions & 0 deletions operator/internal/manifests/openshift/configure.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,13 @@ func ConfigureGatewayDeployment(
// ConfigureGatewayService merges the OpenPolicyAgent sidecar metrics port into
// the service spec. With this the metrics are exposed through the same service.
func ConfigureGatewayService(s *corev1.ServiceSpec) error {
preferDual := corev1.IPFamilyPolicyPreferDualStack
spec := corev1.ServiceSpec{
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: opaMetricsPortName,
Expand Down
12 changes: 12 additions & 0 deletions operator/internal/manifests/querier.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ func NewQuerierDeployment(opts Options) *appsv1.Deployment {
func NewQuerierGRPCService(opts Options) *corev1.Service {
serviceName := serviceNameQuerierGRPC(opts.Name)
labels := ComponentLabels(LabelQuerierComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -179,6 +180,11 @@ func NewQuerierGRPCService(opts Options) *corev1.Service {
},
Spec: corev1.ServiceSpec{
ClusterIP: "None",
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiGRPCPortName,
Expand All @@ -196,6 +202,7 @@ func NewQuerierGRPCService(opts Options) *corev1.Service {
func NewQuerierHTTPService(opts Options) *corev1.Service {
serviceName := serviceNameQuerierHTTP(opts.Name)
labels := ComponentLabels(LabelQuerierComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -207,6 +214,11 @@ func NewQuerierHTTPService(opts Options) *corev1.Service {
Labels: labels,
},
Spec: corev1.ServiceSpec{
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiHTTPPortName,
Expand Down
12 changes: 12 additions & 0 deletions operator/internal/manifests/query-frontend.go
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,7 @@ func NewQueryFrontendDeployment(opts Options) *appsv1.Deployment {
func NewQueryFrontendGRPCService(opts Options) *corev1.Service {
serviceName := serviceNameQueryFrontendGRPC(opts.Name)
labels := ComponentLabels(LabelQueryFrontendComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -185,6 +186,11 @@ func NewQueryFrontendGRPCService(opts Options) *corev1.Service {
},
Spec: corev1.ServiceSpec{
ClusterIP: "None",
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiGRPCPortName,
Expand All @@ -202,6 +208,7 @@ func NewQueryFrontendGRPCService(opts Options) *corev1.Service {
func NewQueryFrontendHTTPService(opts Options) *corev1.Service {
serviceName := serviceNameQueryFrontendHTTP(opts.Name)
labels := ComponentLabels(LabelQueryFrontendComponent, opts.Name)
preferDual := corev1.IPFamilyPolicyPreferDualStack

return &corev1.Service{
TypeMeta: metav1.TypeMeta{
Expand All @@ -213,6 +220,11 @@ func NewQueryFrontendHTTPService(opts Options) *corev1.Service {
Labels: labels,
},
Spec: corev1.ServiceSpec{
IPFamilies: []corev1.IPFamily{
corev1.IPv6Protocol,
corev1.IPv4Protocol,
},
IPFamilyPolicy: &preferDual,
Ports: []corev1.ServicePort{
{
Name: lokiHTTPPortName,
Expand Down
Loading