Skip to content

Commit

Permalink
feat: allow override of volume and volumemount (#83)
Browse files Browse the repository at this point in the history
This PR ensures, that the default volume and volumemount wont be
created, if they are defined in podtemplate to e.g. use an PVC instead
of an emptydir
  • Loading branch information
H777K authored Feb 5, 2025
1 parent a078c41 commit 022a97d
Show file tree
Hide file tree
Showing 3 changed files with 483 additions and 7 deletions.
11 changes: 10 additions & 1 deletion internal/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ import (
"github.com/mercedes-benz/garm-provider-k8s/pkg/diff"
)

const (
runnerContainerName = "runner"
)

type Provider struct {
ControllerID string
ClientSet kubernetes.Interface
Expand Down Expand Up @@ -54,7 +58,7 @@ func (p Provider) CreateInstance(_ context.Context, bootstrapParams params.Boots
RestartPolicy: corev1.RestartPolicyNever,
Containers: []corev1.Container{
{
Name: "runner",
Name: runnerContainerName,
Image: bootstrapParams.Image,
Resources: resourceRequirements,
Env: envs,
Expand All @@ -74,6 +78,11 @@ func (p Provider) CreateInstance(_ context.Context, bootstrapParams params.Boots
return params.ProviderInstance{}, err
}

err = spec.CreateRunnerVolumeMount(pod, runnerContainerName)
if err != nil {
return params.ProviderInstance{}, err
}

mergedPod, err := mergePodSpecs(pod, config.Config.PodTemplate)
if err != nil {
return params.ProviderInstance{}, err
Expand Down
Loading

0 comments on commit 022a97d

Please sign in to comment.