Skip to content

Commit

Permalink
skaffold
Browse files Browse the repository at this point in the history
  • Loading branch information
czeslavo committed Jan 28, 2023
1 parent 52bd1a4 commit 2892dae
Show file tree
Hide file tree
Showing 16 changed files with 1,949 additions and 63 deletions.
13 changes: 8 additions & 5 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -123,8 +123,7 @@ _build.template:
go build -o bin/manager -ldflags "-s -w \
-X $(REPO_URL)/v2/internal/manager/metadata.Release=$(TAG) \
-X $(REPO_URL)/v2/internal/manager/metadata.Commit=$(COMMIT) \
-X $(REPO_URL)/v2/internal/manager/metadata.Repo=$(REPO_INFO)" \
-gcflags "-trimpath" ${MAIN}
-X $(REPO_URL)/v2/internal/manager/metadata.Repo=$(REPO_INFO)" ${MAIN}

.PHONY: _build.debug
_build.debug:
Expand Down Expand Up @@ -474,7 +473,12 @@ debug.skaffold: skaffold
$(SKAFFOLD) debug --port-forward=pods --profile=debug $(SKAFFOLD_FLAGS)

# This will port-forward 40000 from KIC's debugger to localhost. Connect to that
# port with debugger/IDE of your choice
# port with debugger/IDE of your choice.
#
# To make it work with Konnect, you must provide following files under ./config/variants/konnect/debug:
# * `konnect.env` with CONTROLLER_KONNECT_RUNTIME_GROUP env variable set
# to the UUID of a Runtime Group you have created in Konnect.
# * `tls.crt` and `tls.key` with TLS client cerificate and its key (generated by Konnect).
.PHONY: debug.konnect.skaffold
debug.konnect.skaffold: skaffold
TAG=$(TAG)-debug REPO_INFO=$(REPO_INFO) COMMIT=$(COMMIT) \
Expand All @@ -500,8 +504,7 @@ run: install _ensure-namespace
# It should be run only after the cluster has been already prepared to run with KIC.
.PHONY: _run
_run:
go build -gcflags="all=-N -l" -o ./controller ./internal/cmd/main.go && \
./controller \
go run ./internal/cmd/main.go \
--anonymous-reports=false \
--kong-admin-url $(KONG_ADMIN_URL) \
--publish-service $(KONG_NAMESPACE)/$(KONG_PROXY_SERVICE) \
Expand Down
49 changes: 0 additions & 49 deletions config/konnect/manager.yaml

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base
- ../../../base

patchesStrategicMerge:
- manager.yaml
- manager.yaml
29 changes: 29 additions & 0 deletions config/variants/konnect/base/manager.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress-kong
namespace: kong
spec:
template:
spec:
containers:
- name: ingress-controller
envFrom:
- configMapRef:
# konnect-config ConfigMap is expected to specify:
# * CONTROLLER_KONNECT_RUNTIME_GROUP (required)
# * CONTROLLER_KONNECT_ADDRESS (optional)
name: konnect-config
env:
- name: CONTROLLER_KONNECT_SYNC_ENABLED
value: "true"
- name: CONTROLLER_KONNECT_TLS_CLIENT_CERT
valueFrom:
secretKeyRef:
name: konnect-client-tls
key: tls.crt
- name: CONTROLLER_KONNECT_TLS_CLIENT_KEY
valueFrom:
secretKeyRef:
name: konnect-client-tls
key: tls.key
3 changes: 3 additions & 0 deletions config/variants/konnect/debug/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
tls.crt
tls.key
konnect.env
24 changes: 24 additions & 0 deletions config/variants/konnect/debug/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../base

patchesStrategicMerge:
- manager_debug.yaml

generatorOptions:
disableNameSuffixHash: true

secretGenerator:
- name: konnect-client-tls
namespace: kong
type: tls
files:
- tls.crt
- tls.key

configMapGenerator:
- name: konnect-config
namespace: kong
envs: [konnect.env]
32 changes: 32 additions & 0 deletions config/variants/konnect/debug/manager_debug.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: ingress-kong
namespace: kong
spec:
template:
spec:
containers:
- name: ingress-controller
command:
- /go/bin/dlv
- --continue
- --accept-multiclient
- --listen=:40000
- --check-go-version=false
- --headless=true
- --api-version=2
- --log=true
- --log-output=debugger,debuglineerr,gdbwire
- exec
- /manager-debug
- --
args:
- --feature-gates=GatewayAlpha=true
- --anonymous-reports=false
env:
- name: CONTROLLER_LOG_LEVEL
value: debug
- name: CONTROLLER_KONNECT_ADDRESS
value: https://us.kic.api.konghq.tech
image: kic-placeholder:placeholder
Loading

0 comments on commit 2892dae

Please sign in to comment.