@@ -29,8 +29,39 @@ type WorkspaceFile struct {
2929 Content string `json:"content"`
3030}
3131
32+ // SetupContainer defines an init container that runs after git clone but
33+ // before the agent container starts. Setup containers receive the workspace
34+ // volume mount (at /workspace) and any user-defined workspace volumes.
35+ type SetupContainer struct {
36+ // Name is the init container name (must be unique across setup containers).
37+ // +kubebuilder:validation:MinLength=1
38+ Name string `json:"name"`
39+
40+ // Image is the container image to run.
41+ // +kubebuilder:validation:MinLength=1
42+ Image string `json:"image"`
43+
44+ // Command is the entrypoint array (passed to the container as the command).
45+ // +kubebuilder:validation:MinItems=1
46+ Command []string `json:"command"`
47+
48+ // Env are additional environment variables for the container.
49+ // +optional
50+ Env []EnvVar `json:"env,omitempty"`
51+ }
52+
53+ // EnvVar represents an environment variable present in a container.
54+ type EnvVar struct {
55+ // Name of the environment variable.
56+ // +kubebuilder:validation:MinLength=1
57+ Name string `json:"name"`
58+
59+ // Value of the environment variable.
60+ Value string `json:"value"`
61+ }
62+
3263// WorkspaceVolume defines an additional volume to mount into the agent
33- // container ( and setup containers, once supported) .
64+ // container and setup containers.
3465type WorkspaceVolume struct {
3566 // Name is the volume name (must be unique across workspace volumes).
3667 // +kubebuilder:validation:MinLength=1
@@ -107,6 +138,15 @@ type WorkspaceSpec struct {
107138 // +kubebuilder:validation:XValidation:rule="self.map(v, v.name).size() == self.size()",message="volume names must be unique"
108139 // +kubebuilder:validation:XValidation:rule="self.all(v, v.name != 'workspace' && v.name != 'kelos-plugin')",message="volume names 'workspace' and 'kelos-plugin' are reserved"
109140 Volumes []WorkspaceVolume `json:"volumes,omitempty"`
141+
142+ // Setup are init containers that run after git clone (and file injection)
143+ // but before the agent container starts. Each container receives the
144+ // workspace volume and any user-defined volumes. Use this for dependency
145+ // installation, code generation, or other pre-agent setup steps.
146+ // +optional
147+ // +kubebuilder:validation:XValidation:rule="self.map(sc, sc.name).size() == self.size()",message="setup container names must be unique"
148+ // +kubebuilder:validation:XValidation:rule="self.all(sc, !['git-clone','remote-setup','branch-setup','workspace-files','plugin-setup','skills-install'].exists(r, r == sc.name))",message="setup container names 'git-clone', 'remote-setup', 'branch-setup', 'workspace-files', 'plugin-setup', and 'skills-install' are reserved"
149+ Setup []SetupContainer `json:"setup,omitempty"`
110150}
111151
112152// +genclient
0 commit comments