Coder Social home page Coder Social logo

Comments (8)

FogDong avatar FogDong commented on June 11, 2024

So for an application with context, it will be like:

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: test
  namespace: default
spec:
  components:
  - name: express-server
    type: webservice
    properties:
      image: oamdev/hello-world
      ports:
        - port: 8000
  workflow:
    context:
       myName: "my-comp"
    steps:
      - name: apply-comp
        type: apply-component
        properties:
          component: express-server

And if in the definition we have cue template like:

name: context.myName

Then when the application is deployed, the name will be my-comp.

I'd like to discuss more about where we should put this context field. If we put the context in parallel with the component it will make more sense. However, this will also change the model of OAM so we'll probably need more discussion.

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: test
  namespace: default
spec:
  components:
  - name: express-server
    type: webservice
    properties:
      image: oamdev/hello-world
      ports:
        - port: 8000
  context:
    myName: "my-comp"
  workflow:
    steps:
      - name: apply-comp
        type: apply-component
        properties:
          component: express-server

from kubevela.

testinfected avatar testinfected commented on June 11, 2024

We need something similar to pass additional runtime information to the workflow steps. It is possible in standalone workflow runs but not in Applications, which is a shame, and thus we cannot refer to existing workflow templates which expect context parameters.

It would be a great addition if we could define runtime context information for the workflow steps, the same way we do it for workflow runs.

Thanks

from kubevela.

FogDong avatar FogDong commented on June 11, 2024

Hi @testinfected
According to your description, the capability you want is to use the context in workflow steps but not trait and component, right?
If so, we can add the context field inside the workflow but not the whole application like:

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: test
  namespace: default
spec:
  components:
  - name: express-server
    type: webservice
    properties:
      image: oamdev/hello-world
      ports:
        - port: 8000
  workflow:
    context:
       myName: "my-comp"
    steps:
      - name: apply-comp
        type: apply-component
        properties:
          component: express-server

from kubevela.

testinfected avatar testinfected commented on June 11, 2024

Hi @FogDong yes this is correct.

One use case is using an external workflow template. It's possible to add context parameters in workflow runs, but not applications.

Thanks

from kubevela.

FogDong avatar FogDong commented on June 11, 2024

I think it's a valuable feature for Application and I'm good with supporting it.
If other maintainers also like this idea then I'll start working on this.
cc @wonderflow @StevenLeiZhang

from kubevela.

oanasc avatar oanasc commented on June 11, 2024

For us would be beneficial to be able to use the user context in the applications and traits like in your first example
If you add it just to workflow steps will is still be available to use in the application cue templates?

from kubevela.

FogDong avatar FogDong commented on June 11, 2024

For us would be beneficial to be able to use the user context in the applications and traits like in your first example If you add it just to workflow steps will is still be available to use in the application cue templates?

If we want this context to be used in the whole Application, then we may need to re-struct the Application template to add context field, which might affect the OAM model and need more discussion.

from kubevela.

oanasc avatar oanasc commented on June 11, 2024

Having it at a application OAM level and usable in all templating at components, traits, workflow, policy on the application would work for us

apiVersion: core.oam.dev/v1beta1
kind: Application
metadata:
  name: test
  namespace: default
spec:
  components:
  - name: express-server
    type: webservice
    properties:
      image: oamdev/hello-world
      ports:
        - port: 8000
  context:
    myName: "my-comp"
  workflow:
    steps:
      - name: apply-comp
        type: apply-component
        properties:
          component: express-server

from kubevela.

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.