Skip to content

Commit 1d2c54a

Browse files
authored
fix render yaml panic if yaml snippet is empty (#4539)
Signed-off-by: Patrick Zhao <zhaoyu@koderover.com>
1 parent 1699a67 commit 1d2c54a

1 file changed

Lines changed: 4 additions & 0 deletions

File tree

  • pkg/microservice/aslan/core/common/service/kube

pkg/microservice/aslan/core/common/service/kube/render.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,10 @@ func ReplaceWorkloadImages(rawYaml string, images []*commonmodels.Container) (st
143143
}
144144
decoder := yamlutil.NewYAMLOrJSONDecoder(bytes.NewReader([]byte(modifiedYamlStr)), 5*1024*1024)
145145

146+
if resKind == nil || len(resKind.Kind) == 0 {
147+
continue
148+
}
149+
146150
switch resKind.Kind {
147151
case setting.Deployment:
148152
deployment := &appsv1.Deployment{}

0 commit comments

Comments
 (0)