From db2c3fda87927edd40c9e1f64e964e645184f4d9 Mon Sep 17 00:00:00 2001 From: mmueller90 <40487902+mmueller90@users.noreply.github.com> Date: Wed, 27 May 2020 09:19:18 +0200 Subject: [PATCH] added entrypoint in workload model and updated tests (#57) * added entrypoint in workload model and updated tests * Update changelog Co-authored-by: Wulf-Thilo Schreiter --- CHANGELOG.md | 1 + .../project/model/testdata/golden-files/descriptor.job.golden | 2 ++ .../pkg/rancher/cluster/project/model/testdata/input/job.yaml | 1 + internal/pkg/rancher/cluster/project/model/workload_model.go | 1 + 4 files changed, 5 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index affb10d..6b0aba6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,7 @@ All notable changes to this project will be documented in this file. * Objects are handled one by one * First error stops execution * Empty objects are ignored +* (#56) Add support for defining entrypoints in workloads ### Changed diff --git a/internal/pkg/rancher/cluster/project/model/testdata/golden-files/descriptor.job.golden b/internal/pkg/rancher/cluster/project/model/testdata/golden-files/descriptor.job.golden index 9588d9e..e8d39da 100644 --- a/internal/pkg/rancher/cluster/project/model/testdata/golden-files/descriptor.job.golden +++ b/internal/pkg/rancher/cluster/project/model/testdata/golden-files/descriptor.job.golden @@ -14,6 +14,8 @@ spec: - -Mbignum=bpi - -wle - print bpi(2000) + entrypoint: + - /bin/sh environment: TEST_VAR: test value image: perl diff --git a/internal/pkg/rancher/cluster/project/model/testdata/input/job.yaml b/internal/pkg/rancher/cluster/project/model/testdata/input/job.yaml index 8acb979..cbbdbac 100644 --- a/internal/pkg/rancher/cluster/project/model/testdata/input/job.yaml +++ b/internal/pkg/rancher/cluster/project/model/testdata/input/job.yaml @@ -11,6 +11,7 @@ spec: containers: - allowPrivilegeEscalation: true command: [ "perl", "-Mbignum=bpi", "-wle", "print bpi(2000)" ] + entrypoint: [ "/bin/sh" ] environment: TEST_VAR: test value environmentFrom: null diff --git a/internal/pkg/rancher/cluster/project/model/workload_model.go b/internal/pkg/rancher/cluster/project/model/workload_model.go index ed421ef..b9cde31 100644 --- a/internal/pkg/rancher/cluster/project/model/workload_model.go +++ b/internal/pkg/rancher/cluster/project/model/workload_model.go @@ -63,6 +63,7 @@ type baseWorkload struct { type Container struct { AllowPrivilegeEscalation *bool `json:"allowPrivilegeEscalation,omitempty" yaml:"allowPrivilegeEscalation,omitempty"` Command []string `json:"command,omitempty" yaml:"command,omitempty"` + Entrypoint []string `json:"entrypoint,omitempty" yaml:"entrypoint,omitempty"` Environment map[string]string `json:"environment,omitempty" yaml:"environment,omitempty"` EnvironmentFrom []EnvironmentFrom `json:"environmentFrom,omitempty" yaml:"environmentFrom,omitempty"` Image string `json:"image,omitempty" yaml:"image,omitempty"`