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

Update testing image #6

Merged
merged 1 commit into from
Feb 10, 2025
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
9 changes: 5 additions & 4 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,20 @@ COPY pkg ./pkg
RUN --mount=type=cache,target="/root/.cache/go-build" \
CGO_ENABLED=0 GOOS=$TARGETOS GOARCH=$TARGETARCH \
go build -tags -trimpath -ldflags="${GO_LINKER_ARGS}" \
-o ./build/_output/bin/bootstrap
-o ./build/_output/bin/dynatrace-bootstrapper

FROM public.ecr.aws/dynatrace/dynatrace-codemodules:1.299.73.20250109-153420 AS codemodules

# copy bootstrapper binary
COPY --from=build /app/build/_output/bin /opt/dynatrace/bin
COPY --from=build /app/build/_output/bin /opt/dynatrace/oneagent/agent/lib64/

LABEL name="Dynatrace Bootstrapper" \
vendor="Dynatrace LLC" \
maintainer="Dynatrace LLC"

ENV USER_UID=1001 \
USER_NAME=dynatrace-bootstrapper
ENV USER_UID=1001 \
USER_NAME=dynatrace-bootstrapper

USER ${USER_UID}:${USER_UID}

ENTRYPOINT ["/opt/dynatrace/oneagent/agent/lib64/dynatrace-bootstrapper"]
6 changes: 6 additions & 0 deletions hack/testing/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# sample.yaml

A small PHP sample app, with the bootsrapper as it's `initContainer`, as it is expected to be used.

- It uses the `snapshot`, even though that doesn't exist, you SHOULD update the image to the one you wish to test.
- TODO: Automate this.
99 changes: 99 additions & 0 deletions hack/testing/sample.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
apiVersion: v1
kind: Namespace
metadata:
labels:
istio-injection: enabled
name: bootstrapper-test
---
apiVersion: apps/v1
kind: Deployment
metadata:
labels:
app: bootstrapper-test
name: bootstrapper-test
namespace: bootstrapper-test
spec:
replicas: 5
selector:
matchLabels:
app: bootstrapper-test
strategy:
type: Recreate
template:
metadata:
labels:
app: bootstrapper-test
spec:
serviceAccountName: php-glibc
initContainers:
- args:
- --source=/opt/dynatrace/oneagent
- --target=/mnt/bin
image: quay.io/dynatrace/dynatrace-bootstrapper:snapshot
imagePullPolicy: Always
name: codemodule-download
resources: {}
securityContext:
readOnlyRootFilesystem: true
runAsUser: 0
seLinuxOptions:
level: s0
seccompProfile:
type: RuntimeDefault
terminationMessagePath: /dev/termination-log
terminationMessagePolicy: File
volumeMounts:
- mountPath: /mnt/bin
name: dynatrace-codemodules
containers:
- image: docker.io/php:fpm-stretch
imagePullPolicy: Always
livenessProbe:
failureThreshold: 3
tcpSocket:
port: 9000
initialDelaySeconds: 600
periodSeconds: 30
successThreshold: 1
timeoutSeconds: 2
name: app
volumeMounts:
- mountPath: /opt/dynatrace/oneagent
name: dynatrace-codemodules
ports:
- containerPort: 9000
protocol: TCP
readinessProbe:
failureThreshold: 3
tcpSocket:
port: 9000
periodSeconds: 10
successThreshold: 1
timeoutSeconds: 1
resources:
requests:
memory: 64Mi
limits:
memory: 128Mi
restartPolicy: Always
tolerations:
- key: kubernetes.io/arch
value: arm64
effect: NoSchedule
- key: kubernetes.io/arch
value: amd64
effect: NoSchedule
securityContext:
runAsUser: 0
runAsGroup: 0
fsGroup: 2000
terminationGracePeriodSeconds: 30
volumes:
- emptyDir: {}
name: dynatrace-codemodules
---
apiVersion: v1
kind: ServiceAccount
metadata:
name: php-glibc
namespace: bootstrapper-test