quaint-librarian-55734
01/11/2023, 4:45 PMvolume
module, but since this not supported for real kubernetes clusters, I was trying to find a more portable approach.
The use case is that we'd like to load some startup scripts for a containers from a scripts
folder in our Git repo. Right now, we are using a configmap
since mounting this as a volume will convert all of the key/values from the data
section into mounted files - however, this approach forces us to in-line our bash script as yaml text, and this prevents our linters from being able to catch bash scripting issues.
Additionally - while I know that this can also be done by specifying a custom Dockerfile which copies in files from the module build directory, we're trying to avoid the "pull image -> copy files/build new image -> republish" cycle that this causes since we have a very large number of containers that are built from a template and are working on reducing the deployment times.
Here's a reference template for what I'm trying to do:
kind: ModuleTemplate
name: service-template
inputsSchemaPath: schema.json
modules:
# We'd like to pre-load some scripts into the persistent volume created by this claim
- name: "${inputs.serviceName}-scripts-pvc"
type: persistentvolumeclaim
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 1Gi
- type: container
name: ${inputs.serviceName}-container
image: "${inputs.imageName}"
services:
- name: "${inputs.serviceName}-http"
command:
- bash
- /scripts/startup.sh
volumes:
- name: scripts-pvc
containerPath: "/scripts"
module: "${inputs.serviceName}-scripts-pvc"
quaint-dress-831
01/17/2023, 6:06 AMglamorous-caravan-26619
01/18/2023, 2:06 PMquaint-librarian-55734
01/19/2023, 5:22 PMglamorous-caravan-26619
01/19/2023, 5:23 PMgarden deploy
- garden test-lib
- you should see the output of the test script which is mounted on app
- then edit lib/src/scripts/test
- garden update-lib
- garden test-lib
(again)
- you should now see the changed output with your editquaint-librarian-55734
01/19/2023, 5:39 PMglamorous-caravan-26619
01/26/2023, 4:47 PM