diff --git a/.github/workflows/release-version.yml b/.github/workflows/release-version.yml index a47a95084c..38ac777dcb 100644 --- a/.github/workflows/release-version.yml +++ b/.github/workflows/release-version.yml @@ -107,7 +107,7 @@ jobs: uses: docker/build-push-action@v5 with: push: true - tags: kubeshop/tracetest-agent:${{ env.VERSION }} + tags: kubeshop/tracetest-agent:latest,kubeshop/tracetest-agent:${{ env.VERSION }} file: agent/Dockerfile build-args: | TRACETEST_VERSION=${{ env.VERSION }} diff --git a/k8s/agent/deploy-agent.sh b/k8s/agent/deploy-agent.sh new file mode 100755 index 0000000000..230c26b718 --- /dev/null +++ b/k8s/agent/deploy-agent.sh @@ -0,0 +1,26 @@ +NAMESPACE=$1 +API_KEY=$2 +AGENT_VERSION="${3:-latest}" +FILE_PATH="https://raw.githubusercontent.com/kubeshop/tracetest/k8s/agent/deploy-agent.yaml" + +showUsageAndExit() { + echo "Usage: ./script ()?" + echo "Examples:" + echo "./script tracetest my-api-key" + echo "./script my-namespace my-api-key v0.13.9" + + exit 1 +} + +if [ -z "${NAMESPACE}" ]; then + echo "Error: Namespace is required" + showUsageAndExit +fi + +if [ -z "${API_KEY}" ]; then + echo "Error: API key is required" + showUsageAndExit +fi + +kubectl create -n $NAMESPACE secret generic tracetest-agent-secret --from-literal=api-key=$API_KEY +curl $FILE_PATH | sed "s/:TAG/:$AGENT_VERSION/g" | kubectl apply -n $NAMESPACE -f - diff --git a/k8s/agent/deploy-agent.yaml b/k8s/agent/deploy-agent.yaml new file mode 100644 index 0000000000..953caaf030 --- /dev/null +++ b/k8s/agent/deploy-agent.yaml @@ -0,0 +1,53 @@ +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: tracetest-agent + labels: + app: tracetest-agent +spec: + selector: + matchLabels: + app: tracetest-agent + template: + metadata: + labels: + app: tracetest-agent + spec: + containers: + - name: tracetest-agent + image: kubeshop/tracetest-agent:TAG + env: + - name: TRACETEST_API_KEY + valueFrom: + secretKeyRef: + name: tracetest-agent-secret + key: api-key + + ports: + - containerPort: 4317 + - containerPort: 4318 + resources: + requests: + cpu: 100m + memory: 200Mi + +--- +apiVersion: v1 +kind: Service +metadata: + name: tracetest-agent + labels: + app: tracetest-agent +spec: + selector: + app: tracetest-agent + ports: + - name: grpc-collector-entrypoint + protocol: TCP + port: 4317 + targetPort: 4317 + - name: http-collector-entrypoint + protocol: TCP + port: 4318 + targetPort: 4318