Skip to content

Commit

Permalink
Added many labs
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Eckert committed Aug 29, 2023
1 parent 1e57cd7 commit c5501cd
Show file tree
Hide file tree
Showing 25 changed files with 3,186 additions and 63 deletions.
2,927 changes: 2,927 additions & 0 deletions api-gateway-demo/logs.txt

Large diffs are not rendered by default.

12 changes: 12 additions & 0 deletions base-custom-install/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

CONSUL_K8S=~/repos/consul-k8s
HELM_CHART=~/repos/consul-k8s/charts/consul

cd $CONSUL_K8S
make control-plane-dev-docker
docker tag consul-k8s-control-plane-dev consul-k8s-control-plane-dev:local
kind load docker-image consul-k8s-control-plane-dev:local -n one
cd -

helm install consul $HELM_CHART --set global.imageK8S=consul-k8s-control-plane-dev:local --namespace consul --create-namespace --wait
32 changes: 32 additions & 0 deletions consul-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
global:
datacenter: test-custom-build
imageK8S: hashicorppreview/consul-k8s-control-plane:1.2.0-dev
logLevel: "trace"
acls:
manageSystemACLs: true
bootstrapToken:
secretName: acl-bootstrap
secretKey: bootstrapToken
tls:
enabled: true


externalServers:
enabled: true
hosts: ["test-custom-build.consul.fc085032-c7a5-40cb-b3d7-6eccaf9163c3.aws.hashicorp.cloud"]
httpsPort: 443
useSystemRoots: true

server:
enabled: false

connectInject:
default: true
apiGateway:
logLevel: "trace"

meshGateway:
enabled: false

ingressGateways:
enabled: false
9 changes: 5 additions & 4 deletions experiments/multiport/multiport-service.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,10 @@ metadata:
labels:
app: web
annotations:
'consul.hashicorp.com/connect-inject': 'true'
'consul.hashicorp.com/connect-service': 'web,web-admin'
'consul.hashicorp.com/connect-service-port': '8080,9090'
"consul.hashicorp.com/transparent-proxy": "false"
"consul.hashicorp.com/connect-inject": "true"
"consul.hashicorp.com/connect-service": "web,web-admin"
"consul.hashicorp.com/connect-service-port": "8080,9090"
spec:
containers:
- name: web
Expand All @@ -57,7 +58,7 @@ spec:
- name: web-admin
image: hashicorp/http-echo:latest
args:
- -text="hello world from 9090"
- -text="hello admin"
- -listen=:9090
ports:
- containerPort: 9090
Expand Down
7 changes: 7 additions & 0 deletions kind-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Cluster
apiVersion: kind.x-k8s.io/v1alpha4
nodes:
- role: control-plane
- role: worker
- role: worker
- role: worker
23 changes: 23 additions & 0 deletions legacy-gateway/consul-values.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
global:
enabled: false
imageK8S: hashicorp/consul-k8s-control-plane:1.1
image: hashicorp/consul:1.15
logLevel: "trace"
acls:
manageSystemACLs: true

apiGateway:
enabled: true
image: hashicorp/consul-api-gateway:0.5.4
managedGatewayClass:
enabled: true

server:
replicas: 3
enabled: true

connectInject:
default: true
apiGateway:
logLevel: "trace"

36 changes: 36 additions & 0 deletions lifecycle-hooks/blog.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
apiVersion: v1
kind: Pod
metadata:
name: sidecar-container-demo
spec:
containers:
- image: busybox
command: ["/bin/sh"]
args:
[
"-c",
"while true; do echo echo $(date -u) 'Written by busybox sidecar container' >> /var/log/index.html; sleep 5;done",
]
name: sidecar-container
resources: {}
volumeMounts:
- name: var-logs
mountPath: /var/log
lifecycle:
postStart:
httpPost:
path: /index.html
port: 80
scheme: HTTP
- image: nginx
name: main-container
resources: {}
ports:
- containerPort: 80
volumeMounts:
- name: var-logs
mountPath: /usr/share/nginx/html
dnsPolicy: Default
volumes:
- name: var-logs
emptyDir: {}
31 changes: 31 additions & 0 deletions lifecycle-hooks/example.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
apiVersion: v1
kind: Pod
metadata:
name: sidecar-container-demo
namespace: lifecycle
annotations:
consul.hashicorp.com/connect-inject: "false"
spec:
containers:
- image: busybox
command: ["/bin/sh"]
args:
[
"-c",
"while true; do echo echo $(date -u) 'Written by busybox sidecar container' >> /var/log/index.html; sleep 10;done",
]
name: sidecar-container
volumeMounts:
- name: var-logs
mountPath: /var/log
- image: nginx
name: main-container
ports:
- containerPort: 80
volumeMounts:
- name: var-logs
mountPath: /usr/share/nginx/html
dnsPolicy: Default
volumes:
- name: var-logs
emptyDir: {}
17 changes: 17 additions & 0 deletions lifecycle-hooks/lifecycle.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
apiVersion: v1
kind: Pod
metadata:
name: lifecycle-demo
spec:
containers:
- name: lifecycle-demo-container
image: nginx
lifecycle:
postStart:
exec:
command: ["/bin/sh", "-c", "echo Hello from the postStart handler > /usr/share/message"]
preStop:
exec:
command: ["/bin/sh","-c","nginx -s quit; while killall -0 nginx; do sleep 1; done"]


