This repository has been archived by the owner on Sep 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #210 from StrongMonkey/more-fix3
fix router and autoscaling
- Loading branch information
Showing
17 changed files
with
154 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package systemlogs | ||
|
||
import ( | ||
"bufio" | ||
"fmt" | ||
|
||
"github.com/docker/libcompose/cli/logger" | ||
"github.com/rancher/rio/cli/pkg/clicontext" | ||
v1 "k8s.io/api/core/v1" | ||
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
) | ||
|
||
type SystemLog struct { | ||
} | ||
|
||
func (s SystemLog) Run(ctx *clicontext.CLIContext) error { | ||
pods, err := ctx.Core.Pods(ctx.SystemNamespace).List(metav1.ListOptions{ | ||
LabelSelector: "rio-controller=true", | ||
}) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
if len(pods.Items) == 0 { | ||
return fmt.Errorf("failed to find rio controller pod") | ||
} | ||
|
||
factory := logger.NewColorLoggerFactory() | ||
logger := factory.CreateContainerLogger("rio-controller") | ||
req := ctx.Core.Pods(pods.Items[0].Namespace).GetLogs(pods.Items[0].Name, &v1.PodLogOptions{ | ||
Follow: true, | ||
}) | ||
reader, err := req.Stream() | ||
if err != nil { | ||
return err | ||
} | ||
defer reader.Close() | ||
|
||
sc := bufio.NewScanner(reader) | ||
for sc.Scan() { | ||
logger.Out(append(sc.Bytes(), []byte("\n")...)) | ||
} | ||
|
||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.