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

Add parameter to prefix namespaces #122

Merged
merged 19 commits into from
Jul 20, 2023
Merged

Add parameter to prefix namespaces #122

merged 19 commits into from
Jul 20, 2023

Conversation

CloudoguSiebels
Copy link
Contributor

When deploying into an existing SCM-Manager/Jenkins and/or Kubernetes cluster, we want to avoid conflicting names.

We introduce the parameter --name-prefix which adds a prefix to the following:

  • Kubernetes namespaces
  • SCM-Manager namespaces
  • Jenkins job

We also renamed the namespaces argocd-staging and argocd-production to <prefix>-example-apps-staging and -production to better reflect their purpose: deploying the example apps.

CloudoguSiebels and others added 13 commits July 6, 2023 08:35
We try to limit these failures by running the jar once
when building the docker image.
However, we run just a small part of the application.

In this commit, we introduce a possibility to manually add entries
to the configuration.
* Functionality to name repos, GitOps user and Jenkins Job
* Name-prefix ends with '-' for Repos (TODO Namespaces, EnvVars)
* Move Jenkins credentials into Job, instead of global space
* Rename common to 3rd-party-dependencies
* TODO write prefix into SCMM-Repo URLs and Argo CD YAML URLs and NS
* TODO cluster-resources Namespaces in Deployer
* TODO use prefix param in Jenkinsfile

Co-authored-by: Philipp Dziosa <philipp.dziosa@cloudogu.com>
Co-authored-by: Tim Siebels <tim.siebels@cloudogu.com>
As we want to replace a lot of values in those files,
we think it is impractical to replace them each in code.
First, it is unintuitive to find where the change is made.
Secondly, we mix replacing yaml files and parsing yaml files in our code
base.

This approach using templating tries to solve these problems.
Furthermore, we think that it improves documentation as you immediately
see what would be changed in the templated file.
as groovy templating is incompatible with graal.
Groovy's templating engines rely on dynamic code execution.
We decided to remove flux perspectively.
Thus, we do not implement newer functionality for flux.
@schnatterer
Copy link
Member

schnatterer commented Jul 19, 2023

I didn't do a full review, only looked at the templating feature, because I was involved in the discussions beforehand.
The implementation looks really good! We get rid of a lot of explicit if blocks in groovy. Tell don't ask 👍
I'd have preferred the built-in Groovy template, but OTOH freemarker has its moments with <#noparse>. This spares us a lot of escaping. I also follow the reasoning of the ADRs.

I tried to get IDEA to understand the templating language inside the .tpl.x files, but did not succeed. It seems that it can only support one language per file. Either groovy/YAML or freemarker. We could consider changing the file ending to .ftl.x to make it at least more explicit to humans, that there is Freemarker inside and not "some templating language". WDYT @CloudoguSiebels ?

Other than that and my two comments in the code above, the templating LGTM!

@CloudoguSiebels
Copy link
Contributor Author

I am quite happy that I still get code highlighting for YAML files. In most cases the templates are valid YAML when we are only using variables and not directives.

replacing .tpl with .ftl sounds good to me.

We don't need defaults in the template directly.
We can rely on the defaults via ApplicationConfigurator
We want to be more explicit that these templates are
freemarker templates.
@pwrdeli
Copy link
Contributor

pwrdeli commented Jul 20, 2023

Tested it with prefix and reviewed code. LGTM! To mention: the technical scm user gets a name-prefix as well.

@pwrdeli pwrdeli merged commit c80ea4e into main Jul 20, 2023
@pwrdeli pwrdeli deleted the feature/naming branch July 20, 2023 14:49
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