Documentation
¶
Overview ¶
Frames (Executor and Validator) for Skupper 1.x
Code organization:
- Each operation (TokenCreate, ServiceStatus, LinkDelete, etc..) has its own file (token_create, service_status, link_delete). - On it, the main 'SkupperOp' and all interface-specific frames are implemented - Each interface-specific frame also has the full code for all Skupper versions it supports
Index ¶
- Constants
- func VersionLessThan(version, than string) bool
- type CliLinkStatus
- type CliSkupper
- type CliSkupperInstall
- type CliSkupperVersion
- type Connect
- type LinkCreate
- type ManifestMatchesDeployment
- type NetworkStatusConfigMap
- type OutgoingLinkCheck
- type RouterCheck
- type SkupperCliPathSetter
- type SkupperDelete
- type SkupperExpose
- type SkupperExpose1_2
- type SkupperExpose1_3
- type SkupperInfo
- type SkupperInfoContents
- type SkupperInstallSimple
- type SkupperManifest
- type SkupperManifestContent
- type SkupperManifestContentImage
- type SkupperServiceBind
- type SkupperServiceCreate
- type SkupperServiceDelete
- type SkupperServiceUnbind
- type SkupperUnLink
- type SkupperUnexpose
- type SkupperUpgradable
- type SkupperUpgrade
- type SkupperVersioner
- type SkupperVersionerDefault
- type Status
- type TokenCheck
- type TokenCreate
- type ValidateSkupperAvailable
Constants ¶
const ( SkupperRouterRepo = "https://github.com/skupperproject/skupper-router" SkupperRepo = "https://github.com/skupperproject/skupper" EmptyRepo = "" UnknownRepo = "UNKNOWN" )
On skupper code, defined on pkg/utils/configs/manifest.go, but not as constants
Variables ¶
This section is empty.
Functions ¶
func VersionLessThan ¶
As the name implies, compares two versions in string form. It expects the X.Y.Z-a-b-c format, where any items that are integers on both sides will be compared numerically
Types ¶
type CliLinkStatus ¶
type CliLinkStatus struct {
Wait int // skupper link status --help
Timeout time.Duration // skupper link status --help
Verbose bool // skupper link status --help
// These will be put on the command right after the subcommands, and
// before other options selected above
AdditionalArgs []string
// You can configure any aspects of the command configuration. However,
// the fields Command, Args and Shell from the exec.Cmd element will be
// cleared before execution.
CliSkupper
}
func (CliLinkStatus) Execute ¶
func (cls CliLinkStatus) Execute() error
type CliSkupper ¶
type CliSkupper struct {
Args []string
// The primary way to define the namespace
Namespace string
// Secondary way to get the namespace, used only if Namespace is empty
F2Namespace *f2k8s.Namespace
// You can configure any aspects of the command configuration. However,
// the fields Command, Args and Shell from the exec.Cmd element will be
// cleared before execution.
Cmd f2general.Cmd
frame2.DefaultRunDealer
frame2.Log
// contains filtered or unexported fields
}
If both Namespace and ClusterContext are empty, the command will be executed without --namespace
func (*CliSkupper) Execute ¶
func (cs *CliSkupper) Execute() error
func (CliSkupper) GetNamespace ¶
func (c CliSkupper) GetNamespace() string
func (*CliSkupper) SetSkupperCliPath ¶
func (c *CliSkupper) SetSkupperCliPath(path string, env []string)
func (*CliSkupper) Validate ¶
func (c *CliSkupper) Validate() error
type CliSkupperInstall ¶
type CliSkupperInstall struct {
Namespace *f2k8s.Namespace
Ctx context.Context
MaxWait time.Duration // If not set, defaults to types.DefaultTimeoutDuration*2
SkipWait bool
SkipStatus bool
EnableConsole bool
EnableFlowCollector bool
Annotations []string
CreateNetworkPolicy bool
EnableClusterPermissions bool
SiteName string
RouterLogging string
RouterMode string
Ingress string
IngressHost string
DisableServiceSync bool
RouterCPU string
ConsoleAuth string
ConsoleUser string
ConsolePassword string
frame2.DefaultRunDealer
SkupperVersionerDefault
}
func (CliSkupperInstall) Execute ¶
func (s CliSkupperInstall) Execute() error
func (CliSkupperInstall) GetNamespace ¶
func (c CliSkupperInstall) GetNamespace() string
TODO: replace this by f2k8s.Namespace
func (CliSkupperInstall) SkupperUpgradable ¶
func (c CliSkupperInstall) SkupperUpgradable() *f2k8s.Namespace
Interface execute.SkupperUpgradable; allow this to be used with Upgrade disruptors
type CliSkupperVersion ¶
type CliSkupperVersion struct {
Namespace *f2k8s.Namespace
Ctx context.Context
// By default, CliSkupperVersion checks the output of
// the version command against SKUPPER_TEST_VERSION,
// when that variable is set
SkipOutputCheck bool
frame2.Log
frame2.DefaultRunDealer
SkupperVersionerDefault
}
Runs skupper version. By default, this command always shows its output (even if SKUPPER_TEST_VERBOSE_COMMANDS is not set), and it checks the output against the actual version (which, unless explicitly configured, comes from from the environment variable SKUPPER_TEST_VERSION or similar.
This frame cannot run `skupper version manifest`. For that, use SkupperManifest.
func (CliSkupperVersion) Execute ¶
func (s CliSkupperVersion) Execute() error
func (CliSkupperVersion) GetNamespace ¶
func (c CliSkupperVersion) GetNamespace() string
TODO: replace this by f2k8s.Namespace
func (CliSkupperVersion) Validate ¶
func (s CliSkupperVersion) Validate() error
type Connect ¶
type Connect struct {
From *f2k8s.Namespace
To *f2k8s.Namespace
SecretName string
Expiry string
Password string
TokenType string
Uses string
LinkName string
Cost string
Ctx context.Context
frame2.DefaultRunDealer
frame2.Log
}
Connects two Skupper instances installed in different namespaces or clusters
In practice, it does two steps: create the token, then use it to create a link on the other namespace
This _does not_ implement SkupperVersioner: as it calls TokenCreate and LinkCreate, the logic for version-specific behavior should be on them. For all Connect knows, the two sites could even be on different versions. Keep Connect simple.
type LinkCreate ¶
type LinkCreate struct {
Namespace *f2k8s.Namespace
// The token file to be used on the link creation
File string
Name string
Cost string
frame2.DefaultRunDealer
SkupperVersionerDefault
}
func (*LinkCreate) Execute ¶
func (lc *LinkCreate) Execute() error
func (LinkCreate) GetNamespace ¶
func (l LinkCreate) GetNamespace() string
TODO: replace this by f2k8s.Namespace
type ManifestMatchesDeployment ¶
type ManifestMatchesDeployment struct {
Path string
Namespace *f2k8s.Namespace
Ctx context.Context
frame2.DefaultRunDealer
frame2.Log
SkupperVersionerDefault
}
This will get the deployment information on Skupper as currently deployed on the namespace (its images), and then compare it against the manifest, to ensure it matches.
After an install or an upgrade, you may need to retry this action a few times, to ensure the deployment stabilized
func (ManifestMatchesDeployment) GetNamespace ¶
func (m ManifestMatchesDeployment) GetNamespace() string
TODO: replace this by f2k8s.Namespace
func (ManifestMatchesDeployment) Validate ¶
func (m ManifestMatchesDeployment) Validate() error
type NetworkStatusConfigMap ¶
type NetworkStatusConfigMap struct {
Namespace *f2k8s.Namespace
SiteName string
*frame2.DefaultRunDealer
}
INCOMPLETE TODO
func (NetworkStatusConfigMap) Validate ¶
func (n NetworkStatusConfigMap) Validate() error
type OutgoingLinkCheck ¶
type OutgoingLinkCheck struct {
Namespace *f2k8s.Namespace
Name string
Cost string
frame2.DefaultRunDealer
frame2.Log
}
func (*OutgoingLinkCheck) Validate ¶
func (o *OutgoingLinkCheck) Validate() error
type RouterCheck ¶
type RouterCheck struct {
Namespace *f2k8s.Namespace
Mode string
LogLevel string
SiteName string
Ctx context.Context
Return *interface{}
frame2.DefaultRunDealer
frame2.Log
}
func (*RouterCheck) Validate ¶
func (r *RouterCheck) Validate() error
type SkupperCliPathSetter ¶
type SkupperDelete ¶
type SkupperDelete struct {
Namespace *f2k8s.Namespace
Context context.Context
frame2.DefaultRunDealer
}
func (*SkupperDelete) Execute ¶
func (s *SkupperDelete) Execute() error
TODO: remove autodebug TODO: using old version on post-subfinalizer-hook with UPGRADE_AND_FINALIZE
type SkupperExpose ¶
type SkupperExpose struct {
Namespace *f2k8s.Namespace
Type string
Name string
// TODO. Change this into some constants, so it can be reused and translated by different backing
// implementations.
// A string that will compile into a Regex, which matches the command stderr to define an
// expected failure.
FailureReason string
Address string
Headless bool
Protocol string
Ports []int
PublishNotReadyAddress bool
TargetPorts []string
EnableTls bool // deprecated since 1.3
GenerateTlsSecrets bool
AutoTeardown bool
frame2.DefaultRunDealer
SkupperVersionerDefault
}
func (SkupperExpose) Execute ¶
func (s SkupperExpose) Execute() error
func (SkupperExpose) GetNamespace ¶
func (s SkupperExpose) GetNamespace() string
TODO: relace this with f2k8s.Namespace
type SkupperExpose1_2 ¶
type SkupperExpose1_2 struct {
Namespace *f2k8s.Namespace
Type string
Name string
// TODO. Change this into some constants, so it can be reused and translated by different backing
// implementations.
// A string that will compile into a Regex, which matches the command stderr to define an
// expected failure.
FailureReason string
Address string
Headless bool
Protocol string
Ports []int
PublishNotReadyAddress bool
TargetPorts []string
EnableTls bool
AutoTeardown bool
frame2.DefaultRunDealer
}
TODO: rename this to CLI; make a general type that can call the CLI, create annotations, use Ansible or site controller, per configuration.
func (SkupperExpose1_2) Execute ¶
func (se SkupperExpose1_2) Execute() error
func (SkupperExpose1_2) Teardown ¶
func (se SkupperExpose1_2) Teardown() frame2.Executor
type SkupperExpose1_3 ¶
type SkupperExpose1_3 struct {
Namespace *f2k8s.Namespace
Type string
Name string
// TODO. Change this into some constants, so it can be reused and translated by different backing
// implementations.
// A string that will compile into a Regex, which matches the command stderr to define an
// expected failure.
FailureReason string
Address string
Headless bool
Protocol string
Ports []int
PublishNotReadyAddress bool
TargetPorts []string
EnableTls bool
GenerateTlsSecrets bool
AutoTeardown bool
frame2.DefaultRunDealer
}
TODO: rename this to CLI; make a general type that can call the CLI, create annotations, use Ansible or site controller, per configuration.
func (SkupperExpose1_3) Execute ¶
func (se SkupperExpose1_3) Execute() error
func (SkupperExpose1_3) Teardown ¶
func (se SkupperExpose1_3) Teardown() frame2.Executor
type SkupperInfo ¶
type SkupperInfo struct {
Namespace *f2k8s.Namespace
Result SkupperInfoContents
Ctx context.Context
frame2.DefaultRunDealer
frame2.Log
}
Gets various information about Skupper TODO: add ConfigMaps, skmanage executions
func (*SkupperInfo) Validate ¶
func (s *SkupperInfo) Validate() error
type SkupperInfoContents ¶
type SkupperInfoContents struct {
Images SkupperManifestContent
PodImages SkupperManifestContent
HasRouter bool
HasServiceController bool
HasPrometheus bool
RouterDeployment *appsv1.Deployment
ServiceControllerDeployment *appsv1.Deployment
PrometheusDeployment *appsv1.Deployment
AllPods *corev1.PodList
}
type SkupperInstallSimple ¶
type SkupperInstallSimple struct {
Namespace *f2k8s.Namespace
EnableConsole bool
frame2.DefaultRunDealer
}
A Skupper installation that uses some default configurations. It cannot be configured. For a configurable version, use SkupperInstall, instead.
func (SkupperInstallSimple) Execute ¶
func (sis SkupperInstallSimple) Execute() error
type SkupperManifest ¶
type SkupperManifest struct {
// Path to the manifest.json file; if not provided, it will be
// searched first on the test root, then on the source root.
//
// Starting with 1.5, if the Path is empty, the command
// `skupper version manifest` will be executed to generate a
// manifest file, instead of searching for it.
Path string
SkipComparison bool
Expected SkupperManifestContent
Result *SkupperManifestContent
frame2.DefaultRunDealer
frame2.Log
SkupperVersionerDefault
}
SkupperManifest returns the content of the requested manifest.json file as a SkupperManifestContent.
If data is provided in Expected, it also checks that all of its items match the actual file's contents.
The check is only on the actual images, as strings, including the tags. It has no intelligence to add or remove :latest from a tag, for example.
The Repository field is not used in this verification.
Note this frame never accesses a cluster; the verification is on the manifest.json (provided or generated from skupper binary); the comparison is against a SkupperManifestContent generated elsewhere and provided to it
func (SkupperManifest) GetNamespace ¶
func (m SkupperManifest) GetNamespace() string
TODO: replace this by f2k8s.Namespace
func (SkupperManifest) Validate ¶
func (m SkupperManifest) Validate() error
type SkupperManifestContent ¶
type SkupperManifestContent struct {
Images []SkupperManifestContentImage
Variables map[string]string
}
type SkupperServiceBind ¶
type SkupperServiceBind struct {
Namespace *f2k8s.Namespace
Name string
TargetType string
TargetName string
Protocol string
PublishNotReadyAddress bool
TargetPort []string
AutoTeardown bool
Runner *frame2.Run
}
func (SkupperServiceBind) Execute ¶
func (ssb SkupperServiceBind) Execute() error
TODO move implemetnation to CLI, make this one base-independent
func (SkupperServiceBind) Teardown ¶
func (ssb SkupperServiceBind) Teardown() frame2.Executor
type SkupperServiceCreate ¶
type SkupperServiceCreate struct {
Namespace *f2k8s.Namespace
Name string
Port []string
Aggregate string
EnableTls bool
EventChannel bool
Protocol string
Runner *frame2.Run
AutoTeardown bool
}
func (SkupperServiceCreate) Execute ¶
func (ssc SkupperServiceCreate) Execute() error
TODO move implemetnation to CLI, make this one base-independent
func (SkupperServiceCreate) Teardown ¶
func (ssc SkupperServiceCreate) Teardown() frame2.Executor
type SkupperServiceDelete ¶
type SkupperServiceDelete struct {
Namespace *f2k8s.Namespace
ArgName string
Runner *frame2.Run
Wait time.Duration
Ctx context.Context
}
func (SkupperServiceDelete) Execute ¶
func (ssd SkupperServiceDelete) Execute() error
type SkupperServiceUnbind ¶
type SkupperServiceUnbind struct {
Namespace *f2k8s.Namespace
Name string
TargetType string
TargetName string
Runner *frame2.Run
}
func (SkupperServiceUnbind) Execute ¶
func (ssub SkupperServiceUnbind) Execute() error
TODO move implemetnation to CLI, make this one base-independent
type SkupperUnLink ¶
type SkupperUnLink struct {
Name string
From *f2k8s.Namespace
To *f2k8s.Namespace
Ctx context.Context
Runner *frame2.Run
frame2.Log
}
func (SkupperUnLink) Execute ¶
func (s SkupperUnLink) Execute() error
type SkupperUnexpose ¶
type SkupperUnexpose struct {
Namespace *f2k8s.Namespace
Type string
Name string
Address string
Runner *frame2.Run
}
func (SkupperUnexpose) Execute ¶
func (su SkupperUnexpose) Execute() error
type SkupperUpgradable ¶
This interface should be used only on components that install skupper (such as SkupperInit). It indicates to the upgrade disruptors that a step and/or namespace is a candidate for running skupper upgrade
type SkupperUpgrade ¶
type SkupperUpgrade struct {
Runner *frame2.Run
Namespace *f2k8s.Namespace
ForceRestart bool
SkipVersion bool
Wait time.Duration
Ctx context.Context
// If true, skips checking the images against the manifest. If
// false and no manifest available, panic
SkipManifest bool
// Location of the manifest file to be used on the manifest/image
// tag check. If empty, check: (?)
//
// Before 1.5:
// - Current dir (ie, etc package dir)
// - Source root dir
//
// Since 1.5:
// - Execute skupper version manifest to generate a manifest.json file
ManifestFile string
// If true, the upgrade output will be inspected, to ensure the message
// "No update required in 'namespace'" was not shown.
//
// In practice, it makes it an error to try to upgrade a site that is
// already in the right version
CheckUpdateRequired bool
}
func (SkupperUpgrade) Execute ¶
func (s SkupperUpgrade) Execute() error
type SkupperVersioner ¶
type SkupperVersioner interface {
SetSkupperVersion(version string)
GetSkupperVersion() string
GetNamespace() string
}
An action that implements SkupperVersioner is expected to act differently for different Skupper versions. This can be used, for example, when flags are added or removed to the cli.
type SkupperVersionerDefault ¶
type SkupperVersionerDefault struct {
// You can define this value directly, if you want to set its
// value directly on a frame. For acquiring its value, though,
// use GetSkupperVersion() instead, as it may do special
// manipulation.
SkupperVersion string
}
SkupperVersionerDefault is an incomplete implementation of SkupperVersioner; you still need to define GetNamespace()
Check for f2k8s.Namespace for that
func (SkupperVersionerDefault) GetSkupperVersion ¶
func (s SkupperVersionerDefault) GetSkupperVersion() string
If explicitly set, returns its s.SkupperVersion. Otherwise, returns the value of SKUPPER_TEST_VERSION, which may be the empty string
func (*SkupperVersionerDefault) SetSkupperVersion ¶
func (s *SkupperVersionerDefault) SetSkupperVersion(version string)
func (SkupperVersionerDefault) WhichSkupperVersion ¶
func (s SkupperVersionerDefault) WhichSkupperVersion(candidates []string) string
Given a list of versions, WhichSkupperVersion will return the one that is more appropriate to be used, given its current SkupperVersion value.
Namely:
- If its SkupperVersion is empty, always return empty, regardless of the values of the candidates
- If its SkupperVersion is greater than all presented candidates, return empty, indicating that the most recent version should be used
- If its SkupperVersion is lower than all presented candidates, return the candidate with the lowest version
- If its SkupperVersion stands in between two versions, return the lower version of the two
The way SkupperVersioner is to be used, changes are always introduced on the sub action named after the version that introduces the change. So, if something changed on 1.4, WhichSkupperVersion receives the candidates 1.2 and 1.4, and its current SkupperVersion is 1.3, it will return 1.2 (that is, the version that 1.3 is compatible with, as it does not have the changes from 1.4).
If the version is empty on the struct, WhichSkupperVersion will check the environment variable SKUPPER_TEST_VERSION, and use its value. Otherwise, it will return empty, which means 'latest' version.
type Status ¶
type Status struct {
Namespace *f2k8s.Namespace
Ctx context.Context
Verbose bool
CheckStatus bool
Enabled bool
// Only TotalConn is supported for non-verbose
CheckConnectionCounts bool
TotalConn int
DirectConn int
IndirectConn int
// TODO non-zero count is still not implemented
CheckServiceCount bool
ExposedServices int
// Mode and Sitename checks are not supported for
// non-verbose
Mode string
SiteName string
// Policies check is not yet implemetned for
// non-verbose TODO
CheckPolicies bool
Policies bool
frame2.Log
frame2.DefaultRunDealer
SkupperVersionerDefault
}
With only a namespace configured, this command will simply execute skupper status. If Verbose is set, the -v flag is added to that execution.
If the other fields are set, different verifications will be done on the output of the command, ensuring it matches the expectation.
func (Status) Execute ¶
TODO: move this to a new SkupperInstallVAN or something; leave SkupperInstall as a SkupperOp that calls either that or CliSkupperInit
func (Status) GetNamespace ¶
TODO: replace this by f2k8s.Namespace
type TokenCheck ¶
type TokenCheck struct {
Namespace *f2k8s.Namespace
FileName string
// If Name is not provided, it will be derived from the token
// file. If both provided, TokenCheck will ensure they match
Name string
Expiry string
Password string
TokenType string
Uses string
// By default, on the comparison between the Expiry above and
// what's on the secret, the following rules will be followed:
//
// - If both are below 60s, they'll be considered equivalent
// - Otherwise, if the difference between them is less than 20%,
// they'll be considered equivalent
//
// This is to allow for
//
// - clock differences between computer running the test and the cluster
// - time between creating a token and calling TokenCheck
//
// If MaxExpiryDelta is set, however, a fixed delta will be used
// for the comparison
MaxExpiryDelta time.Duration
CheckDefaults bool
frame2.DefaultRunDealer
frame2.Log
}
Verify that a Token (the file and its Kubernetes representation as a secret) matches some expectations.
func (TokenCheck) Validate ¶
func (tc TokenCheck) Validate() error
type TokenCreate ¶
type TokenCreate struct {
Namespace *f2k8s.Namespace
Expiry string
Name string
Password string
TokenType string
Uses string
FileName string
// By default, the token file is automatically removed at the
// end of the test
SkipTearDown bool
frame2.DefaultRunDealer
frame2.Log
SkupperVersionerDefault
}
func (*TokenCreate) Execute ¶
func (tc *TokenCreate) Execute() error
func (TokenCreate) GetNamespace ¶
func (t TokenCreate) GetNamespace() string
TODO: replace this by f2k8s.Namespace
func (*TokenCreate) Teardown ¶
func (t *TokenCreate) Teardown() frame2.Executor
type ValidateSkupperAvailable ¶
type ValidateSkupperAvailable struct {
Namespace *f2k8s.Namespace
Ctx context.Context
MaxWait time.Duration // If not set, defaults to types.DefaultTimeoutDuration*2
SkipWait bool
SkipStatus bool
frame2.DefaultRunDealer
frame2.Log
}
func (ValidateSkupperAvailable) Validate ¶
func (v ValidateSkupperAvailable) Validate() error
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
The files in this package contains two types of strucs:
|
The files in this package contains two types of strucs: |