Skip to content

Commit

Permalink
Kong (#134)
Browse files Browse the repository at this point in the history
* Kong validation

* upstream testJob

* adding test jobs

* cronjob, resource cleanup

* cronjob

* cronjob fix

---------

Co-authored-by: Anuj Sharma <[email protected]>
  • Loading branch information
DaniellaFreese and anshrma authored Sep 21, 2023
1 parent 486cc13 commit e2ad87c
Show file tree
Hide file tree
Showing 6 changed files with 162 additions and 0 deletions.
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
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:
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

0 comments on commit e2ad87c

Please sign in to comment.