Skip to content

Commit b1f8f59

Browse files
committed
clarifying schema for multi-kind object references
There are a few types of patterns for multi-kind object references that are currently included in the Kubernetes core resources (EnvVarSource, ObjectReference). Adding a section to clarify the preferred pattern for future resources.
1 parent a268f68 commit b1f8f59

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

contributors/devel/sig-architecture/api-conventions.md

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -900,8 +900,34 @@ clearly described and the permissions issues should be resolved.
900900
This could be done with a double opt-in (an opt-in from both the referrer and the refer-ee) or with secondary permissions
901901
checks performed in admission.
902902

903-
TODO: Plugins, extensions, nested kinds, headers
903+
TODO: Plugins, extensions, headers
904904

905+
### Handling references to multiple kinds
906+
907+
References which can refer to multiple kinds should use a single field, and select the target kind via `apiVersion` and `kind` fields.
908+
909+
For example, if one can retrieving a referenced value from a `ConfigMap` or a `Secret` kind, the schema for the reference should be of the form:
910+
911+
```yaml
912+
# preferred pattern
913+
valueFrom:
914+
kind: Secret # alternatively ConfigMap
915+
name: resource-name
916+
optional: true
917+
```
918+
919+
Rather than:
920+
921+
```yaml
922+
# discouraged pattern
923+
valueFrom:
924+
configMapRef:
925+
name: resource-name
926+
optional: true
927+
secretRef:
928+
name: resource-name
929+
optional: true
930+
```
905931

906932
## HTTP Status codes
907933

0 commit comments

Comments
 (0)