config

package
v0.5.3 Latest Latest
Warning

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

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

Documentation

Overview

Package config - Is the package for storing adapter configuration

Index

Constants

View Source
const (
	// HelmChart is the key name used in the map to store Helm Chart name
	HelmChart = "helm-chart"

	// NSMICMPResponderSampleApp is the name for the NSM ICMP Responder
	// Sample Application
	NSMICMPResponderSampleApp = "nsm-icmp-responder-sample-app"
	// NSMVPPICMPResponderSampleApp is the name for the NSM VPP ICMP
	// Responder Sample Application
	NSMVPPICMPResponderSampleApp = "nsm-vpp-icmp-responder-sample-app"
	// NSMVPMSampleApp is the name for the NSM VPM Sample Application
	NSMVPMSampleApp = "nsm-vpn-sample-app"
)
View Source
const (
	// ErrEmptyConfigCode represents the error when the configuration is either empty
	// or is invalid
	ErrEmptyConfigCode = "1000"

	// ErrGetLatestReleasesCode represents the error which occurs during the process of getting
	// latest releases
	ErrGetLatestReleasesCode = "1001"

	// ErrGetLatestReleaseNamesCode represents the error which occurs during the process of extracting
	// release names
	ErrGetLatestReleaseNamesCode = "1002"
)

Variables

View Source
var (
	// NSMMeshOperation is the default name for the install
	// and uninstall commands on the nsm mesh
	NSMMeshOperation = strings.ToLower(smp.ServiceMesh_NETWORK_SERVICE_MESH.Enum().String())

	// Config is the collection of ServerConfig, MeshConfig and ProviderConfig
	Config = configprovider.Options{
		ServerConfig:   ServerConfig,
		MeshSpec:       MeshSpec,
		ProviderConfig: ProviderConfig,
		Operations:     Operations,
	}

	// ServerConfig is the configuration for the gRPC server
	ServerConfig = map[string]string{
		"name":     smp.ServiceMesh_NETWORK_SERVICE_MESH.Enum().String(),
		"port":     "10004",
		"type":     "adapter",
		"traceurl": status.None,
	}

	// MeshSpec is the spec for the service mesh associated with this adapter
	MeshSpec = map[string]string{
		"name":    smp.ServiceMesh_NETWORK_SERVICE_MESH.Enum().String(),
		"status":  status.None,
		"version": status.None,
	}

	// ProviderConfig is the config for the configuration provider
	ProviderConfig = map[string]string{
		configprovider.FilePath: configRootPath,
		configprovider.FileType: "yaml",
		configprovider.FileName: "nsm",
	}

	// KubeConfig - Controlling the kubeconfig lifecycle with viper
	KubeConfig = map[string]string{
		configprovider.FilePath: configRootPath,
		configprovider.FileType: "yaml",
		configprovider.FileName: "kubeconfig",
	}

	// Operations represents the set of valid operations that are available
	// to the adapter
	Operations = getOperations(common.Operations)
)
View Source
var (
	// ErrEmptyConfig error is the error when config is invalid
	ErrEmptyConfig = errors.New(ErrEmptyConfigCode, errors.Alert, []string{"Config is empty"}, []string{}, []string{}, []string{})
)

Functions

func ErrGetLatestReleaseNames

func ErrGetLatestReleaseNames(err error) error

ErrGetLatestReleaseNames is the error for fetching nsm-mesh releases

func ErrGetLatestReleases

func ErrGetLatestReleases(err error) error

ErrGetLatestReleases is the error for fetching nsm-mesh releases

func New

func New(provider string) (config.Handler, error)

New creates a new config instance

func NewKubeconfigBuilder

func NewKubeconfigBuilder(provider string) (config.Handler, error)

NewKubeconfigBuilder returns a config handler based on the provider

Valid prividers are "viper" and "in-mem"

func RootPath

func RootPath() string

RootPath returns the config root path for the adapter

Types

type Asset

type Asset struct {
	Name        string `json:"name,omitempty"`
	State       string `json:"state,omitempty"`
	DownloadURL string `json:"browser_download_url,omitempty"`
}

Asset describes the github release asset object

type Release

type Release struct {
	ID      int             `json:"id,omitempty"`
	TagName string          `json:"tag_name,omitempty"`
	Name    adapter.Version `json:"name,omitempty"`
	Draft   bool            `json:"draft,omitempty"`
	Assets  []*Asset        `json:"assets,omitempty"`
}

Release is used to save the release informations

func GetLatestReleases

func GetLatestReleases(releases uint) ([]*Release, error)

GetLatestReleases fetches the latest releases from the nsm mesh repository

Jump to

Keyboard shortcuts

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