Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kong #134

Merged
merged 6 commits into from
Sep 21, 2023
Merged

Kong #134

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions eks-anywhere-common/Addons/Partner/Kong/kong-source.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
---
apiVersion: source.toolkit.fluxcd.io/v1beta2
kind: HelmRepository
metadata:
name: kong-charts
namespace: flux-system
spec:
interval: 30s
url: https://charts.konghq.com
42 changes: 42 additions & 0 deletions eks-anywhere-common/Addons/Partner/Kong/kong.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
apiVersion: helm.toolkit.fluxcd.io/v2beta1
kind: HelmRelease
metadata:
name: kong
namespace: kong
spec:
chart:
spec:
chart: kong
reconcileStrategy: ChartVersion
sourceRef:
kind: HelmRepository
name: kong-charts
namespace: flux-system
version: 2.27.0
interval: 1m0s
targetNamespace: kong
releaseName: eks-anywhere
values:
enterprise:
enabled: true
vitals:
enabled: false
portal:
enabled: false
rbac:
enabled: false
manager:
enabled: false
portal:
enabled: false
portalapi:
enabled: false
env:
database: "off"
ingressController:
enabled: true
installCRDs: false
proxy:
enabled: true
type: ClusterIP
7 changes: 7 additions & 0 deletions eks-anywhere-common/Addons/Partner/Kong/namespace.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
apiVersion: v1
kind: Namespace
metadata:
name: kong
labels:
aws.conformance.vendor: kong
aws.conformance.vendor-solution: kong-enterprise
44 changes: 44 additions & 0 deletions eks-anywhere-common/Testers/Kong/test-job-configmap.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
apiVersion: v1
kind: ConfigMap
metadata:
name: test-configmap
namespace: kong
data:
test.sh: |-
#!/bin/bash
kubectl apply -f https://bit.ly/echo-service
echo "
apiVersion: networking.k8s.io/v1
kind: Ingress
DaniellaFreese marked this conversation as resolved.
Show resolved Hide resolved
metadata:
labels:
app: echo
name: demo
spec:
ingressClassName: kong
rules:
- http:
paths:
- path: /foo
pathType: ImplementationSpecific
backend:
service:
name: echo
port:
number: 80
" | kubectl apply -f - -n kong

sleep 300

response=$(curl --silent -i http://eks-anywhere-kong-proxy.kong.svc.cluster.local:80/foo)
response_status=$(echo $response | awk '/^HTTP/{print $2}')

kubectl delete deployment,service,ingress -l app=echo -n kong

if [[ $response_status == "200" && $response == *"pod namespace"* ]]; then
echo -e "\n Kong Gateway is running, test service passed \n"
exit 0
else
echo -e "\n Kong Gateway is running, test service failed \n"
exit 1
fi
30 changes: 30 additions & 0 deletions eks-anywhere-common/Testers/Kong/test-job-role.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
---
apiVersion: rbac.authorization.k8s.io/v1
kind: Role
metadata:
name: kong-gateway-job
namespace: kong
rules:
- apiGroups: [ "" ]
resources: ["pods","services"]
verbs: [ "get","list","create", "update", "patch", "watch", "delete" ]
- apiGroups: [ "apps" ]
resources: ["deployments"]
verbs: [ "get", "create", "update", "list", "patch", "delete" ]
- apiGroups: ["networking.k8s.io"]
resources: ["ingresses"]
verbs: [ "get", "create", "update", "list", "patch", "delete" ]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: RoleBinding
metadata:
name: kong-test
namespace: kong
subjects:
- kind: User
name: system:serviceaccount:kong:default
apiGroup: rbac.authorization.k8s.io
roleRef:
kind: Role
name: kong-gateway-job
apiGroup: rbac.authorization.k8s.io
30 changes: 30 additions & 0 deletions eks-anywhere-common/Testers/Kong/test-job.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
apiVersion: batch/v1
kind: CronJob
metadata:
DaniellaFreese marked this conversation as resolved.
Show resolved Hide resolved
name: kong-enterprise-testjob
namespace: kong
spec:
schedule: "10 10 * * *"
jobTemplate:
spec:
template:
spec:
containers:
- name: job
image: 'alpine/k8s:1.26.2'
imagePullPolicy: Always
command:
- /bin/test.sh
volumeMounts:
- name: test-configmap-volume
mountPath: /bin/test.sh
readOnly: true
subPath: test.sh
volumes:
- name: test-configmap-volume
configMap:
defaultMode: 0700
name: test-configmap
restartPolicy: Never
successfulJobsHistoryLimit: 3
failedJobsHistoryLimit: 1