@@ -503,6 +503,8 @@ Here is an example of a full template with parameter definitions and references:
503
503
----
504
504
kind: Template
505
505
apiVersion: v1
506
+ metadata:
507
+ name: my-template
506
508
objects:
507
509
- kind: BuildConfig
508
510
apiVersion: v1
@@ -579,6 +581,8 @@ earlier.
579
581
----
580
582
kind: "Template"
581
583
apiVersion: "v1"
584
+ metadata:
585
+ name: my-template
582
586
objects:
583
587
- kind: "Service" <1>
584
588
apiVersion: "v1"
@@ -661,34 +665,39 @@ Unless escaped with a backslash, Kubernetes' JSONPath implementation interprets
661
665
characters such as `.`, `@`, and others as metacharacters, regardless of their
662
666
position in the expression. Therefore, for example, to refer to a `ConfigMap`
663
667
datum named `my.key`, the required JSONPath expression would be
664
- `{.data['my\.key']}`.
668
+ `{.data['my\.key']}`. Depending on how the JSONPath expression is then written in YAML,
669
+ an additional backslash might be required, for example `"{.data['my\\.key']}"`.
665
670
====
666
671
667
672
The following is an example of different objects' fields being exposed:
668
673
669
- ====
670
674
[source,yaml]
671
675
----
672
676
kind: Template
673
677
apiVersion: v1
678
+ metadata:
679
+ name: my-template
674
680
objects:
675
681
- kind: ConfigMap
676
682
apiVersion: v1
677
683
metadata:
684
+ name: my-template-config
678
685
annotations:
679
- template.openshift.io/expose-username: "{.data['my\.username']}"
686
+ template.openshift.io/expose-username: "{.data['my\\ .username']}"
680
687
data:
681
688
my.username: foo
682
689
- kind: Secret
683
690
apiVersion: v1
684
691
metadata:
692
+ name: my-template-config-secret
685
693
annotations:
686
694
template.openshift.io/base64-expose-password: "{.data['password']}"
687
695
stringData:
688
696
password: bar
689
697
- kind: Service
690
698
apiVersion: v1
691
699
metadata:
700
+ name: my-template-service
692
701
annotations:
693
702
template.openshift.io/expose-service_ip_port: "{.spec.clusterIP}:{.spec.ports[?(.name==\"web\")].port}"
694
703
spec:
@@ -698,11 +707,12 @@ objects:
698
707
- kind: Route
699
708
apiVersion: v1
700
709
metadata:
710
+ name: my-template-route
701
711
annotations:
702
712
template.openshift.io/expose-uri: "http://{.spec.host}{.spec.path}"
703
713
spec:
704
714
path: mypath
705
- ====
715
+ ----
706
716
707
717
An example response to a `bind` operation given the above partial template
708
718
follows:
@@ -802,6 +812,8 @@ annotation. Further examples can be found in the OpenShift quickstart templates.
802
812
----
803
813
kind: Template
804
814
apiVersion: v1
815
+ metadata:
816
+ name: my-template
805
817
objects:
806
818
- kind: BuildConfig
807
819
apiVersion: v1
0 commit comments