webhook

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 17, 2021 License: Apache-2.0 Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	LBReadyKey         = "externalnetwork.ocgi.dev/lb-ready"
	ExternalNetworkKey = "carrier.ocgi.dev/external-network-type"
)

Variables

This section is empty.

Functions

func EnsureDefaultForGameServer

func EnsureDefaultForGameServer(gs *v1alpha1.GameServer) *v1alpha1.GameServer

EnsureDefaultForGameServer ensure some default fields of GameServer

func EnsureDefaultPortType

func EnsureDefaultPortType(gsSpec *v1alpha1.GameServerSpec)

EnsureDefaultPortType ensure default policyType of GameServer: LoaderBalancer

func EnsureDefaultsForGameServerSet

func EnsureDefaultsForGameServerSet(gsSet *v1alpha1.GameServerSet) *v1alpha1.GameServerSet

EnsureDefaultsForGameServerSet ensure some default fields of GameServerSet

func EnsureDefaultsForSquad

func EnsureDefaultsForSquad(squad *v1alpha1.Squad) *v1alpha1.Squad

EnsureDefaultsForSquad ensure some default fields of Squad

func EnsurePod

func EnsurePod(pod *corev1.Pod, f func(*corev1.Pod), opts ...option) *corev1.Pod

EnsurePod add side car to the pod and create patch.

func NewWebhookServer

func NewWebhookServer(config *SideCarConfig, kubeClient kubernetes.Interface,
	factory informers.SharedInformerFactory) *webhookServer

NewWebhookServer creates a new server

func ValidateGameServer

func ValidateGameServer(gs *carrierv1alpha1.GameServer) field.ErrorList

ValidateGameServer validates the GameServer configuration. If a GameServer is invalid there will be > 0 values in the returned array

func ValidateGameServerSet

func ValidateGameServerSet(gsSet *carrierv1alpha1.GameServerSet) field.ErrorList

ValidateGameServerSet validates when Create occurs, check name, label, annotaions and podSpec

func ValidateGameServerSetUpdate

func ValidateGameServerSetUpdate(oldGSS, newGSS *carrierv1alpha1.GameServerSet) field.ErrorList

ValidateGameServerSetUpdate validate the GameServerSet update, only allow image, pullPolicy and replicas now.

func ValidateGameServerUpdate

func ValidateGameServerUpdate(oldGS, newGS *carrierv1alpha1.GameServer) field.ErrorList

ValidateGameServerUpdate validate the GameServer update, only allow image now.

func ValidateSquad

func ValidateSquad(squad *carrierv1alpha1.Squad) field.ErrorList

ValidateSquad validates when Create occurs, check name, label, annotaions and podSpec

func ValidateSquadUpdate

func ValidateSquadUpdate(oldSquad, newSquad *carrierv1alpha1.Squad) field.ErrorList

ValidateSquadUpdate validate the Squad update, only allow image, pullPolicy for pod spec. other fields to controller update policy are all alowed

func WithArgs

func WithArgs(httpPort, grpcPort int) option

WithArgs add port to side car args

func WithEnvs

func WithEnvs(pod *corev1.Pod) option

WithEnvs add port envs to side car

func WithHealthCheck

func WithHealthCheck() option

WithHealthCheck inject health check

func WithImageName

func WithImageName(sc *SideCarConfig) option

WithImageName add image

func WithResource

func WithResource(sc *SideCarConfig) option

WithResource add resource to sidecar

Types

type SideCarConfig

type SideCarConfig struct {
	// Image describes the image version
	Image string
	// CPU if cpu config of side car
	CPU resource.Quantity
	// Memory if memory config of side car
	Memory resource.Quantity
	// HttpPort is the port for http
	HttpPort int
	// GrpcPort is the port for grpc
	GrpcPort int
}

SideCarConfig describes the config of sidecar

Jump to

Keyboard shortcuts

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