businesspolicy

package
v3.2.1+incompatible Latest Latest
Warning

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

Go to latest
Published: Feb 21, 2020 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const DEFAULT_MAX_AGREEMENT = 0

Variables

This section is empty.

Functions

func ConvertChoice

func ConvertChoice(wl WorkloadChoice, url string, org string, arch string, pol *policy.Policy)

func ConvertConstraints

func ConvertConstraints(constraints externalpolicy.ConstraintExpression, pol *policy.Policy) error

func ConvertNodeHealth

func ConvertNodeHealth(nodeh NodeHealth, pol *policy.Policy)

func ConvertProperties

func ConvertProperties(properties externalpolicy.PropertyList, pol *policy.Policy) error

Types

type BusinessPolicy

type BusinessPolicy struct {
	Owner       string                              `json:"owner,omitempty"`
	Label       string                              `json:"label"`
	Description string                              `json:"description"`
	Service     ServiceRef                          `json:"service"`
	Properties  externalpolicy.PropertyList         `json:"properties,omitempty"`
	Constraints externalpolicy.ConstraintExpression `json:"constraints,omitempty"`
	UserInput   []policy.UserInput                  `json:"userInput,omitempty"`
}

the business policy

func (*BusinessPolicy) GenPolicyFromBusinessPolicy

func (b *BusinessPolicy) GenPolicyFromBusinessPolicy(policyName string) (*policy.Policy, error)

Convert business policy to a policy object.

func (BusinessPolicy) String

func (w BusinessPolicy) String() string

func (*BusinessPolicy) Validate

func (b *BusinessPolicy) Validate() error

The validate function returns errors if the policy does not validate. It uses the constraint language plugins to handle the constraints field.

type NodeHealth

type NodeHealth struct {
	MissingHBInterval    int `json:"missing_heartbeat_interval,omitempty"` // How long a heartbeat can be missing until it is considered missing (in seconds)
	CheckAgreementStatus int `json:"check_agreement_status,omitempty"`     // How often to check that the node agreement entry still exists in the exchange (in seconds)
}

func (NodeHealth) String

func (w NodeHealth) String() string

type ServiceRef

type ServiceRef struct {
	Name            string           `json:"name"`                      // refers to a service definition in the exchange
	Org             string           `json:"org,omitempty"`             // the org holding the service definition
	Arch            string           `json:"arch,omitempty"`            // the hardware architecture of the service definition
	ServiceVersions []WorkloadChoice `json:"serviceVersions,omitempty"` // a list of service version for rollback
	NodeH           NodeHealth       `json:"nodeHealth"`                // policy for determining when a node's health is violating its agreements
}

func (ServiceRef) String

func (w ServiceRef) String() string

type UpgradePolicy

type UpgradePolicy struct {
	Lifecycle string `json:"lifecycle,omitempty"` // immediate, never, agreement
	Time      string `json:"time,omitempty"`      // the time of the upgrade
}

func (UpgradePolicy) String

func (w UpgradePolicy) String() string

type WorkloadChoice

type WorkloadChoice struct {
	Version  string           `json:"version,omitempty"`  // the version of the workload
	Priority WorkloadPriority `json:"priority,omitempty"` // the highest priority workload is tried first for an agreement, if it fails, the next priority is tried. Priority 1 is the highest, priority 2 is next, etc.
	Upgrade  UpgradePolicy    `json:"upgradePolicy,omitempty"`
}

func (WorkloadChoice) String

func (w WorkloadChoice) String() string

type WorkloadPriority

type WorkloadPriority struct {
	PriorityValue     int `json:"priority_value,omitempty"`     // The priority of the workload
	Retries           int `json:"retries,omitempty"`            // The number of retries before giving up and moving to the next priority
	RetryDurationS    int `json:"retry_durations,omitempty"`    // The number of seconds in which the specified number of retries must occur in order for the next priority workload to be attempted.
	VerifiedDurationS int `json:"verified_durations,omitempty"` // The number of second in which verified data must exist before the rollback retry feature is turned off
}

func (WorkloadPriority) String

func (w WorkloadPriority) String() string

Jump to

Keyboard shortcuts

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