Skip to content
This repository has been archived by the owner on Mar 24, 2023. It is now read-only.

Write out kustomize overlays #229

Merged
merged 1 commit into from
Aug 1, 2018
Merged

Write out kustomize overlays #229

merged 1 commit into from
Aug 1, 2018

Conversation

dexhorthy
Copy link
Member

What I Did

After user finalizes kustomization step, write out overlays to the filesystem.

How I Did it

  • move state behind an interface so we can mock it, add mockgen steps (interface is Manager old struct is called MManager, I would make the struct private but too many tests grab for it directly)
  • needed to tweak specs.Resolver/ResolverTest a little, but this should eventually use the mock instead
  • When user saves kustomize, load overlays from state, write each patch file, tracking each one and adding to kustomization.yml as well
  • add some basic testing for lifecycle/kustomize#kustomizer
  • rename state.Overlay#Files to Patches

How to verify it

Run ship init flow, see kustomize overlay written out

Description for the Changelog

Kustomize step writes overlays to output directory

What I Did
------------

After user finalizes kustomization step, write out overlays to the filesystem.

How I Did it
------------

- move state behind an interface so we can mock it, add mockgen steps (interface is `Manager` old struct is called `MManager`, I would make the struct private but too many tests grab for it directly)
- needed to tweak `specs.Resolver`/`ResolverTest` a little, but this should eventually use the mock instead
- When user saves kustomize, load overlays from state, write each patch file, tracking each one and adding to `kustomization.yml` as well
- add some basic testing for `lifecycle/kustomize#kustomizer`
- rename `state.Overlay#Files` to `Patches`

How to verify it
------------

Run `ship init` flow, see kustomize overlay written out

Description for the Changelog
------------

Kustomize step writes overlays to output directory

![](http://cdn.earthporm.com/wp-content/uploads/2014/06/sinking-boat-92.jpg)
@dexhorthy dexhorthy requested a review from ebramanti August 1, 2018 20:33
Copy link
Contributor

@ebramanti ebramanti left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Gave this an overview, it LGTM.

Would be good to pair on what I'm doing with FS, see you are decoupling FS from StateManager

@@ -27,6 +28,6 @@ func TestPersistSpec(t *testing.T) {
err := r.persistSpec(desiredSpec)
req.NoError(err)

persistedSpec, err := r.StateManager.FS.ReadFile(".ship/release.yml")
persistedSpec, err := r.FS.ReadFile(".ship/release.yml")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will have to rework this in my PR, we gotta figure out how we are going to organize filesystem path constants

@dexhorthy dexhorthy merged commit 899938f into replicatedhq:master Aug 1, 2018
@dexhorthy dexhorthy deleted the dex/kustomize-render branch August 10, 2018 16:18
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants