Use mux to handle req; get tail from req

This commit is contained in:
Rita Zhang
2017-12-21 21:42:05 -08:00
parent 04db926faa
commit 43137d09f7
6 changed files with 52 additions and 24 deletions

View File

@@ -198,7 +198,7 @@ func (p *ACIProvider) GetPod(namespace, name string) (*v1.Pod, error) {
}
// GetPodLogs returns the logs of a pod by name that is running inside ACI.
func (p *ACIProvider) GetContainerLogs(namespace, podName, containerName string) (string, error) {
func (p *ACIProvider) GetContainerLogs(namespace, podName, containerName string, tail int) (string, error) {
logContent := ""
cg, err := p.aciClient.GetContainerGroup(p.resourceGroup, fmt.Sprintf("%s-%s", namespace, podName))
if err != nil {
@@ -215,7 +215,7 @@ func (p *ACIProvider) GetContainerLogs(namespace, podName, containerName string)
// get logs from cg
retry := 10
for i := 0; i < retry; i++ {
cLogs, err := p.aciClient.GetContainerLogs(p.resourceGroup, cg.Name, containerName, 10)
cLogs, err := p.aciClient.GetContainerLogs(p.resourceGroup, cg.Name, containerName, tail)
if err != nil {
log.Println(err)
time.Sleep(5000 * time.Millisecond)

View File

@@ -140,7 +140,7 @@ func (p *HyperProvider) GetPod(namespace, name string) (*v1.Pod, error) {
}
// GetContainerLogs retrieves the logs of a container by name from the provider.
func (p *HyperProvider) GetContainerLogs(namespace, podName, containerName string) (string, error) {
func (p *HyperProvider) GetContainerLogs(namespace, podName, containerName string, tail int) (string, error) {
return "", nil
}