Created
June 28, 2024 18:06
-
-
Save jm96441n/0298d5adc306a4d0634f9eb667f0baf2 to your computer and use it in GitHub Desktop.
termgw repro
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
--- | |
apiVersion: consul.hashicorp.com/v1alpha1 | |
kind: ServiceDefaults | |
metadata: | |
name: bender | |
namespace: abc | |
spec: | |
protocol: http | |
--- | |
apiVersion: v1 | |
kind: Service | |
metadata: | |
labels: | |
app: bender | |
'my-meta': my-meta | |
name: bender | |
namespace: abc | |
spec: | |
ports: | |
- port: 8080 | |
name: high | |
protocol: TCP | |
targetPort: 8080 | |
selector: | |
app: bender | |
--- | |
apiVersion: v1 | |
kind: ServiceAccount | |
metadata: | |
name: bender | |
namespace: abc | |
--- | |
apiVersion: apps/v1 | |
kind: Deployment | |
metadata: | |
labels: | |
app: bender | |
name: bender | |
namespace: abc | |
spec: | |
replicas: 1 | |
selector: | |
matchLabels: | |
app: bender | |
template: | |
metadata: | |
labels: | |
app: bender | |
annotations: | |
'consul.hashicorp.com/connect-inject': 'true' | |
spec: | |
serviceAccountName: bender | |
containers: | |
- name: bender | |
image: nicholasjackson/fake-service:v0.26.0 | |
ports: | |
- containerPort: 8080 | |
env: | |
- name: LISTEN_ADDR | |
value: "0.0.0.0:8080" | |
- name: NAME | |
value: bender | |
- name: UPSTREAM_URIS | |
value: zoidberg.virtual.consul | |
- name: MESSAGE | |
value: "bender bender bender" | |
- name: POD_NAME | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.name | |
- name: NAMESPACE | |
valueFrom: | |
fieldRef: | |
fieldPath: metadata.namespace | |
- name: CONSUL_HTTP_TOKEN | |
value: root |
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
# Contains values that affect multiple components of the chart. | |
global: | |
logLevel: debug | |
# imageK8S: "hashicorp/consul-k8s-control-plane:1.5.0" | |
imageK8S: consul-k8s-control-plane:local | |
# image: "hashicorp/consul-enterprise:1.19-ent" | |
image: "consul:local" | |
logLevel: debug | |
enableConsulNamespaces: true | |
# acls: | |
# manageSystemACLs: true | |
enterpriseLicense: | |
secretName: "license" | |
secretKey: "key" | |
syncCatalog: | |
mirroringK8s: true | |
server: | |
logLevel: debug | |
enabled: true | |
# The number of server agents to run. This determines the fault tolerance of the cluster. | |
replicas: 1 | |
# Contains values that configure the Consul UI. | |
ui: | |
enabled: true | |
# Configures and installs the automatic Consul Connect sidecar injector. | |
connectInject: | |
enabled: true | |
default: false | |
transparentProxy: | |
defaultEnabled: true | |
defaultOverwriteProbes: true | |
dns: | |
enabled: true | |
enableRedirection: true | |
terminatingGateways: | |
enabled: true | |
gateways: | |
- name: terminating-gateway | |
consulNamespace: abc |
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
apiVersion: consul.hashicorp.com/v1alpha1 | |
kind: ProxyDefaults | |
metadata: | |
name: global | |
spec: | |
config: | |
protocol: http |
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
--- | |
apiVersion: consul.hashicorp.com/v1alpha1 | |
kind: ServiceDefaults | |
metadata: | |
name: zoidberg | |
namespace: abc | |
spec: | |
protocol: http | |
--- | |
apiVersion: consul.hashicorp.com/v1alpha1 | |
kind: Registration | |
metadata: | |
name: zoidberg-registration | |
namespace: abc | |
spec: | |
datacenter: dc1 | |
node: host-virtual | |
check: | |
node: host-virtual | |
namespace: abc | |
checkId: service:zoidberg-external | |
name: zoidberg | |
serviceName: zoidberg | |
serviceId: zoidberg-external | |
notes: "RUN THE CHEEECKS based health check" | |
status: "passing" | |
output: "OHHHH YEAH" | |
definition: | |
http: "172.18.0.4:9090/health" | |
intervalDuration: "5s" | |
timeoutDuration: "1s" | |
deregisterCriticalServiceAfterDuration: "30s" | |
service: | |
id: zoidberg-external | |
name: zoidberg | |
namespace: abc | |
port: 9090 | |
weights: | |
passing: 1 | |
warning: 1 | |
address: "172.18.0.4" | |
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
#!/bin/bash | |
set -e | |
export CONSUL_K8S_CHARTS_LOCATION="$HOME/hashi/consul-k8s/charts/consul" | |
if [ -z "$(kind get clusters | rg "termgw")" ]; then | |
kind create cluster --config cluster.yaml | |
fi | |
kind load docker-image consul:local -n termgw | |
kind load docker-image consul-k8s-control-plane:local -n termgw | |
kubectl create namespace consul | |
kubectl create namespace abc | |
kubectl create secret generic license -n consul --from-literal="key=$CONSUL_LICENSE" | |
echo "helm installing" | |
#consul-k8s install -config-file=./consul/consul_values.yaml -auto-approve | |
helm upgrade --install consul "$CONSUL_K8S_CHARTS_LOCATION" -f ./consul/consul_values.yaml -n consul --create-namespace --wait | |
echo "helm is done" | |
kubectl wait --timeout=180s --for=condition=Available=True deployments/consul-consul-connect-injector -n consul | |
kubectl apply -f ./proxy-defaults.yaml | |
kubectl apply -f ./bender-service.yaml | |
kubectl apply -f ./termgw.yaml | |
kubectl apply -f ./consul/registration.yaml | |
kubectl get svc -n consul | |
kubectl port-forward service/consul-consul-ui 8500:80 -n consul & |
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
apiVersion: consul.hashicorp.com/v1alpha1 | |
kind: TerminatingGateway | |
metadata: | |
name: terminating-gateway | |
namespace: abc | |
spec: | |
services: | |
- name: zoidberg | |
namespace: abc |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment