configs

package
v0.4.2 Latest Latest
Warning

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

Go to latest
Published: Dec 21, 2023 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OperatorNameAPI          = "Api"
	OperatorNameArgo         = "Argo"
	OperatorNameBase         = "Base"
	OperatorNameCluster      = "Cluster"
	OperatorNameArtifactRepo = "Repo"
	OperatorNameRuntime      = "Runtime"
)
View Source
const (
	ENV_CFG_NAMESPACE      = "NATUESCFGNAMESPACE"
	ENV_CFG_NAME           = "NATUESCFGNAME"
	DEFAULT_CFG_NAMESPACE  = "nautes"
	DEFAULT_CFG_NAME       = "nautes-configs"
	DefaultConfigName      = "nautes"
	DefaultConfigNamespace = "nautes-configs"
)
View Source
const DefaultNautesConfigPath = "./config/config"
View Source
const EnvNautesConfigPath = "NAUTESCONFIGPATH"

Variables

This section is empty.

Functions

func FilePath

func FilePath(path string) configFunction

Types

type ArgoCD

type ArgoCD struct {
	URL       string    `yaml:"url"`
	Namespace string    `yaml:"namespace"`
	Kustomize Kustomize `yaml:"kubestomize"`
}

ArgoCD stores argocd configs

type ArgoEvents

type ArgoEvents struct {
	Namespace              string `yaml:"namespace"`
	TemplateServiceAccount string `yaml:"templateServiceAccount"`
}

type Config

type Config struct {
	Deploy   DeployApp  `yaml:"deploy"`
	EventBus EventBus   `yaml:"eventbus"`
	Git      GitRepo    `yaml:"git"`
	Nautes   Nautes     `yaml:"nautes"`
	OAuth    OAuth      `yaml:"OAuth"`
	Pipeline Pipeline   `yaml:"pipeline"`
	Secret   SecretRepo `yaml:"secret"`
}

func NewConfig

func NewConfig(cfgString string) (*Config, error)

func NewConfigInstanceForK8s

func NewConfigInstanceForK8s(namespace, configMap string, kubeconfig string) (*Config, error)

func NewNautesConfigFromFile

func NewNautesConfigFromFile(opts ...configFunction) (*Config, error)

NewNautesConfigFromFile will return a nautes config from specify path If path is empty. It will try to find files based on environment variables and default values

func NewNautesConfigFromKubernetes

func NewNautesConfigFromKubernetes(ctx context.Context, k8sClient client.Client, opts ...configFunction) (*Config, error)

NewNautesConfigFromKubernetes will return a nautes config from kubernetes

type DeployApp

type DeployApp struct {
	DefaultApp map[string]DeployAppType `yaml:"defaultApp"`
	ArgoCD     ArgoCD                   `yaml:"argocd"`
}

type DeployAppType

type DeployAppType string
const (
	DEPLOY_APP_TYPE_ARGOCD DeployAppType = "argocd"
)

type EventBus

type EventBus struct {
	DefaultApp map[string]EventBusType `yaml:"defaultApp"`
	ArgoEvents ArgoEvents              `yaml:"argoEvents"`
}

type EventBusType

type EventBusType string
const (
	EventBusTypeArgoEvent EventBusType = "argo-events"
)

type GitRepo

type GitRepo struct {
	Addr                 string  `yaml:"addr"`
	DefaultProductName   string  `yaml:"defaultProductName"`
	GitType              GitType `yaml:"gitType"`
	DefaultDeployKeyType string  `yaml:"defaultDeployKeyType"`
}

type GitType

type GitType string
const (
	GIT_TYPE_GITLAB GitType = "gitlab"
	GIT_TYPE_GITHUB GitType = "github"
)

type Kustomize

type Kustomize struct {
	DefaultPath KustomizeDefaultPath `yaml:"defaultPath"`
}

Kustomize stores configurations of kustomize

type KustomizeDefaultPath

type KustomizeDefaultPath struct {
	DefaultProject string `yaml:"defaultProject"`
}

KustomizeDefaultPath stores default path of kustomize

type Nautes

type Nautes struct {
	TenantName string `yaml:"tenantName"`
	Namespace  string `yaml:"namespace"`
	// The git repo where store runtime template
	RuntimeTemplateSource string            `yaml:"runtimeTemplateSource"`
	ServiceAccount        map[string]string `yaml:"serviceAccount"`
}

type NautesConfigs

type NautesConfigs struct {
	Namespace string
	Name      string
}

func (*NautesConfigs) GetConfigByClient

func (nc *NautesConfigs) GetConfigByClient(client client.Client) (*Config, error)

func (*NautesConfigs) GetConfigByRest

func (nc *NautesConfigs) GetConfigByRest(cfg *rest.Config) (*Config, error)

func (*NautesConfigs) GetNamespacedName

func (nc *NautesConfigs) GetNamespacedName() types.NamespacedName

type OAuth

type OAuth struct {
	OAuthType    OAuthType `yaml:"OAuthType"`
	Issuer       string    `yaml:"issuer"`
	ClientID     string    `yaml:"clientID"`
	ClientSecret string    `yaml:"clientSecret"`
}

type OAuthType

type OAuthType string
const (
	OAuthTypeDex OAuthType = "dex"
)

type Pipeline

type Pipeline struct {
	DefaultApp map[string]PipelineType `yaml:"defaultApp"`
}

type PipelineType

type PipelineType string
const (
	PipelineTypeTekton PipelineType = "tekton"
)

type SecretRepo

type SecretRepo struct {
	RepoType     SecretStoreType   `yaml:"repoType"`
	Vault        Vault             `yaml:"vault"`
	OperatorName map[string]string `yaml:"operatorName"`
}

type SecretStoreType

type SecretStoreType string
const (
	SECRET_STORE_VAULT SecretStoreType = "vault"
)

type Vault

type Vault struct {
	Addr string `yaml:"addr"`
	// Url for vault proxy
	ProxyAddr string `yaml:"proxyAddr"`
	CABundle  string `yaml:"CABundle"`
	PKIPath   string `yaml:"PKIPath"`
	// The auth name of current cluster
	MountPath string `yaml:"mountPath"`
	// Specify the token connect to vault, this use for debug, do not use it in product
	Token string `yaml:"token"`
	// Valut kubernetes auth service account namespace
	Namesapce string `yaml:"namespace"`
	// The service account name when create kubernetes auth in vault
	ServiceAccount string `yaml:"serviceAccount"`
}

Jump to

Keyboard shortcuts

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