-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This satisfies Tekton's need for a minimal image that will simply exit immediately (to gracefully stop sidecars), and for a minimal image that will run indefinitely (to power the Affinity Assistant), and will be owned and released by Tekton unlike the tianon/true and nginx images it replaces.
- Loading branch information
1 parent
d3ba81d
commit a81f43d
Showing
14 changed files
with
89 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
# `nop` Image | ||
|
||
This image is responsible for two internal functions of Tekton: | ||
|
||
1. Stopping sidecar containers[#stopping-sidecar-containers] | ||
1. Affinity Assistant StatefulSet[#affinity-assistant-statefulset] | ||
|
||
The `nop` image satisfies these two functions with a minimally small image, | ||
both to optimize image pull latency and to present a minimal surface for a | ||
potential attacker. | ||
|
||
## Stopping sidecar containers | ||
|
||
When all steps in a TaskRun are complete, Tekton attempts to gracefully stop | ||
any running sidecar containers, by replacing their `image` with an image that | ||
exits immediately, regardless of any `args` passed to the container. | ||
|
||
When the `nop` image is run with any args (except one unique string, described | ||
[below](#affinity-assistant-statefulset)), it will exit with the exit code zero | ||
immediately. | ||
|
||
* **NB:** If the sidecar container has its `command` specified, the `nop` | ||
binary will not be invoked, and may exit with a non-zero exit code. Tekton | ||
will not interpret this as a TaskRun failure, but it may result in noisy | ||
logs/metrics being emitted. | ||
|
||
## Affinity Assistant StatefulSet | ||
|
||
The Affinity Assistant, which powers [workspaces](docs/workspaces.md), works | ||
by running a | ||
[`StatefulSet`](https://kubernetes.io/docs/concepts/workloads/controllers/statefulset/) | ||
with an container that runs indefinitely. This container doesn't need to _do_ | ||
anything, it just needs to exist. | ||
|
||
When the `nop` image is passed the string `tekton_run_indefinitely` (a unique, | ||
Tekton-identified string), it will run indefinitely until it receives a signal | ||
to terminate. The affinity assistant StatefulSet passes this arg to ensure its | ||
container runs indefinitely. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
/* | ||
Copyright 2020 The Tekton Authors | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
*/ | ||
|
||
package main | ||
|
||
import ( | ||
"log" | ||
"os" | ||
"os/signal" | ||
"syscall" | ||
) | ||
|
||
func main() { | ||
if len(os.Args) >= 2 && os.Args[1] == "tekton_run_indefinitely" { | ||
log.Println("Waiting indefinitely...") | ||
ch := make(chan os.Signal) | ||
signal.Notify(ch, syscall.SIGINT, syscall.SIGTERM) | ||
log.Println("received signal:", <-ch) | ||
} | ||
|
||
log.Println("Exiting...") | ||
os.Exit(0) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters