NiklasRosenstein / nyl

Nyl facilitates the orchestration of infrastructure and application deployment pipelines across different tools, making them work together in a seamless manner.
https://niklasrosenstein.github.io/nyl/
1 stars 0 forks source link

Support for re-usable components #29

Closed NiklasRosenstein closed 1 month ago

NiklasRosenstein commented 1 month ago

Currently we can instantiate Helm charts with Nyl using the inline.nyl.io/v1/HelmChart resource. This is very useful to allow an ArgoCD application to consist of one or more Helm charts that are further empowered by Nyl templating (e.g. to inject secrets).

You eventually start building core components that that are instantiated multiple times in your repository, and the HelmChart API tends to be a bit verbose for that. Having a way to define strongly defined interfaces for such components with a minimal API overhead would improve the readability of a repository.

For example:

apiVersion: inline.nyl.io/v1
kind: HelmChart
release:
  name: myapp
chart:
  name: opinionated-ingress
values:
  host: myapp.example.org
  targetSelectors:
    app.kubernetes.io/name: myapp

This bears a bit of noise that we could avoid:

apiVersion: example.org/v1
kind: Ingress
metadata:
  name: myapp
spec:
  host: myapp.example.org
  targetSelectors:
    app.kubernetes.io/name: myapp

For this we would allow Nyl to lookup the source of the Helm chart in a pre-defined path, for example your repository layout may be:

/
  components/
    example.org/
      v1/
        Ingress/
  charts/
    myapp/
  clusters/
    main/
      myapp.yaml

We would start with a component just being another Helm chart, but we can go on to add more features such as simplified schema validation (Helm's JSON schema based validation is a bit painful to configure), etc.

NiklasRosenstein commented 1 month ago

Implemented in #30