Skip to content

Commit 2327b49

Browse files
committed
[enterprise-3.7] added metadata:name to templates
(cherry picked from commit b904e40) xref:openshift#7071
1 parent 0477f74 commit 2327b49

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

dev_guide/templates.adoc

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -499,6 +499,8 @@ Here is an example of a full template with parameter definitions and references:
499499
----
500500
kind: Template
501501
apiVersion: v1
502+
metadata:
503+
name: my-template
502504
objects:
503505
- kind: BuildConfig
504506
apiVersion: v1
@@ -575,6 +577,8 @@ earlier.
575577
----
576578
kind: "Template"
577579
apiVersion: "v1"
580+
metadata:
581+
name: my-template
578582
objects:
579583
- kind: "Service" <1>
580584
apiVersion: "v1"
@@ -656,34 +660,39 @@ Unless escaped with a backslash, Kubernetes' JSONPath implementation interprets
656660
characters such as `.`, `@`, and others as metacharacters, regardless of their
657661
position in the expression. Therefore, for example, to refer to a `ConfigMap`
658662
datum named `my.key`, the required JSONPath expression would be
659-
`{.data['my\.key']}`.
663+
`{.data['my\.key']}`. Depending on how the JSONPath expression is then written in YAML,
664+
an additional backslash might be required, for example `"{.data['my\\.key']}"`.
660665
====
661666

662667
The following is an example of different objects' fields being exposed:
663668

664-
====
665669
[source,yaml]
666670
----
667671
kind: Template
668672
apiVersion: v1
673+
metadata:
674+
name: my-template
669675
objects:
670676
- kind: ConfigMap
671677
apiVersion: v1
672678
metadata:
679+
name: my-template-config
673680
annotations:
674-
template.openshift.io/expose-username: "{.data['my\.username']}"
681+
template.openshift.io/expose-username: "{.data['my\\.username']}"
675682
data:
676683
my.username: foo
677684
- kind: Secret
678685
apiVersion: v1
679686
metadata:
687+
name: my-template-config-secret
680688
annotations:
681689
template.openshift.io/base64-expose-password: "{.data['password']}"
682690
stringData:
683691
password: bar
684692
- kind: Service
685693
apiVersion: v1
686694
metadata:
695+
name: my-template-service
687696
annotations:
688697
template.openshift.io/expose-service_ip_port: "{.spec.clusterIP}:{.spec.ports[?(.name==\"web\")].port}"
689698
spec:
@@ -693,11 +702,12 @@ objects:
693702
- kind: Route
694703
apiVersion: v1
695704
metadata:
705+
name: my-template-route
696706
annotations:
697707
template.openshift.io/expose-uri: "http://{.spec.host}{.spec.path}"
698708
spec:
699709
path: mypath
700-
====
710+
----
701711

702712
An example response to a `bind` operation given the above partial template
703713
follows:
@@ -797,6 +807,8 @@ annotation. Further examples can be found in the OpenShift quickstart templates.
797807
----
798808
kind: Template
799809
apiVersion: v1
810+
metadata:
811+
name: my-template
800812
objects:
801813
- kind: BuildConfig
802814
apiVersion: v1

0 commit comments

Comments
 (0)