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

Rename tyk charts #144

Merged
merged 18 commits into from
Oct 30, 2023
Merged
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
86 changes: 42 additions & 44 deletions .github/workflows/run-tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ on:
env:
TIMEOUT: 15m
TYK_OSS_NS: tyk-oss
TYK_MDCB_DATAPLANE_NS: tyk-mdcb-dataplane
TYK_SINGLE_DC_NS: tyk-single-dc
TYK_DATAPLANE_NS: tyk-dataplane
TYK_STACK_NS: tyk-stack

jobs:
lint-test:
Expand All @@ -36,8 +36,6 @@ jobs:

integration-tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
Expand Down Expand Up @@ -82,68 +80,68 @@ jobs:
helm uninstall redis -n ${{ env.TYK_OSS_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_OSS_NS }}

# Tyk Single Data Center tests
- name: Deploy Tyk Single Data Center and dependencies
# Tyk Stack tests
- name: Deploy Tyk Stack and dependencies
run: |
kubectl create namespace ${{ env.TYK_SINGLE_DC_NS }}
kubectl create namespace ${{ env.TYK_STACK_NS }}

# Do not change the name
# Install redis
helm install redis simple-redis --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env.TYK_SINGLE_DC_NS }} --timeout ${{ env.TIMEOUT }}
helm install redis simple-redis --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}

# Install mongo
helm install mongo simple-mongodb --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env.TYK_SINGLE_DC_NS }} --timeout ${{ env.TIMEOUT }}
helm install mongo simple-mongodb --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}

helm dependency update ./tyk-single-dc
helm dependency update ./tyk-stack

helm install --namespace tyk-single-dc tyk-single-dc ./tyk-single-dc \
--set "global.mongo.mongoURL=mongodb://mongo.tyk-single-dc.svc.cluster.local:27017/tyk_analytics" \
--set "global.redis.addrs[0]=redis.tyk-single-dc.svc.cluster.local:6379" \
helm install --namespace ${{ env.TYK_STACK_NS }} tyk-stack ./tyk-stack \
--set "global.mongo.mongoURL=mongodb://mongo.tyk-stack.svc.cluster.local:27017/tyk_analytics" \
--set "global.redis.addrs[0]=redis.tyk-stack.svc.cluster.local:6379" \
--set "global.license.dashboard=${{ secrets.DASH_LICENSE }}" \
--set "global.storageType=mongo" \
--timeout=${{ env.TIMEOUT }}

- name: Run integration tests for Tyk Single DC
run: helm test -n ${{ env.TYK_SINGLE_DC_NS }} tyk-single-dc
- name: Run integration tests for Tyk Stack
run: helm test -n ${{ env.TYK_STACK_NS }} tyk-stack

- if: failure()
name: Check logs in case of failure
run: kubectl logs -n ${{ env.TYK_SINGLE_DC_NS }} tyk-single-dc-test-tyk-single-dc
run: kubectl logs -n ${{ env.TYK_STACK_NS }} tyk-stack-test-tyk-stack

- name: Uninstall Tyk Single DC Dependencies
- name: Uninstall Tyk Stack Dependencies
run: |
helm uninstall redis -n ${{ env.TYK_SINGLE_DC_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall mongo -n ${{ env.TYK_SINGLE_DC_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall tyk-single-dc -n ${{ env.TYK_SINGLE_DC_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_SINGLE_DC_NS }}
helm uninstall redis -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall mongo -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
helm uninstall tyk-stack -n ${{ env.TYK_STACK_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_STACK_NS }}

# Tyk MDCB Data Plane tests
- name: Deploy Tyk MDCB Data Plane and Dependencies
# Tyk Data Plane tests
- name: Deploy Tyk Data Plane and Dependencies
run: |
kubectl create namespace ${{ env.TYK_MDCB_DATAPLANE_NS }}
kubectl create namespace ${{ env. TYK_DATAPLANE_NS }}

# Do not change the name
helm install redis simple-redis --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env.TYK_MDCB_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
helm install redis simple-redis --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}

helm dependency update ./tyk-mdcb-data-plane
helm dependency update ./tyk-data-plane

helm install --namespace ${{ env.TYK_MDCB_DATAPLANE_NS }} tyk-mdcb-data-plane ./tyk-mdcb-data-plane --wait \
helm install --namespace ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --wait \
--set global.remoteControlPlane.orgId=${{ secrets.HYBRID_RPC_KEY }} \
--set global.remoteControlPlane.userApiKey=${{ secrets.HYBRID_API_KEY }} \
--set global.remoteControlPlane.connectionString=${{ secrets.HYBRID_MDCB_HOST }}

- name: Run integration tests for Tyk MDCB Data Plane
run: helm test -n ${{ env.TYK_MDCB_DATAPLANE_NS }} tyk-mdcb-data-plane
- name: Run integration tests for Tyk Data Plane
run: helm test -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane

- if: failure()
name: Check logs in case of failure
run: kubectl logs -n ${{ env.TYK_MDCB_DATAPLANE_NS }} tyk-mdcb-data-plane-test-tyk-data-plane
run: kubectl logs -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane-test-tyk-data-plane

- name: Uninstall Tyk MDCB Data Plane Dependencies
- name: Uninstall Tyk Data Plane Dependencies
run: |
helm uninstall tyk-mdcb-data-plane -n ${{ env.TYK_MDCB_DATAPLANE_NS }}
helm uninstall redis -n ${{ env.TYK_MDCB_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_MDCB_DATAPLANE_NS }}
helm uninstall tyk-data-plane -n ${{ env. TYK_DATAPLANE_NS }}
helm uninstall redis -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env. TYK_DATAPLANE_NS }}

smoke-tests:
runs-on: ubuntu-latest
Expand Down Expand Up @@ -184,25 +182,25 @@ jobs:
helm uninstall tyk-oss -n tyk-oss --timeout ${{ env.TIMEOUT }}
kubectl delete namespace tyk-oss

- name: Deploy Tyk MDCB Data Plane
- name: Deploy Tyk Data Plane
run: |
kubectl create namespace ${{ env.TYK_MDCB_DATAPLANE_NS }}
kubectl create namespace ${{ env. TYK_DATAPLANE_NS }}

# Do not change the name
helm install redis simple-redis --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env.TYK_MDCB_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
helm install redis simple-redis --wait --repo 'https://helm.tyk.io/public/helm/charts/' -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}

helm dependency update ./tyk-mdcb-data-plane
helm dependency update ./tyk-data-plane

helm install --namespace ${{ env.TYK_MDCB_DATAPLANE_NS }} tyk-mdcb-data-plane ./tyk-mdcb-data-plane --wait \
helm install --namespace ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --wait \
--set global.remoteControlPlane.orgId=${{ secrets.HYBRID_RPC_KEY }} \
--set global.remoteControlPlane.userApiKey=${{ secrets.HYBRID_API_KEY }} \
--set global.remoteControlPlane.connectionString=${{ secrets.HYBRID_MDCB_HOST }}

- name: Upgrade Tyk MDCB Data Plane
- name: Upgrade Tyk Data Plane
run: |
helm upgrade -n ${{ env.TYK_MDCB_DATAPLANE_NS }} tyk-mdcb-data-plane ./tyk-mdcb-data-plane --set tyk-gateway.gateway.kind=DaemonSet
helm upgrade -n ${{ env. TYK_DATAPLANE_NS }} tyk-data-plane ./tyk-data-plane --set tyk-gateway.gateway.kind=DaemonSet

- name: Uninstall Tyk MDCB Data Plane
- name: Uninstall Tyk Data Plane
run: |
helm uninstall tyk-mdcb-data-plane -n ${{ env.TYK_MDCB_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env.TYK_MDCB_DATAPLANE_NS }}
helm uninstall tyk-data-plane -n ${{ env. TYK_DATAPLANE_NS }} --timeout ${{ env.TIMEOUT }}
kubectl delete namespace ${{ env. TYK_DATAPLANE_NS }}
7 changes: 4 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
tyk-oss/charts/*
tyk-oss/Chart.lock
buraksekili marked this conversation as resolved.
Show resolved Hide resolved

/.idea

tyk-mdcb-data-plane/charts/*
tyk-mdcb-data-plane/Chart.lock

tyk-single-dc/charts/*
tyk-single-dc/Chart.lock

tyk-stack/charts/*

tyk-data-plane/charts/*

8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ Helm umbrella chart (chart of charts) is an easy and really flexible way of inst
| Umbrella Charts | Description | Status |
|-----------------|-------------|--------|
| [tyk-oss](./tyk-oss) | Tyk Open Source | Stable |
| [tyk-single-dc](./tyk-single-dc) | Tyk Self Managed (Single DC) | Beta |
| tyk-mdcb-control-plane | Tyk Self Managed (MDCB) Control Plane | Coming Soon |
| [tyk-mdcb-data-plane](./tyk-mdcb-data-plane) | Tyk Self Managed (MDCB) Data Plane <br> Tyk Hybrid Data Plane | Stable |
| [tyk-stack](./tyk-stack) | Tyk Self Managed (Single DC) | Beta |
| tyk-control-plane | Tyk Self Managed (MDCB) Control Plane | Coming Soon |
| [tyk-data-plane](./tyk-data-plane) | Tyk Self Managed (MDCB) Data Plane <br> Tyk Hybrid Data Plane | Stable |

## Component Charts
* [tyk-gateway](./components/tyk-gateway)
* [tyk-pump](./components/tyk-pump)
* [tyk-dashboard](./components/tyk-dashboard)
* [tyk-enterprise-portal](./components/tyk-enterprise-portal)
* [tyk-dev-portal](./components/tyk-dev-portal)
* tyk-mdcb (Coming soon!)
* tyk-tib (Coming soon!)
* tyk-operator (Coming soon!)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,11 +108,11 @@ spec:
- name: OPERATOR_SECRET_NAME
value: "tyk-operator-conf"
{{- end }}
{{- if .Values.bootstrap.enterprisePortal }}
- name: ENTERPRISE_PORTAL_SECRET_ENABLED
{{- if .Values.bootstrap.devPortal }}
- name: DEVELOPER_PORTAL_SECRET_ENABLED
value: "true"
- name: ENTERPRISE_PORTAL_SECRET_NAME
value: {{ .Values.global.secrets.enterprisePortal}}
- name: DEVELOPER_PORTAL_SECRET_NAME
value: {{ .Values.global.secrets.devPortal}}
{{- end }}
- name: GATEWAY_ADDRESS
value: "{{ include "tyk-bootstrap.gateway_url" . }}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ spec:
env:
- name: OPERATOR_SECRET_NAME
value: "tyk-operator-conf"
- name: ENTERPRISE_PORTAL_SECRET_NAME
value: {{ .Values.global.secrets.enterprisePortal }}
- name: DEVELOPER_PORTAL_SECRET_NAME
value: {{ .Values.global.secrets.devPortal }}
- name: TYK_POD_NAMESPACE
valueFrom:
fieldRef:
Expand Down
8 changes: 4 additions & 4 deletions components/tyk-bootstrap/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ global:
# Enables/disables the dashboard component and also used to detect when the bootstrapping needs to be done
# for a separate Tyk Dashboard installation or for an umbrella chart installation
dashboard: false
enterprisePortal: false
devPortal: false

tls:
# If set to true the Dashboard will use SSL connection.
Expand All @@ -55,11 +55,11 @@ global:
# You can set following fields in the secret
# AdminSecret - Admin user secret key
useSecretName: ""
enterprisePortal: tyk-enterprise-portal-conf
devPortal: tyk-dev-portal-conf

bootstrap:
# Trigger to control if we want to bootstrap the Enterprise Portal component using tyk-bootstrap
enterprisePortal: true
# Trigger to control if we want to bootstrap the Developer Portal component using tyk-bootstrap
devPortal: true

# Trigger to control if we want to bootstrap the dashboard component using tyk-bootstrap
dashboard: true
Expand Down
2 changes: 1 addition & 1 deletion components/tyk-dashboard/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ The Dashboard also provides the [API Developer Portal](https://tyk.io/docs/tyk-d
This chart defines a standalone Tyk Dashboard component on a [Kubernetes](https://kubernetes.io/) cluster using the [Helm](https://helm.sh/) package manager.

For typical usage, we recommend using following umbrella charts:
* For single data centre deployment, please use [tyk-single-dc](https://github.com/TykTechnologies/tyk-charts/tree/main/tyk-single-dc)
* For single data centre deployment, please use [tyk-stack](https://github.com/TykTechnologies/tyk-charts/tree/main/tyk-stack)
* For multi data centre deployment, please use tyk-mdcb-control-plane (Coming soon!)

[Learn more about Tyk Licensing and Deployment models](https://tyk.io/docs/tyk-on-premises/licensing/)
Expand Down
23 changes: 23 additions & 0 deletions components/tyk-dev-portal/.helmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*.orig
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
18 changes: 18 additions & 0 deletions components/tyk-dev-portal/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apiVersion: v2
name: tyk-dev-portal
description: A Helm chart for Kubernetes

# A chart can be either an 'application' or a 'library' chart.
#
# Application charts are a collection of templates that can be packaged into versioned archives
# to be deployed.
#
# Library charts provide useful utilities or functions for the chart developer. They're included as
# a dependency of application charts to inject those utilities and functions into the rendering
# pipeline. Library charts do not define any templates and therefore cannot be deployed.
type: application

# This is the chart version. This version number should be incremented each time you make changes
# to the chart and its templates, including the app version.
# Versions are expected to follow Semantic Versioning (https://semver.org/)
version: 1.0.0-beta1
22 changes: 22 additions & 0 deletions components/tyk-dev-portal/templates/NOTES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
1. Get the application URL by running these commands:
{{- if .Values.ingress.enabled }}
{{- range $host := .Values.ingress.hosts }}
{{- range .paths }}
http{{ if $.Values.ingress.tls }}s{{ end }}://{{ $host.host }}{{ .path }}
{{- end }}
{{- end }}
{{- else if contains "NodePort" .Values.service.type }}
export NODE_PORT=$(kubectl get --namespace {{ .Release.Namespace }} -o jsonpath="{.spec.ports[0].nodePort}" services {{ include "tyk-dev-portal.fullname" . }})
export NODE_IP=$(kubectl get nodes --namespace {{ .Release.Namespace }} -o jsonpath="{.items[0].status.addresses[0].address}")
echo http://$NODE_IP:$NODE_PORT
{{- else if contains "LoadBalancer" .Values.service.type }}
NOTE: It may take a few minutes for the LoadBalancer IP to be available.
You can watch the status of by running 'kubectl get --namespace {{ .Release.Namespace }} svc -w {{ include "tyk-dev-portal.fullname" . }}'
export SERVICE_IP=$(kubectl get svc --namespace {{ .Release.Namespace }} {{ include "tyk-dev-portal.fullname" . }} --template "{{"{{ range (index .status.loadBalancer.ingress 0) }}{{.}}{{ end }}"}}")
echo http://$SERVICE_IP:{{ .Values.service.port }}
{{- else if contains "ClusterIP" .Values.service.type }}
export POD_NAME=$(kubectl get pods --namespace {{ .Release.Namespace }} -l "app.kubernetes.io/name={{ include "tyk-dev-portal.name" . }},app.kubernetes.io/instance={{ .Release.Name }}" -o jsonpath="{.items[0].metadata.name}")
export CONTAINER_PORT=$(kubectl get pod --namespace {{ .Release.Namespace }} $POD_NAME -o jsonpath="{.spec.containers[0].ports[0].containerPort}")
echo "Visit http://127.0.0.1:8080 to use your application"
kubectl --namespace {{ .Release.Namespace }} port-forward $POD_NAME 8080:$CONTAINER_PORT
{{- end }}
59 changes: 59 additions & 0 deletions components/tyk-dev-portal/templates/_helpers.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
{{/*
Expand the name of the chart.
*/}}
{{- define "tyk-dev-portal.name" -}}
{{- default .Chart.Name .Values.nameOverride | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Create a default fully qualified app name.
We truncate at 63 chars because some Kubernetes name fields are limited to this (by the DNS naming spec).
If release name contains chart name it will be used as a full name.
*/}}
{{- define "tyk-dev-portal.fullname" -}}
{{- if .Values.fullnameOverride -}}
{{- .Values.fullnameOverride | trunc 63 | trimSuffix "-" }}
{{- else }}
{{- $name := default .Chart.Name .Values.nameOverride -}}
{{- if contains $name .Release.Name -}}
{{- .Release.Name | trunc 63 | trimSuffix "-" -}}
{{- else }}
{{- printf "%s-%s" .Release.Name $name | trunc 63 | trimSuffix "-" -}}
{{- end }}
{{- end }}
{{- end }}

{{/*
Create chart name and version as used by the chart label.
*/}}
{{- define "tyk-dev-portal.chart" -}}
{{- printf "%s-%s" .Chart.Name .Chart.Version | replace "+" "_" | trunc 63 | trimSuffix "-" }}
{{- end }}

{{/*
Common labels
*/}}
{{- define "tyk-dev-portal.labels" -}}
helm.sh/chart: {{ include "tyk-dev-portal.chart" . }}
{{ include "tyk-dev-portal.selectorLabels" . }}
{{- if .Chart.AppVersion }}
app.kubernetes.io/version: {{ .Chart.AppVersion | quote }}
{{- end }}
app.kubernetes.io/managed-by: {{ .Release.Service }}
{{- end }}

{{/*
Selector labels
*/}}
{{- define "tyk-dev-portal.selectorLabels" -}}
app.kubernetes.io/name: {{ include "tyk-dev-portal.name" . }}
app.kubernetes.io/instance: {{ .Release.Name }}
{{- end }}

{{- define "tyk-dev-portal.tplvalues.render" -}}
{{- if typeIs "string" .value }}
{{- tpl .value .context }}
{{- else }}
{{- tpl (.value | toYaml) .context }}
{{- end }}
{{- end -}}
Loading