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

Add ConfigMap volume source support to workspaces #1800

Merged
merged 1 commit into from Jan 14, 2020
Merged

Add ConfigMap volume source support to workspaces #1800

merged 1 commit into from Jan 14, 2020

Conversation

ghost
Copy link

@ghost ghost commented Jan 2, 2020

Changes

One of the original feature requests for workspaces was to include
support for ConfigMaps as the contents of a volume mounted into
Task containers.

This PR introduces support for ConfigMaps as workspaces in a TaskRun
definition.

This PR contributes to #1438

Submitter Checklist

These are the criteria that every PR should meet, please check them off as you
review them:

Reviewer Notes

If API changes are included, additive changes must be approved by at least two OWNERS and backwards incompatible changes must be approved by more than 50% of the OWNERS, and they must first be added in a backwards compatible way.

Release Notes

A ConfigMap can be bound to a workspace. This allows users to easily expose the contents of a ConfigMap as a volume in Task containers.

@googlebot googlebot added the cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit label Jan 2, 2020
@tekton-robot tekton-robot requested review from dibyom and dlorenc January 2, 2020 20:15
@tekton-robot tekton-robot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Jan 2, 2020
@ghost ghost requested a review from bobcatfish January 2, 2020 20:16
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 94.1% 94.3% 0.2

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 94.1% 94.3% 0.2

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 94.1% 94.3% 0.2

@ghost ghost mentioned this pull request Jan 3, 2020
3 tasks
Copy link
Member

@vdemeester vdemeester left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SGTM
/cc @skaegi

@tekton-robot tekton-robot requested a review from skaegi January 6, 2020 10:08
@tekton-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vdemeester

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@tekton-robot tekton-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jan 6, 2020
@ghost
Copy link
Author

ghost commented Jan 14, 2020

Rebased on top of v1alpha2 changes. This is ready for review.

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha2/workspace_validation.go 100.0% 90.0% -10.0
pkg/workspace/apply.go 94.1% 94.3% 0.2

One of the original feature requests for workspaces was to include
support for ConfigMaps as the contents of a volume mounted into
Task containers.

This PR introduces support for ConfigMaps as workspaces in a TaskRun
definition.
@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/apis/pipeline/v1alpha2/workspace_validation.go 100.0% 95.0% -5.0
pkg/workspace/apply.go 94.1% 94.3% 0.2

@tekton-robot
Copy link
Collaborator

The following is the coverage report on pkg/.
Say /test pull-tekton-pipeline-go-coverage to re-run this coverage report

File Old Coverage New Coverage Delta
pkg/workspace/apply.go 94.1% 94.3% 0.2

Copy link
Collaborator

@bobcatfish bobcatfish left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks wonderful!!! 😍 I had one small thought about unit tests for invalid configuration but it's super minor and I'm happy to go ahead without it :D

configmap:
name: my-configmap
```

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

name: my-configmap
data:
message: hello world
---
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

@@ -24,5 +24,5 @@ import (
type WorkspaceDeclaration = v1alpha2.WorkspaceDeclaration

// WorkspaceBinding maps a Task's declared workspace to a Volume.
// Currently we only support PersistentVolumeClaims and EmptyDir.
// Currently we only support PersistentVolumeClaims, EmptyDir and ConfigMap.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we'd be better off removing this comment so we don't have it fall out of date later 🤔

"workspace.persistentvolumeclaim",
"workspace.emptydir",
"workspace.configmap",
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎉

// For a ConfigMap to work, you must provide the name of the ConfigMap to use.
if b.ConfigMap != nil && b.ConfigMap.LocalObjectReference.Name == "" {
return apis.ErrMissingField("workspace.configmap.name")
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we have a unit test that tries to set a configmap + something else?

that's quickly starting to balloon out of control unit test permutation wise - i wonder if we can isolate the logic for determining this somehow such that the tests wont need to be updated with every permutation 🤔

@bobcatfish
Copy link
Collaborator

/lgtm

We can always tackle that invalid case unit test thing later

@tekton-robot tekton-robot added the lgtm Indicates that a PR is ready to be merged. label Jan 14, 2020
@tekton-robot tekton-robot merged commit 49969b7 into tektoncd:master Jan 14, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cla: yes Trying to make the CLA bot happy with ppl from different companies work on one commit lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants