Open jingav opened 1 month ago
Similarly for apply.file
apiVersion: chainsaw.kyverno.io/v1alpha1
kind: StepTemplate
metadata:
name: generic-step-apply-claim
spec:
bindings:
# e.g. "../.."
- name: rootPath
value: ($rootPath)
# e.g. "../../common/claims"
- name: claimsPath
value: (join('/', [$rootPath, 'common/claims']))
# e.g. "azure-subscription.yaml"
- name: claimFileName
value: ($claimFileName)
# e.g. "../../common/claims/azure-subscription.yaml"
- name: claimFileNamePath
value: (join('/', [$claimsPath, $claimFileName]))
# e.g. "my-azure-subscription-claim"
- name: claimName
value: (to_string($claimName))
try:
- apply:
# file: ../../common/claims/azure-subscription.yaml
file: ($claimFileNamePath)
catch:
.....
finally:
.....
So, it looks like no interpolation for any paths anywhere?
@jingav it will be supported in file
in the next version (v0.2.9
).
There's no plan to support it in template
at this point. Step templates are resolved at discovery time and no binding are evaluated at that time, only when the test executes. We could delay the step template loading until execution but again, there's no plan for that yet.
@eddycharly , ok thanks for sharing the details.
Shall I then change this issue to Enhancement
type for the template
part?
Yes you can change it to a feature request.
I'm not able to change label from question
to enhancement
.
Please change it if you can.
how about use can support from workdir and build-in workdir
// Use defines a reference to a step template.
type Use struct {
// Template references a step template.
Template string `json:"template,omitempty"`
// TemplateFromWorkDir references a step template from workdir.
TemplateFromWorkDir string `json:"templateFromWorkDir,omitempty"`
}
@eddycharly, I have one more case, for wait
and its selector
.
bindings:
- name: dnsClaimName
value: (lower(join('-', ['private-dns', $dnsSuffix, $branchName])))
steps:
- wait:
timeout: 5m
namespace: ($namespace)
apiVersion: ($resourceApiVersion)
kind: ($resourceKind)
# name: ($dnsSpokeVnetLinkExtName)
selector: crossplane.io/claim-name=($dnsClaimName)
for:
condition:
name: LastAsyncOperation
value: 'false'
Response
=== STDERR
Error from server (BadRequest): Unable to find "network.azure.upbound.io/v1beta1, Resource=privatednszonevirtualnetworklinks" that match label selector "crossplane.io/claim-name=()", field selector "": unable to parse requirement: found '(', expected: identifier
Any trick to use or chance this would get supported in the next version (v0.2.9)?
Thanks
selector: crossplane.io/claim-name=($dnsClaimName)
@jingav try
selector: (join('=', ['crossplane.io/claim-name',$dnsClaimName]))
selector: crossplane.io/claim-name=($dnsClaimName)
@jingav try
selector: (join('=', ['crossplane.io/claim-name',$dnsClaimName]))
Ah, yes, thanks.
For multi selection, something like this
selector: (join(',', ['scc.cloud.abcd/usage=dns-link-hub', (join('=', ['crossplane.io/claim-name', $dnsClaimName]))]))
Describe your question
Hi there,
I'm trying to create reusable (StepTemplate) building blocks and have the following:
It seems it's not currently supported or did I miss anything?
Would it be possible to add support for this? There are more use cases for this, the above is just a quick example.
chainsaw version Version
v0.2.8
Additional context
No response