Skip to content

Commit

Permalink
Merge pull request #1001 from wzshiming/feat/sidecar-container
Browse files Browse the repository at this point in the history
Support Sidecar container
  • Loading branch information
wzshiming authored Apr 3, 2024
2 parents 6d154b2 + e275512 commit 37b7812
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
7 changes: 7 additions & 0 deletions kustomize/stage/pod/fast/pod-ready.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,19 @@ spec:
name: {{ .name | Quote }}
ready: true
restartCount: 0
{{ if eq .restartPolicy "Always" }}
started: true
state:
running:
startedAt: {{ $now | Quote }}
{{ else }}
state:
terminated:
exitCode: 0
finishedAt: {{ $now | Quote }}
reason: Completed
startedAt: {{ $now | Quote }}
{{ end }}
{{ end }}
hostIP: {{ NodeIPWith .spec.nodeName | Quote }}
Expand Down
23 changes: 19 additions & 4 deletions test/e2e/helper/pod.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ package helper
import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"sigs.k8s.io/kwok/pkg/utils/format"
)

// PodBuilder is a builder for pod.
Expand All @@ -35,10 +37,23 @@ func NewPodBuilder(name string) *PodBuilder {
Namespace: "default",
},
Spec: corev1.PodSpec{
Containers: []corev1.Container{{
Name: "container",
Image: "image",
}},
InitContainers: []corev1.Container{
{
Name: "init",
Image: "image",
},
{
Name: "sidecar",
Image: "image",
RestartPolicy: format.Ptr(corev1.ContainerRestartPolicyAlways),
},
},
Containers: []corev1.Container{
{
Name: "container",
Image: "image",
},
},
},
},
}
Expand Down

0 comments on commit 37b7812

Please sign in to comment.