Skip to content

generator.GetContainers output should not include initContainers #532

@kadel

Description

@kadel

/kind bug

Which area this bug is related to?

/area library

Bug Summary

Describe the bug:

given the devfile like this

schemaVersion: 2.1.0
metadata:
  name: test

commands:
- id: build
  exec:
    commandLine: "true"
    component: cmp
    group:
      isDefault: true
      kind: build
- id: run
  exec:
    commandLine: "sleep infinity"
    component: cmp
    group:
      isDefault: true
      kind: run
- id: test-apply
  apply:
    component: cmp-apply

components:
- name: cmp-apply
  container:
    image: quay.io/prometheus/busybox:latest
    command:
      - "echo 'preStart'"
- name: cmp
  container:
    image: quay.io/prometheus/busybox:latest

events:
  preStart:
    - test-apply

generator.GetContainers return only cmp and cmp-apply container.

Expected behavior

generator.GetContainers should return only cmp container.

Devfile spec says:

when an apply command is bound to a preStart event, and references a container component, it will start the container as a K8S initContainer, unless the component has its dedicatedPod field set to true.

When no apply command exist for a given component, it is assumed the component will be applied at devworkspace start by default.

It is impossible to filter out initContainers from GetContainers output because when calling GetInitContainers containers have autogenerated names that don't match containers from GetInitContainers

Metadata

Metadata

Assignees

Labels

area/libraryCommon devfile library for interacting with devfileskind/bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions