Skip to content

Commit 8c3efc0

Browse files
author
OpenShift Bot
authored
Merge pull request #10377 from mfojtik/dc-container
Merged by openshift-bot
2 parents 57573d4 + e63851e commit 8c3efc0

File tree

4 files changed

+48
-0
lines changed

4 files changed

+48
-0
lines changed

pkg/cmd/cli/cmd/logs.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,7 @@ func (o *OpenShiftLogsOptions) Complete(f *clientcmd.Factory, out io.Writer, cmd
132132
o.Options = bopts
133133
case deployapi.Resource("deploymentconfig"):
134134
dopts := &deployapi.DeploymentLogOptions{
135+
Container: podLogOptions.Container,
135136
Follow: podLogOptions.Follow,
136137
Previous: podLogOptions.Previous,
137138
SinceSeconds: podLogOptions.SinceSeconds,

pkg/deploy/api/helpers.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ func DeploymentToPodLogOptions(opts *DeploymentLogOptions) *kapi.PodLogOptions {
2424
Timestamps: opts.Timestamps,
2525
TailLines: opts.TailLines,
2626
LimitBytes: opts.LimitBytes,
27+
Container: opts.Container,
2728
}
2829
}
2930

test/extended/deployments/deployments.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ var _ = g.Describe("deploymentconfigs", func() {
3636
historyLimitedDeploymentFixture = exutil.FixturePath("testdata", "deployment-history-limit.yaml")
3737
minReadySecondsFixture = exutil.FixturePath("testdata", "deployment-min-ready-seconds.yaml")
3838
multipleICTFixture = exutil.FixturePath("testdata", "deployment-example.yaml")
39+
multiContainerFixture = exutil.FixturePath("testdata", "test-deployment-config-multicontainer.yaml")
3940
)
4041

4142
g.Describe("when run iteratively", func() {
@@ -458,6 +459,24 @@ var _ = g.Describe("deploymentconfigs", func() {
458459
})
459460
})
460461

462+
g.Describe("with logging with multiple containers [Conformance]", func() {
463+
g.AfterEach(func() {
464+
failureTrap(oc, "test-deployment-config-multicontainer", g.CurrentGinkgoTestDescription().Failed)
465+
})
466+
467+
g.It("should be able to get the logs from each container", func() {
468+
_, name, err := createFixture(oc, multiContainerFixture)
469+
o.Expect(err).NotTo(o.HaveOccurred())
470+
o.Expect(waitForLatestCondition(oc, name, deploymentRunTimeout, deploymentReachedCompletion)).NotTo(o.HaveOccurred())
471+
472+
_, err = oc.Run("logs").Args("dc/"+name, "-c", "container1").Output()
473+
o.Expect(err).NotTo(o.HaveOccurred())
474+
_, err = oc.Run("logs").Args("dc/"+name, "-c", "container2").Output()
475+
o.Expect(err).NotTo(o.HaveOccurred())
476+
})
477+
478+
})
479+
461480
g.Describe("with failing hook", func() {
462481
g.AfterEach(func() {
463482
failureTrap(oc, "hook", g.CurrentGinkgoTestDescription().Failed)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: v1
2+
kind: DeploymentConfig
3+
metadata:
4+
name: test-deployment-config-multicontainer
5+
spec:
6+
replicas: 1
7+
selector:
8+
name: test-deployment
9+
strategy:
10+
type: Recreate
11+
template:
12+
metadata:
13+
labels:
14+
name: test-deployment
15+
spec:
16+
containers:
17+
- image: busybox:latest
18+
imagePullPolicy: IfNotPresent
19+
name: container1
20+
command: ["tail", "-f", "/dev/null"]
21+
- image: busybox:latest
22+
imagePullPolicy: IfNotPresent
23+
name: container2
24+
command: ["tail", "-f", "/dev/null"]
25+
triggers:
26+
- type: ConfigChange
27+
status: {}

0 commit comments

Comments
 (0)