Coder Social home page Coder Social logo

Comments (2)

khmarochos avatar khmarochos commented on June 17, 2024 1

I'd like to appreciate the detailed documentation you provided for the project. If I had been more careful, I'd have noticed the sources parameter before. Thank you!

from hull.

gre9ory avatar gre9ory commented on June 17, 2024

Hi @khmarochos,

if I understand correctly you want to create an arbitrary number of properties via a transformation and add them to an (arbitrary) dictionary having the possibility to specify additional keys as well?

If so, that is not possible directly but can be done I think. I'll try to explain using the pod dictionary from above:

Let's assume you have a deployment like this:

hull:
  objects:
    deployment:
      example:
        pod:
          containers:
            main:
              image:
                repository: somerepo
                tag: "latest"

and you want to add some additional properties dynamically to the pod. At the moment there is no way to do that on the pod itself, transformations normally fully replace values and not add key-values to dicts where they are used.

But you can utilize the sources feature for this I think. If you put a transformation for the pod value in another object you don't render but reference as a source, this transformation is evaluated first and afterwards merged with the object which references it as a source under sources:

hull:
  objects:
    deployment:
      pod-values:
        enabled: false
        pod: |-
          _HT!{
            "replicas": 5
          }
      example:
        sources:
        - pod-values
        pod:
          containers:
            main:
              image:
                repository: somerepo
                tag: "latest"

So pod in pod-values is evaluated to replicas: 5 and this replicas: 5 is merged to the definition of example. pod-values deployment is disabled and will not be rendered at all.

In the end you have in the example deployment:

...
    spec:
      containers:
      - env: []
        envFrom: []
        image: somerepo:latest
        name: main
        ports: []
        volumeMounts: []
      imagePullSecrets:
      - name: release-name-hull-test-example-registry
      - name: release-name-hull-test-local-registry
      initContainers: []
      replicas: 5
      serviceAccountName: release-name-hull-test-default
      volumes: []

Hope it brings the idea across, more information on sources is here.

Quite late now so can't add more info at the moment. If you need more support please let me know and I will get back to you right after christmas days. Thanks.

from hull.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.