-
Notifications
You must be signed in to change notification settings - Fork 74
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(agent): k8s deployment script (#3190)
* feat(agent): k8s deployment script * tag latest image * update tag with placeholder * fix: allow version to be specified in parameter * fix: kubectl apply from pipe
- Loading branch information
1 parent
9474d33
commit 6844e5c
Showing
3 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 <namespace> <api-key> (<version>)?" | ||
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 - |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |