utils

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2021 License: Apache-2.0 Imports: 21 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CatalogConnectorServiceAddressKey string = "CATALOG_CONNECTOR_URL"
	VaultAddressKey                   string = "VAULT_ADDRESS"
	VaultModulesRole                  string = "VAULT_MODULES_ROLE"
)

Attributes that are defined in a config map or the runtime environment

View Source
const DefaultBlueprintNamespace = "fybrik-blueprints"

BlueprintNamespace defines a namespace where blueprints and associated resources will be allocated

View Source
const DefaultControllerNamespace = "fybrik-system"

Controller namespace defines a namespace where

Variables

This section is empty.

Functions

func CreateStepName

func CreateStepName(moduleName string, assetID string) string

Create a name for a step in a blueprint. Since this is part of the name of a release, this should be done in a central location to make testing easier

func CreateUnstructured

func CreateUnstructured(group, version, kind, name, namespace string) *unstructured.Unstructured

CreateUnstructured creates a new Unstructured runtime object

func DefaultTestConfiguration

func DefaultTestConfiguration(t ginkgo.GinkgoTInterface)

func GenerateModuleEndpointFQDN

func GenerateModuleEndpointFQDN(releaseName string, blueprintNamespace string) string

Generate fqdn for a module

func GetApplicationNamespace added in v0.5.0

func GetApplicationNamespace() string

func GetAuthPath

func GetAuthPath(authPath string) string

GetAuthPath returns the auth method path to use It is of the form v1/auth/<auth path>/login TODO - Different credentials for different data flows (read, write, delete)

func GetBatchTransferNamespace added in v0.5.0

func GetBatchTransferNamespace() string

func GetBlueprintNamespace added in v0.5.0

func GetBlueprintNamespace() string

func GetControllerNamespace added in v0.5.0

func GetControllerNamespace() string

func GetDataCatalogServiceAddress

func GetDataCatalogServiceAddress() string

GetDataCatalogServiceAddress returns the address where data catalog is running

func GetModuleCapabilities added in v0.5.0

func GetModuleCapabilities(module *app.FybrikModule, requestedCapability app.CapabilityType) (bool, []app.ModuleCapability)

GetModuleCapabilities checks if the requested capability is supported by the module. If so it returns the ModuleCapability structure. There could be more than one, since multiple structures could exist with the same CapabilityType but different protocols, dataformats and/or actions.

func GetModulesRole

func GetModulesRole() string

GetModulesRole returns the modules assigned authentification role for accessing dataset credentials

func GetProtocol

func GetProtocol(info *dc.DatasetDetails) (string, error)

GetProtocol returns the existing data protocol

func GetReleaseName

func GetReleaseName(applicationName string, namespace string, instanceName string) string

Generating release name based on blueprint module

func GetReleaseNameByStepName

func GetReleaseNameByStepName(applicationName string, namespace string, moduleInstanceName string) string

Generate release name from blueprint module name

func GetStreamTransferNamespace added in v0.5.0

func GetStreamTransferNamespace() string

func GetSystemNamespace

func GetSystemNamespace() string

GetSystemNamespace returns the namespace of control plane

func GetVaultAddress

func GetVaultAddress() string

GetVaultAddress returns the address and port of the vault system, which is used for managing data set credentials

func Hash

func Hash(value string, hashLength int) string

Hash generates a name based on the unique identifier

func HelmConformName

func HelmConformName(name string) string

Helm has stricter restrictions than K8s and restricts release names to 53 characters

func IsDenied

func IsDenied(actionName string) bool

IsDenied returns true if the data access is denied

func K8sConformName

func K8sConformName(name string) string

Some k8s objects only allow for a length of 63 characters. This method shortens the name keeping a prefix and using the last 5 characters of the new name for the hash of the postfix.

func ListeningAddress

func ListeningAddress(port int) string

func NewScheme

func NewScheme(g *gomega.WithT) *runtime.Scheme

Creates a scheme that can be used in unit tests The scheme will have the core and batch apis from K8s registered as well as the app and motion apis from Fybrik. This function can be tested with a gomega environment if passed or otherwise (if nil is passed) it will ignore tests.

func PrintStructure

func PrintStructure(argStruct interface{}, log logr.Logger, argName string)

PrintStructure prints the structure in a textual format

func SetIfNotSet

func SetIfNotSet(key string, value string, t ginkgo.GinkgoTInterface)

func ShortenedName

func ShortenedName(name string, maxLength int, hashLength int) string

This function shortens a name to the maximum length given and uses rest of the string that is too long as hash that gets added to the valid name.

func StructToMap

func StructToMap(data interface{}) (map[string]interface{}, error)

StructToMap converts a struct to a map using JSON marshal

func SupportsInterface

func SupportsInterface(array []*app.InterfaceDetails, element *app.InterfaceDetails) bool

SupportsInterface returns true iff the protocol/format list contains the given protocol/format interface

Types

type UnstructuredAsLabels

type UnstructuredAsLabels struct {
	Data *unstructured.Unstructured
}

UnstructuredAsLabels is an implementation of labels.Labels interface which allows us to take advantage of k8s labels library for the purposes of evaluating fail and success conditions

func (UnstructuredAsLabels) Get

func (c UnstructuredAsLabels) Get(label string) string

Get returns the value for the provided label.

func (UnstructuredAsLabels) Has

func (c UnstructuredAsLabels) Has(label string) bool

Has returns whether the provided label exists.

Jump to

Keyboard shortcuts

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