agones.dev/agones@v1.53.0/pkg/apis/agones/v1/apihooks.go (about)

     1  // Copyright 2022 Google LLC All Rights Reserved.
     2  //
     3  // Licensed under the Apache License, Version 2.0 (the "License");
     4  // you may not use this file except in compliance with the License.
     5  // You may obtain a copy of the License at
     6  //
     7  //	http://www.apache.org/licenses/LICENSE-2.0
     8  //
     9  // Unless required by applicable law or agreed to in writing, software
    10  // distributed under the License is distributed on an "AS IS" BASIS,
    11  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    12  // See the License for the specific language governing permissions and
    13  // limitations under the License.
    14  
    15  package v1
    16  
    17  import (
    18  	"agones.dev/agones/pkg/apis"
    19  	corev1 "k8s.io/api/core/v1"
    20  	"k8s.io/apimachinery/pkg/util/validation/field"
    21  )
    22  
    23  // APIHooks is a subset of the cloudproduct.CloudProduct interface for cloud product hooks specific to this package.
    24  type APIHooks interface {
    25  	// ValidateGameServerSpec is called by GameServer.Validate to allow for product specific validation.
    26  	ValidateGameServerSpec(*GameServerSpec, *field.Path) field.ErrorList
    27  
    28  	// ValidateScheduling is called by Fleet and GameServerSet Validate() to allow for product specific validation of scheduling strategy.
    29  	ValidateScheduling(apis.SchedulingStrategy, *field.Path) field.ErrorList
    30  
    31  	// MutateGameServerPod is called by createGameServerPod to allow for product specific pod mutation.
    32  	MutateGameServerPod(*GameServerSpec, *corev1.Pod) error
    33  
    34  	// SetEviction is called by gs.Pod to enforce GameServer.Status.Eviction.
    35  	SetEviction(*Eviction, *corev1.Pod) error
    36  }