Skip to content

Commit

Permalink
chore: move subscribers
Browse files Browse the repository at this point in the history
  • Loading branch information
Ubisoft-potato authored and cre8ivejp committed Aug 5, 2024
1 parent 34d8f33 commit 24ea123
Show file tree
Hide file tree
Showing 57 changed files with 1,673 additions and 501 deletions.
41 changes: 41 additions & 0 deletions cmd/subscriber/subscriber.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
// Copyright 2024 The Bucketeer Authors.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package main

import (
"log"

"github.com/bucketeer-io/bucketeer/pkg/cli"
"github.com/bucketeer-io/bucketeer/pkg/subscriber/cmd/server"
)

var (
name = "bucketeer-subscriber"
version = ""
build = ""
)

func main() {
app := cli.NewApp(name, "A/B Testing Microservice", version, build)
registerCommands(app)
err := app.Run()
if err != nil {
log.Fatal(err)
}
}

func registerCommands(app *cli.App) {
server.RegisterCommand(app, app)
}
14 changes: 0 additions & 14 deletions manifests/bucketeer/charts/batch/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,6 @@ spec:
- name: oauth-key-secret
secret:
secretName: {{ template "oauth-key-secret" . }}
- name: subscriber-config
configMap:
name: {{ template "batch-server.fullname" . }}-subscribers-config
{{- if .Values.serviceAccount.annotations }}
serviceAccountName: {{ template "batch-server.fullname" . }}
{{- end }}
Expand Down Expand Up @@ -117,14 +114,6 @@ spec:
value: /usr/local/service-token/token
- name: BUCKETEER_BATCH_CERT
value: /usr/local/certs/service/tls.crt
- name : BUCKETEER_BATCH_SUBSCRIBER_CONFIG
value: /usr/local/conf/subscribers.json
- name: BUCKETEER_BATCH_ON_DEMAND_SUBSCRIBER_CONFIG
value: /usr/local/conf/onDemandSubscribers.json
- name: BUCKETEER_BATCH_PROCESSORS_CONFIG
value: /usr/local/conf/processors.json
- name: BUCKETEER_BATCH_ON_DEMAND_PROCESSORS_CONFIG
value: /usr/local/conf/onDemandProcessors.json
- name: BUCKETEER_BATCH_KEY
value: /usr/local/certs/service/tls.key
- name: BUCKETEER_BATCH_OAUTH_PUBLIC_KEY
Expand Down Expand Up @@ -161,9 +150,6 @@ spec:
- name: service-token-secret
mountPath: /usr/local/service-token
readOnly: true
- name: subscriber-config
mountPath: /usr/local/conf
readOnly: true
- name: oauth-key-secret
mountPath: /usr/local/oauth-key
readOnly: true
Expand Down
155 changes: 0 additions & 155 deletions manifests/bucketeer/charts/batch/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -165,158 +165,3 @@ cronjob:
jobId: AutoOpsRulesCacher
schedule: "* * * * *"

subscribers:
# This is the processor's name. It must match the same name defined in the
# pkg/batch/subscriber/processor/processors.go
auditLogPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 1000000000
maxMps: 50
workerNum: 1
domainEventInformer:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 1000000000
maxMps: 50
workerNum: 1
evaluationCountEventPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 1000000000
maxMps: 50
workerNum: 1
metricsEventPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 1000000000
maxMps: 50
workerNum: 1
pushSender:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 500
pullerMaxOutstandingBytes: 50000000
maxMps: 100
workerNum: 1
segmentUserPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 1000000000
maxMps: 50
workerNum: 1
userEventPersister:
project:
topic:
subscription:
pullerNumGoroutines: 10
pullerMaxOutstandingMessages: 10000
pullerMaxOutstandingBytes: 100000000
maxMps: 1000
workerNum: 5

onDemandSubscribers:
evaluationCountEventDWHPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 100000000
maxMps: 100
workerNum: 1
checkInterval: 10
evaluationCountEventOPSPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 100000000
maxMps: 100
workerNum: 1
checkInterval: 10
goalCountEventDWHPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 100000000
maxMps: 100
workerNum: 1
checkInterval: 10
goalCountEventOPSPersister:
project:
topic:
subscription:
pullerNumGoroutines: 5
pullerMaxOutstandingMessages: 1000
pullerMaxOutstandingBytes: 100000000
maxMps: 100
workerNum: 1
checkInterval: 10

# This configuration is used for add custom params to Processors
processors:
# This is the processor's name. It must match the same name defined in the
# pkg/batch/subscriber/processor/processors.go
auditLogPersister:
flushSize: 100
flushInterval: 10
flushTimeout: 10
evaluationCountEventPersister:
flushSize: 100
flushInterval: 10
writeCacheInterval: 10
segmentUserPersister:
domainEventProject:
domainEventTopic:
flushSize: 100
flushInterval: 10
userEventPersister:
flushSize: 200
flushInterval: 5

onDemandProcessors:
evaluationCountEventDWHPersister:
flushSize: 20
flushInterval: 5
flushTimeout: 30
project:
bigQueryDataSet:
bigQueryBatchSize:
timezone: UTC
evaluationCountEventOPSPersister:
flushSize: 20
flushInterval: 5
flushTimeout: 30
goalCountEventDWHPersister:
flushSize: 20
flushInterval: 5
flushTimeout: 30
project:
bigQueryDataSet:
bigQueryBatchSize:
timezone: UTC
goalCountEventOPSPersister:
flushSize: 20
flushInterval: 5
flushTimeout: 30
23 changes: 23 additions & 0 deletions manifests/bucketeer/charts/subscriber/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
5 changes: 5 additions & 0 deletions manifests/bucketeer/charts/subscriber/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "1.0"
description: A Helm chart for bucketeer-subscriber
name: subscriber
version: 1.0.0
15 changes: 15 additions & 0 deletions manifests/bucketeer/charts/subscriber/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
1. Get the application URL by running these commands:
{{- if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ template "subscriber.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get svc -w {{ template "subscriber.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ template "subscriber.fullname" . }} -o jsonpath='{.status.loadBalancer.ingress[0].ip}')
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app={{ template "subscriber.name" . }},release={{ template "subscriber.fullname" . }}" -o jsonpath="{.items[0].metadata.name}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl port-forward $POD_NAME 8080:80
{{- end }}
57 changes: 57 additions & 0 deletions manifests/bucketeer/charts/subscriber/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{{/* vim: set filetype=mustache: */}}
{{/*
Expand the name of the chart.
*/}}
{{- define "subscriber.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "subscriber.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else -}}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end -}}
{{- end -}}
{{- end -}}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "subscriber.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" -}}
{{- end -}}

{{- define "service-cert-secret" -}}
{{- if .Values.tls.service.secret }}
{{- printf "%s" .Values.tls.service.secret -}}
{{- else -}}
{{ template "subscriber.fullname" . }}-service-cert
{{- end -}}
{{- end -}}

{{- define "service-token-secret" -}}
{{- if .Values.serviceToken.secret }}
{{- printf "%s" .Values.serviceToken.secret -}}
{{- else -}}
{{ template "subscriber.fullname" . }}-service-token
{{- end -}}
{{- end -}}


{{- define "issuer-cert-secret" -}}
{{- if .Values.tls.issuer.secret }}
{{- printf "%s" .Values.tls.issuer.secret -}}
{{- else -}}
{{ template "subscriber.fullname" . }}-issuer-cert
{{- end -}}
{{- end -}}
Loading

0 comments on commit 24ea123

Please sign in to comment.