Skip to content
This repository has been archived by the owner on Jun 8, 2022. It is now read-only.

Support complex/object data type for parameterValues in ApplicationConfiguration #325

Open
arjav-desai opened this issue Apr 9, 2021 · 2 comments

Comments

@arjav-desai
Copy link

Is your feature request related to a problem? Please describe.
ConfigMap allows for data to be specified as complex type e.g.

apiVersion: core.oam.dev/v1alpha2
kind: Component
metadata:
  name: test-configmap
  namespace: test-config
spec:
  workload:
    apiVersion: v1
    kind: ConfigMap
    metadata:
      name: test-cm
      namespace: test-config
    data:
      config-properties.yaml: |
        greeting: Hello
  parameters:
    - name: config-data
      required: false
      fieldPaths:
        - data

When we try to overwrite this parameter in appconf e.g.

apiVersion: core.oam.dev/v1alpha2
kind: ApplicationConfiguration
metadata:
  name: test-appconf
  namespace: test-config
  annotations:
    version: v1.0.0
    description: "Test Config application"
spec:
  components:
    - componentName: test-configmap
      parameterValues:
        - name: config-data
          value:
            config-properties.yaml: |
              greeting: Howdy

This fails with

The ApplicationConfiguration "test-appconf" is invalid:

spec.components.parameterValues.value: Invalid value: "object": spec.components.parameterValues.value in body must be of type integer,string: "object"
: Invalid value: "": "spec.components.parameterValues.value" must validate at least one schema (anyOf)
spec.components.parameterValues.value: Invalid value: "object": spec.components.parameterValues.value in body must be of type integer: "object"

Describe the solution you'd like
Had raised this on gitter and was informed that current schema for app conf supports only int and string i.e.

parameterValues:
description: ParameterValues specify values for the the specified component's parameters. Any parameter required by the component must be specified.
items:
description: A ComponentParameterValue specifies a value for a named parameter. The associated component must publish a parameter with this name.
properties:
name:
description: Name of the component parameter to set.
type: string
value:
anyOf:
- type: integer
- type: string

I would parameterValues to support complex/object type.

Describe alternatives you've considered

  • Not map ConfigMap as component.
  • Defined each key-value pair independently and specify override for each of them. This is super tedious and not user friendly.

Additional context

  • NA
@wonderflow
Copy link
Member

Would you like to try KubeVela( https://kubevela.io/ ), it's the implementation of OAM v0.3 . And its Application(https://kubevela.io/docs/application) Object can support almost every complex types by CUE/Helm schematic, while also support the old way here as Raw Template schematic.

@resouer
Copy link
Contributor

resouer commented Apr 10, 2021

We normally consider ConfigMap/Secret (i.e. the carrier of external data) not part of the application definition (i.e. model with components). Though if that's the preference, using CUE or Helm to package them in component definition is the recommended approach, per se comment above.

We do not have plan to extend raw resource template beyond simple key-value pair as this will essentially reinvent CUE or Helm (go-tmpl).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants