common

package
v0.42.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2024 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultIstioNamespace           = "istio-system"
	DefaultKnativeServingNamespace  = "knative-serving"
	DefaultKnativeEventingNamespace = "knative-eventing"
	DefaultNamespace                = "default"
	Latest                          = "latest"
	Nightly                         = "nightly"
	ServingComponent                = "serving"
	EventingComponent               = "eventing"
	YttMatchingTag                  = "#@overlay/match missing_ok=True"
	YttReplaceTag                   = "#@overlay/replace or_add=True"
	Space                           = " "
	LatestVersion                   = "1.6"
)
View Source
const (
	KnativeOperatorName       = "knative-operator"
	KnativeServingActivator   = "activator"
	KnativeEventingController = "eventing-controller"
)
View Source
const (
	KnativeServingName  = "knative-serving"
	KnativeEventingName = "knative-eventing"
)
View Source
const (
	CustomDataKey     = "custom-manifests.yaml"
	VerticalDelimiter = "|"
	LineWrapper       = "\n"
	Separator         = "---"
	MountPath         = "/knative-custom-manifest"
	CustomVolumeName  = "config-manifest-volume"
	ConfigMapName     = "config-manifest"
)

Variables

This section is empty.

Functions

func ApplyManifests

func ApplyManifests(yamlTemplateString, overlayContent, yamlValuesContent string, p *pkg.OperatorParams) error

func Contains

func Contains(s []string, searchterm string) bool

func DeleteFile

func DeleteFile(path string) error

DeleteFile deletes the file

func DownloadFile

func DownloadFile(url string) (string, error)

DownloadFile reads an online file into a string

func FieldByName

func FieldByName(name string) string

FieldByName returns the overlay tag by a certain field. It is allowed to miss this field in the existing yaml

func GenerateOperatorCRString

func GenerateOperatorCRString(component, namespace string, p *pkg.OperatorParams) (string, error)

func GetMajor

func GetMajor(version string) (bool, string)

func ReadFile

func ReadFile(path string) (string, error)

ReadFile returns the content of the file as a string

func Spaces

func Spaces(num int) string

Spaces returns series of spaces based on the input number

func WriteFile

func WriteFile(path, content string) error

WriteFile creates a file with the string content

Types

type CMsFlags

type CMsFlags struct {
	Value     string
	Key       string
	Component string
	Namespace string
	CMName    string
}

type Deployment

type Deployment struct {
	Client kubernetes.Interface
}

Deployment is used to access the cluster to check if the deployment of the knative operator exists

func (*Deployment) CheckIfKeyDeploymentInstalled added in v0.34.0

func (d *Deployment) CheckIfKeyDeploymentInstalled(name string) (bool, string, string, error)

func (*Deployment) CheckIfKnativeEventingInstalled added in v0.34.0

func (d *Deployment) CheckIfKnativeEventingInstalled() (bool, string, string, error)

func (*Deployment) CheckIfKnativeInstalled added in v0.34.0

func (d *Deployment) CheckIfKnativeInstalled(component string) (bool, string, string, error)

CheckIfOperatorInstalled checks if Knative Component exists

func (*Deployment) CheckIfKnativeServingInstalled added in v0.34.0

func (d *Deployment) CheckIfKnativeServingInstalled() (bool, string, string, error)

func (*Deployment) CheckIfOperatorInstalled

func (d *Deployment) CheckIfOperatorInstalled() (bool, string, string, error)

CheckIfOperatorInstalled checks if Knative Operator exists

type KeyValueFlags

type KeyValueFlags struct {
	Value        string
	Key          string
	Component    string
	Namespace    string
	DeployName   string
	ServiceName  string
	Selector     bool
	NodeSelector bool
	Annotation   bool
	Label        bool
}

type KnativeOperatorCR

type KnativeOperatorCR struct {
	KnativeOperatorClient *versioned.Clientset
}

KnativeOperatorCR is used to access the knative custom resource in the Kubernetes cluster.

func GetKnativeOperatorCR

func GetKnativeOperatorCR(p *pkg.OperatorParams) (*KnativeOperatorCR, error)

func (*KnativeOperatorCR) GetCRInterface

func (ko *KnativeOperatorCR) GetCRInterface(component, namespace string) (interface{}, error)

GetCRInterface gets the Knative custom resource under a certain namespace

func (*KnativeOperatorCR) GetCommonSpec

func (ko *KnativeOperatorCR) GetCommonSpec(component, namespace string) (*base.CommonSpec, error)

func (*KnativeOperatorCR) GetConfigMaps

func (ko *KnativeOperatorCR) GetConfigMaps(component, namespace string) (base.ConfigMapData, error)

func (*KnativeOperatorCR) GetDeployments

func (ko *KnativeOperatorCR) GetDeployments(component, namespace string) ([]base.WorkloadOverride, error)

func (*KnativeOperatorCR) GetKnativeEventing

func (ko *KnativeOperatorCR) GetKnativeEventing(namespace string) (interface{}, error)

GetKnativeEventing gets the Knative Eventing custom resource under a certain namespace

func (*KnativeOperatorCR) GetKnativeEventingInCluster

func (ko *KnativeOperatorCR) GetKnativeEventingInCluster(namespace string) (*eventingv1beta1.KnativeEventing, error)

GetKnativeEventingInCluster gets the Knative Eventing custom resource in the cluster under a certain namespace

func (*KnativeOperatorCR) GetKnativeServing

func (ko *KnativeOperatorCR) GetKnativeServing(namespace string) (interface{}, error)

GetKnativeServing gets the Knative Serving custom resource under a certain namespace

func (*KnativeOperatorCR) GetKnativeServingInCluster

func (ko *KnativeOperatorCR) GetKnativeServingInCluster(namespace string) (*servingv1beta1.KnativeServing, error)

GetKnativeServingInCluster gets the Knative Serving custom resource in the cluster under a certain namespace

func (*KnativeOperatorCR) GetRegistry

func (ko *KnativeOperatorCR) GetRegistry(component, namespace string) (base.Registry, error)

func (*KnativeOperatorCR) GetServices

func (ko *KnativeOperatorCR) GetServices(component, namespace string) ([]base.ServiceOverride, error)

func (*KnativeOperatorCR) UpdateCommonSpec

func (ko *KnativeOperatorCR) UpdateCommonSpec(component, namespace string, commonSpec *base.CommonSpec) error

func (*KnativeOperatorCR) UpdateConfigMaps

func (ko *KnativeOperatorCR) UpdateConfigMaps(component, namespace string, cmData base.ConfigMapData) error

func (*KnativeOperatorCR) UpdateDeployments

func (ko *KnativeOperatorCR) UpdateDeployments(component, namespace string, workloadOverrides []base.WorkloadOverride) error

func (*KnativeOperatorCR) UpdateKnativeEventing

UpdateKnativeEventing updates the Knative Eventing custom resource in the cluster based on the provided Knative Eventing

func (*KnativeOperatorCR) UpdateKnativeServing

UpdateKnativeServing updates the Knative Serving custom resource in the cluster based on the provided Knative Serving

func (*KnativeOperatorCR) UpdateRegistry

func (ko *KnativeOperatorCR) UpdateRegistry(component, namespace string, registry base.Registry) error

func (*KnativeOperatorCR) UpdateServices

func (ko *KnativeOperatorCR) UpdateServices(component, namespace string, serviceOverrides []base.ServiceOverride) error

type KubeResource

type KubeResource struct {
	KubeClient kubernetes.Interface
}

KubeResource is used to access the Kubernetes resources in the Kubernetes cluster.

func (*KubeResource) CreateOrUpdateConfigMap

func (kr *KubeResource) CreateOrUpdateConfigMap(name, namespace, data string, overwrite bool) error

CreateOrUpdateConfigMap creates or updates the ConfigMap with the data under a certain namespace

func (*KubeResource) UpdateOperatorDeployment

func (kr *KubeResource) UpdateOperatorDeployment(name, namespace string) error

UpdateOperatorDeployment updates the deployment of the operator

type Manifest

type Manifest struct {
	// YttPro is an instance of the YttProcessor to generate the output yaml
	YttPro *YttProcessor
	// RestConfig is the rest configuration to access the Kubernetes cluster
	RestConfig *rest.Config
}

Manifest applies the content of the yaml file against a Kubernetes cluster

func (*Manifest) Apply

func (man *Manifest) Apply() error

Apply applies the content of the yaml file against the Kubernetes cluster

type Namespace

type Namespace struct {
	Client    kubernetes.Interface
	Component string
}

Namespace is used to access the namespace resource in the Kubernetes cluster.

func (*Namespace) CreateNamespace

func (ns *Namespace) CreateNamespace(namespace string) error

CreateNamespace creates the namespace if it is not available in the Kubernetes cluster

type YamlGenarator

type YamlGenarator struct {
	// Input is a Kubernetes resource, either Knative Serving or Eventing
	Input interface{}
}

YamlGenarator generates the final output yaml content for Knative Eventing or Serving custom resource.

func (*YamlGenarator) GenerateYamlOutput

func (yamlg *YamlGenarator) GenerateYamlOutput() (string, error)

GenerateYamlOutput returns the yaml content for Knative Serving or Eventing CR

type YttProcessor

type YttProcessor struct {
	// baseData is a byte array to save the content of the base yaml
	BaseData []byte
	// overlayData is a byte array to save the content of the overlay yaml
	OverlayData []byte
	// valuesData is a byte array to save the content of the values
	ValuesData []byte
}

YttProcessor generates the final output yaml content, based on the base, overlay and values.

func (*YttProcessor) GenerateOutput

func (yttp *YttProcessor) GenerateOutput() (string, error)

GenerateOutput returns the generated content and path, based on the base, overlay and values.

Jump to

Keyboard shortcuts

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