v1

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Feb 2, 2024 License: BSD-3-Clause Imports: 9 Imported by: 2

Documentation

Overview

Package v1 contains API Schema definitions for the kne v1 API group +kubebuilder:object:generate=true +groupName=kne.srlinux.dev

Index

Constants

View Source
const (
	GroupName = "kne.srlinux.dev"
	Version   = "v1"
)

Variables

View Source
var (
	// GroupVersion is group version used to register these objects.
	GroupVersion = schema.GroupVersion{Group: GroupName, Version: Version}

	// SchemeBuilder is used to add go types to the GroupVersionKind scheme.
	SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

	// AddToScheme adds the types in this group-version to the given scheme.
	AddToScheme = SchemeBuilder.AddToScheme
)

Functions

This section is empty.

Types

type CertificateCfg

type CertificateCfg struct {
	// Certificate name on the node.
	CertName string `json:"cert_name,omitempty"`
	// Key name on the node.
	KeyName string `json:"key_name,omitempty"`
	// RSA keysize to use for key generation.
	KeySize uint32 `json:"key_size,omitempty"`
	// Common name to set in the cert.
	CommonName string `json:"common_name,omitempty"`
}

CertificateCfg represents srlinux certificate configuration parameters.

func (*CertificateCfg) DeepCopy

func (in *CertificateCfg) DeepCopy() *CertificateCfg

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new CertificateCfg.

func (*CertificateCfg) DeepCopyInto

func (in *CertificateCfg) DeepCopyInto(out *CertificateCfg)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type NodeConfig

type NodeConfig struct {
	Command []string `json:"command,omitempty"` // Command to pass into pod.
	Args    []string `json:"args,omitempty"`    // Command args to pass into the pod.
	Image   string   `json:"image,omitempty"`   // Docker image to use with pod.
	// Map of environment variables to pass into the pod.
	Env map[string]string `json:"env,omitempty"`
	// Specific entry point command for accessing the pod.
	EntryCommand string `json:"entry_command,omitempty"`
	// Mount point for configuration inside the pod. Should point to a dir that contains ConfigFile
	ConfigPath string `json:"config_path,omitempty"`
	// Startup configuration file name for the pod. Set in the kne topo and created by kne as a config map
	ConfigFile string `json:"config_file,omitempty"`
	// When set to true by kne, srlinux controller will attempt to mount the file with startup config to the pod
	ConfigDataPresent bool            `json:"config_data_present,omitempty"`
	Cert              *CertificateCfg `json:"cert,omitempty"`
	Sleep             uint32          `json:"sleep,omitempty"` // Sleep time before starting the pod.
}

NodeConfig represents srlinux node configuration parameters.

func (*NodeConfig) DeepCopy

func (in *NodeConfig) DeepCopy() *NodeConfig

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new NodeConfig.

func (*NodeConfig) DeepCopyInto

func (in *NodeConfig) DeepCopyInto(out *NodeConfig)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*NodeConfig) GetArgs

func (n *NodeConfig) GetArgs() []string

GetArgs gets arguments from srlinux node configuration.

func (*NodeConfig) GetCommand

func (n *NodeConfig) GetCommand() []string

GetCommand gets command from srlinux node configuration.

type SrlVersion

type SrlVersion struct {
	Major  string `json:"major,omitempty"`
	Minor  string `json:"minor,omitempty"`
	Patch  string `json:"patch,omitempty"`
	Build  string `json:"build,omitempty"`
	Commit string `json:"commit,omitempty"`
}

SrlVersion represents an sr linux version as a set of fields.

func (*SrlVersion) DeepCopy

func (in *SrlVersion) DeepCopy() *SrlVersion

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SrlVersion.

func (*SrlVersion) DeepCopyInto

func (in *SrlVersion) DeepCopyInto(out *SrlVersion)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type Srlinux

type Srlinux struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`

	Spec   SrlinuxSpec   `json:"spec,omitempty"`
	Status SrlinuxStatus `json:"status,omitempty"`

	// license key from license secret that contains a license file for this Srlinux
	LicenseKey string `json:"license_key,omitempty"`
}

Srlinux is the Schema for the srlinuxes API. +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" +kubebuilder:printcolumn:name="Image",type="string",JSONPath=".status.image" +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.status" +kubebuilder:printcolumn:name="Ready",type="boolean",JSONPath=".status.ready" +kubebuilder:printcolumn:name="Config",type="string",JSONPath=".status.startup-config.phase"

func (*Srlinux) DeepCopy

func (in *Srlinux) DeepCopy() *Srlinux

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Srlinux.

func (*Srlinux) DeepCopyInto

func (in *Srlinux) DeepCopyInto(out *Srlinux)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*Srlinux) DeepCopyObject

func (in *Srlinux) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

func (*Srlinux) InitLicenseKey

func (s *Srlinux) InitLicenseKey(
	_ context.Context,
	secret *corev1.Secret,
	version *SrlVersion,
)

InitLicenseKey sets the Srlinux.LicenseKey to a value of a key that matches MAJOR-MINOR.key of a passed secret. Where MAJOR-MINOR is retrieved from the image version. If such key doesn't exist, it checks if a wildcard `all.key` is found in that secret, if nothing found, LicenseKey stays empty, which denotes that no license was found for Srlinux.

type SrlinuxList

type SrlinuxList struct {
	metav1.TypeMeta `json:",inline"`
	metav1.ListMeta `json:"metadata,omitempty"`
	Items           []Srlinux `json:"items"`
}

SrlinuxList contains a list of Srlinux.

func (*SrlinuxList) DeepCopy

func (in *SrlinuxList) DeepCopy() *SrlinuxList

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SrlinuxList.

func (*SrlinuxList) DeepCopyInto

func (in *SrlinuxList) DeepCopyInto(out *SrlinuxList)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SrlinuxList) DeepCopyObject

func (in *SrlinuxList) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type SrlinuxSpec

type SrlinuxSpec struct {
	Config        *NodeConfig       `json:"config,omitempty"`
	NumInterfaces int               `json:"num-interfaces,omitempty"`
	Constraints   map[string]string `json:"constraints,omitempty"`
	// Model encodes SR Linux variant (ixr-d3, ixr-6e, etc)
	Model string `json:"model,omitempty"`
	// Version may be set in kne topology as a mean to explicitly provide version information
	// in case it is not encoded in the image tag
	Version string `json:"version,omitempty"`
}

SrlinuxSpec defines the desired state of Srlinux.

func (*SrlinuxSpec) DeepCopy

func (in *SrlinuxSpec) DeepCopy() *SrlinuxSpec

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SrlinuxSpec.

func (*SrlinuxSpec) DeepCopyInto

func (in *SrlinuxSpec) DeepCopyInto(out *SrlinuxSpec)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*SrlinuxSpec) GetConfig

func (s *SrlinuxSpec) GetConfig() *NodeConfig

GetConfig gets config from srlinux spec.

func (*SrlinuxSpec) GetConstraints

func (s *SrlinuxSpec) GetConstraints() map[string]string

GetConstraints gets constraints from srlinux spec, default constraints are returned if none are present in the spec.

func (*SrlinuxSpec) GetImage

func (s *SrlinuxSpec) GetImage() string

GetImage returns the srlinux container image name that is used in pod spec if Config.Image is provided it takes precedence over all other option if not, the Spec.Version is used as a tag for public container image ghcr.io/nokia/srlinux.

func (*SrlinuxSpec) GetImageVersion

func (s *SrlinuxSpec) GetImageVersion() *SrlVersion

GetImageVersion finds an srlinux image version by looking at the Image field of the spec as well as at Version field. When Version field is set it is returned. In other cases, Image string is evaluated and it's tag substring is parsed. If no tag is present, or tag is latest, the 0.0 version is assumed to be in use.

func (*SrlinuxSpec) GetModel

func (s *SrlinuxSpec) GetModel() string

GetModel gets srlinux model (aka variant) from srlinux spec, default srlinux variant is returned if none present in the spec.

type SrlinuxStatus

type SrlinuxStatus struct {
	// Status is the status of the srlinux custom resource.
	// Can be one of: "created", "running", "error".
	Status string `json:"status,omitempty"`
	// Image used to run srlinux pod
	Image string `json:"image,omitempty"`
	// StartupConfig contains the status of the startup-config.
	StartupConfig StartupConfigStatus `json:"startup-config,omitempty"`
	// Ready is true if the srlinux NOS is ready to receive config.
	// This is when management server is running and initial commit is processed.
	Ready bool `json:"ready,omitempty"`
}

SrlinuxStatus defines the observed state of Srlinux.

func (*SrlinuxStatus) DeepCopy

func (in *SrlinuxStatus) DeepCopy() *SrlinuxStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SrlinuxStatus.

func (*SrlinuxStatus) DeepCopyInto

func (in *SrlinuxStatus) DeepCopyInto(out *SrlinuxStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

type StartupConfigStatus added in v0.6.0

type StartupConfigStatus struct {
	// Phase is the phase startup-config is in. Can be one of: "pending", "loaded", "not-provided", "failed".
	Phase string `json:"phase,omitempty"`
}

func (*StartupConfigStatus) DeepCopy added in v0.6.0

func (in *StartupConfigStatus) DeepCopy() *StartupConfigStatus

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new StartupConfigStatus.

func (*StartupConfigStatus) DeepCopyInto added in v0.6.0

func (in *StartupConfigStatus) DeepCopyInto(out *StartupConfigStatus)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

Jump to

Keyboard shortcuts

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