-
Notifications
You must be signed in to change notification settings - Fork 5
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
Support sidecars #135
Comments
Fully agree. In my view ods-pipeline should provide an additional task with support for sidecar containers.
Yes, I guess we have no other option at the moment. The only drawback I see for now is maintainability (we'll now have twice the number of tasks per every builder task). Perhaps you can elaborate a bit more on how to automatically generate the task? I'd like to have some |
The idea would be:
That way we do not need to maintain two tasks. However the tests should verify that the sidecar works as expected. Example: Original task: apiVersion: tekton.dev/v1beta1
kind: ClusterTask
metadata:
name: ods-build-go
spec:
description: Builds Go (module) applications.
params:
- name: enable-cgo
description: Whether to enable CGO. When not enabled the build will set `CGO_ENABLED=0`.
type: string
default: "false"
steps:
- name: build-go-binary
image: build/package/Dockerfile.go-toolset
resources: {}
script: go build
workingDir: $(workspaces.source.path)
workspaces:
- name: source Modified task with sidecar: apiVersion: tekton.dev/v1beta1
kind: ClusterTask
metadata:
name: ods-build-go
spec:
description: Builds Go (module) applications.
params:
- name: enable-cgo
description: Whether to enable CGO. When not enabled the build will set `CGO_ENABLED=0`.
type: string
default: "false"
- name: sidecar-image
description: Image to use for sidecar
type: string
- name: sidecar-script
description: Image to use for sidecar
type: string
default: ''
steps:
- name: build-go-binary
image: build/package/Dockerfile.go-toolset
resources: {}
script: go build
workingDir: $(workspaces.source.path)
sidecars:
- image: $(params.sidecar-image)
name: sidecar
script: $(params.sidecar-script)
workspaces:
- name: source |
The sidecar variants are the exact same task, with the addition of one sidecar - the image for this sidecar needs to be specified. Closes #135.
The sidecar variants are the exact same task, with the addition of one sidecar - the image for this sidecar needs to be specified. Closes #135.
The sidecar variants are the exact same task, with the addition of one sidecar - the image for this sidecar needs to be specified. Closes #135.
Tekton tasks may specify sidecars, see https://tekton.dev/vault/pipelines-v0.16.3/tasks/#specifying-sidecars. One use case for sidecars is to run a database for use with integration tests. To support this, our builder tasks (
ods-build-go
and friends) would need to be able to run a sidecar.However, it seems like sidecars cannot be configured from a pipeline, only from within a task. This is problematic as we don't want to run a sidecar all the time, nor do we want that every user who wants to use a sidecar needs to create a custom task.
One idea I have is to automatically generate a "sidecar companion task": based on
ods-build-go
, generate aods-build-go-with-sidecar
task. This task also has a few parameters which allow to specify the image to use and thescript
to execute.Other ideas?
FYI @felipecruz91 @renedupont
The text was updated successfully, but these errors were encountered: