Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Support multi-document yaml components #788

@shomron

Description

@shomron

/kind feature

Multi-document YAML components are not compatible with Ksonnet 0.12.0-rc1.

Given the following yaml:

$ cat components/stuff.yaml
---
apiVersion: v1
kind: ServiceAccount
metadata:
  name: my-service-account
  namespace: default
---
apiVersion: v1
kind: Pod
metadata:
  name: oren-test
  labels:
    app: oren-test
spec:
  containers:
  - name: nginx
    image: nginx:latest
    ports:
    - containerPort: 8888
    imagePullPolicy: Always

...evaluating an environment gives the following error:

$ ks show default
ERROR find objects: patching YAML/JSON component: RUNTIME ERROR: Field does not exist: components
	patchJSON:3:19-35	thunk from <function <anonymous>>
	<std>:1182:21-22	thunk from <function <anonymous>>
	<std>:1182:5-33	function <anonymous>
	patchJSON:3:5-47	function <anonymous>
	Top-level function

Interestingly, we can suppress the error by adding an entry for the component into params.libsonnet, but we will only get the first document:

$ cat components/params.libsonnet
{
  global: {
  },
  components: {
    stuff: {},
  },
}

$ ks show default
---
apiVersion: v1
kind: ServiceAccount
metadata:
  labels:
    ksonnet.io/component: stuff
  name: my-service-account
  namespace: default

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions