Add support for referencing bundle from resources
Use case: generate resource names based on the bundle name (see name: {{#metadata.name}}-sleeper1 for example):
apiVersion: smith.atlassian.com/v1
kind: Bundle
metadata:
name: bundlex
spec:
resources:
- name: sleeper1
spec:
apiVersion: tpr.atlassian.com/v1
kind: Sleeper
metadata:
name: {{#metadata.name}}-sleeper1
spec:
sleepFor: 3
wakeupMessage: Hello 1 from bundle {{#metadata.name}}!
- name: sleeper2
dependsOn:
- sleeper1
spec:
apiVersion: tpr.atlassian.com/v1
kind: Sleeper
metadata:
name: {{#metadata.name}}-sleeper2
spec:
sleepFor: 4
wakeupMessage: "{{sleeper1.status.message}}"
- name: sleeper3
dependsOn:
- sleeper2
spec:
apiVersion: tpr.atlassian.com/v1
kind: Sleeper
metadata:
name: sleeper3
spec: "{{{sleeper2.spec}}}"
Some "global variables" defined within bundle would also work.
We should probably support "global constants" section inside of the bundle that can be referenced along with other bundle contents.
@wryun this is what I was talking about
Ah, right, makes more sense. I'm not convinced it would be an understandability improvement, though, in the case we were discussing (because the 'resource specific' info would be moved out of the resource...). One could maintain separate constants for each resource, I guess, or even invert things: i.e. the spec is always a valid object that can be pushed into the actual types (has the examples in it), and there is a separate 'template' thing full of references that's merged in.