stream logs from s3

This commit is contained in:
rushtehrani
2020-01-20 18:06:02 -08:00
parent 2c7a83e20c
commit 0c8854a04c
6 changed files with 107 additions and 81 deletions

View File

@@ -495,55 +495,56 @@ func init() {
func init() { proto.RegisterFile("workflow.proto", fileDescriptor_892c7f566756b0be) } func init() { proto.RegisterFile("workflow.proto", fileDescriptor_892c7f566756b0be) }
var fileDescriptor_892c7f566756b0be = []byte{ var fileDescriptor_892c7f566756b0be = []byte{
// 768 bytes of a gzipped FileDescriptorProto // 773 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xcd, 0x4e, 0x1b, 0x49, 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xa4, 0x96, 0xdd, 0x4e, 0x13, 0x41,
0x10, 0xc7, 0xd5, 0x18, 0xb3, 0xb8, 0x90, 0x81, 0x2d, 0x8c, 0xf1, 0x7a, 0x59, 0x2d, 0xdb, 0xcb, 0x14, 0xc7, 0xb3, 0x94, 0x22, 0x3d, 0x58, 0xc0, 0x43, 0x29, 0xb5, 0x62, 0xc4, 0x11, 0x13, 0x10,
0x4a, 0xb0, 0x20, 0x8f, 0xf1, 0x6e, 0xa2, 0x88, 0x08, 0x25, 0x11, 0x02, 0x72, 0xb0, 0xa2, 0xc8, 0xd2, 0x2d, 0xf5, 0x23, 0x06, 0x43, 0xa2, 0x21, 0x80, 0x17, 0x8d, 0x31, 0xf5, 0x83, 0x88, 0x17,
0xf9, 0x40, 0xe2, 0x12, 0x1a, 0xbb, 0x71, 0x46, 0x31, 0xd3, 0x93, 0xe9, 0xb6, 0x51, 0x64, 0xf9, 0x32, 0xb4, 0x43, 0xdd, 0x58, 0x76, 0xd6, 0x9d, 0x69, 0x89, 0x69, 0x7a, 0xa3, 0x77, 0xc6, 0x3b,
0x92, 0x48, 0x39, 0xe4, 0x9a, 0xdc, 0xf2, 0x22,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04, 0x2e, 0xf5, 0xc9, 0x37, 0xea, 0xa2, 0xeb, 0x5c, 0x1e, 0xc0, 0xd3, 0xd7, 0xfd,
0xe6, 0x15, 0x92, 0xc0, 0x77, 0x24, 0xfa, 0x1b, 0x67, 0xd4, 0x24, 0xfe, 0xf5, 0x4d, 0x92, 0x10, 0xa6, 0x2a, 0x7d, 0x03, 0xef, 0x9d, 0xa1, 0x08, 0xfc, 0x62, 0x84, 0x7f, 0xff, 0x74, 0x36, 0x81,
0x96, 0x7e, 0xcf, 0x25, 0xa0, 0xfc, 0x5f, 0x53, 0x96, 0x70, 0xac, 0xf6, 0x3f, 0x99, 0xd2, 0xff, 0x57, 0xff, 0x48, 0x12, 0xc0, 0x92, 0xbf, 0xb9, 0xf8, 0x94, 0xb7, 0x14, 0x65, 0x01, 0x87, 0x6a,
0xb4, 0xfe, 0xfb, 0x1a, 0x00, 0x00, 0xff, 0xff, 0x85, 0x5f, 0xab, 0xe2, 0xb7, 0x09, 0x00, 0x00, 0xff, 0x83, 0x31, 0xf5, 0x2f, 0xec, 0xe6, 0xef, 0x00, 0x00, 0x00, 0xff, 0xff, 0x18, 0x2a, 0x86,
0x9a, 0xd3, 0x09, 0x00, 0x00,
} }
// Reference imports to suppress errors if they are not otherwise used. // Reference imports to suppress errors if they are not otherwise used.

View File

@@ -292,10 +292,6 @@ func request_WorkflowService_WatchWorkflow_0(ctx context.Context, marshaler runt
} }
var (
filter_WorkflowService_GetWorkflowLogs_0 = &utilities.DoubleArray{Encoding: map[string]int{"namespace": 0, "name": 1, "podName": 2}, Base: []int{1, 1, 2, 3, 0, 0, 0}, Check: []int{0, 1, 1, 1, 2, 3, 4}}
)
func request_WorkflowService_GetWorkflowLogs_0(ctx context.Context, marshaler runtime.Marshaler, client WorkflowServiceClient, req *http.Request, pathParams map[string]string) (WorkflowService_GetWorkflowLogsClient, runtime.ServerMetadata, error) { func request_WorkflowService_GetWorkflowLogs_0(ctx context.Context, marshaler runtime.Marshaler, client WorkflowServiceClient, req *http.Request, pathParams map[string]string) (WorkflowService_GetWorkflowLogsClient, runtime.ServerMetadata, error) {
var protoReq GetWorkflowLogsRequest var protoReq GetWorkflowLogsRequest
var metadata runtime.ServerMetadata var metadata runtime.ServerMetadata
@@ -340,11 +336,15 @@ func request_WorkflowService_GetWorkflowLogs_0(ctx context.Context, marshaler ru
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "podName", err) return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "podName", err)
} }
if err := req.ParseForm(); err != nil { val, ok = pathParams["containerName"]
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) if !ok {
return nil, metadata, status.Errorf(codes.InvalidArgument, "missing parameter %s", "containerName")
} }
if err := runtime.PopulateQueryParameters(&protoReq, req.Form, filter_WorkflowService_GetWorkflowLogs_0); err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err) protoReq.ContainerName, err = runtime.String(val)
if err != nil {
return nil, metadata, status.Errorf(codes.InvalidArgument, "type mismatch, parameter: %s, error: %v", "containerName", err)
} }
stream, err := client.GetWorkflowLogs(ctx, &protoReq) stream, err := client.GetWorkflowLogs(ctx, &protoReq)
@@ -1313,7 +1313,7 @@ var (
pattern_WorkflowService_WatchWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflows", "name", "watch"}, "", runtime.AssumeColonVerbOpt(true))) pattern_WorkflowService_WatchWorkflow_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5}, []string{"apis", "v1beta1", "namespace", "workflows", "name", "watch"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_GetWorkflowLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7}, []string{"apis", "v1beta1", "namespace", "workflows", "name", "pods", "podName", "log"}, "", runtime.AssumeColonVerbOpt(true))) pattern_WorkflowService_GetWorkflowLogs_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3, 1, 0, 4, 1, 5, 4, 2, 5, 1, 0, 4, 1, 5, 6, 2, 7, 1, 0, 4, 1, 5, 8, 2, 9}, []string{"apis", "v1beta1", "namespace", "workflows", "name", "pods", "podName", "containers", "containerName", "logs"}, "", runtime.AssumeColonVerbOpt(true)))
pattern_WorkflowService_CreateWorkflowTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workflow_templates"}, "", runtime.AssumeColonVerbOpt(true))) pattern_WorkflowService_CreateWorkflowTemplate_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 1, 0, 4, 1, 5, 2, 2, 3}, []string{"apis", "v1beta1", "namespace", "workflow_templates"}, "", runtime.AssumeColonVerbOpt(true)))

View File

@@ -34,7 +34,7 @@ service WorkflowService {
rpc GetWorkflowLogs (GetWorkflowLogsRequest) returns (stream LogEntry) { rpc GetWorkflowLogs (GetWorkflowLogsRequest) returns (stream LogEntry) {
option (google.api.http) = { option (google.api.http) = {
get: "/apis/v1beta1/{namespace}/workflows/{name}/pods/{podName}/log" get: "/apis/v1beta1/{namespace}/workflows/{name}/pods/{podName}/containers/{containerName}/logs"
}; };
} }

View File

@@ -298,7 +298,7 @@
] ]
} }
}, },
"/apis/v1beta1/{namespace}/workflows/{name}/pods/{podName}/log": { "/apis/v1beta1/{namespace}/workflows/{name}/pods/{podName}/containers/{containerName}/logs": {
"get": { "get": {
"operationId": "GetWorkflowLogs", "operationId": "GetWorkflowLogs",
"responses": { "responses": {
@@ -330,8 +330,8 @@
}, },
{ {
"name": "containerName", "name": "containerName",
"in": "query", "in": "path",
"required": false, "required": true,
"type": "string" "type": "string"
} }
], ],

View File

@@ -4,12 +4,14 @@ import (
"bufio" "bufio"
"encoding/json" "encoding/json"
"fmt" "fmt"
"io"
"os" "os"
"strconv" "strconv"
"time" "time"
"github.com/onepanelio/core/kube" "github.com/onepanelio/core/kube"
"github.com/onepanelio/core/model" "github.com/onepanelio/core/model"
"github.com/onepanelio/core/s3"
"github.com/onepanelio/core/util" "github.com/onepanelio/core/util"
"google.golang.org/grpc/codes" "google.golang.org/grpc/codes"
) )
@@ -136,7 +138,30 @@ func (r *ResourceManager) WatchWorkflow(namespace, name string) (<-chan *model.W
} }
func (r *ResourceManager) GetWorkflowLogs(namespace, name, podName, containerName string) (<-chan *model.LogEntry, error) { func (r *ResourceManager) GetWorkflowLogs(namespace, name, podName, containerName string) (<-chan *model.LogEntry, error) {
stream, err := r.kubeClient.GetPodLogs(namespace, podName, containerName) wf, err := r.kubeClient.GetWorkflow(namespace, name)
if err != nil {
return nil, util.NewUserError(codes.NotFound, "Workflow not found.")
}
var (
stream io.ReadCloser
s3Client *s3.Client
)
if wf.Status.Completed() {
s3Client, err = s3.NewClient(s3.Config{
AccessKey: os.Getenv("ARTIFACT_REPOSITORY_ACCESS_KEY"),
SecretKey: os.Getenv("ARTIFACT_REPOSITORY_SECRET_KEY"),
Region: os.Getenv("ARTIFACT_REPOSITORY_REGION"),
Endpoint: os.Getenv("ARTIFACT_REPOSITORY_ENDPOINT"),
})
if err != nil {
return nil, util.NewUserError(codes.PermissionDenied, "Can't connect to S3 storage.")
}
stream, err = s3Client.StreamObject(os.Getenv("ARTIFACT_REPOSITORY_BUCKET"), "artifacts/"+namespace+"/"+name+"/"+podName+"/"+containerName+".log")
} else {
stream, err = r.kubeClient.GetPodLogs(namespace, podName, containerName)
}
// TODO: Catch exact kubernetes error // TODO: Catch exact kubernetes error
if err != nil { if err != nil {
return nil, util.NewUserError(codes.NotFound, "Log not found.") return nil, util.NewUserError(codes.NotFound, "Log not found.")

View File

@@ -1,8 +1,7 @@
package s3 package s3
import ( import (
"io/ioutil" "io"
"time"
"github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/credentials"
@@ -14,17 +13,18 @@ type Client struct {
*s3.S3 *s3.S3
} }
type Object struct { type Config struct {
Key *string `json:"key"` AccessKey string
LastModified *time.Time `json:"last_modified"` SecretKey string
Size *int64 `json:"size"` Endpoint string
IsPrefix bool `json:"is_prefix"` Region string
} }
func NewClient(id, secret, region string) (s3Client *Client, err error) { func NewClient(config Config) (s3Client *Client, err error) {
session, err := session.NewSession(&aws.Config{ session, err := session.NewSession(&aws.Config{
Credentials: credentials.NewStaticCredentials(id, secret, ""), Credentials: credentials.NewStaticCredentials(config.AccessKey, config.SecretKey, ""),
Region: aws.String(region), Region: aws.String(config.Region),
Endpoint: aws.String(config.Endpoint),
}) })
if err != nil { if err != nil {
return nil, err return nil, err
@@ -32,7 +32,7 @@ func NewClient(id, secret, region string) (s3Client *Client, err error) {
return &Client{S3: s3.New(session)}, nil return &Client{S3: s3.New(session)}, nil
} }
func (c *Client) GetObject(bucket, key string) (content *[]byte, err error) { func (c *Client) StreamObject(bucket, key string) (stream io.ReadCloser, err error) {
out, err := c.S3.GetObject(&s3.GetObjectInput{ out, err := c.S3.GetObject(&s3.GetObjectInput{
Bucket: aws.String(bucket), Bucket: aws.String(bucket),
Key: aws.String(key), Key: aws.String(key),
@@ -41,12 +41,12 @@ func (c *Client) GetObject(bucket, key string) (content *[]byte, err error) {
return return
} }
defer out.Body.Close() switch {
data, err := ioutil.ReadAll(out.Body) case (out.Body != nil):
if err != nil { return out.Body, nil
return
}
content = &data
return default:
defer out.Body.Close()
return nil, err
}
} }