-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit d274126
Showing
17 changed files
with
1,134 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
branches: [main] | ||
pull_request: | ||
release: | ||
types: [published] | ||
|
||
jobs: | ||
# TODO lint | ||
|
||
# TODO tests | ||
|
||
# Build and push image | ||
build-image: | ||
strategy: | ||
matrix: | ||
include: | ||
- os: ubuntu-latest | ||
arch: linux/amd64 | ||
- os: ARM64 | ||
arch: linux/arm64 | ||
|
||
runs-on: ${{ matrix.os }} | ||
|
||
# TODO deps | ||
# needs: | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
- name: Tag the image | ||
id: meta | ||
uses: docker/metadata-action@v4 | ||
with: | ||
images: | | ||
bitovi/temporal-cloud-metrics-to-k8s | ||
tags: | | ||
type=raw,value=latest,enable=${{ github.ref_name == 'main' }} | ||
type=semver,pattern={{version}},enable=${{ github.event_name == 'release' }} | ||
- | ||
name: Login to Docker Hub | ||
uses: docker/login-action@v2 | ||
if: github.event_name != 'pull_request' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
- | ||
name: Build Docker image | ||
uses: docker/build-push-action@v4 | ||
with: | ||
context: . | ||
platforms: ${{ matrix.arch }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
- | ||
name: Push Docker image | ||
uses: docker/build-push-action@v4 | ||
if: ${{ (github.ref_name == 'main') || (github.event_name == 'release') }} | ||
with: | ||
context: . | ||
platforms: ${{ matrix.arch }} | ||
tags: ${{ steps.meta.outputs.tags }} | ||
push: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
certs | ||
manifests/020-registry-secrets.yaml | ||
manifests/030-temporal-mtls-certificates.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM golang:1.22.3 | ||
|
||
WORKDIR /app | ||
|
||
COPY go.mod go.sum ./ | ||
|
||
RUN go mod download | ||
|
||
COPY src/*.go ./ | ||
|
||
RUN CGO_ENABLED=0 GOOS=linux go build -o ./temporal-cloud-metrics-adapter | ||
|
||
CMD ["./temporal-cloud-metrics-adapter", "--secure-port=6443", "--cert-dir=/var/run/serving-cert", "--v=10"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Bitovi | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
# Temporal Cloud Metrics to Kubernetes | ||
|
||
```bash | ||
kubectl create namespace staging-workers | ||
``` | ||
|
||
```bash | ||
kubectl create secret docker-registry docker-registry-credentials \ | ||
--docker-username=username \ | ||
--docker-password=password \ | ||
[email protected] \ | ||
--docker-server=https://registry.example.com:5000/v2/ \ | ||
-n=custom-metrics | ||
``` | ||
|
||
```yaml | ||
apiVersion: autoscaling/v2 | ||
kind: HorizontalPodAutoscaler | ||
metadata: | ||
name: temporal-worker | ||
# The namespace of your worker | ||
namespace: staging-workers | ||
spec: | ||
scaleTargetRef: | ||
apiVersion: apps/v1 | ||
kind: Deployment | ||
# The worker deployment name | ||
name: temporal-worker | ||
minReplicas: 1 | ||
maxReplicas: 20 | ||
metrics: | ||
- type: External | ||
external: | ||
metric: | ||
name: temporal_cloud_sync_match_rate | ||
# If your metrics live in a different namespace, you can specify it like so | ||
selector: | ||
matchLabels: | ||
namespace: staging-workers | ||
target: | ||
type: Value | ||
value: 5m | ||
behavior: | ||
scaleUp: | ||
stabilizationWindowSeconds: 10 | ||
selectPolicy: Max | ||
policies: | ||
- type: Pods | ||
value: 5 | ||
periodSeconds: 10 | ||
scaleDown: | ||
stabilizationWindowSeconds: 60 | ||
selectPolicy: Max | ||
policies: | ||
- type: Pods | ||
value: 3 | ||
periodSeconds: 30 | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,103 @@ | ||
module temporal-cloud-metrics-to-k8s | ||
|
||
go 1.22.1 | ||
|
||
require ( | ||
gopkg.in/yaml.v2 v2.4.0 | ||
k8s.io/apimachinery v0.30.1 | ||
k8s.io/component-base v0.30.1 | ||
k8s.io/metrics v0.30.1 | ||
sigs.k8s.io/custom-metrics-apiserver v1.30.0 | ||
) | ||
|
||
require ( | ||
github.com/NYTimes/gziphandler v1.1.1 // indirect | ||
github.com/antlr/antlr4/runtime/Go/antlr/v4 v4.0.0-20230305170008-8188dc5388df // indirect | ||
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect | ||
github.com/beorn7/perks v1.0.1 // indirect | ||
github.com/blang/semver/v4 v4.0.0 // indirect | ||
github.com/cenkalti/backoff/v4 v4.2.1 // indirect | ||
github.com/cespare/xxhash/v2 v2.2.0 // indirect | ||
github.com/coreos/go-semver v0.3.1 // indirect | ||
github.com/coreos/go-systemd/v22 v22.5.0 // indirect | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/emicklei/go-restful/v3 v3.12.0 // indirect | ||
github.com/evanphx/json-patch v5.7.0+incompatible // indirect | ||
github.com/felixge/httpsnoop v1.0.4 // indirect | ||
github.com/fsnotify/fsnotify v1.7.0 // indirect | ||
github.com/go-logr/logr v1.4.1 // indirect | ||
github.com/go-logr/stdr v1.2.2 // indirect | ||
github.com/go-openapi/jsonpointer v0.20.2 // indirect | ||
github.com/go-openapi/jsonreference v0.20.4 // indirect | ||
github.com/go-openapi/swag v0.22.7 // indirect | ||
github.com/gogo/protobuf v1.3.2 // indirect | ||
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect | ||
github.com/golang/protobuf v1.5.4 // indirect | ||
github.com/google/cel-go v0.17.8 // indirect | ||
github.com/google/gnostic-models v0.6.8 // indirect | ||
github.com/google/go-cmp v0.6.0 // indirect | ||
github.com/google/gofuzz v1.2.0 // indirect | ||
github.com/google/uuid v1.5.0 // indirect | ||
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0 // indirect | ||
github.com/grpc-ecosystem/grpc-gateway/v2 v2.18.1 // indirect | ||
github.com/imdario/mergo v0.3.16 // indirect | ||
github.com/inconshreveable/mousetrap v1.1.0 // indirect | ||
github.com/josharian/intern v1.0.0 // indirect | ||
github.com/json-iterator/go v1.1.12 // indirect | ||
github.com/mailru/easyjson v0.7.7 // indirect | ||
github.com/matttproud/golang_protobuf_extensions/v2 v2.0.0 // indirect | ||
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect | ||
github.com/modern-go/reflect2 v1.0.2 // indirect | ||
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect | ||
github.com/pkg/errors v0.9.1 // indirect | ||
github.com/prometheus/client_golang v1.18.0 // indirect | ||
github.com/prometheus/client_model v0.5.0 // indirect | ||
github.com/prometheus/common v0.45.0 // indirect | ||
github.com/prometheus/procfs v0.12.0 // indirect | ||
github.com/spf13/cobra v1.8.0 // indirect | ||
github.com/spf13/pflag v1.0.5 // indirect | ||
github.com/stoewer/go-strcase v1.3.0 // indirect | ||
go.etcd.io/etcd/api/v3 v3.5.11 // indirect | ||
go.etcd.io/etcd/client/pkg/v3 v3.5.11 // indirect | ||
go.etcd.io/etcd/client/v3 v3.5.11 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.46.1 // indirect | ||
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.46.1 // indirect | ||
go.opentelemetry.io/otel v1.21.0 // indirect | ||
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.21.0 // indirect | ||
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.21.0 // indirect | ||
go.opentelemetry.io/otel/metric v1.21.0 // indirect | ||
go.opentelemetry.io/otel/sdk v1.21.0 // indirect | ||
go.opentelemetry.io/otel/trace v1.21.0 // indirect | ||
go.opentelemetry.io/proto/otlp v1.0.0 // indirect | ||
go.uber.org/multierr v1.11.0 // indirect | ||
go.uber.org/zap v1.26.0 // indirect | ||
golang.org/x/crypto v0.22.0 // indirect | ||
golang.org/x/exp v0.0.0-20231226003508-02704c960a9b // indirect | ||
golang.org/x/net v0.24.0 // indirect | ||
golang.org/x/oauth2 v0.15.0 // indirect | ||
golang.org/x/sync v0.7.0 // indirect | ||
golang.org/x/sys v0.19.0 // indirect | ||
golang.org/x/term v0.19.0 // indirect | ||
golang.org/x/text v0.14.0 // indirect | ||
golang.org/x/time v0.5.0 // indirect | ||
google.golang.org/appengine v1.6.8 // indirect | ||
google.golang.org/genproto v0.0.0-20231212172506-995d672761c0 // indirect | ||
google.golang.org/genproto/googleapis/api v0.0.0-20231212172506-995d672761c0 // indirect | ||
google.golang.org/genproto/googleapis/rpc v0.0.0-20231212172506-995d672761c0 // indirect | ||
google.golang.org/grpc v1.60.1 // indirect | ||
google.golang.org/protobuf v1.33.0 // indirect | ||
gopkg.in/inf.v0 v0.9.1 // indirect | ||
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
k8s.io/api v0.30.1 // indirect | ||
k8s.io/apiserver v0.30.0 // indirect | ||
k8s.io/client-go v0.30.1 // indirect | ||
k8s.io/klog/v2 v2.120.1 // indirect | ||
k8s.io/kms v0.30.0 // indirect | ||
k8s.io/kube-openapi v0.0.0-20240430033511-f0e62f92d13f // indirect | ||
k8s.io/utils v0.0.0-20240423183400-0849a56e8f22 // indirect | ||
sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.29.0 // indirect | ||
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect | ||
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect | ||
sigs.k8s.io/yaml v1.4.0 // indirect | ||
) |
Oops, something went wrong.