-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support preloading cache in pod evaluator (#3065)
* support preloading cache in pod evaluator * change yaml package and cancel context
- Loading branch information
Mengqi Yu
authored
Apr 28, 2022
1 parent
4db5feb
commit d32bf9a
Showing
7 changed files
with
243 additions
and
72 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,6 +27,9 @@ FROM gcr.io/kpt-fn/upsert-resource:v0.2.0 as upsert-resource | |
FROM golang:1.17.6-alpine3.15 as builder | ||
WORKDIR /go/src/github.com/GoogleContainerTools/kpt | ||
|
||
RUN go install github.com/grpc-ecosystem/[email protected] | ||
RUN cp $GOPATH/bin/grpc-health-probe /grpc-health-probe | ||
|
||
COPY go.mod go.sum ./ | ||
COPY porch/go.mod porch/go.sum porch/ | ||
COPY porch/api/go.mod porch/api/go.sum porch/api/ | ||
|
@@ -52,7 +55,7 @@ COPY --from=set-namespace /usr/local/bin/function /functions/set-namesp | |
COPY --from=set-project-id /usr/local/bin/function /functions/set-project-id | ||
COPY --from=starlark /usr/local/bin/star /functions/starlark | ||
COPY --from=upsert-resource /usr/local/bin/function /functions/upsert-resource | ||
COPY --from=builder /server /config.yaml / | ||
COPY --from=builder /server /grpc-health-probe /config.yaml / | ||
|
||
EXPOSE 9445/tcp | ||
ENTRYPOINT [ "/server", "--config=/config.yaml", "--functions=/functions" ] |
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 |
---|---|---|
|
@@ -6,7 +6,7 @@ COPY go.mod go.sum ./ | |
COPY porch/go.mod porch/go.sum porch/ | ||
COPY porch/api/go.mod porch/api/go.sum porch/api/ | ||
|
||
RUN go install github.com/grpc-ecosystem/[email protected].8 | ||
RUN go install github.com/grpc-ecosystem/[email protected].11 | ||
COPY porch/func/ porch/func/ | ||
RUN cd porch/func ; go build -v -o /wrapper-server/wrapper-server ./wrapper-server | ||
RUN cp $GOPATH/bin/grpc-health-probe /wrapper-server/ | ||
|
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,42 @@ | ||
// Copyright 2022 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
package healthchecker | ||
|
||
import ( | ||
"context" | ||
|
||
"google.golang.org/grpc/health/grpc_health_v1" | ||
"k8s.io/klog/v2" | ||
) | ||
|
||
type HealthChecker struct{} | ||
|
||
func NewHealthChecker() *HealthChecker { | ||
return &HealthChecker{} | ||
} | ||
|
||
func (s *HealthChecker) Check(ctx context.Context, req *grpc_health_v1.HealthCheckRequest) (*grpc_health_v1.HealthCheckResponse, error) { | ||
klog.Info("Serving the Check request for health check") | ||
return &grpc_health_v1.HealthCheckResponse{ | ||
Status: grpc_health_v1.HealthCheckResponse_SERVING, | ||
}, nil | ||
} | ||
|
||
func (s *HealthChecker) Watch(req *grpc_health_v1.HealthCheckRequest, server grpc_health_v1.Health_WatchServer) error { | ||
klog.Info("Serving the Watch request for health check") | ||
return server.Send(&grpc_health_v1.HealthCheckResponse{ | ||
Status: grpc_health_v1.HealthCheckResponse_SERVING, | ||
}) | ||
} |
Oops, something went wrong.