Documentation ¶
Index ¶
- Variables
- func BuildAndUploadDockerImage(ctx context.Context, dep *protos.Deployment, image string, runInDevMode bool) (string, error)
- func GenerateKubeDeployment(image string, dep *protos.Deployment, cfg *KubeConfig) error
- func RunBabysitter(ctx context.Context) error
- type KubeConfig
- type ListenerOptions
- type ReplicaSetConfig
- func (*ReplicaSetConfig) Descriptor() ([]byte, []int)deprecated
- func (x *ReplicaSetConfig) GetComponentsToStart() map[string]*ReplicaSetConfig_Listeners
- func (x *ReplicaSetConfig) GetDeployment() *protos.Deployment
- func (x *ReplicaSetConfig) GetInternalPort() int32
- func (x *ReplicaSetConfig) GetReplicaSet() string
- func (*ReplicaSetConfig) ProtoMessage()
- func (x *ReplicaSetConfig) ProtoReflect() protoreflect.Message
- func (x *ReplicaSetConfig) Reset()
- func (x *ReplicaSetConfig) String() string
- type ReplicaSetConfig_Listener
- func (*ReplicaSetConfig_Listener) Descriptor() ([]byte, []int)deprecated
- func (x *ReplicaSetConfig_Listener) GetExternalPort() int32
- func (x *ReplicaSetConfig_Listener) GetIsPublic() bool
- func (x *ReplicaSetConfig_Listener) GetName() string
- func (*ReplicaSetConfig_Listener) ProtoMessage()
- func (x *ReplicaSetConfig_Listener) ProtoReflect() protoreflect.Message
- func (x *ReplicaSetConfig_Listener) Reset()
- func (x *ReplicaSetConfig_Listener) String() string
- type ReplicaSetConfig_Listeners
- func (*ReplicaSetConfig_Listeners) Descriptor() ([]byte, []int)deprecated
- func (x *ReplicaSetConfig_Listeners) GetListeners() []*ReplicaSetConfig_Listener
- func (*ReplicaSetConfig_Listeners) ProtoMessage()
- func (x *ReplicaSetConfig_Listeners) ProtoReflect() protoreflect.Message
- func (x *ReplicaSetConfig_Listeners) Reset()
- func (x *ReplicaSetConfig_Listeners) String() string
Constants ¶
This section is empty.
Variables ¶
var File_internal_impl_kube_proto protoreflect.FileDescriptor
Functions ¶
func BuildAndUploadDockerImage ¶
func BuildAndUploadDockerImage(ctx context.Context, dep *protos.Deployment, image string, runInDevMode bool) (string, error)
BuildAndUploadDockerImage builds a docker image and upload it to docker hub.
func GenerateKubeDeployment ¶
func GenerateKubeDeployment(image string, dep *protos.Deployment, cfg *KubeConfig) error
GenerateKubeDeployment generates the kubernetes deployment and service information for a given app deployment.
Note that for each application, we generate the following Kubernetes topology:
for each replica set that has at least a listener, we generate a deployment whose name is persistent across new app versions rollouts. Note that in general this should only be the replica set that contains the main component. We do this because by default we rely on RollingUpdate as a deployment strategy to rollout new versions of the app. RollingUpdate will update the existing pods for the replica set with the new version one by one, hence the new application version is being deployed. For example, let's assume that we have an app v1 with 2 replica sets main and foo. main is the replica set that contains the public listener, and it has 2 replicas. Next, we deploy the version v2 of the app. v2 will be rolled out as follows:
[main v1] [main v1] [main v1] [main v2] [main v2] [main v2] | | | | | | v | => v v => | v [foo v1] <---| [foo v1] [foo v2] |-------> [foo v2]
for all the replica sets, we create a per app version service so components within an app version can communicate with each other.
for all the listeners we create a load balancer or a cluster IP with an unique name that is persistent across new app version rollouts.
if Prometheus/Jaeger are enabled, we deploy corresponding services using unique names as well s.t., we don't rollout new instances of Prometheus/Jaeger, when we rollout new versions of the app.
func RunBabysitter ¶
Types ¶
type KubeConfig ¶
type KubeConfig struct { // Image is the name of the container image that "weaver kube deploy" // builds and uploads. For example, if Image is "docker.io/alanturing/foo", // then "weaver kube deploy" will build a container called // "docker.io/alanturing/foo" and upload it to Docker Hub. // // The format of Image depends on the registry being used. For example: // // - Docker Hub: USERNAME/NAME or docker.io/USERNAME/NAME // - Google Artifact Registry: LOCATION-docker.pkg.dev/PROJECT-ID/REPOSITORY/NAME // - GitHub Container Registry: ghcr.io/NAMESPACE/NAME // // Note that "weaver kube deploy" will automatically append a unique tag to // Image, so Image should not already contain a tag. Image string // Options for the application listeners, keyed by listener name. // If a listener isn't specified in the map, default options will be used. Listeners map[string]*ListenerOptions }
KubeConfig stores the configuration information for one execution of a Service Weaver application deployed using the Kube deployer.
type ListenerOptions ¶
type ListenerOptions struct { // Is the listener public, i.e., should it receive ingress traffic // from the public internet. If false, the listener is configured only // for cluster-internal access. Public bool }
ListenerOptions stores configuration options for a listener.
type ReplicaSetConfig ¶
type ReplicaSetConfig struct { Deployment *protos.Deployment `protobuf:"bytes,1,opt,name=deployment,proto3" json:"deployment,omitempty"` ReplicaSet string `protobuf:"bytes,2,opt,name=replica_set,json=replicaSet,proto3" json:"replica_set,omitempty"` ComponentsToStart map[string]*ReplicaSetConfig_Listeners `` /* 202-byte string literal not displayed */ InternalPort int32 `protobuf:"varint,4,opt,name=internal_port,json=internalPort,proto3" json:"internal_port,omitempty"` // contains filtered or unexported fields }
ReplicaSetConfig contains app deployment information that is needed by a babysitter started using the kube deployer to manage a set of components.
func (*ReplicaSetConfig) Descriptor
deprecated
func (*ReplicaSetConfig) Descriptor() ([]byte, []int)
Deprecated: Use ReplicaSetConfig.ProtoReflect.Descriptor instead.
func (*ReplicaSetConfig) GetComponentsToStart ¶
func (x *ReplicaSetConfig) GetComponentsToStart() map[string]*ReplicaSetConfig_Listeners
func (*ReplicaSetConfig) GetDeployment ¶
func (x *ReplicaSetConfig) GetDeployment() *protos.Deployment
func (*ReplicaSetConfig) GetInternalPort ¶
func (x *ReplicaSetConfig) GetInternalPort() int32
func (*ReplicaSetConfig) GetReplicaSet ¶
func (x *ReplicaSetConfig) GetReplicaSet() string
func (*ReplicaSetConfig) ProtoMessage ¶
func (*ReplicaSetConfig) ProtoMessage()
func (*ReplicaSetConfig) ProtoReflect ¶
func (x *ReplicaSetConfig) ProtoReflect() protoreflect.Message
func (*ReplicaSetConfig) Reset ¶
func (x *ReplicaSetConfig) Reset()
func (*ReplicaSetConfig) String ¶
func (x *ReplicaSetConfig) String() string
type ReplicaSetConfig_Listener ¶
type ReplicaSetConfig_Listener struct { Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` ExternalPort int32 `protobuf:"varint,2,opt,name=external_port,json=externalPort,proto3" json:"external_port,omitempty"` IsPublic bool `protobuf:"varint,3,opt,name=is_public,json=isPublic,proto3" json:"is_public,omitempty"` // contains filtered or unexported fields }
func (*ReplicaSetConfig_Listener) Descriptor
deprecated
func (*ReplicaSetConfig_Listener) Descriptor() ([]byte, []int)
Deprecated: Use ReplicaSetConfig_Listener.ProtoReflect.Descriptor instead.
func (*ReplicaSetConfig_Listener) GetExternalPort ¶
func (x *ReplicaSetConfig_Listener) GetExternalPort() int32
func (*ReplicaSetConfig_Listener) GetIsPublic ¶
func (x *ReplicaSetConfig_Listener) GetIsPublic() bool
func (*ReplicaSetConfig_Listener) GetName ¶
func (x *ReplicaSetConfig_Listener) GetName() string
func (*ReplicaSetConfig_Listener) ProtoMessage ¶
func (*ReplicaSetConfig_Listener) ProtoMessage()
func (*ReplicaSetConfig_Listener) ProtoReflect ¶
func (x *ReplicaSetConfig_Listener) ProtoReflect() protoreflect.Message
func (*ReplicaSetConfig_Listener) Reset ¶
func (x *ReplicaSetConfig_Listener) Reset()
func (*ReplicaSetConfig_Listener) String ¶
func (x *ReplicaSetConfig_Listener) String() string
type ReplicaSetConfig_Listeners ¶
type ReplicaSetConfig_Listeners struct { Listeners []*ReplicaSetConfig_Listener `protobuf:"bytes,1,rep,name=listeners,proto3" json:"listeners,omitempty"` // contains filtered or unexported fields }
func (*ReplicaSetConfig_Listeners) Descriptor
deprecated
func (*ReplicaSetConfig_Listeners) Descriptor() ([]byte, []int)
Deprecated: Use ReplicaSetConfig_Listeners.ProtoReflect.Descriptor instead.
func (*ReplicaSetConfig_Listeners) GetListeners ¶
func (x *ReplicaSetConfig_Listeners) GetListeners() []*ReplicaSetConfig_Listener
func (*ReplicaSetConfig_Listeners) ProtoMessage ¶
func (*ReplicaSetConfig_Listeners) ProtoMessage()
func (*ReplicaSetConfig_Listeners) ProtoReflect ¶
func (x *ReplicaSetConfig_Listeners) ProtoReflect() protoreflect.Message
func (*ReplicaSetConfig_Listeners) Reset ¶
func (x *ReplicaSetConfig_Listeners) Reset()
func (*ReplicaSetConfig_Listeners) String ¶
func (x *ReplicaSetConfig_Listeners) String() string