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

Example of deploying the operator with Flux source controller #339

Merged
merged 11 commits into from
Oct 24, 2022

Conversation

squaremo
Copy link
Contributor

@squaremo squaremo commented Oct 13, 2022

This example shows how to set up the operator and Flux's source controller so they can work together. It includes a subordinate example which shows how to create a GitRepository (a Flux source) and a Stack object that points to it.

This should remain a draft until the Flux support is released.

spec: {
interval: '5m0s',
url: 'https://github.com/squaremo/pko-dev',
ref: { branch: 'main' },
Copy link
Contributor

Choose a reason for hiding this comment

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

Worth showing off any of the value add here? (Features we get via Flux that aren’t available directly?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, somewhere. This example is a "how to", to show people how to get it working at all, and (secondarily) for them to adapt to their needs. Putting fancy stuff in would obscure that.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would cool to do more examples that show off e.g.,

  • using OCI images with cosign verification
  • following a semver tag
  • using "ignore" to filter down the files made available
  • using webhooks for notifications (at least once watching sources is implemented in the operator)

@squaremo
Copy link
Contributor Author

We'll need to bump the default values for operator-version and crd-version once there's a release including Flux source watch (i.e., after #348). It will kind of work at present, but you need an image built from #348.

@squaremo squaremo marked this pull request as draft October 21, 2022 15:06
This has two Pulumi projects:

 - the top directory (examples/flux-source) is for deploying the Pulumi
   Kubernetes operator along with the Flux source controller

 - the subdirectory app/ has an example a a Stack object refering to a
   Flux source.

Signed-off-by: Michael Bridgen <[email protected]>
Installing the CRD in this stack causes problems when you want to update
it, since you can't patch/update a CRD within a ConfigFile.

Instead, just assume it's already installed, e.g., by `make install`,
for now.

Signed-off-by: Michael Bridgen <[email protected]>
Instead of asserting that the Stack CRD is present, download and apply
it unconditionally. Once you've run the stack, you can apply a
development version of the CRD over the top of it, if you wish.

Signed-off-by: Michael Bridgen <[email protected]>
 - include Flux's notification-controller when installing Flux
 - create a webhook receiver object

This parameterises the git URL used for the GitRepository source, so you
must supply your own. (People won't be able to install webhooks in my
repo!)

Signed-off-by: Michael Bridgen <[email protected]>
Copy link
Contributor

@roothorp roothorp left a comment

Choose a reason for hiding this comment

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

Just 2 tiny changes - all seems to work brilliantly with these.

You can use ngrok to tunnel webhooks through to a local or otherwise
private cluster. This gives an example of deploying it which is enough
to make the webhook in ../app work.

Signed-off-by: Michael Bridgen <[email protected]>
This is better than quietly failing later on, with a bogus token.

Signed-off-by: Michael Bridgen <[email protected]>
Signed-off-by: Michael Bridgen <[email protected]>
This removes another hard-coding of an account name.

Signed-off-by: Michael Bridgen <[email protected]>
Signed-off-by: Michael Bridgen <[email protected]>
@squaremo squaremo marked this pull request as ready for review October 24, 2022 18:31
@squaremo squaremo merged commit b7f30cc into master Oct 24, 2022
@squaremo squaremo deleted the deploy-flux-too branch October 24, 2022 18:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants