Documentation ¶
Index ¶
- Constants
- func GetAPIVersion() string
- func GetMappingGVR() schema.GroupVersionResource
- func GetMappingService(obj *unstructured.Unstructured) string
- func GetMappingWeight(obj *unstructured.Unstructured) int64
- func NewDynamicClient(di dynamic.Interface, namespace string) dynamic.ResourceInterface
- func SetAPIVersion(apiVersion string)
- type ClientInterface
- type Reconciler
Constants ¶
const ( Type = "Ambassador" AmbassadorMappingNotFound = "AmbassadorMappingNotFound" AmbassadorMappingConfigError = "AmbassadorMappingConfigError" CanaryMappingCleanupError = "CanaryMappingCleanupError" CanaryMappingCreationError = "CanaryMappingCreationError" CanaryMappingUpdateError = "CanaryMappingUpdateError" CanaryMappingWeightUpdate = "CanaryMappingWeightUpdate" )
Type defines the ambassador traffic routing type.
Variables ¶
This section is empty.
Functions ¶
func GetAPIVersion ¶
func GetAPIVersion() string
func GetMappingGVR ¶
func GetMappingGVR() schema.GroupVersionResource
GetMappingGVR will return the Ambassador Mapping GVR to be used. The logic is based on the ambassadorAPIVersion variable that is set with a default value. The default value can be changed by invoking the SetAPIVersion function.
func GetMappingService ¶
func GetMappingService(obj *unstructured.Unstructured) string
func GetMappingWeight ¶
func GetMappingWeight(obj *unstructured.Unstructured) int64
func NewDynamicClient ¶
func NewDynamicClient(di dynamic.Interface, namespace string) dynamic.ResourceInterface
NewDynamicClient will initialize a real kubernetes dynamic client to interact with Ambassador CRDs
func SetAPIVersion ¶
func SetAPIVersion(apiVersion string)
Types ¶
type ClientInterface ¶
type ClientInterface interface { Get(ctx context.Context, name string, options metav1.GetOptions, subresources ...string) (*unstructured.Unstructured, error) Create(ctx context.Context, obj *unstructured.Unstructured, options metav1.CreateOptions, subresources ...string) (*unstructured.Unstructured, error) Update(ctx context.Context, obj *unstructured.Unstructured, options metav1.UpdateOptions, subresources ...string) (*unstructured.Unstructured, error) Delete(ctx context.Context, name string, options metav1.DeleteOptions, subresources ...string) error }
ClientInterface defines a subset of k8s client operations having only the required ones.
type Reconciler ¶
type Reconciler struct { Rollout *v1alpha1.Rollout Client ClientInterface Recorder record.EventRecorder Log *logrus.Entry }
Reconciler implements a TrafficRoutingReconciler for Ambassador.
func NewReconciler ¶
func NewReconciler(r *v1alpha1.Rollout, c ClientInterface, rec record.EventRecorder) *Reconciler
NewReconciler will build and return an ambassador Reconciler
func (*Reconciler) SetWeight ¶
func (r *Reconciler) SetWeight(desiredWeight int32) error
SetWeight will configure a canary ambassador mapping with the given desiredWeight. The canary ambassador mapping is dynamically created cloning the mapping provided in the ambassador configuration in the traffic routing section of the rollout. If the canary ambassador mapping is already present, it will be updated to the given desiredWeight.
func (*Reconciler) Type ¶
func (r *Reconciler) Type() string
func (*Reconciler) UpdateHash ¶
func (r *Reconciler) UpdateHash(canaryHash, stableHash string) error
UpdateHash informs a traffic routing reconciler about new canary/stable pod hashes
func (*Reconciler) VerifyWeight ¶
func (r *Reconciler) VerifyWeight(desiredWeight int32) (bool, error)