translator

package
v0.0.0-...-ad0f46d Latest Latest
Warning

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

Go to latest
Published: Jun 11, 2024 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultChangeMode              = "restart"
	ReloaderConfigMapAnnotationKey = "configmap.reloader.stakater.com/reload"
	ReloaderSecretAnnotationKey    = "secret.reloader.stakater.com/reload"
)

Variables

View Source
var (
	ErrNoToken              = errors.New("openai token missing, set envvar OPENAI_TOKEN")
	ErrGenerationUnparsable = errors.New("the generated output is not parsable")
)
View Source
var (
	ErrNoNetworkBlock       = errors.New("network mode has to be provided")
	ErrOnlyContainerSupport = errors.New("pod only support container")
)

Functions

func AbbrevStr

func AbbrevStr(in string, length int) string

func AppendIfNotNil

func AppendIfNotNil[T any](arr []T, v T) []T

Types

type DriverNotSupportedError

type DriverNotSupportedError struct {
	Type string
}

func (*DriverNotSupportedError) Error

func (de *DriverNotSupportedError) Error() string

type K8sResourceInfo

type K8sResourceInfo struct {
	metav1.TypeMeta `json:",inline"`
	// Standard object's metadata.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#metadata
	// +optional
	metav1.ObjectMeta `json:"metadata,omitempty" protobuf:"bytes,1,opt,name=metadata"`
}

type NetworkNotSupportedError

type NetworkNotSupportedError struct {
	Type string
}

func (*NetworkNotSupportedError) Error

func (ne *NetworkNotSupportedError) Error() string

type NoticeImportance

type NoticeImportance int
const (
	NoticeBroken NoticeImportance = iota
	NoticeImportant
	NoticeInformative
)

func (NoticeImportance) String

func (ni NoticeImportance) String() string

type NoticeItem

type NoticeItem struct {
	Importance NoticeImportance
	Msg        string
}

type Notices

type Notices []NoticeItem

func (Notices) Sort

func (ns Notices) Sort()

func (Notices) String

func (ns Notices) String() string

func (Notices) UniqueNotices

func (ns Notices) UniqueNotices() Notices

type StructuredResponse

type StructuredResponse struct {
	Result      vsov1.VaultStaticSecret `yaml:"result" json:"result"`
	Confidence  float32                 `yaml:"confidence" json:"confidence"`
	Explanation string                  `yaml:"explanation" json:"explanation"`
}

func CachedTranslateSecretUsingOpenAI

func CachedTranslateSecretUsingOpenAI(logger zerolog.Logger, isEnv bool, tpl string) (*StructuredResponse, error)

func TranslateSecretUsingOpenAI

func TranslateSecretUsingOpenAI(logger zerolog.Logger, isEnv bool, tpl string) (*StructuredResponse, error)

type TranslateError

type TranslateError struct {
	Name string
	Type string
	Err  error
}

func (*TranslateError) Error

func (te *TranslateError) Error() string

type Translator

type Translator struct {
	DestPath   string
	NamePrefix string
	Job        *api.Job

	Notices Notices

	K8sCRs         []client.Object
	K8sDeployemnts []*v1.Deployment

	// When Generation CMs, the name could collide based on the original nomad template
	// destination attribute
	// thus using a map to better test collision than slice
	K8sConfigMaps map[string]*corev1.ConfigMap

	K8sSecret map[string]*corev1.Secret

	K8sServices []*corev1.Service

	K8sHTTPRoute []*gwv1.HTTPRoute
}

func (*Translator) GetNamePrefix

func (t *Translator) GetNamePrefix() string

func (*Translator) Process

func (t *Translator) Process() error

func (*Translator) ProcessTaskGroup

func (t *Translator) ProcessTaskGroup(tg *api.TaskGroup) error

Jump to

Keyboard shortcuts

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