Last active
February 19, 2025 13:52
-
-
Save Knappek/229df48c136c450b4cb5d33e8908e5b3 to your computer and use it in GitHub Desktop.
YTT exclude unwanted routes
This file contains hidden or 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
| #@data/values | |
| --- | |
| unwanted_routes: | |
| - method: "GET" | |
| path: "/api/foo" | |
| - method: "GET" | |
| path: "/api/3" | |
| - method: "POST" | |
| path: "/api/bla" |
This file contains hidden or 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
| #@ load("@ytt:overlay", "overlay") | |
| #@ load("@ytt:data", "data") | |
| #@overlay/match by=overlay.all | |
| --- | |
| routes: | |
| #@ for route in data.values.unwanted_routes: | |
| #@overlay/match by=overlay.subset(route), expects="1+" | |
| #@overlay/remove | |
| - | |
| #@ end |
This file contains hidden or 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
| routes: | |
| - method: GET | |
| order: 10 | |
| path: /api/customer | |
| title: foo bar | |
| - method: PUT | |
| order: 10 | |
| path: /api/2 | |
| title: foo bar | |
| - method: GET | |
| order: 10 | |
| path: /api/3 | |
| title: foo bar | |
| - method: GET | |
| order: 10 | |
| path: /api/foo | |
| title: foo bar | |
| - method: GET | |
| order: 10 | |
| path: /api/baz | |
| title: foo bar | |
| - method: POST | |
| order: 10 | |
| path: /api/bla | |
| title: foo bar |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
can be seen and interacted with on the YTT playground: https://carvel.dev/ytt/#gist:https://gist.github.com/Knappek/229df48c136c450b4cb5d33e8908e5b3