|
| 1 | +# Behaviors Defining Conformance |
| 2 | + |
| 3 | +The conformance program is intended to answer the question "What is |
| 4 | +Kubernetes?". That is, what features, functions, and APIs are needed in order to |
| 5 | +call something "Kubernetes". Since v1.9, this has been defined as passing a |
| 6 | +specific set of e2e tests. As part of the [conformance behavior KEP](https://git.k8s.io/enhancements/keps/sig-architecture/20190412-conformance-behaviors.md), |
| 7 | +this instead is moved to an explicit list of "behaviors", which are captured in |
| 8 | +this directory tree. The e2e tests are used to validate whether specific |
| 9 | +behaviors are met, but the definition of conformance is based upon that list of |
| 10 | +approved behaviors. This allows separate reviewers for behaviors and tests, |
| 11 | +provides a description of conformance separate from long, complex tests with |
| 12 | +code, and enables the definition of conformance to encompass behaviors for which |
| 13 | +tests have not yet been written. All of this begs the question, though, "what is |
| 14 | +a behavior?". |
| 15 | + |
| 16 | +In behavior driven development, it is sometimes defined as the "business logic" |
| 17 | +expected from the software. That is, it is a sequence of reactions to some |
| 18 | +stimulus: an API call, a component failure, a network request on the data plane, |
| 19 | +or some other action. We can classify these reactions into a few different types |
| 20 | +in Kubernetes: |
| 21 | + |
| 22 | +1. Transient runtime / communication state |
| 23 | +1. Cluster state changes observable via the control plane |
| 24 | +1. Cluster state changes observable via the data plane |
| 25 | + |
| 26 | +Another way to think about this is that a behavior is the combination of the |
| 27 | +question and answer to "What happens when...". |
| 28 | + |
| 29 | +A behavior will consist of: |
| 30 | + |
| 31 | +* A description of the initial conditions and stimulus |
| 32 | +* A description of the resulting reactions |
| 33 | +* If necessary, a sequencing (ordering) of those reactions |
| 34 | + |
| 35 | +All this is still pretty vague, so it is helpful to enumerate some of the |
| 36 | +characteristics expected of behavior descriptions for conformance in particular. |
| 37 | + |
| 38 | + - Behaviors should be defined at the user-visible level. Things happening |
| 39 | + behind the scenes that are not visible to the user via the API or actual data |
| 40 | + plane execution do not need to be part of conformance. |
| 41 | + - Behaviors should describe portable features. That is, they should be |
| 42 | + expected to work as described across vendor systems. |
| 43 | + - Behaviors should be defined so they are minimally constraining; if a detail is |
| 44 | + not needed for portability, it should be left out. |
| 45 | + - Behaviors should not be tied to specific implementations of components, or even |
| 46 | + to the existence of specific components. If a vendor chooses to rewrite a |
| 47 | + component or replace it with something else, they should still pass conformance |
| 48 | + simply by meeting the expected behaviors. |
| 49 | + - Ordered sequencing of the reactions should be avoided unless absolutely |
| 50 | + necessary. For example, it is core to the `initContainers` functionality that |
| 51 | + they run before the main containers, so in that case ordering is required. |
| 52 | + |
| 53 | +<!-- |
| 54 | + TODO Examples: include example of a good behavior and a poorly written behavior |
| 55 | +--> |
0 commit comments