Skip to content

Instantly share code, notes, and snippets.

@thesurlydev
Last active August 31, 2020 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thesurlydev/2a119f323b0bc4ae436c55bc53742c1c to your computer and use it in GitHub Desktop.
Save thesurlydev/2a119f323b0bc4ae436c55bc53742c1c to your computer and use it in GitHub Desktop.
inlets-operator debug
#!/usr/bin/env bash
set -e
INLETS_NAMESPACE="inlets"
kubectl delete service nginx-1 || true
kubectl delete ns ${INLETS_NAMESPACE} || true
kubectl delete secret inlets-access-key -n ${INLETS_NAMESPACE} || true
kubectl delete secret inlets-secret-key -n ${INLETS_NAMESPACE} || true
kubectl delete clusterrolebinding inlets-operator-rw || true
kubectl delete clusterrole inlets-operator-rw || true
kubectl delete sa inlets-operator -n ${INLETS_NAMESPACE} || true
kubectl delete -f ./artifacts/crds || true
2020/08/31 20:55:40 Inlets client: inlets/inlets-pro:0.7.0
2020/08/31 20:55:40 Using inlets PRO.
W0831 20:55:40.361950 1 client_config.go:552] Neither --kubeconfig nor --master was specified. Using the inClusterConfig. This might not work.
I0831 20:55:40.362916 1 controller.go:123] Setting up event handlers
I0831 20:55:40.362953 1 controller.go:245] Starting Tunnel controller
I0831 20:55:40.362958 1 controller.go:248] Waiting for informer caches to sync
I0831 20:55:40.463129 1 controller.go:253] Starting workers
I0831 20:55:40.463142 1 controller.go:259] Started workers
2020/08/31 20:55:40 Creating tunnel for nginx-1-tunnel.default
I0831 20:55:40.470227 1 controller.go:317] Successfully synced 'default/nginx-1'
2020/08/31 20:55:40 Provisioning started with provider:ec2 host:nginx-1-tunnel
2020/08/31 20:55:42 Provisioning call took: 2.373870s
2020/08/31 20:55:42 Status (nginx-1): provisioning, ID: i-0c3f0e1fff1b1b54a, IP:
I0831 20:55:42.852005 1 controller.go:317] Successfully synced 'default/nginx-1-tunnel'
I0831 20:55:43.038809 1 controller.go:317] Successfully synced 'default/nginx-1-tunnel'
.PHONY: build push manifest test verify-codegen charts
TAG?=latest
#PREFIX?=inlets
PREFIX?=digitalsanctum
# docker manifest command will work with Docker CLI 18.03 or newer
# but for now it's still experimental feature so we need to enable that
export DOCKER_CLI_EXPERIMENTAL=enabled
build:
docker build -t $(PREFIX)/inlets-operator:$(TAG)-amd64 . -f Dockerfile
#docker build --build-arg OPTS="GOARCH=arm64" -t $(PREFIX)/inlets-operator:$(TAG)-arm64 . -f Dockerfile
#docker build --build-arg OPTS="GOARCH=arm GOARM=6" -t $(PREFIX)/inlets-operator:$(TAG)-armhf . -f Dockerfile
push:
docker push $(PREFIX)/inlets-operator:$(TAG)-amd64
#docker push $(PREFIX)/inlets-operator:$(TAG)-arm64
#docker push $(PREFIX)/inlets-operator:$(TAG)-armhf
manifest:
docker manifest create --amend $(PREFIX)/inlets-operator:$(TAG) \
$(PREFIX)/inlets-operator:$(TAG)-amd64 \
$(PREFIX)/inlets-operator:$(TAG)-arm64 \
$(PREFIX)/inlets-operator:$(TAG)-armhf
docker manifest annotate $(PREFIX)/inlets-operator:$(TAG) $(PREFIX)/inlets-operator:$(TAG)-arm64 --os linux --arch arm64
docker manifest annotate $(PREFIX)/inlets-operator:$(TAG) $(PREFIX)/inlets-operator:$(TAG)-armhf --os linux --arch arm --variant v6
docker manifest push -p $(PREFIX)/inlets-operator:$(TAG)
test:
go test ./...
verify-codegen:
./hack/verify-codegen.sh
charts:
cd chart && helm package inlets-operator/
mv chart/*.tgz docs/
helm repo index docs --url https://inlets.github.io/inlets-operator/ --merge ./docs/index.yaml
apiVersion: apps/v1
kind: Deployment
metadata:
name: nginx-1
labels:
app: nginx
spec:
replicas: 1
selector:
matchLabels:
app: nginx
template:
metadata:
labels:
app: nginx
spec:
containers:
- name: nginx
image: nginx:1.14.2
ports:
- containerPort: 80
replicaCount: 1
# inlets PRO enables L4 TCP LoadBalancers in Kubernetes
## To enable, obtain a free 14-day trial from https://github.com/inlets/inlets-pro
## Or purchase at https://store.openfaas.com/
inletsProLicense: "MY JWT"
provider: "ec2"
region: "us-west-2"
accessKeyFile: "/var/secrets/inlets/inlets-access-key"
# Set to /var/secrets/inlets/secret/inlets-secret-key for a provider
# that requires an access key and secret key, such as EC2.
#secretKeyFile: "inlets-secret-key"
secretKeyFile: "/var/secrets/inlets/secret/inlets-secret-key"
# The VPC ID to create the exit-server in (EC2)
vpcId: "vpc-f12e6b88"
# The Subnet ID where the exit-server should be placed (EC2)
subnetId: "subnet-89ef61d"
annotatedOnly: false
image: "digitalsanctum/inlets-operator:latest-amd64"
pullPolicy: "Always"
clientImage: "inlets/inlets:2.7.4"
proClientImage: "inlets/inlets-pro:0.7.0"
nameOverride: ""
fullnameOverride: ""
resources:
requests:
cpu: 100m
memory: 128Mi
nodeSelector: {}
tolerations: []
affinity: {}
#!/usr/bin/env bash
set -e
INLETS_NAMESPACE="inlets"
INLETS_ACCESS_KEY_FILE="inlets-access-key"
INLETS_SECRET_KEY_FILE="inlets-secret-key"
make build
make test
make push
kubectl create ns ${INLETS_NAMESPACE} || true
kubectl create secret generic inlets-access-key --from-literal inlets-access-key="$(cat ${INLETS_ACCESS_KEY_FILE})" -n ${INLETS_NAMESPACE} || true
kubectl create secret generic inlets-secret-key --from-literal inlets-secret-key="$(cat ${INLETS_SECRET_KEY_FILE})" -n ${INLETS_NAMESPACE} || true
kubectl apply -f ./artifacts/crds || true
helm install -f ./test-values.yaml inlets-operator ./chart/inlets-operator -n ${INLETS_NAMESPACE}
kubectl apply -f nginx.yaml
kubectl expose deployment nginx-1 --port=80 --type=LoadBalancer
sleep 10
kubectl logs -n inlets deploy/inlets-operator
kubectl get svc -w
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment