-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Prepare sample funnel target service scaling test
- Loading branch information
Showing
18 changed files
with
620 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 |
---|---|---|
@@ -1,2 +1,4 @@ | ||
# JetBrains Rider | ||
**/.idea/ | ||
|
||
**/out/ |
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
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
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,61 @@ | ||
load('ext://helm_resource', 'helm_resource', 'helm_repo') | ||
|
||
allow_k8s_contexts('k3d-testapp') | ||
default_registry('k3d-testapp-registry.local.lncd.pl:21345') | ||
|
||
helm_repo('bitnami', 'https://charts.bitnami.com/bitnami') | ||
helm_resource('rabbit', 'bitnami/rabbitmq', flags=['--set=auth.password=user']) | ||
|
||
local_resource( | ||
'build-testappfunnel', | ||
'dotnet publish -o out/testapp_funnel ../test/LeanCode.Pipe.Funnel.TestAppFunnel', | ||
deps=['../src', '../test/LeanCode.Pipe.Funnel.TestAppFunnel'], | ||
ignore=['../**/obj', '../**/bin'], | ||
) | ||
|
||
local_resource( | ||
'build-testapp1', | ||
'dotnet publish -o out/testapp1 ../test/LeanCode.Pipe.Funnel.TestApp1', | ||
deps=['src', '../test/LeanCode.Pipe.Funnel.TestApp1'], | ||
ignore=['../**/obj', '../**/bin'], | ||
) | ||
|
||
local_resource( | ||
'build-scaled-service-tests', | ||
'dotnet publish -o out/scaled_service_tests ../test/LeanCode.Pipe.Funnel.ScaledServiceTests', | ||
deps=[ | ||
'../src', | ||
'../test/LeanCode.Pipe.Funnel.TestAppFunnel', | ||
'../test/LeanCode.Pipe.Funnel.TestApp1', | ||
'../test/LeanCode.Pipe.Funnel.ScaledServiceTests' ], | ||
ignore=['../**/obj', '../**/bin'], | ||
) | ||
|
||
docker_build( | ||
'testapp_funnel', | ||
'.', | ||
dockerfile='testapp_funnel.dockerfile', | ||
only = ['out/testapp_funnel'], | ||
) | ||
|
||
docker_build( | ||
'testapp1', | ||
'.', | ||
dockerfile='testapp1.dockerfile', | ||
only = ['out/testapp1'], | ||
) | ||
|
||
docker_build( | ||
'scaled_service_tests', | ||
'.', | ||
dockerfile='scaled_service_tests.dockerfile', | ||
only = ['out/scaled_service_tests'], | ||
) | ||
|
||
k8s_yaml('k8s/testapp_funnel.yaml') | ||
k8s_yaml('k8s/testapp1.yaml') | ||
k8s_yaml('k8s/scaled_service_tests.yaml') | ||
|
||
k8s_resource('testapp-funnel', resource_deps=['rabbit']) | ||
k8s_resource('testapp1', resource_deps=['rabbit']) | ||
k8s_resource('scaled-service-tests', resource_deps=['testapp-funnel', 'testapp1']) |
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,43 @@ | ||
apiVersion: k3d.io/v1alpha5 | ||
kind: Simple | ||
metadata: | ||
name: testapp | ||
image: docker.io/rancher/k3s:v1.28.2-k3s1 | ||
servers: 1 | ||
agents: 0 | ||
kubeAPI: | ||
host: "testapp-cluster.local.lncd.pl" | ||
hostIP: "127.0.0.1" | ||
hostPort: "6445" | ||
ports: | ||
- port: 80:80 | ||
nodeFilters: | ||
- loadbalancer | ||
- port: 443:443 | ||
nodeFilters: | ||
- loadbalancer | ||
- port: 1433:1433 | ||
nodeFilters: | ||
- loadbalancer | ||
- port: 5432:5432 | ||
nodeFilters: | ||
- loadbalancer | ||
- port: 10000:10000 | ||
nodeFilters: | ||
- loadbalancer | ||
registries: | ||
create: | ||
name: k3d-testapp-registry.local.lncd.pl | ||
host: "0.0.0.0" | ||
hostPort: "21345" | ||
options: | ||
k3d: | ||
wait: true | ||
k3s: | ||
extraArgs: | ||
- arg: --disable=traefik,metrics-server | ||
nodeFilters: | ||
- server:* | ||
kubeconfig: | ||
updateDefaultKubeconfig: true | ||
switchCurrentContext: true |
15 changes: 15 additions & 0 deletions
15
publisher/funnel_cluster_tests_env/k8s/scaled_service_tests.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,15 @@ | ||
apiVersion: batch/v1 | ||
kind: Job | ||
metadata: | ||
name: scaled-service-tests | ||
labels: | ||
app: scaled-service-tests | ||
spec: | ||
template: | ||
spec: | ||
restartPolicy: Never | ||
containers: | ||
- name: scaled-service-tests | ||
image: scaled_service_tests | ||
ports: | ||
- containerPort: 22 |
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,100 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: testapp1-svc | ||
labels: | ||
app: testapp1 | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
clusterIP: None | ||
selector: | ||
app: testapp1 | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: testapp1 | ||
labels: | ||
app: testapp1 | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: testapp1 | ||
serviceName: testapp1-svc | ||
replicas: 2 | ||
template: | ||
metadata: | ||
labels: | ||
app: testapp1 | ||
spec: | ||
containers: | ||
- name: testapp1 | ||
image: testapp1 | ||
ports: | ||
- containerPort: 8080 | ||
- containerPort: 22 | ||
livenessProbe: | ||
httpGet: | ||
path: /health/live | ||
port: 8080 | ||
readinessProbe: | ||
httpGet: | ||
path: /health/ready | ||
port: 8080 | ||
#--- | ||
#apiVersion: v1 | ||
#kind: Service | ||
#metadata: | ||
# name: testapp1-0 | ||
# labels: | ||
# app: testapp1 | ||
#spec: | ||
# type: ClusterIP | ||
# ports: | ||
# - port: 80 | ||
# targetPort: 8080 | ||
# protocol: TCP | ||
# selector: | ||
# app: testapp1-0 | ||
#--- | ||
#apiVersion: v1 | ||
#kind: Service | ||
#metadata: | ||
# name: testapp1-1 | ||
# labels: | ||
# app: testapp1 | ||
#spec: | ||
# type: ClusterIP | ||
# ports: | ||
# - port: 80 | ||
# targetPort: 8080 | ||
# protocol: TCP | ||
# selector: | ||
# app: testapp1-1 | ||
#--- | ||
#apiVersion: networking.k8s.io/v1 | ||
#kind: Ingress | ||
#metadata: | ||
# name: testapp1-ingress | ||
#spec: | ||
# rules: | ||
# - host: testapp1.local.lncd.pl | ||
# http: | ||
# paths: | ||
# - path: /0 | ||
# backend: | ||
# service: | ||
# name: testapp1-0 | ||
# port: | ||
# number: 80 | ||
# pathType: ImplementationSpecific | ||
# - path: /1 | ||
# backend: | ||
# service: | ||
# name: testapp1-1 | ||
# port: | ||
# number: 80 | ||
# pathType: ImplementationSpecific |
100 changes: 100 additions & 0 deletions
100
publisher/funnel_cluster_tests_env/k8s/testapp_funnel.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,100 @@ | ||
apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
name: testapp-funnel-svc | ||
labels: | ||
app: testapp-funnel | ||
spec: | ||
ports: | ||
- port: 80 | ||
targetPort: 8080 | ||
protocol: TCP | ||
clusterIP: None | ||
selector: | ||
app: testapp-funnel | ||
--- | ||
apiVersion: apps/v1 | ||
kind: StatefulSet | ||
metadata: | ||
name: testapp-funnel | ||
labels: | ||
app: testapp-funnel | ||
spec: | ||
selector: | ||
matchLabels: | ||
app: testapp-funnel | ||
serviceName: testapp-funnel-svc | ||
replicas: 2 | ||
template: | ||
metadata: | ||
labels: | ||
app: testapp-funnel | ||
spec: | ||
containers: | ||
- name: leanpipe-funnel | ||
image: testapp_funnel | ||
ports: | ||
- containerPort: 8080 | ||
- containerPort: 22 | ||
livenessProbe: | ||
httpGet: | ||
path: /health/live | ||
port: 8080 | ||
readinessProbe: | ||
httpGet: | ||
path: /health/ready | ||
port: 8080 | ||
#--- | ||
#apiVersion: v1 | ||
#kind: Service | ||
#metadata: | ||
# name: testapp-funnel-0 | ||
# labels: | ||
# app: testapp-funnel | ||
#spec: | ||
# type: ClusterIP | ||
# ports: | ||
# - port: 80 | ||
# targetPort: 8080 | ||
# protocol: TCP | ||
# selector: | ||
# app: testapp-funnel-0 | ||
#--- | ||
#apiVersion: v1 | ||
#kind: Service | ||
#metadata: | ||
# name: testapp-funnel-1 | ||
# labels: | ||
# app: testapp-funnel | ||
#spec: | ||
# type: ClusterIP | ||
# ports: | ||
# - port: 80 | ||
# targetPort: 8080 | ||
# protocol: TCP | ||
# selector: | ||
# app: testapp-funnel-1 | ||
#--- | ||
#apiVersion: networking.k8s.io/v1 | ||
#kind: Ingress | ||
#metadata: | ||
# name: testapp-funnel-ingress | ||
#spec: | ||
# rules: | ||
# - host: testappfunnel.local.lncd.pl | ||
# http: | ||
# paths: | ||
# - path: /0 | ||
# backend: | ||
# service: | ||
# name: testapp-funnel-0 | ||
# port: | ||
# number: 80 | ||
# pathType: ImplementationSpecific | ||
# - path: /1 | ||
# backend: | ||
# service: | ||
# name: testapp-funnel-1 | ||
# port: | ||
# number: 80 | ||
# pathType: ImplementationSpecific |
7 changes: 7 additions & 0 deletions
7
publisher/funnel_cluster_tests_env/scaled_service_tests.dockerfile
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,7 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:8.0 | ||
|
||
USER $APP_UID | ||
|
||
WORKDIR /LeanCode.Pipe.Funnel.ScaledServiceTests | ||
COPY --chown=$APP_UID out/scaled_service_tests /home/app/bin | ||
ENTRYPOINT ["dotnet", "test", "/home/app/bin/ScaledServiceTests.dll"] |
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,9 @@ | ||
FROM mcr.microsoft.com/dotnet/aspnet:8.0 | ||
|
||
USER $APP_UID | ||
|
||
ENV ASPNETCORE_ENVIRONMENT=Development | ||
|
||
WORKDIR /LeanCode.Pipe.Funnel.TestApp1 | ||
COPY --chown=$APP_UID out/testapp1 /home/app/bin | ||
ENTRYPOINT ["dotnet", "/home/app/bin/TestApp1.dll"] |
Oops, something went wrong.