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

Suggestion: idempotent install #17

Open
andreas-baus opened this issue Feb 18, 2021 · 5 comments
Open

Suggestion: idempotent install #17

andreas-baus opened this issue Feb 18, 2021 · 5 comments

Comments

@andreas-baus
Copy link

andreas-baus commented Feb 18, 2021

I would like to suggest a feature: "idempotent" installations. To illustrate what I mean: the company I work for is building a system that involves deploying a set of microservices to a kubernetes cluster, and we want to automate the deployment process. We don't want the deployment pipeline to need information about which services are already deployed and in which version; so it should just (re-)install every service whenever a new version of the system is to be deployed, even if not all of them have actually changed. This is accomplished by doing a 'porter install' using your mixin with the upsert flag (so it does not matter if the service is already installed or not).

However, this still has a small flaw: the mixin always installs the charts, leading to them getting a new revision number, even if nothing about the installation has changed (either the chart itself or its parameters). We would prefer if there was a way (i.e. via by an additional flag) to tell the mixin to compare the chart already installed on the cluster with the one about to be installed and not actually perform the installation if the 'new' installation is in fact identical to the current one.

I already implemented logic that accomplishes this (by essentially invoking a "helm get manifest" command to get the manifest of the installed release, then using the "helm template" command to render the manifest for the chart about to be installed, comparing the two and skipping the installation if they are identical) in a fork of your code for our internal use, but I've been wondering if you might be interested in including this in your project.

@carolynvs
Copy link
Collaborator

@andreas-baus Can you share your fork? I'm curious how you are handling when the chart is the same but the specified values are different (perhaps because the user repeated install and changed a parameter).

@andreas-baus
Copy link
Author

andreas-baus commented Sep 16, 2021 via email

@carolynvs
Copy link
Collaborator

That's great! 💯 Do you do that just for install or also for upgrade too? It almost seems like it should be done for both, unless someone uses a flag to force it.

@andreas-baus
Copy link
Author

andreas-baus commented Sep 17, 2021 via email

@carolynvs
Copy link
Collaborator

Oh then this new feature in the upcoming porter v1 alpha may be useful to you. I am adding additional commands to help manage an installation using GitOps (and a Porter Kubernetes Operator).

porter installation apply my-installation.yaml

The definition of what you want the installation to look like is represented in a file, and you can pass that file into porter and it is reconciled against the current state of the installation. If the installation doesn't exist, it is installed. If it does exist, porter checks whether the bundle has changed, or any parameters/credentials that you have specified to use with the installation. If anything has changed, the installation is upgraded.

Here's an example of what that will look like

schemaVersion: 1.0.0
name: demo
namespace: demo
bundleRepository: carolynvs/tabbycat-demo
bundleVersion: 0.2.1
parameters:
  logLevel: 11
parameterSets:
  - devEnv
credentialSets:
  - myCloudCreds

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

No branches or pull requests

2 participants