deployers

package
v0.0.0-...-0e9b45f Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2022 License: Apache-2.0 Imports: 19 Imported by: 2

Documentation

Index

Constants

View Source
const (
	CONFLICT_MESSAGE = "Concurrent modification to resource detected"
	CONFLICT_CODE    = 153
	DEFAULT_ATTEMPTS = 3
	DEFAULT_INTERVAL = 1 * time.Second
)
View Source
const (
	SOURCE_WSKPROPS         = ".wskprops"
	SOURCE_WHISK_PROPERTIES = "whisk.properties"
	SOURCE_DEFAULT_VALUE    = "wskdeploy default"
)

Possible sources for config info (e.g., API Host, Auth Key, Namespace)

Variables

View Source
var CreateNewClient = func(config_input *whisk.Config) (*whisk.Client, error) {
	var netClient = &http.Client{
		Timeout: time.Second * utils.DEFAULT_HTTP_TIMEOUT,
	}
	return whisk.NewClient(netClient, config_input)
}
View Source
var GetCommandLineFlags = func() (string, string, string, string, string, string) {
	return utils.Flags.ApiHost, utils.Flags.Auth, utils.Flags.Namespace, utils.Flags.Key, utils.Flags.Cert, utils.Flags.ApigwAccessToken
}

TODO implement a command line flag for APIGW_TENANT_ID

View Source
var GetPropertyValue = func(prop PropertyValue, newValue string, source string) PropertyValue {
	if len(prop.Value) == 0 && len(newValue) > 0 {
		prop.Value = newValue
		prop.Source = source
	}
	return prop
}

Note buyer beware this function returns the existing value, and only if there is not an existing value does it set it to newValue. We should perhaps rename this function as it implies that it is a getter, when this is not strictly true

View Source
var GetWskPropFromWhiskProperty = func(pi whisk.Properties) (*whisk.Wskprops, error) {
	return whisk.GetWskPropFromWhiskProperty(pi)
}
View Source
var GetWskPropFromWskprops = func(pi whisk.Properties, proppath string) (*whisk.Wskprops, error) {
	return whisk.GetWskPropFromWskprops(pi, proppath)
}

Functions

func AddAdditionalHeader

func AddAdditionalHeader(hdrName string, hdrValue string)

func NewWhiskConfig

func NewWhiskConfig(proppath string, deploymentPath string, manifestPath string) (*whisk.Config, error)

we are reading openwhisk credentials (apihost, namespace, and auth) in the following precedence order: (1) wskdeploy command line `wskdeploy --apihost --namespace --auth` (2) deployment file (3) manifest file (4) .wskprops we are following the same precedence order for APIGW_ACCESS_TOKEN but as a separate thread as APIGW_ACCESS_TOKEN only needed for APIs

Types

type DeploymentPackage

type DeploymentPackage struct {
	Package      *whisk.Package
	Dependencies map[string]dependencies.DependencyRecord
	Actions      map[string]utils.ActionRecord
	Sequences    map[string]utils.ActionRecord
	Inputs       parsers.PackageInputs
}

func NewDeploymentPackage

func NewDeploymentPackage() *DeploymentPackage

type DeploymentProject

type DeploymentProject struct {
	Packages          map[string]*DeploymentPackage
	Triggers          map[string]*whisk.Trigger
	Rules             map[string]*whisk.Rule
	Apis              map[string]*whisk.ApiCreateRequest
	ApiOptions        map[string]*whisk.ApiCreateRequestOptions
	SwaggerApi        *whisk.ApiCreateRequest
	SwaggerApiOptions *whisk.ApiCreateRequestOptions
}

func NewDeploymentProject

func NewDeploymentProject() *DeploymentProject

type DeploymentReader

type DeploymentReader struct {
	DeploymentDescriptor *parsers.YAML
	// contains filtered or unexported fields
}

func NewDeploymentReader

func NewDeploymentReader(serviceDeployer *ServiceDeployer) *DeploymentReader

func (*DeploymentReader) BindAssets

func (reader *DeploymentReader) BindAssets() error

Update entities with deployment settings

func (*DeploymentReader) HandleYaml

func (reader *DeploymentReader) HandleYaml() error

Wrapper parser to handle yaml dir

type ManifestReader

type ManifestReader struct {
	IsUndeploy bool
	// contains filtered or unexported fields
}

func NewManifestReader

func NewManifestReader(serviceDeployer *ServiceDeployer) *ManifestReader

func (*ManifestReader) HandleYaml

func (reader *ManifestReader) HandleYaml(manifestParser *parsers.YAMLParser, manifest *parsers.YAML, managedAnnotations whisk.KeyValue) error

Wrapper parser to handle yaml dir

func (*ManifestReader) InitPackages

func (reader *ManifestReader) InitPackages(manifestParser *parsers.YAMLParser, manifest *parsers.YAML, managedAnnotations whisk.KeyValue) error

func (*ManifestReader) ParseManifest

func (deployer *ManifestReader) ParseManifest() (*parsers.YAML, *parsers.YAMLParser, error)

func (*ManifestReader) SetActions

func (reader *ManifestReader) SetActions(actions []utils.ActionRecord) error

func (*ManifestReader) SetApis

func (reader *ManifestReader) SetApis(ar []*whisk.ApiCreateRequest, responses map[string]*whisk.ApiCreateRequestOptions) error

func (*ManifestReader) SetDependencies

func (reader *ManifestReader) SetDependencies(deps map[string]dependencies.DependencyRecord) error

func (*ManifestReader) SetPackages

func (reader *ManifestReader) SetPackages(packages map[string]*whisk.Package, inputs map[string]parsers.PackageInputs) error

func (*ManifestReader) SetRules

func (reader *ManifestReader) SetRules(rules []*whisk.Rule) error

func (*ManifestReader) SetSequences

func (reader *ManifestReader) SetSequences(sequences []utils.ActionRecord) error

func (*ManifestReader) SetSwaggerApi

func (reader *ManifestReader) SetSwaggerApi(api *whisk.ApiCreateRequest, response *whisk.ApiCreateRequestOptions) error

func (*ManifestReader) SetTriggers

func (reader *ManifestReader) SetTriggers(triggers []*whisk.Trigger) error

type PropertyValue

type PropertyValue struct {
	Value  string
	Source string
}

type ServiceDeployer

type ServiceDeployer struct {
	ProjectName   string
	ProjectInputs map[string]parsers.Parameter
	Deployment    *DeploymentProject
	Client        *whisk.Client

	Preview           bool
	Report            bool
	ManifestPath      string
	ProjectPath       string
	DeploymentPath    string
	ClientConfig      *whisk.Config
	DependencyMaster  map[string]dependencies.DependencyRecord
	ManagedAnnotation whisk.KeyValue
	// contains filtered or unexported fields
}

ServiceDeployer defines a prototype service deployer. It should do the following:

  1. Collect information from the manifest file (if any)
  2. Collect information from the deployment file (if any)
  3. Collect information about the source code files in the working directory
  4. Create a deployment plan to create OpenWhisk service

func NewServiceDeployer

func NewServiceDeployer() *ServiceDeployer

NewServiceDeployer is a Factory to create a new ServiceDeployer

func (*ServiceDeployer) Check

func (deployer *ServiceDeployer) Check()

Check if the manifest yaml could be parsed by Manifest Parser. Check if the deployment yaml could be parsed by Manifest Parser.

func (*ServiceDeployer) ConstructDeploymentPlan

func (deployer *ServiceDeployer) ConstructDeploymentPlan() error

func (*ServiceDeployer) ConstructUnDeploymentPlan

func (deployer *ServiceDeployer) ConstructUnDeploymentPlan() (*DeploymentProject, error)

func (*ServiceDeployer) Deploy

func (deployer *ServiceDeployer) Deploy() error

Use reflect util to deploy everything in this service deployer TODO(TBD): according to some planning?

func (*ServiceDeployer) DeployActions

func (deployer *ServiceDeployer) DeployActions() error

Deploy Actions into OpenWhisk

func (*ServiceDeployer) DeployApis

func (deployer *ServiceDeployer) DeployApis() error

Deploy Apis into OpenWhisk

func (*ServiceDeployer) DeployDependencies

func (deployer *ServiceDeployer) DeployDependencies() error

func (*ServiceDeployer) DeployPackages

func (deployer *ServiceDeployer) DeployPackages() error

func (*ServiceDeployer) DeployRules

func (deployer *ServiceDeployer) DeployRules() error

Deploy Rules into OpenWhisk

func (*ServiceDeployer) DeploySequences

func (deployer *ServiceDeployer) DeploySequences() error

Deploy Sequences into OpenWhisk

func (*ServiceDeployer) DeployTriggers

func (deployer *ServiceDeployer) DeployTriggers() error

Deploy Triggers into OpenWhisk

func (*ServiceDeployer) RefreshManagedActions

func (deployer *ServiceDeployer) RefreshManagedActions(packageName string, ma map[string]interface{}) error

TODO() display "update" | "synced" messages pre/post

func (*ServiceDeployer) RefreshManagedEntities

func (deployer *ServiceDeployer) RefreshManagedEntities(maValue whisk.KeyValue) error

TODO() display "update" | "synced" messages pre/post

func (*ServiceDeployer) RefreshManagedPackages

func (deployer *ServiceDeployer) RefreshManagedPackages(ma map[string]interface{}) error

TODO() display "update" | "synced" messages pre/post

func (*ServiceDeployer) RefreshManagedPackagesWithDependencies

func (deployer *ServiceDeployer) RefreshManagedPackagesWithDependencies(ma map[string]interface{}) error

func (*ServiceDeployer) RefreshManagedRules

func (deployer *ServiceDeployer) RefreshManagedRules(ma map[string]interface{}) error

TODO() display "update" | "synced" messages pre/post

func (*ServiceDeployer) RefreshManagedTriggers

func (deployer *ServiceDeployer) RefreshManagedTriggers(ma map[string]interface{}) error

TODO() display "update" | "synced" messages pre/post

func (*ServiceDeployer) SetPackageActionsAndSequences

func (deployer *ServiceDeployer) SetPackageActionsAndSequences(projectName string) error

capture all the actions/sequences with "whisk-managed" annotations and matching project name

func (*ServiceDeployer) SetProjectApis

func (deployer *ServiceDeployer) SetProjectApis(projectName string) error

func (*ServiceDeployer) SetProjectAssets

func (deployer *ServiceDeployer) SetProjectAssets(projectName string) error

based on the project name set in "whisk-managed" annotation calculate and determine list of packages, actions, sequences, rules and triggers

func (*ServiceDeployer) SetProjectDependencies

func (deployer *ServiceDeployer) SetProjectDependencies(projectName string) ([]*DeploymentProject, error)

derive a map of dependent packages using "whisk-managed" annotation "whisk-managed" annotation has a list of dependent packages in "projectDeps" projectDeps is a list of key value pairs with its own "whisk-managed" annotation for a given package, get the list of dependent packages for each dependent package, determine whether any other package is using it or not if not, collect a list of actions, sequences, triggers, and rules of the dependent package and delete them in order following by deleting the package itself

func (*ServiceDeployer) SetProjectPackages

func (deployer *ServiceDeployer) SetProjectPackages(projectName string) error

capture all the packages with "whisk-managed" annotations and matching project name

func (*ServiceDeployer) SetProjectRules

func (deployer *ServiceDeployer) SetProjectRules(projectName string) error

capture all the rules with "whisk-managed" annotations and matching project name

func (*ServiceDeployer) SetProjectTriggers

func (deployer *ServiceDeployer) SetProjectTriggers(projectName string) error

capture all the triggers with "whisk-managed" annotations and matching project name

func (*ServiceDeployer) UnDeploy

func (deployer *ServiceDeployer) UnDeploy(verifiedPlan *DeploymentProject) error

func (*ServiceDeployer) UnDeployActions

func (deployer *ServiceDeployer) UnDeployActions(deployment *DeploymentProject) error

DeployActions into OpenWhisk

func (*ServiceDeployer) UnDeployApis

func (deployer *ServiceDeployer) UnDeployApis(deployment *DeploymentProject) error

func (*ServiceDeployer) UnDeployDependencies

func (deployer *ServiceDeployer) UnDeployDependencies() error

func (*ServiceDeployer) UnDeployPackages

func (deployer *ServiceDeployer) UnDeployPackages(deployment *DeploymentProject) error

func (*ServiceDeployer) UnDeployProject

func (deployer *ServiceDeployer) UnDeployProject() error

func (*ServiceDeployer) UnDeployProjectAssets

func (deployer *ServiceDeployer) UnDeployProjectAssets() error

func (*ServiceDeployer) UnDeployRules

func (deployer *ServiceDeployer) UnDeployRules(deployment *DeploymentProject) error

Deploy Rules into OpenWhisk

func (*ServiceDeployer) UnDeploySequences

func (deployer *ServiceDeployer) UnDeploySequences(deployment *DeploymentProject) error

func (*ServiceDeployer) UnDeployTriggers

func (deployer *ServiceDeployer) UnDeployTriggers(deployment *DeploymentProject) error

Deploy Triggers into OpenWhisk

func (*ServiceDeployer) UndeploySwaggerApis

func (deployer *ServiceDeployer) UndeploySwaggerApis(deployment *DeploymentProject) error

func (*ServiceDeployer) UpdatePackageInputs

func (deployer *ServiceDeployer) UpdatePackageInputs() error

Jump to

Keyboard shortcuts

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