handler

package
v0.0.0-...-c63b137 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2025 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Copyright 2025 The canary-gate authors

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 FLAGGER_METADATA_EVENT_MESSAGE = "eventMessage"

Variables

This section is empty.

Functions

func StoreKey

func StoreKey(canary *CanaryWebhookPayload, hook service.HookType) string

StoreKey get store key name

Types

type CanaryGatePayload

type CanaryGatePayload struct {
	// Name of the canary
	Type service.HookType `json:"type"`

	// Name of the canarygate crd
	Name string `json:"name"`

	// Namespace where canarygate crd is created
	Namespace string `json:"namespace"`
}

CanaryGatePayload holds the open/close gate request

type CanaryGateStatus

type CanaryGateStatus struct {
	// Name of the canary
	Type service.HookType `json:"type"`
	// Name of the canary
	Name string `json:"name"`
	// Namespace of the canary
	Namespace string `json:"namespace"`
	// Gate status
	Status string `json:"status"`
}

CanaryGatePayload holds the open/close gate request

type CanaryWebhookPayload

type CanaryWebhookPayload struct {
	// Name of the canary
	Name string `json:"name"`

	// Namespace of the canary
	Namespace string `json:"namespace"`

	// Phase of the canary analysis
	Phase service.Phase `json:"phase"`

	// Hash from the TrackedConfigs and LastAppliedSpec of the Canary.
	// Can be used to identify a Canary for a specific configuration of the
	// deployed resources.
	Checksum string `json:"checksum"`

	// Metadata (key-value pairs) for this webhook
	Metadata map[string]string `json:"metadata,omitempty"`
}

CanaryWebhookPayload holds the deployment info and metadata sent to webhooks

type FlaggerHandler

type FlaggerHandler struct {
	// contains filtered or unexported fields
}

func NewHandler

func NewHandler(cmd *cli.Command, noti noti.Client, store store.Store) FlaggerHandler

func (*FlaggerHandler) CloseGate

func (h *FlaggerHandler) CloseGate() http.Handler

CloseGate set gate close

func (*FlaggerHandler) ConfirmPromotion

func (h *FlaggerHandler) ConfirmPromotion() http.Handler

ConfirmPromotion hooks are executed before the promotion step. The canary promotion is paused until the hooks return HTTP 200. While the promotion is paused, Flagger will continue to run the metrics checks and rollout hooks.

func (*FlaggerHandler) ConfirmRollout

func (h *FlaggerHandler) ConfirmRollout() http.Handler

ConfirmRollout hooks are executed before scaling up the canary deployment and can be used for manual approval. The rollout is paused until the returns a successful HTTP status code.

func (*FlaggerHandler) ConfirmTrafficIncrease

func (h *FlaggerHandler) ConfirmTrafficIncrease() http.Handler

ConfirmTrafficIncrease hooks are executed right before the weight on the canary is increased. The canary advancement is paused until this returns HTTP 200.

func (*FlaggerHandler) Event

func (h *FlaggerHandler) Event() http.Handler

Event hooks are executed every time Flagger emits a Kubernetes event. When configured, every action that Flagger takes during a canary deployment will be sent as JSON via an HTTP POST request

func (*FlaggerHandler) OpenGate

func (h *FlaggerHandler) OpenGate() http.Handler

OpenGate set gate open

func (*FlaggerHandler) PostRollout

func (h *FlaggerHandler) PostRollout() http.Handler

PostRollout hooks are executed after the canary has been promoted or rolled back. If a post rollout fails the error is logged.

func (*FlaggerHandler) PreRollout

func (h *FlaggerHandler) PreRollout() http.Handler

PreRollout hooks are executed before routing traffic to canary. The canary advancement is paused if a pre-rollout fails and if the number of failures reach the threshold the canary will be rollback

func (*FlaggerHandler) Rollback

func (h *FlaggerHandler) Rollback() http.Handler

Rollback hooks are executed while a canary deployment is in either Progressing or Waiting status. This provides the ability to rollback during analysis or while waiting for a confirmation. If a rollback returns a successful HTTP status code, Flagger will stop the analysis and mark the canary release as failed.

func (*FlaggerHandler) Rollout

func (h *FlaggerHandler) Rollout() http.Handler

Rollout hooks are executed during the analysis on each iteration before the metric checks. If a rollout call fails the canary advancement is paused and eventfully rolled back.

func (*FlaggerHandler) StatusGate

func (h *FlaggerHandler) StatusGate() http.Handler

StatusGate get gate status

type ServerHandler

type ServerHandler struct {
}

func (*ServerHandler) Version

func (h *ServerHandler) Version() http.Handler

Version handles the /version endpoint, returning the version of the canary-gate server.

type ServerVersion

type ServerVersion struct {
	// Version string
	Version string `json:"version"`
}

ServerVersion holds the server version information

Jump to

Keyboard shortcuts

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