diff --git a/charts/testkube-cloud-api/.argocd-source-edge-testkube-cloud-api.yaml b/charts/testkube-cloud-api/.argocd-source-edge-testkube-cloud-api.yaml index 8e477d6a9..5d6bc2cd2 100644 --- a/charts/testkube-cloud-api/.argocd-source-edge-testkube-cloud-api.yaml +++ b/charts/testkube-cloud-api/.argocd-source-edge-testkube-cloud-api.yaml @@ -4,5 +4,5 @@ helm: value: kubeshop/testkube-cloud-api forcestring: true - name: image.tag - value: 1.9.3-dev-d5a4a480 + value: 1.9.5-dev-d78695ab forcestring: true diff --git a/charts/testkube-cloud-api/.argocd-source-norauto-testkube-cloud-api.yaml b/charts/testkube-cloud-api/.argocd-source-norauto-testkube-cloud-api.yaml index 7368229f6..7c2c5f64e 100644 --- a/charts/testkube-cloud-api/.argocd-source-norauto-testkube-cloud-api.yaml +++ b/charts/testkube-cloud-api/.argocd-source-norauto-testkube-cloud-api.yaml @@ -4,5 +4,5 @@ helm: value: kubeshop/testkube-cloud-api forcestring: true - name: image.tag - value: 1.9.2-rc-355c53b4 + value: 1.9.6-rc-d78695ab forcestring: true diff --git a/charts/testkube-cloud-api/README.md b/charts/testkube-cloud-api/README.md index aca4d30b8..3f8514dce 100644 --- a/charts/testkube-cloud-api/README.md +++ b/charts/testkube-cloud-api/README.md @@ -31,6 +31,7 @@ A Helm chart for Testkube Cloud API | analytics.segmentio.enabled | bool | `false` | Toggle whether to enable Segment.io analytics | | analytics.segmentio.secretRef | string | `""` | Segment.io secret ref (secret must contain key SEGMENTIO_WRITE_KEY) (default is `testkube-cloud-analytics-secret`) | | analytics.segmentio.writeKey | string | `""` | Segment.io write key | +| api.agent.healthcheck.lock | string | `"kv"` | Agent healthcheck distributed mode (one of mongo|kv) - used for pods sync to run healthchecks on single pod at once | | api.agent.hide | bool | `false` | | | api.agent.host | string | `""` | Agent host with protocol (example `agent.testkube.xyz`) | | api.agent.port | string | `"443"` | Agent port | @@ -111,7 +112,7 @@ A Helm chart for Testkube Cloud API | grpcIngress.maxPayloadSize | string | `"16m"` | Max payload size for proxied gRPC API | | image.pullPolicy | string | `"IfNotPresent"` | | | image.repository | string | `"kubeshop/testkube-cloud-api"` | | -| image.tag | string | `"1.9.3"` | | +| image.tag | string | `"1.9.4"` | | | imagePullSecrets | list | `[]` | | | ingress.annotations | object | `{"nginx.ingress.kubernetes.io/force-ssl-redirect":"true","nginx.ingress.kubernetes.io/preserve-trailing-slash":"true"}` | Common annotations which will be added to all Ingress resources | | ingress.className | string | `"nginx"` | Common Ingress class name (NGINX is the only officially supported ingress controller and should not be changed) | diff --git a/charts/testkube-cloud-api/templates/deployment.yaml b/charts/testkube-cloud-api/templates/deployment.yaml index 81fae0136..232f9056c 100644 --- a/charts/testkube-cloud-api/templates/deployment.yaml +++ b/charts/testkube-cloud-api/templates/deployment.yaml @@ -68,6 +68,8 @@ spec: - name: OPENAI_API_KEY value: "{{ .Values.ai.apiKey }}" {{- end }} + - name: HEALTHCHECK_DISTRIBUTED_LOCK + value: "{{ .Values.api.agent.healthcheck.lock }}" - name: INVITE_MODE value: "{{ .Values.api.inviteMode }}" {{- if eq .Values.api.inviteMode "email" }} diff --git a/charts/testkube-cloud-api/values.yaml b/charts/testkube-cloud-api/values.yaml index 55176e94b..1f46d46c8 100644 --- a/charts/testkube-cloud-api/values.yaml +++ b/charts/testkube-cloud-api/values.yaml @@ -42,7 +42,7 @@ replicaCount: 1 image: repository: kubeshop/testkube-cloud-api pullPolicy: IfNotPresent - tag: "1.6.7" + tag: "1.9.4" imagePullSecrets: [] nameOverride: "" fullnameOverride: "" @@ -165,6 +165,9 @@ api: # -- Secret API key secret ref (secret must contain key SENDGRID_API_KEY) (default is `sendgrid-api-key`) secretRef: "" agent: + healthcheck: + # -- Agent healthcheck distributed mode (one of mongo|kv) - used for pods sync to run healthchecks on single pod at once + lock: kv hide: false # -- Agent host with protocol (example `agent.testkube.xyz`) host: "" diff --git a/charts/testkube-cloud-ui/.argocd-source-edge-testkube-cloud-ui.yaml b/charts/testkube-cloud-ui/.argocd-source-edge-testkube-cloud-ui.yaml index 41f395326..8aad8babe 100644 --- a/charts/testkube-cloud-ui/.argocd-source-edge-testkube-cloud-ui.yaml +++ b/charts/testkube-cloud-ui/.argocd-source-edge-testkube-cloud-ui.yaml @@ -4,5 +4,5 @@ helm: value: kubeshop/testkube-cloud-ui forcestring: true - name: image.tag - value: 1.8.0-dev-6a24340 + value: 1.8.0-dev-fc529d3 forcestring: true diff --git a/charts/testkube-cloud-ui/README.md b/charts/testkube-cloud-ui/README.md index 49341d616..5389c1da5 100644 --- a/charts/testkube-cloud-ui/README.md +++ b/charts/testkube-cloud-ui/README.md @@ -41,7 +41,7 @@ A Helm chart for Testkube Cloud UI | global.uiSubdomain | string | `"cloud"` | UI subdomain which get prepended to the domain | | image.pullPolicy | string | `"IfNotPresent"` | | | image.repository | string | `"kubeshop/testkube-cloud-ui"` | | -| image.tag | string | `"1.7.9"` | | +| image.tag | string | `"1.6.2"` | | | imagePullSecrets | list | `[]` | | | ingress.annotations | object | `{}` | Additional Ingress annotations | | ingress.className | string | `"nginx"` | Ingress class (NGINX Controller is the only officially supported Ingress controller) | diff --git a/charts/testkube-enterprise/.argocd-source-dev-testkube-enterprise.yaml b/charts/testkube-enterprise/.argocd-source-dev-testkube-enterprise.yaml index 762914eb0..7de793e15 100644 --- a/charts/testkube-enterprise/.argocd-source-dev-testkube-enterprise.yaml +++ b/charts/testkube-enterprise/.argocd-source-dev-testkube-enterprise.yaml @@ -4,7 +4,7 @@ helm: value: testkubeenterprise/testkube-enterprise-ui forcestring: true - name: testkube-cloud-api.image.tag - value: 1.9.2-rc-355c53b4 + value: 1.9.6-rc-d78695ab forcestring: true - name: testkube-cloud-ui.image.tag value: 1.8.0-rc-91b720e diff --git a/charts/testkube-enterprise/.argocd-source-edge-testkube-enterprise.yaml b/charts/testkube-enterprise/.argocd-source-edge-testkube-enterprise.yaml index ca620570e..b2f37170f 100644 --- a/charts/testkube-enterprise/.argocd-source-edge-testkube-enterprise.yaml +++ b/charts/testkube-enterprise/.argocd-source-edge-testkube-enterprise.yaml @@ -4,8 +4,8 @@ helm: value: testkubeenterprise/testkube-enterprise-ui forcestring: true - name: testkube-cloud-api.image.tag - value: 1.9.3-dev-d5a4a480 + value: 1.9.5-dev-d78695ab forcestring: true - name: testkube-cloud-ui.image.tag - value: 1.8.0-dev-6a24340 + value: 1.8.0-dev-fc529d3 forcestring: true diff --git a/charts/testkube-enterprise/README.md b/charts/testkube-enterprise/README.md index 17292d5fd..ab8488d03 100644 --- a/charts/testkube-enterprise/README.md +++ b/charts/testkube-enterprise/README.md @@ -132,6 +132,7 @@ A Helm chart for Testkube Enterprise | nats.reloader.merge | object | `{}` | Merge additional fields to the container https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.24/#container-v1-core | | nats.reloader.patch | list | `[]` | Patch additional fields to the container | | testkube-cloud-api.ai.secretRef | string | `""` | | +| testkube-cloud-api.api.agent.healthcheck.lock | string | `"kv"` | Agent healthcheck distributed mode (one of mongo|kv) - used for pods sync to run healthchecks on single pod at once | | testkube-cloud-api.api.agent.hide | bool | `false` | | | testkube-cloud-api.api.agent.host | string | `""` | Agent host (without protocol) is used for building agent install commands (if blank, api will autogenerate it based on the value of `global.domain`) | | testkube-cloud-api.api.agent.port | int | `443` | Agent port - used for building agent install commands | @@ -168,18 +169,18 @@ A Helm chart for Testkube Enterprise | testkube-cloud-api.api.tls.tlsSecret | string | `"testkube-enterprise-api-tls"` | | | testkube-cloud-api.fullnameOverride | string | `"testkube-enterprise-api"` | | | testkube-cloud-api.image.repository | string | `"testkubeenterprise/testkube-enterprise-api"` | | -| testkube-cloud-api.image.tag | string | `"1.9.3"` | | +| testkube-cloud-api.image.tag | string | `"1.9.4"` | | | testkube-cloud-api.ingress.className | string | `"nginx"` | | | testkube-cloud-api.prometheus.enabled | bool | `false` | | | testkube-cloud-ui.fullnameOverride | string | `"testkube-enterprise-ui"` | | | testkube-cloud-ui.image.repository | string | `"testkubeenterprise/testkube-enterprise-ui"` | | -| testkube-cloud-ui.image.tag | string | `"1.7.9"` | | +| testkube-cloud-ui.image.tag | string | `"1.7.3"` | | | testkube-cloud-ui.ingress.tlsSecretName | string | `"testkube-enterprise-ui-tls"` | Name of the TLS secret which contains the certificate files | | testkube-cloud-ui.ingressRedirect | object | `{"enabled":false}` | Toggle whether to enable redirect Ingress which allows having a different subdomain redirecting to the actual Dashboard UI Ingress URL | | testkube-cloud-ui.ui.authStrategy | string | `""` | Auth strategy to use (possible values: "" (default), "gitlab", "github"), setting to "" enables all auth strategies, if you use a custom Dex connector, set this to the id of the connector | | testkube-worker-service.fullnameOverride | string | `"testkube-enterprise-worker-service"` | | | testkube-worker-service.image.repository | string | `"testkubeenterprise/testkube-enterprise-worker-service"` | | -| testkube-worker-service.image.tag | string | `"1.7.2"` | | +| testkube-worker-service.image.tag | string | `"1.9.0-rc-e5167f6a"` | | ---------------------------------------------- Autogenerated from chart metadata using [helm-docs v1.11.0](https://github.com/norwoodj/helm-docs/releases/v1.11.0) diff --git a/charts/testkube-enterprise/installer_enterprise.sh b/charts/testkube-enterprise/installer_enterprise.sh new file mode 100644 index 000000000..26d7d865f --- /dev/null +++ b/charts/testkube-enterprise/installer_enterprise.sh @@ -0,0 +1,193 @@ +#!/bin/bash +echo "Installing Testkube Enterprise..." + +# If DEBUG is not empty, then the script enables debugging by setting the -x option +if [ ! -z "${DEBUG}" ]; +then set -x +fi + +## Install helm +echo "Checking for helm installation.." +if command -v helm &> /dev/null; then + echo "Helm is already installed." +else + curl -fsSL -o get_helm.sh https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 \ + chmod 700 get_helm.sh \ + ./get_helm.sh +fi + +## Create the testkube-enterprise namespace +NAMESPACE="testkube-enterprise" + +kubectl create namespace "$NAMESPACE" 2>/dev/null + +# Check the exit status of the kubectl command +if [ $? -eq 0 ]; then + echo "Namespace '$NAMESPACE' created." +else + # Handle the case where the namespace already exists or there is another error + existing_namespace=$(kubectl get namespace "$NAMESPACE" --no-headers 2>/dev/null) + if [ -n "$existing_namespace" ]; then + echo "Namespace '$NAMESPACE' already exists. Continuing..." + else + echo "Error: Failed to create namespace '$NAMESPACE'." + exit 1 + fi +fi +# Save the namespace to a variable +export NAMESPACE="$NAMESPACE" + +## License +# Ask a user for the value of the license key from the email +read -p "Please enter the value for the license key from the email: " license_value + +# Create a secret with the license +secret_creation_output=$(kubectl create secret generic testkube-enterprise-license --from-literal=LICENSE_KEY="$license_value" --namespace "$NAMESPACE" 2>&1) + +# Check the exit status of the kubectl command +if [ $? -eq 0 ]; then + echo "Secret 'license' created with the provided license key value." +else + # Handle the case where there is an error creating the secret + if [[ $secret_creation_output == *"already exists"* ]]; then + echo "Secret 'testkube-enterprise-license' already exists in namespace '$NAMESPACE'. Continuing..." + else + echo "Error: Failed to create secret 'license' in namespace '$NAMESPACE'." + exit 1 + fi +fi + +## Deploy Testkube Enterprise chart into testkube-enterprise namespace +# Install Helm chart using the values file +helm repo add testkubeenterprise https://kubeshop.github.io/testkube-cloud-charts +echo "Installing testkube-enterprise helm chart into your k8s cluster." +helm repo update && helm upgrade --install testkube-enterprise testkubeenterprise/testkube-enterprise --namespace "$NAMESPACE" --values https://raw.githubusercontent.com/kubeshop/testkube-cloud-charts/develop/charts/testkube-enterprise/local-values.yaml + +# Wait for the pods to launch +sleep 40 + +# Function to check if a port is available +function is_port_available() { + local port=$1 + local result=$(curl -s -o /dev/null -w "%{http_code}" http://localhost:$port) + + # Check if the HTTP status code is not 200 (OK) + if [ "$result" -ne 200 ]; then + return 0 # Port is available + else + return 1 # Port is not available + fi +} + + +# Wait for all Pods to be ready +while true; do + pod_statuses=$(kubectl get pods -l app.kubernetes.io/instance=testkube-enterprise -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}' --namespace "$NAMESPACE" 2>/dev/null) + num_ready_pods=$(echo "$pod_statuses" | tr ' ' '\n' | grep -c "True") + + if [ "$num_ready_pods" -eq "$(kubectl get pods -l app.kubernetes.io/instance=testkube-enterprise --no-headers --namespace "$NAMESPACE" | wc -l)" ]; then + echo "All pods are ready. Proceeding with the next steps." + + # Check if ports are available before port-forwarding + if is_port_available 8080 && is_port_available 8090 && is_port_available 5556; then + + kubectl port-forward svc/testkube-enterprise-ui 8080:8080 --namespace "$NAMESPACE" & + kubectl port-forward svc/testkube-enterprise-api 8090:8088 --namespace "$NAMESPACE" & + kubectl port-forward svc/testkube-enterprise-dex 5556:5556 --namespace "$NAMESPACE" & + sleep 20 + break + else + echo "Error: One or more ports are already in use or inaccessible. Please make sure ports 8080, 8090, and 5556 are available and not occupied by another application." + exit 1 + fi + + else + echo "Waiting for all pods to be ready. Currently, $num_ready_pods out of $(kubectl get pods -l app.kubernetes.io/instance=testkube-enterprise --no-headers --namespace "$NAMESPACE" | wc -l) pods are ready." + sleep 2 + fi +done + +##Access token +# Get response +response=$(curl -L -X POST 'http://127.0.0.1:5556/token' -d "client_id=testkube-enterprise&client_secret=QWkVzs3nct6HZM5hxsPzwaZtq&response_type=token&scope=openid email&state=&grant_type=password&username=admin@example.com&password=password") +echo "Response:" +echo "$response" | jq '.' + +# Get Access token +access_token=$(echo "$response" | jq -r '.access_token') +echo "Access token: $access_token" + +# Base URLs and Endpoints +auth_server='http://127.0.0.1:5556' +api_server='http://127.0.0.1:8090' +org_endpoint='/organizations' +env_endpoint='/environments' + +##Organization ID +#Get response +while true; do + response=$(curl -s "$api_server$org_endpoint" -H "Authorization: Bearer $access_token") + if [ -n "$response" ]; then + echo "Response from API:" + echo "$response" | jq '.' + break + else + echo "Error retrieving response. Retrying..." + sleep 2 + fi +done + +#Get Organization ID +org_id=$(echo "$response" | jq -r '.elements[0].id') +echo "Organization ID: $org_id" + +#Rename Organization to admin-personal-org +org_payload='{"id":"'$org_id'","name":"admin-personal-org"}' +curl -X PATCH "$api_server$org_endpoint/$org_id" -H "Authorization: Bearer $access_token" -H "Content-Type: application/json" -d "$org_payload" + +## Environment +# Gey a payload +env_payload='{"name":"My First Environment", "id":"'$org_id'", "connected":false}' +# Create an environment +curl -X POST "$api_server$org_endpoint/$org_id$env_endpoint" \ + -H "Authorization: Bearer $access_token" \ + -H "Content-Type: application/json" \ + -d "$env_payload" + +# Get Environment ID and Agent Token +response=$(curl -s "$api_server$org_endpoint/$org_id$env_endpoint" -H "Authorization: Bearer $access_token") +env_id=$(echo "$response" | jq -r '.elements[0].id') +agent_token=$(echo "$response" | jq -r '.elements[0].agentToken') + +# Deploy an Agent +helm repo add kubeshop https://kubeshop.github.io/helm-charts +helm repo update && helm upgrade --install --create-namespace testkube kubeshop/testkube \ + --set testkube-api.cloud.key="$agent_token" \ + --set testkube-api.cloud.orgId="$org_id" \ + --set testkube-api.cloud.envId="$env_id" \ + --set testkube-api.minio.enabled=false \ + --set mongodb.enabled=false \ + --set testkube-dashboard.enabled=false \ + --set testkube-api.cloud.url=testkube-enterprise-api.testkube-enterprise.svc.cluster.local:8089 \ + --set testkube-api.cloud.tls.enabled=false \ + --namespace testkube + +# Sleep +sleep 40 + +# Wait for all Pods to be ready +while true; do + pod_statuses=$(kubectl get pods -l app.kubernetes.io/instance=testkube -o 'jsonpath={..status.conditions[?(@.type=="Ready")].status}' --namespace testkube 2>/dev/null) + num_ready_pods=$(echo "$pod_statuses" | tr ' ' '\n' | grep -c "True") + + if [ "$num_ready_pods" -eq "$(kubectl get pods -l app.kubernetes.io/instance=testkube --no-headers --namespace testkube | wc -l)" ]; then + echo "All pods are ready" + break + else + echo "Waiting for all pods to be ready. Currently, $num_ready_pods out of $(kubectl get pods -l app.kubernetes.io/instance=testkube-enterprise --no-headers --namespace testkube | wc -l) pods are ready." + sleep 2 + fi +done + + +echo "Testkube Enterprise was deployed along with the Agent into your k8s cluster. Please note that it may take up to 5 minutes for Agent to be fully running. Visit http://localhost:8080 to open the Dashboard. Use 'admin@example.com' and 'password' as a username and a password respectively." diff --git a/charts/testkube-enterprise/local-values.yaml b/charts/testkube-enterprise/local-values.yaml index a3ffd46ec..34255e04b 100644 --- a/charts/testkube-enterprise/local-values.yaml +++ b/charts/testkube-enterprise/local-values.yaml @@ -256,10 +256,12 @@ testkube-worker-service: # -- NATS URI uri: "nats://testkube-enterprise-nats.testkube-enterprise.svc.cluster.local:4222" minio: - endpoint: "http://testkube-enterprise-minio.testkube-enterprise.svc.cluster.local:9000" -# additionalEnv: -# USE_MINIO: true - + endpoint: "testkube-enterprise-minio:9000" + accessKeyId: "testkube-enterprise" + secretAccessKey: "t3stkub3-3nt3rpr1s3" + secure: false + additionalEnv: + USE_MINIO: true ## NATS chart parameter ## For more configuration parameters of NATS chart please look here: https://docs.nats.io/running-a-nats-service/nats-kubernetes/helm-charts diff --git a/charts/testkube-enterprise/values.yaml b/charts/testkube-enterprise/values.yaml index 688c1e2c9..e00f2aceb 100644 --- a/charts/testkube-enterprise/values.yaml +++ b/charts/testkube-enterprise/values.yaml @@ -131,7 +131,7 @@ testkube-cloud-api: fullnameOverride: testkube-enterprise-api image: repository: testkubeenterprise/testkube-enterprise-api - tag: 1.8.0 + tag: 1.9.4 ai: secretRef: "" api: @@ -194,6 +194,9 @@ testkube-cloud-api: # -- Secret API key secret ref (secret must contain key SENDGRID_API_KEY) (default is `sendgrid-api-key`) secretRef: "" agent: + healthcheck: + # -- Agent healthcheck distributed mode (one of mongo|kv) - used for pods sync to run healthchecks on single pod at once + lock: kv hide: false # -- Agent host (without protocol) is used for building agent install commands (if blank, api will autogenerate it based on the value of `global.domain`) host: "" @@ -431,4 +434,4 @@ dex: tls: - secretName: testkube-enterprise-api-tls hosts: - - "{{ .Values.global.restApiSubdomain }}.{{ .Values.global.domain }}" \ No newline at end of file + - "{{ .Values.global.restApiSubdomain }}.{{ .Values.global.domain }}" diff --git a/charts/testkube-worker-service/.argocd-source-edge-testkube-worker-service.yaml b/charts/testkube-worker-service/.argocd-source-edge-testkube-worker-service.yaml index 43e3f1994..cb294f639 100644 --- a/charts/testkube-worker-service/.argocd-source-edge-testkube-worker-service.yaml +++ b/charts/testkube-worker-service/.argocd-source-edge-testkube-worker-service.yaml @@ -4,5 +4,5 @@ helm: value: kubeshop/testkube-worker-service forcestring: true - name: image.tag - value: 1.9.3-dev-d5a4a480 + value: 1.9.5-dev-d78695ab forcestring: true diff --git a/charts/testkube-worker-service/README.md b/charts/testkube-worker-service/README.md index 6a84c1d06..2af27ebd1 100644 --- a/charts/testkube-worker-service/README.md +++ b/charts/testkube-worker-service/README.md @@ -45,7 +45,7 @@ A Helm chart for Testkube Worker Service | global.imagePullSecrets | list | `[]` | | | image.pullPolicy | string | `"IfNotPresent"` | | | image.repository | string | `"kubeshop/testkube-worker-service"` | | -| image.tag | string | `"1.7.2"` | | +| image.tag | string | `"1.9.0-rc-e5167f6a"` | | | imagePullSecrets | list | `[]` | | | nameOverride | string | `""` | | | nodeSelector | object | `{}` | |