Skip to content
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

Feat: As Penny I want full control over where files are scheduled in a Destination #129

Open
aclevername opened this issue May 16, 2024 · 3 comments
Labels
enhancement New feature or request

Comments

@aclevername
Copy link
Member

aclevername commented May 16, 2024

Follow up from #127

Background

As part of #127 you can now specify that files written to the destination either:

  • follow our existing convention of nested directories, e.g. kratix/platform-cluster/resources/default/redis/example/instance-configure/5058f/redis-instance.yaml
  • are placed at the top level directory

These are 2 common use cases we think we will run into, but is not the definitive list. To enable users with more complex use cases we want to support expressing your own desired filepath structure via a key.

Proposal

Expand the filepathExpressionType key to have an additional value custom and introduce two new keys promise and resource value. e.g.:

spec:
  filepathExpression:
    type: custom                
    resource: "resources/$namespace/$promise_name-$resource_name-$pipeline_name-$uid-$workload_group-"
    promise:  "promises/$promise_name-$uuid-"

We should expose all the variables we use today to template our default to the user:
for resources:

  • promise name
  • resource name
  • workload group
  • namespace
  • pipeline name
  • uid of the resource (.spec.uid)

for promises:

  • promise name
  • workload group
  • pipeline name
  • uid of the promise (.spec.uid)

We should add proper validation so that any usage of custom withotu setting resource/promise results in an error

Templating style

TBD what format the templating should take, in the example its bash variables. We could do something like the go-templating that helm uses {{ .PromiseName }}. Investigate which makes sense and use that

this current solution is just for setting prefixes, in a follow up story we can add more complex templating language to enable suffixes etc as there are many more complicated use cases.

@aclevername aclevername changed the title Feat: As Penny I want full control over where files are scheduled in a Destination Feat: As Penny I want to be able to write to the top level directory of the statestore May 22, 2024
@kirederik kirederik changed the title Feat: As Penny I want to be able to write to the top level directory of the statestore Feat: As Penny I want full control over where files are scheduled in a Destination May 23, 2024
@tdiaque
Copy link

tdiaque commented Aug 13, 2024

Hello,
Has the use of filepath.mode = none been released yet? I see we can configure that now per the docs but I am receiving the following error upon attempting to apply my destinations.yaml
The Destination "flux-hub" is invalid: spec.filepath.mode: Invalid value: "string": filepath.mode is immutable

---
apiVersion: platform.kratix.io/v1alpha1
kind: Destination
metadata:
  name: flux-hub
  labels:
    environment: platform
spec:
  filepath:
    mode: none
  stateStoreRef:
    name: plat-eng-gitops-git
    kind: GitStateStore

I am attempting to create a promise to onboard tenants onto our FluxCD Hub/Spoke and I figured this might allow me to push the files to the specific directory structure that FluxCD is expecting.

@aclevername
Copy link
Member Author

Hi @tdiaque, it is released. The error you are getting is because its immutable, we don't support changing the values for an existing Destination. To get the desired behaviour you want you can delete:

  1. Delete the destination and anything scheduled to it
  2. Recreate it with filepath.mode=none set

@tdiaque
Copy link

tdiaque commented Aug 14, 2024

That worked @aclevername. Thank you for the clarification.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants