Skip to content

Commit

Permalink
Add container name parameter to k8s log api explicitly (#4964)
Browse files Browse the repository at this point in the history
Co-authored-by: jiang.pengcheng <[email protected]>
  • Loading branch information
jiangpengcheng and jiangpengcheng authored Sep 29, 2020
1 parent 2fe4ec8 commit 259186e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -397,6 +397,8 @@ object KubernetesRestLogSourceStage {

val retryDelay = 100.milliseconds

val actionContainerName = "user-action"

sealed trait K8SRestLogTimingEvent

case object K8SRestLogRetry extends K8SRestLogTimingEvent
Expand All @@ -408,7 +410,8 @@ object KubernetesRestLogSourceStage {

val sinceTimestamp = sinceTime.flatMap(time => formatK8STimestamp(time).toOption)

Query(Map("timestamps" -> "true") ++ sinceTimestamp.map(time => "sinceTime" -> time))
Query(Map("timestamps" -> "true", "container" -> actionContainerName) ++ sinceTimestamp.map(time =>
"sinceTime" -> time))

}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import scala.collection.JavaConverters._

class WhiskPodBuilder(client: NamespacedKubernetesClient, config: KubernetesClientConfig) {
private val template = config.podTemplate.map(_.value.getBytes(UTF_8))
private val actionContainerName = "user-action"
private val actionContainerName = KubernetesRestLogSourceStage.actionContainerName
private val actionContainerPredicate: Predicate[ContainerBuilder] = (cb) => cb.getName == actionContainerName

def affinityEnabled: Boolean = config.userPodNodeAffinity.enabled
Expand Down Expand Up @@ -119,7 +119,7 @@ class WhiskPodBuilder(client: NamespacedKubernetesClient, config: KubernetesClie
.withLimits((Map("memory" -> new Quantity(memory.toMB + "Mi")) ++ cpu ++ diskLimit).asJava)
.withRequests((Map("memory" -> new Quantity(memory.toMB + "Mi")) ++ cpu ++ diskLimit).asJava)
.endResources()
.withName("user-action")
.withName(actionContainerName)
.withImage(image)
.withEnv(envVars.asJava)
.addNewPort()
Expand Down

0 comments on commit 259186e

Please sign in to comment.