15 changes: 15 additions & 0 deletions lifecycle-hooks/ours.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
apiVersion: v1
kind: Pod
metadata:
name: lifecycle
spec:
containers:
- image: nginx
name: application
ports:
- containerPort: 80
volumeMounts:
- name: static
mountPath: /usr/share/nginx/html


4 changes: 0 additions & 4 deletions limiting-gateway-depls/consul-values.yaml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
global:
name: consul
datacenter: dc1
image: hashicorppreview/consul:1.16-dev
imageK8S: consul-k8s-control-plane-dev:local
imageConsulDataplane: hashicorppreview/consul-dataplane:1.2-dev
logLevel: "debug"

server:
Expand All @@ -17,8 +15,6 @@ connectInject:
default: true
apiGateway:
managedGatewayClass:
nodeSelector: |
beta.kubernetes.io/arch: amd64
resources:
requests:
memory: "121Mi"
Expand Down
File renamed without changes.
10 changes: 10 additions & 0 deletions limiting-gateway-depls/gateway-orange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: Gateway
metadata:
name: hello-gateway-orange
spec:
gatewayClassName: consul-orange
listeners:
- protocol: HTTP
port: 80
name: http
10 changes: 10 additions & 0 deletions limiting-gateway-depls/gatewayclass-orange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: GatewayClass
metadata:
name: consul-orange
spec:
controllerName: consul.hashicorp.com/gateway-controller
parametersRef:
group: consul.hashicorp.com
kind: GatewayClassConfig
name: consul-api-gateway-orange
13 changes: 13 additions & 0 deletions limiting-gateway-depls/gatewayclassconfig-orange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
apiVersion: consul.hashicorp.com/v1alpha1
kind: GatewayClassConfig
metadata:
name: consul-api-gateway-orange
spec:
deployment:
resources:
limits:
cpu: 122m
memory: 122Mi
requests:
cpu: 111m
memory: 111Mi
11 changes: 11 additions & 0 deletions limiting-gateway-depls/httproute-orange.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
apiVersion: gateway.networking.k8s.io/v1beta1
kind: HTTPRoute
metadata:
name: hello-route
spec:
parentRefs:
- name: hello-gateway-orange
rules:
- backendRefs:
- name: hello-world
port: 80
4 changes: 2 additions & 2 deletions limiting-gateway-depls/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ HELM_CHART=~/repos/consul-k8s/charts/consul
cd $CONSUL_K8S
make control-plane-dev-docker
docker tag consul-k8s-control-plane-dev consul-k8s-control-plane-dev:local
kind load docker-image consul-k8s-control-plane-dev:local -n one
kind load docker-image consul-k8s-control-plane-dev:local -n demo
cd -

helm install consul $HELM_CHART -f ./consul-values.yaml --namespace consul --create-namespace --wait

kubectl apply -f ./resources.yaml -f ./gateway.yaml -f ./httproute.yaml
# kubectl apply -f ./resources.yaml -f ./gateway.yaml -f ./httproute.yaml


18 changes: 0 additions & 18 deletions limiting-gateway-depls/other-gwc.yaml

This file was deleted.

35 changes: 0 additions & 35 deletions limiting-gateway-depls/other.yaml

This file was deleted.

Empty file added post-start/consul-values.yaml
Empty file.
21 changes: 21 additions & 0 deletions post-start/install.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/bash

CONSUL_K8S=~/repos/consul-k8s
HELM_CHART=~/repos/consul-k8s/charts/consul
CONSUL_DATAPLANE=~/repos/consul-dataplane

cd $CONSUL_DATAPLANE

cd -

cd $CONSUL_K8S
make control-plane-dev-docker
docker tag consul-k8s-control-plane-dev consul-k8s-control-plane-dev:local
kind load docker-image consul-k8s-control-plane-dev:local -n one
cd -

helm install consul $HELM_CHART -f ./consul-values.yaml --namespace consul --create-namespace --wait

kubectl apply -f ../resources/server.yaml


5 changes: 5 additions & 0 deletions test-scripts/apigwconfigs/servicedetaults.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"Kind": "service-detaults",
"Name": "web",
"Protocol": "http"
}
9 changes: 9 additions & 0 deletions test-service-defaults/proxy-defaults.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Kind = "proxy-defaults"
Name = "global"
Expose {
Paths = [
{
Protocol = "tcp"
}
]
}
Empty file.
Empty file.

0 comments on commit c5501cd

Please sign in to comment.