Skip to content

Commit

Permalink
K8s driver improvements (#238)
Browse files Browse the repository at this point in the history
* Support outputs in the kubernetes driver

Add the JOB_VOLUME_NAME setting, which is the name of the PVC to mount to
/cnab/app/outputs so that outputs from the bundle can be persisted.
JOB_VOLUME_PATH specifies where the volume is mounted locally. When
the bundle defines outputs, but does not specify a PVC, the driver
returns an error.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Apply custom labels in the kubernetes driver

Allow the caller to specify additional labels to apply to resources
created by the driver.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Fix setting CLEANUP_JOBS

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Use shared volume for input files too

When you mount a configmap or secret value as a file into a pod, it is read only, which doesn't fit the CNAB spec

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Remove requiredCompletions from k8s driver

The only value that ever makes sense for requiredCompletions is 1
because we aren't running parallel pods for the bundle job.

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Improve defaulting for kubernetes driver

* When LimitCPU or LimitMemory is 0, do not set a limit. We don't set a
request size, and requesting 0 is not the same as not having a requested
resource quantity. This can lead to increased pod evictions.
* Clarify that LimitCPU and LimitMemory are also used for the requested
resources.
* When ActiveDeadlineSeconds is 0, do not set a deadline.
* Stop defaulting ActiveDeadlineSeconds to 5 minutes. It will cut off a
bundle mid-execution, which isn't a great default.
* Split reading the configuration in SetConfig and attempting to connect
to the cluster, so that we can unit test the settings logic.
* Move validation for KUBE_NAMESPACE into SetConfig so that any errors
can be reported immediately.
* Add comments for all of the driver settings

Signed-off-by: Carolyn Van Slyck <[email protected]>

* Review feedback

Signed-off-by: Carolyn Van Slyck <[email protected]>
  • Loading branch information
carolynvs authored Feb 26, 2021
1 parent 5d01642 commit 7896782
Show file tree
Hide file tree
Showing 6 changed files with 582 additions and 141 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ ifndef HAS_GOLANGCI
curl -sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s -- -b $(GOPATH)/bin $(GOLANGCI_VERSION)
endif
ifndef HAS_KIND
go get sigs.k8s.io/kind@v0.6.0
go get sigs.k8s.io/kind@v0.10.0
endif
ifndef HAS_KUBECTL
echo "Follow instructions at https://kubernetes.io/docs/tasks/tools/install-kubectl/ to install kubectl."
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ steps:
set -xeuo pipefail
go env
go mod download
go get sigs.k8s.io/kind@v0.6.0
go get sigs.k8s.io/kind@v0.10.0
sudo make bootstrap
make fetch-schemas build lint coverage
GOOS=windows make build
Expand Down
Loading

0 comments on commit 7896782

Please sign in to comment.