Skip to content

Commit

Permalink
Merge pull request #62 from microsoft/eedorenko/http-api-server
Browse files Browse the repository at this point in the history
Http api server
  • Loading branch information
eedorenko authored Dec 19, 2024
2 parents d2b7df9 + 7b44a14 commit 35cca3b
Show file tree
Hide file tree
Showing 14 changed files with 790 additions and 109 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: CI

on:
push:
branches: ["main"]
branches: ["main", "eedorenko/*"]
workflow_dispatch:

env:
Expand Down Expand Up @@ -57,6 +57,11 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.19'

- name: Install Helmify
run: |
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v4
- name: Install Go
uses: actions/setup-go@v2
with:
go-version: '1.19'
cache: false
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
Expand Down
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/microsoft/kalypso-observability-hub/storage v0.0.0
github.com/onsi/ginkgo/v2 v2.9.5
github.com/onsi/gomega v1.27.7
k8s.io/api v0.27.3
k8s.io/apimachinery v0.27.3
k8s.io/client-go v0.27.3
sigs.k8s.io/controller-runtime v0.15.0
Expand Down Expand Up @@ -75,11 +76,10 @@ require (
google.golang.org/appengine v1.6.7 // indirect
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
google.golang.org/grpc v1.56.3 // indirect
google.golang.org/protobuf v1.33.0 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
k8s.io/api v0.27.3 // indirect
k8s.io/apiextensions-apiserver v0.27.3 // indirect
k8s.io/component-base v0.27.3 // indirect
k8s.io/klog/v2 v2.90.1 // indirect
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -269,8 +269,8 @@ google.golang.org/protobuf v1.23.1-0.20200526195155-81db48ad09cc/go.mod h1:EGpAD
google.golang.org/protobuf v1.24.0/go.mod h1:r/3tXBNzIEhYS9I1OUVjXDlt8tc493IdKGjtUeSXeh4=
google.golang.org/protobuf v1.26.0-rc.1/go.mod h1:jlhhOSvTdKEhbULTjvd4ARK9grFBp09yW+WbY/TyQbw=
google.golang.org/protobuf v1.26.0/go.mod h1:9q0QmTI4eRPtz6boOQmLYwt+qCgq0jsYwAQnmE0givc=
google.golang.org/protobuf v1.33.0 h1:uNO2rsAINq/JlFpSdYEKIZ0uKD/R9cpdv0T+yoGwGmI=
google.golang.org/protobuf v1.33.0/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
google.golang.org/protobuf v1.34.1 h1:9ddQBjfCyZPOHPUiPxpYESBLc+T8P3E+Vo4IbKZgFWg=
google.golang.org/protobuf v1.34.1/go.mod h1:c6P6GXX6sHbq/GpV6MGZEdwhWPcYBgnhAHhKbcUYpos=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
Expand Down
17 changes: 17 additions & 0 deletions storage/api/grpc/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ type ObservabilityStorageGrpcClient interface {
UpdateReconciler(ctx context.Context, in *pb.Reconciler) (*pb.Reconciler, error)
UpdateDeployment(ctx context.Context, in *pb.Deployment) (*pb.Deployment, error)
GetDeploymentTarget(ctx context.Context, in *pb.DeploymentTargetSearch) (*pb.DeploymentTarget, error)
GetDeploymentState(ctx context.Context, in *pb.DeploymentStateRequest) (*pb.DeploymentState, error)
}

type observabilityStorageGrpcClient struct {
Expand Down Expand Up @@ -210,3 +211,19 @@ func (c *observabilityStorageGrpcClient) GetDeploymentTarget(ctx context.Context
}
return dt, nil
}

// GetDeploymentState
func (c *observabilityStorageGrpcClient) GetDeploymentState(ctx context.Context, in *pb.DeploymentStateRequest) (*pb.DeploymentState, error) {
conn, err := c.getConnection()
if err != nil {
return nil, err
}
defer conn.Close()
client := pb.NewStorageApiClient(conn)

ds, err := client.GetDeploymentState(ctx, in)
if err != nil {
return nil, err
}
return ds, nil
}
16 changes: 16 additions & 0 deletions storage/api/grpc/client/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,3 +162,19 @@ func TestUpdateDeployment(t *testing.T) {
return
}
}

// Test GetDeploymentState
func TestGetDeploymentState(t *testing.T) {
client := NewObservabilityStorageGrpcClient(*serverAddr)
deployment_state, err := client.GetDeploymentState(context.Background(), &pb.DeploymentStateRequest{
ManifestsEndpoint: "https://github.com/Org/data-ingestion/dev%",
CommitId: "sha1:a97f94d3f3ede63d08d58ae4cf9f3262d7679c4f",
})
// Print the deployment state
t.Logf("DeploymentState: %v", *deployment_state)

if err != nil {
t.Errorf("GetDeploymentState() error = %v", err)
return
}
}
Loading

0 comments on commit 35cca3b

Please sign in to comment.