-
Notifications
You must be signed in to change notification settings - Fork 136
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add an example of serialized structures used in config map
- Loading branch information
1 parent
21fd25d
commit 7b7e5d7
Showing
6 changed files
with
51 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
This example was created to show how to include YAML structures into k8s ConfigMap as YAML serialized files. We use functions to group configuration that is later serialized via `yaml.encode`. | ||
|
||
[slack thread](https://kubernetes.slack.com/archives/CH8KCCKA5/p1562863952459400) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
#@ load("@ytt:yaml", "yaml") | ||
#@ load("@ytt:json", "json") | ||
#@ load("config1.lib.yml", "config1") | ||
#@ load("config2.lib.yml", "config2") | ||
|
||
--- | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: configs | ||
data: | ||
config1.yml: #@ yaml.encode(config1()) | ||
config2.yml: #@ yaml.encode(config2()) | ||
config3.json: #@ json.encode(config2()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#@ def config1(): | ||
--- | ||
config1a: config1a | ||
config1b: config1b | ||
--- | ||
config1c: config1c | ||
#@ end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#@ def config2(): | ||
rules2a: 123 | ||
rules2b: #@ config2sub() | ||
#@ end | ||
|
||
--- | ||
#@ def config2sub(): | ||
[a, b, c] | ||
#@ end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
kind: ConfigMap | ||
apiVersion: v1 | ||
metadata: | ||
name: configs | ||
data: | ||
config1.yml: | | ||
config1a: config1a | ||
config1b: config1b | ||
--- | ||
config1c: config1c | ||
config2.yml: | | ||
rules2a: 123 | ||
rules2b: | ||
- a | ||
- b | ||
- c | ||
config3.json: '{"rules2a":123,"rules2b":["a","b","c"]}' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters