@@ -499,6 +499,8 @@ Here is an example of a full template with parameter definitions and references:
499
499
----
500
500
kind: Template
501
501
apiVersion: v1
502
+ metadata:
503
+ name: my-template
502
504
objects:
503
505
- kind: BuildConfig
504
506
apiVersion: v1
@@ -575,6 +577,8 @@ earlier.
575
577
----
576
578
kind: "Template"
577
579
apiVersion: "v1"
580
+ metadata:
581
+ name: my-template
578
582
objects:
579
583
- kind: "Service" <1>
580
584
apiVersion: "v1"
@@ -656,34 +660,39 @@ Unless escaped with a backslash, Kubernetes' JSONPath implementation interprets
656
660
characters such as `.`, `@`, and others as metacharacters, regardless of their
657
661
position in the expression. Therefore, for example, to refer to a `ConfigMap`
658
662
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']}"`.
660
665
====
661
666
662
667
The following is an example of different objects' fields being exposed:
663
668
664
- ====
665
669
[source,yaml]
666
670
----
667
671
kind: Template
668
672
apiVersion: v1
673
+ metadata:
674
+ name: my-template
669
675
objects:
670
676
- kind: ConfigMap
671
677
apiVersion: v1
672
678
metadata:
679
+ name: my-template-config
673
680
annotations:
674
- template.openshift.io/expose-username: "{.data['my\.username']}"
681
+ template.openshift.io/expose-username: "{.data['my\\ .username']}"
675
682
data:
676
683
my.username: foo
677
684
- kind: Secret
678
685
apiVersion: v1
679
686
metadata:
687
+ name: my-template-config-secret
680
688
annotations:
681
689
template.openshift.io/base64-expose-password: "{.data['password']}"
682
690
stringData:
683
691
password: bar
684
692
- kind: Service
685
693
apiVersion: v1
686
694
metadata:
695
+ name: my-template-service
687
696
annotations:
688
697
template.openshift.io/expose-service_ip_port: "{.spec.clusterIP}:{.spec.ports[?(.name==\"web\")].port}"
689
698
spec:
@@ -693,11 +702,12 @@ objects:
693
702
- kind: Route
694
703
apiVersion: v1
695
704
metadata:
705
+ name: my-template-route
696
706
annotations:
697
707
template.openshift.io/expose-uri: "http://{.spec.host}{.spec.path}"
698
708
spec:
699
709
path: mypath
700
- ====
710
+ ----
701
711
702
712
An example response to a `bind` operation given the above partial template
703
713
follows:
@@ -797,6 +807,8 @@ annotation. Further examples can be found in the OpenShift quickstart templates.
797
807
----
798
808
kind: Template
799
809
apiVersion: v1
810
+ metadata:
811
+ name: my-template
800
812
objects:
801
813
- kind: BuildConfig
802
814
apiVersion: v1
0 commit comments