-
Notifications
You must be signed in to change notification settings - Fork 65
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
custom core packages #180
custom core packages #180
Conversation
I like the idea, it might be helpful to have a command to print the built in manifests so that folks can understand the defaults and diff between theirs and what's built in. Otherwise they have to wait for a whole create run to come up just to see what the values are or to read the sources. Either is not that bad, but if we are trying to be friendly :) |
9f79b03
to
23c9a31
Compare
agreed. I think we need the export command like we discussed before. |
this is interesting, thanks for the proposal. skimming over the current implementation, looks like we will do a full override for a given resource from the embedded package file, if the flag is present. I wonder if we can use an overlay strategy (i.e. Kustomize) to allow folks to add strategic patches instead, so we could change bits in a target file more surgically but also based on some common and already existing patterns. since we have a known list of files for each of the core components, constructing an internal base should be feasible, I think. |
my suggestion also goes hand in hand with this proposal #165 |
I don't think kustomize is a good fit.
So if we use kustomize, we are asking the users to:
I think, in most cases, user made changes to core packages are not that complex. e.g. additional argocd or ingress nignx CMs. While I agree it's a good idea to use an industry standard tools, I am not sure if they are worth it (in terms of implementing such logic and user effort) just to make small changes like these. |
I fully agree. This is today a big issue that we have around the customization of the packages deployed on a cluster as some parameters can be easily configured when we deploy the existing resources (helm, kustomize, etc) but some will require that a user knows how the package A can be customized, etc and the argocd example you provided is a good one ;-) Another example could be: How can I create some users/pwd for gitea, repositories, etc |
What will happen if the resource already exist ? Will idpbuilder by default merge or replace a CM, secret, etc ? This is an important point that we should carefully log (and why not include as annotations) to inform the users about what it happened |
What you propose here is inline with my ideas where we should in a future release propose a way for an admin users to define using "profiles/stacks" what they would like to deploy on cluster A or B or C where a profile / stack will be composed of x packages: package A version 1.2.3, package B version 3.4.5, etc and where we will propose a way to customize each package Remark: Personally and to avoid to execute too many manual commands, I was thinking to use Tekton, Argocd flow or any other flow engine (https://sonataflow.org/serverlessworkflow/latest/index.html) to manage using tasks post installation steps or rollback |
The admin credentials for gitea can be configured using current implementation in this PR. You could probably create repositories as well, though I have not tried. From security perspective, we should generate gitea admin credentials instead of using hardcoded values.
It shouldn't touch already existing k8s resources belonging to core packages. As of now, we never touch the manifests for core packages once they are installed. This hasn't changed. We should 100% log (debug level) what was replaced though. |
I like the idea about to extend the existing package definition (= what Argocd deploys using the inputs coming from helm chart (or kustomize or etc) instead of merging as that will improve the readability about what idpbuilder do. Another benefit will also be (according tor the scenario which finally correspond to the users's needs declared in profile/stack), that different configs could be applied against different deployments (cluster a or be or c) using perhaps the same idpbuilder release: 1.2.3 or 1.2.5 or etc |
ah ok. I was under the impression that people can modify the already existing secrets or CMs as well. if it is only for the first run, then having a flag to pass in the full config makes sense. But why only at create time? in terms of its usability also, only allowing the flag to work at create time will offer a disjoint experience IMO. Basically, your first try with then what will the cli do in followup runs with both the |
We should be very careful here about what we propose:
|
During the community meeting we discussed what we want to do with this. With the current implementation, modifications to CORE packages are applied at creation only. This was done to ensure we do not break the current behaviour. E.g. We currently do not touch CORE package manifests stored in Gitea repositories after installation. This way users can make modifications in the Gitea UI or clone locally then push without worrying about manifests being overwritten. Most people in the meeting seem to think we should modify them if specified in the CLI. As a consequence, any modifications made in Gitea UI will be lost. I don't have a preference either way. So I'm going to let it modify manifests post creation. |
This is now ready for review. IF you want to test it, flow is
|
Signed-off-by: Manabu McCloskey <[email protected]>
Signed-off-by: Manabu McCloskey <[email protected]>
Signed-off-by: Manabu McCloskey <[email protected]>
64ae7c3
to
b0faa57
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
One thought I had as was reviewing the PR was, to guard against unintended overrides, I wonder if we should check whether the git repository for the embedded application exists and warn on git repo content getting overwritten before applying the override?
_, ok := corePkgs[name] | ||
if !ok { | ||
return v1alpha1.PackageCustomization{}, fmt.Errorf("customization for %s not supported", name) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
_, ok := corePkgs[name] | |
if !ok { | |
return v1alpha1.PackageCustomization{}, fmt.Errorf("customization for %s not supported", name) | |
} | |
if _, ok := corePkgs[name]; !ok { | |
return v1alpha1.PackageCustomization{}, fmt.Errorf("customization for %s not supported", name) | |
} |
err = helpers.ValidateKubernetesYamlFile(paths[0]) | ||
if err != nil { | ||
return v1alpha1.PackageCustomization{}, err | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
err = helpers.ValidateKubernetesYamlFile(paths[0]) | |
if err != nil { | |
return v1alpha1.PackageCustomization{}, err | |
} | |
if err = helpers.ValidateKubernetesYamlFile(paths[0]); err != nil { | |
return v1alpha1.PackageCustomization{}, err | |
} |
name := s[0] | ||
_, ok := corePkgs[name] | ||
if !ok { | ||
return v1alpha1.PackageCustomization{}, fmt.Errorf("customization for %s not supported", name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this logic deserves to be pulled out into a reusable bit
o, ok := overrideMap[id] | ||
if ok { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can be inlined
Currently, it's impossible to customize core packages on startup.
Let's take an example. For a user to configure a very common case of customizing ArgoCD config map to allow for custom health checks:
To apply this in idpbuilder, users must:
Obviously this workflow is not portable. I think we need to introduce a way to customize core packages.
What I am proposing in this PR is introduction of the
package-custom-file
flag (I don't like this name, please suggest something better). This flag looks something like this:With this flag, you don't have to specify the entire manifest for a package. We will override provided objects (GVK + NS + Name match). E.g. if you just want to change the argocd-cm CM, you can just provide that.
The provided file (
/tmp/cm.yaml
in above example) can be a go template file. Core customization flag values (hostname, protocl, etc) are used to render it before applied to the cluster.In addition, you can specify additional objects like more CMs and secrets for ArgoCD to consume.
I am not sure if we want to support resource deletion initially but I imagine we will need to support it.