-
Notifications
You must be signed in to change notification settings - Fork 6
feat: Editable debug mode #1212
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
Open
callumforrester
wants to merge
7
commits into
main
Choose a base branch
from
editable-debug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
5d6f5cd
Editable debug mode
callumforrester 0a85228
Ensure debug editable volume actually exists
callumforrester 8d890d6
Fix no init containers when debug enabled but init container disabled
callumforrester be7d24f
Fix debug suffix in wrong place
callumforrester 63f6550
Use init command
callumforrester e922f9c
Increase debug volume size
callumforrester 19bef2f
Fix tests
callumforrester File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
|---|---|---|
|
|
@@ -45,6 +45,11 @@ spec: | |
| sources: | ||
| - configMap: | ||
| name: {{ include "blueapi.fullname" . }}-config | ||
| {{- if .Values.debug.enabled }} | ||
| - name: {{ include "blueapi.fullname" . }}-develop | ||
| persistentVolumeClaim: | ||
| claimName: {{ include "blueapi.fullname" . }}-develop | ||
| {{- end }} | ||
| {{- with .Values.volumes }} | ||
| {{- toYaml . | nindent 6 }} | ||
| {{- end }} | ||
|
|
@@ -76,8 +81,10 @@ spec: | |
| emptyDir: | ||
| sizeLimit: 5Mi | ||
| {{- end }} | ||
| {{- if .Values.initContainer.enabled }} | ||
| {{- if or .Values.initContainer.enabled .Values.debug.enabled }} | ||
| initContainers: | ||
| {{- end}} | ||
| {{- if .Values.initContainer.enabled }} | ||
| - name: setup-scratch | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag | default .Chart.AppVersion }}{{ ternary "-debug" "" .Values.debug.enabled }}" | ||
| imagePullPolicy: {{ .Values.image.pullPolicy }} | ||
|
|
@@ -106,6 +113,37 @@ spec: | |
| mountPropagation: HostToContainer | ||
| {{- end }} | ||
| {{- end }} | ||
| {{- if .Values.debug.enabled }} | ||
| # add in an init container to copy out virtual environment and workspaces | ||
| - name: {{ include "blueapi.fullname" . }}-init-debug | ||
| image: "{{ .Values.image.repository }}:{{ .Values.image.tag }}-debug" | ||
| imagePullPolicy: IfNotPresent | ||
| resources: | ||
| {{- .Values.initResources | default .Values.resources | toYaml | nindent 12 }} | ||
| {{- with .Values.securityContext }} | ||
| securityContext: | ||
| {{- toYaml . | nindent 12 }} | ||
| {{- end }} | ||
| command: | ||
| - /bin/bash | ||
| - -c | ||
| - | | ||
| echo "Running as account"; id | ||
| if [ -d /dest/venv ]; then | ||
| echo "Virtual environment already exists, skipping copy" | ||
| else | ||
| echo "Copying virtual env to the debugging volume" | ||
| cp -r /venv /dest/venv | ||
| echo "Copying workspaces to the debugging volume" | ||
| cp -r /workspaces /dest/workspaces | ||
| echo "Setting permissions on the debugging volume" | ||
| chmod -R o+rwX /dest/venv /dest/workspaces | ||
| fi | ||
| echo "Init container completed successfully" | ||
| volumeMounts: | ||
| - name: {{ include "blueapi.fullname" . }}-develop | ||
| mountPath: /dest | ||
| {{- end }} | ||
| containers: | ||
| - name: {{ .Chart.Name }} | ||
| {{- with .Values.securityContext }} | ||
|
|
@@ -147,7 +185,19 @@ spec: | |
| - name: venv | ||
| mountPath: /venv | ||
| {{- end }} | ||
| {{- if or .Values.debug.enabled (and .Values.initContainer.enabled .Values.initContainer.persistentVolume.enabled) }} | ||
| {{- if or .Values.debug.enabled }} | ||
| - mountPath: /home | ||
| name: home | ||
| - mountPath: /var/run/nslcd | ||
| name: nslcd | ||
|
Comment on lines
+189
to
+192
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe these, and /venv would cause issues if |
||
| - name: {{ include "blueapi.fullname" . }}-develop | ||
| mountPath: /workspaces | ||
| subPath: workspaces | ||
| - name: {{ include "blueapi.fullname" . }}-develop | ||
| mountPath: /venv | ||
| subPath: venv | ||
| {{- end }} | ||
| {{- if and .Values.initContainer.enabled .Values.initContainer.persistentVolume.enabled }} | ||
| - mountPath: /home | ||
| name: home | ||
| - mountPath: /var/run/nslcd | ||
|
|
||
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
debug.enabledis doing a lot of things on a single boolean- it changes the container that is being used to one that does not start the service by default (allows debugging service startup); it starts a sidecar and mounts config (to allow VSCode to attach); and it would now mount an additional PVC and initContainer in addition to one that may already be configured forscratchpurposes, overwriting code changes, so long as the container follows a convention for placement and use of submodule dependencies that is not documented.We must better decompose those behaviours, as well as documenting the requirements.
I propose we keep the existing
scratchconfiguration/PVC for the copying of code from the container, but make it more in line with what this change is suggesting, while documenting the requirements for mutability:For the repository
plan-blueskyblueapi,dodaldirectlyplan-blueskyanddodalin a predictable location/workspaces/$REPO/workspaces/if they may need to be editableFor the
blueapirepository:blueapiin a predictable location/workspaces/$REPODockerfilehas a-debugimage tag that does not start the service by default to allow debugging container startup by execing into the podFor both:
blueapiCLI-debugimage can be specified in theimage:fieldscratchconfiguration fromvalues.yamland attempts to copy source from the container, falling back to fetching the latest release (later: allow configuration of specific versions), copying either to scratch on/dls_sw/or a volume as currently configured (now: add field to switch ephemeral/persisted for version/persisted constantly)chmod -R o+wrX'd, and the sidecar/mounting to allow fedids to be picked up is enabledThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you suggesting we get rid of the ability to include arbitrary external repos in the scratch area (i.e. no more git cloning at all)?
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
falling back to fetching from the default branch of the
remote_urlfrom theScratchRepositoryconfig (later: allow configuration of specific refs)*There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And with this current setup, the pvc is deleted when you disable debug mode, are you suggesting getting rid of that too?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm suggesting in
add field to switch ephemeral/persisted for version/persisted constantlythat that becomes configurable behaviour.