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

Miscellaneous kubernetes deployment fixes #507

Merged
merged 3 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion Dockerfile.release
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ RUN git restore .

# Regenerate _version.py with the correct version - this should run quickly since we already have our dependencies
RUN rm src/mx_bluesky/_version.py
RUN pip install --no-cache-dir --no-compile -e .
RUN pip install --no-cache-dir --no-compile --no-deps -e .

ENTRYPOINT /app/hyperion/utility_scripts/docker/entrypoint.sh

Expand Down
42 changes: 41 additions & 1 deletion helmchart/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,46 @@ spec:
path: "{{ .Values.hyperion.dataDir }}"
containers:
- name: hyperion
image: {{ .Values.hyperion.imageRepository}}/hyperion:{{ .Values.hyperion.appVersion }}
image: {{ .Values.hyperion.imageRepository}}/mx-bluesky:{{ .Values.hyperion.appVersion }}
securityContext:
capabilities:
# Required for hostNetwork
drop:
- AUDIT_WRITE
- CHOWN
- DAC_OVERRIDE
- FOWNER
- FSETID
- KILL
- MKNOD
- NET_BIND_SERVICE
- NET_RAW
- SETFCAP
- SETGID
- SETPCAP
- SETUID
- SYS_CHROOT
- AUDIT_CONTROL
- BLOCK_SUSPEND
- DAC_READ_SEARCH
- IPC_LOCK
- IPC_OWNER
- LEASE
- LINUX_IMMUTABLE
- MAC_ADMIN
- MAC_OVERRIDE
- SYS_ADMIN
- SYS_BOOT
- SYS_MODULE
- SYS_NICE
- SYS_PACCT
- SYS_MODULE
- SYS_PTRACE
- SYS_RESOURCE
- SYS_TIME
- SYS_TTY_CONFIG
- SYSLOG
- WAKE_ALARM
Comment on lines +64 to +99
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should: As discussed, this may not be necessary or it may be better to drop ALL. Can you make an issue to chase up, feel free to add other k8s tidying to that issue if you think there's some needed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Raised #534

resources:
limits:
cpu: "1"
Expand Down Expand Up @@ -111,3 +150,4 @@ spec:
name: logs
- mountPath: "/dls/{{ .Values.hyperion.beamline }}/data"
name: data
hostNetwork: true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@callumforrester or @DiamondJoseph why do we need this to talk to EPICS but blueapi seems fine without it?

2 changes: 1 addition & 1 deletion helmchart/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ hyperion:
supplementalGroups: []
beamline: i03
dev: false
logDir: "/dls_sw/i03/logs/bluesky"
logDir: "/dls_sw/i03/logs/bluesky/hyperion-k8s"
dataDir: "/dls/i03/data"
# These should be overridden at install time
projectDir: SET_ON_INSTALL
Expand Down
12 changes: 6 additions & 6 deletions utility_scripts/build_docker_image.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ for option in "$@"; do
done

PROJECTDIR=`dirname $0`/..
PROJECT=hyperion
IMAGE=mx-bluesky

if ! git diff --cached --quiet; then
echo "Cannot build image from unclean workspace"
Expand All @@ -40,15 +40,15 @@ fi

if [[ $BUILD == 1 ]]; then
echo "Building initial image"
LATEST_TAG=$PROJECT:latest
LATEST_TAG=$IMAGE:latest
TMPDIR=/tmp podman build \
-f $PROJECTDIR/Dockerfile.release \
--tag $LATEST_TAG \
$PROJECTDIR
# Now extract the version from the built image and then rebuild with the label
IMAGE_VERSION=$(podman run --rm --entrypoint=hyperion $LATEST_TAG -c "--version" | \
sed -e 's/[^a-zA-Z0-9 ._-]/_/g')
TAG=$PROJECT:$IMAGE_VERSION
TAG=$IMAGE:$IMAGE_VERSION
echo "Labelling image with version $IMAGE_VERSION, tagging with tags $TAG $LATEST_TAG"
TMPDIR=/tmp podman build \
-f $PROJECTDIR/Dockerfile.release \
Expand All @@ -64,7 +64,7 @@ if [[ $PUSH == 1 ]]; then
echo "Not logged in to ghcr.io"
exit 1
fi
echo "Pushing to ghcr.io/$NAMESPACE/$PROJECT:latest ..."
podman push $PROJECT:latest docker://ghcr.io/$NAMESPACE/$PROJECT:latest
podman push $PROJECT:latest docker://ghcr.io/$NAMESPACE/$PROJECT:$IMAGE_VERSION
echo "Pushing to ghcr.io/$NAMESPACE/$IMAGE:latest ..."
podman push $IMAGE:latest docker://ghcr.io/$NAMESPACE/$IMAGE:latest
podman push $IMAGE:latest docker://ghcr.io/$NAMESPACE/$IMAGE:$IMAGE_VERSION
fi
2 changes: 1 addition & 1 deletion utility_scripts/deploy/deploy_hyperion_to_k8s.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ else
cd $NEW_PROJECTDIR
PROJECTDIR=$NEW_PROJECTDIR
HYPERION_BASENAME=$(basename $HYPERION_BASE)
CHECKED_OUT_VERSION=${HYPERION_BASENAME#mx_bluesky_v}
CHECKED_OUT_VERSION=${HYPERION_BASENAME#mx_bluesky_}
fi


Expand Down
2 changes: 1 addition & 1 deletion utility_scripts/docker/i03-compose.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: i03-hyperion
services:
hyperion-common:
image: localhost/hyperion
image: localhost/mx-bluesky
pull_policy: never
expose:
- "5005"
Expand Down