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

Feat: support hostpath in storage and vela cli #5265

Merged
merged 1 commit into from
Jan 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 20 additions & 0 deletions charts/vela-core/templates/defwithtemplate/storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ spec:
emptyDir: medium: v.medium
}
},
if parameter.hostPath != _|_ for v in parameter.hostPath {
{
name: "hostpath-" + v.name
path: v.path
}
},
]
volumeMountsList: [
if parameter.pvc != _|_ for v in parameter.pvc {
Expand Down Expand Up @@ -94,6 +100,12 @@ spec:
}
}
},
if parameter.hostPath != _|_ for v in parameter.hostPath {
{
name: "hostpath-" + v.name
mountPath: v.mountPath
}
},
]
envList: [
if parameter.configMap != _|_ for v in parameter.configMap if v.mountToEnv != _|_ {
Expand Down Expand Up @@ -331,5 +343,13 @@ spec:
subPath?: string
medium: *"" | "Memory"
}]

// +usage=Declare host path type storage
hostPath?: [...{
name: string
path: string
mountPath: string
type: *"Directory" | "DirectoryOrCreate" | "FileOrCreate" | "File" | "Socket" | "CharDevice" | "BlockDevice"
}]
}

23 changes: 21 additions & 2 deletions charts/vela-core/templates/defwithtemplate/vela-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@ spec:
mountsArray: [
if parameter.storage != _|_ && parameter.storage.secret != _|_ for v in parameter.storage.secret {
{
name: "secret-" + v.name
mountPath: v.mountPath
if v.subPath != _|_ {
subPath: v.subPath
}
name: v.name
}
},
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
{
name: "hostpath-" + v.name
mountPath: v.mountPath
}
},
]
volumesList: [
if parameter.storage != _|_ && parameter.storage.secret != _|_ for v in parameter.storage.secret {
{
name: v.name
name: "secret-" + v.name
secret: {
defaultMode: v.defaultMode
secretName: v.secretName
Expand All @@ -39,6 +45,12 @@ spec:
}
}
}
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
{
name: "hostpath-" + v.name
path: v.path
}
}
},
]
deDupVolumesArray: [
Expand Down Expand Up @@ -125,6 +137,13 @@ spec:
mode: *511 | int
}]
}]
// +usage=Declare host path type storage
hostPath?: [...{
name: string
path: string
mountPath: string
type: *"Directory" | "DirectoryOrCreate" | "FileOrCreate" | "File" | "Socket" | "CharDevice" | "BlockDevice"
}]
}
}

20 changes: 20 additions & 0 deletions charts/vela-minimal/templates/defwithtemplate/storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,12 @@ spec:
emptyDir: medium: v.medium
}
},
if parameter.hostPath != _|_ for v in parameter.hostPath {
{
name: "hostpath-" + v.name
path: v.path
}
},
]
volumeMountsList: [
if parameter.pvc != _|_ for v in parameter.pvc {
Expand Down Expand Up @@ -94,6 +100,12 @@ spec:
}
}
},
if parameter.hostPath != _|_ for v in parameter.hostPath {
{
name: "hostpath-" + v.name
mountPath: v.mountPath
}
},
]
envList: [
if parameter.configMap != _|_ for v in parameter.configMap if v.mountToEnv != _|_ {
Expand Down Expand Up @@ -331,5 +343,13 @@ spec:
subPath?: string
medium: *"" | "Memory"
}]

// +usage=Declare host path type storage
hostPath?: [...{
name: string
path: string
mountPath: string
type: *"Directory" | "DirectoryOrCreate" | "FileOrCreate" | "File" | "Socket" | "CharDevice" | "BlockDevice"
}]
}

23 changes: 21 additions & 2 deletions charts/vela-minimal/templates/defwithtemplate/vela-cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,24 @@ spec:
mountsArray: [
if parameter.storage != _|_ && parameter.storage.secret != _|_ for v in parameter.storage.secret {
{
name: "secret-" + v.name
mountPath: v.mountPath
if v.subPath != _|_ {
subPath: v.subPath
}
name: v.name
}
},
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
{
name: "hostpath-" + v.name
mountPath: v.mountPath
}
},
]
volumesList: [
if parameter.storage != _|_ && parameter.storage.secret != _|_ for v in parameter.storage.secret {
{
name: v.name
name: "secret-" + v.name
secret: {
defaultMode: v.defaultMode
secretName: v.secretName
Expand All @@ -39,6 +45,12 @@ spec:
}
}
}
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
{
name: "hostpath-" + v.name
path: v.path
}
}
},
]
deDupVolumesArray: [
Expand Down Expand Up @@ -125,6 +137,13 @@ spec:
mode: *511 | int
}]
}]
// +usage=Declare host path type storage
hostPath?: [...{
name: string
path: string
mountPath: string
type: *"Directory" | "DirectoryOrCreate" | "FileOrCreate" | "File" | "Socket" | "CharDevice" | "BlockDevice"
}]
}
}

20 changes: 20 additions & 0 deletions vela-templates/definitions/internal/trait/storage.cue
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,12 @@ template: {
}
}
},
if parameter.hostPath != _|_ for v in parameter.hostPath {
{
name: "hostpath-" + v.name
path: v.path
}
},
]

volumeMountsList: [
Expand Down Expand Up @@ -89,6 +95,12 @@ template: {
}
}
},
if parameter.hostPath != _|_ for v in parameter.hostPath {
{
name: "hostpath-" + v.name
mountPath: v.mountPath
}
},
]

envList: [
Expand Down Expand Up @@ -334,6 +346,14 @@ template: {
subPath?: string
medium: *"" | "Memory"
}]

// +usage=Declare host path type storage
hostPath?: [...{
name: string
path: string
mountPath: string
type: *"Directory" | "DirectoryOrCreate" | "FileOrCreate" | "File" | "Socket" | "CharDevice" | "BlockDevice"
}]
}

}
23 changes: 21 additions & 2 deletions vela-templates/definitions/internal/workflowstep/vela-cli.cue
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,25 @@ template: {
mountsArray: [
if parameter.storage != _|_ && parameter.storage.secret != _|_ for v in parameter.storage.secret {
{
name: "secret-" + v.name
mountPath: v.mountPath
if v.subPath != _|_ {
subPath: v.subPath
}
name: v.name
}
},
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
{
name: "hostpath-" + v.name
mountPath: v.mountPath
}
},
]

volumesList: [
if parameter.storage != _|_ && parameter.storage.secret != _|_ for v in parameter.storage.secret {
{
name: v.name
name: "secret-" + v.name
secret: {
defaultMode: v.defaultMode
secretName: v.secretName
Expand All @@ -34,6 +40,12 @@ template: {
}
}
}
if parameter.storage != _|_ && parameter.storage.hostPath != _|_ for v in parameter.storage.hostPath {
{
name: "hostpath-" + v.name
path: v.path
}
}
},
]

Expand Down Expand Up @@ -134,6 +146,13 @@ template: {
mode: *511 | int
}]
}]
// +usage=Declare host path type storage
hostPath?: [...{
name: string
path: string
mountPath: string
type: *"Directory" | "DirectoryOrCreate" | "FileOrCreate" | "File" | "Socket" | "CharDevice" | "BlockDevice"
}]
}
}
}