-
Notifications
You must be signed in to change notification settings - Fork 228
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
include-file
function
#2350
Comments
I agree with the injection idea in order to reduce boilerplate and facilitate separation of code and data, and possibly other preprocessing. This could also facilitate testing. A non-kpt ConstraintTemplate generation example: Possibly another issue would be warranted, but functions are currently too verbose. For example, setting an annotation should only require a couple of lines of code. The current function contains 150. Other Go implementations that set annotations are also fairly long, largely because they include a lot of code that could be in a more generic harness: Interpreted languages especially have the potential for simplification, but even our typescript functions are much longer than is ideal and would benefit from kernel injection or composition: Metacontroller did a decent job of facilitating simple transformation kernels: In particular, transformers and validators would benefit from a simple filter kernel framework, with filtering implemented in the orchestrator, as discussed in #2364. |
Coming from #1151 (comment) supporting such an include comment directive sounds interesting. My use cases that could benefit from such an include functionality are as follows:
In both cases the function could define a custom resource kind (e.g. |
@maxsmythe and @julianKatz and @willbeason -- just FYI, not sure if this is on your radar |
Would this function only modify files in-place, or could it redirect the output to a separate directory, leaving the original YAML untouched? |
Also, at what granularity could/does this operate? If I point it to a directory tree, will it perform all substitutions in that directory tree? If I'm not modifying the file in-place, will the structure of the output's dirtree be maintained? |
Rather than mounting the current working directory, another approach could be including non-KRM files in the ResourceList by wrapping them with KRM: #3118. That's probably the approach we'll need for porch. Like the FileBlob proprosal above. |
Hi, Include non-yaml files (sh scripts, python scripts, etc)Tekton allows to add content of the apiVersion: tekton.dev/v1beta1
kind: TaskRun
metadata:
name: kubectl-run
spec:
taskRef:
name: kubernetes-actions
params:
- name: script
value: |
kubectl get pods
echo "-----------"
kubectl get deploy This is fine when the script is small, but when it become bigger you may want to move it to a separate file to get e.g. #!/bin/bash
kubectl get pods
echo "-----------"
kubectl get deploy Include Markdown filesIn order to describe
I would like to store description separately from the pipeline and include it into Pipeline with Chaos Scenario CEP0001
Link: TBD
Flow:
1. Get pods
2. Kill master redis pod
3. Get pods Include YAML filesI can have apiVersion: tekton.dev/v1beta1
kind: PipelineRun
metadata:
name: cep0002-run
spec:
params:
- name: chaos-mesh-yaml
value: |
TBD include pod-kill.yaml
kind: PodChaos
apiVersion: chaos-mesh.org/v1alpha1
metadata:
namespace: target-namespace
name: pod-kill
annotations:
config.kubernetes.io/local-config: "true"
spec:
selector:
namespaces:
- target-namespace
labelSelectors:
app.kubernetes.io/component: master
app.kubernetes.io/name: redis
mode: one
action: pod-kill
gracePeriod: 0 Note: I would like to modify Partial YAMLs included into one YAMLhttps://github.com/argoproj/argo-workflows/blob/master/examples/handle-large-output-results.yaml
|
A weakness of execution configuration pattern is that it interleaves configuration and code. For example, gatekeeper constraint templates wrap Rego code in KRM. Similarly, starlark code is wrapped in StarlarkRun resource. We can improve the development UX by providing an imperative pre-processor function that injects the content of a file into a particular field of a KRM resource. Note that this is useful for gatekeeper admission controller, even when not using the gatekeeper kpt function.
Strawman:
Assume one or more resources (which may be deeply nested) in the current directory have a comment directive pointing to a file containing code, e.g.:
This script references
myscript.star
in the same directory:And we have a gatekeeper template:
That references
myscript.rego
:After running the imperative function:
(See #2351)
All resources containing the
kpt-include
comment directive are expanded:Considerations:
The text was updated successfully, but these errors were encountered: