-
Notifications
You must be signed in to change notification settings - Fork 35
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: allow destinations to be configured to write straight to the root of the state store #234
Comments
+1 to this. When leveraging an existing TFE workspace, its often pointed at the root of a git repo. This means that if I want to use an existing TFE workspace with Kratix, I have to change it to use the sub dir, which is frustrating. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
OK, here's my Formal Proposal, following the guidelines from WikiHow. The issueToday, whenever the user create a Destination, Kratix will create a directory with the destination name in the State Store and will push a couple of test documents. Users have the following levers to configure the path that Kratix uses on the State Store:
For
For
However, for some use cases like integrating with existing systems or terraform, users want to define the full path themselves, sometimes even writing to the root of the state store altogether. That means we need to provide a way for them to not end up with the The SolutionCurrently, the Destination object looks like this: apiVersion: platform.kratix.io/v1alpha1
kind: Destination
metadata:
name: destination-name
labels:
environment: dev
spec:
path: path/in/statestore # optional
strictMatchLabels: false
filepath:
mode: nestedByMetadata | none
cleanup: none
stateStoreRef:
name: default
kind: BucketStateStore The first thing that comes to mind as a solution is to just get rid of the destination name from the path entirely. The danger of this solution is that it may lead users to errors, since if you register two destinations on the same state store, but forget to define different Note We could create a Validation webhook that checks all the destinations writing to the same state store, and fail (or warn) if we detect possible conflicts. This is a breaking change that's quite difficult to circumvent. We would need to patch destinations existing prior to the upgrade, but somehow know that, for newer destinations, that could be empty. An alternative solution is to make If we do make it mandatory, we can introduce some logic in Kratix that would automatically patch any pre-existing Destination with Note Although we can make this a not-breaking-change for existing, live Kratix, all scripts generating Destinations on a brand-new Kratix may need to be updated so Destinations include a path. I believe that making it mandatory makes the most sense. It's easy to migrate, it does not represent extra cognitive load (users already have to reason about the path, even if they leave it as empty). Summary
|
Making it mandatory is reasonable. deffo would want:
|
TODO
|
Only a couple of small questions
Thanks for the clear write-up and party forward @kirederik ! |
No, it's still needed to determine if kratix will be writing in subfolders within the path or not. We could look into simplifying it though, maybe merging... but will leave it as a subsequent improvement
That's for what is currently being controlled by the |
- update example and scripts - add migration webhook and in the controller - update tests
- update example and scripts - add migration webhook and in the controller - update tests
- update example and scripts - add migration webhook and in the controller - update tests
- update example and scripts - add migration webhook and in the controller - update tests
- update example and scripts - add migration webhook and in the controller - update tests
also: - added validation to prevent destination path clashes - make `destination.spec.path` default to the destination name - add annotation to handle migration for existing destinations Co-authored-by: Sapphire Mason-Brown <[email protected]>
We recently introduced
filepath.mode=none
in destinations, which stops kratix from nesting files into directories. However, Kratix will still create at least one directory, named after the destinationmetadata.name
.There's a good reason why it behaves this way: state stores can be shared across different destinations, and not having a unique top-level directory can lead to file clashes. On the other hand, it's a bit confusing for users to explicitly set it to
none
but still get "one".A less surprising experience would be if
filepath.mode=none
didn't create any directories at all. Users can still create subdirs for the destination by setting thespec.path
field. We could also make it configurable via another property.Warning
Depending on the implementation decision, this may be a breaking change.
Scenarios
Note
There are many ways to implement this story. Update the scenarios accordingly
The text was updated successfully, but these errors were encountered: