server

package
v2.0.0-beta.3 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 28, 2024 License: Apache-2.0 Imports: 43 Imported by: 0

Documentation

Overview

Copyright © 2024 Pulumi Corporation

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.

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.

Index

Constants

View Source
const (
	ServiceAccountPermissionsErrorMessage = `` /* 455-byte string literal not displayed */

)

Variables

This section is empty.

Functions

func NewKubeAuth

func NewKubeAuth(rootLogger *zap.Logger, config *rest.Config, opts KubeAuthOptions) (grpc_auth.AuthFunc, error)

NewKubeAuth provides a grpc_auth.AuthFunc for authentication and authorization. Requests will be authenticated (via TokenReviews) and authorized (via SubjectAccessReviews) with the kube-apiserver. For the authentication and authorization the agent needs a role with the following rules: * apiGroups: authentication.k8s.io, resources: tokenreviews, verbs: create * apiGroups: authorization.k8s.io, resources: subjectaccessreviews, verbs: create

To make RPC requests e.g. as the Operator the client needs a role with the following rule: * apiGroups: auto.pulumi.com, resources: workspaces/rpc, verbs: use

func RecordRequestLatency

func RecordRequestLatency(ctx context.Context, code string, latency float64)

RecordRequestLatency measures request latency in seconds for the delegated authentication. Broken down by status code.

func RecordRequestTotal

func RecordRequestTotal(ctx context.Context, code string)

RecordRequestTotal increments the total number of requests for the delegated authentication.

Types

type GRPC

type GRPC struct {
	*grpc.Server
	// contains filtered or unexported fields
}

GRPC serves the automation service.

func NewGRPC

func NewGRPC(rootLogger *zap.SugaredLogger, server *Server, authF grpc_auth.AuthFunc) *GRPC

NewGRPC constructs a new gRPC server with logging and authentication support.

func (*GRPC) Serve

func (s *GRPC) Serve(ctx context.Context, l net.Listener) error

Serve wraps the underlying gRPC server with graceful shutdown. When the given context is canceled a SIGTERM is propagated to all child processes (spawned by Automation API) and requests are given an opportunity to exit cleanly.

type KubeAuthOptions

type KubeAuthOptions struct {
	WorkspaceName types.NamespacedName
}

type Options

type Options struct {
	// StackName is the name of the stack to upsert (optional).
	StackName string
	// SecretsProvider is the secrets provider to use for new stacks (optional).
	SecretsProvider string
}

type Server

type Server struct {
	pb.UnimplementedAutomationServiceServer
	// contains filtered or unexported fields
}

func NewServer

func NewServer(ctx context.Context, ws auto.Workspace, opts *Options) (*Server, error)

NewServer creates a new automation server for the given workspace.

func (*Server) Cancel

func (s *Server) Cancel()

Cancel attempts to send an interrupt to all of our outstanding Automation API subprocesses -- simulating a user's ctrl-C. This call is advisory and non-blocking; it is intended to be used alongside grpc.GracefulStop to allow outstanding handlers to return. If a handler needs to spawn multiple long-running Automation API subprocesses it should check whether the server is stopping before doing so.

func (*Server) Destroy

Destroy implements proto.AutomationServiceServer.

func (*Server) Info

func (s *Server) Info(ctx context.Context, in *pb.InfoRequest) (*pb.InfoResult, error)

func (*Server) Install

func (s *Server) Install(ctx context.Context, in *pb.InstallRequest) (*pb.InstallResult, error)

func (*Server) Preview

Preview implements proto.AutomationServiceServer.

func (*Server) Refresh

Refresh implements proto.AutomationServiceServer.

func (*Server) SelectStack

func (s *Server) SelectStack(ctx context.Context, in *pb.SelectStackRequest) (*pb.SelectStackResult, error)

func (*Server) SetAllConfig

func (s *Server) SetAllConfig(ctx context.Context, in *pb.SetAllConfigRequest) (*pb.SetAllConfigResult, error)

func (*Server) Up

Up implements proto.AutomationServiceServer.

func (*Server) WhoAmI

func (s *Server) WhoAmI(ctx context.Context, in *pb.WhoAmIRequest) (*pb.WhoAmIResult, error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL