models

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Overview

Package models contains a collection of structs that represent Kubernetes resources

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func KustomizeFromYAMLPath

func KustomizeFromYAMLPath(path string) (kustomizationAPITypes.Kustomization, error)

KustomizeFromYAMLPath reads the file at path and returns a Kustomization object.

func NewKomponent

func NewKomponent(resources []string) kustomizationAPITypes.Kustomization

NewKomponent creates a new Komponent object.

func NewKustomization

func NewKustomization(resources []string, components []string, namespace string) kustomizationAPITypes.Kustomization

func SortKustomization added in v0.3.0

func ToYAML

func ToYAML(resource interface{}) ([]byte, error)

ToYAML converts a struct into a YAML string. If unable to marshal the struct, it prints an error and exits.

Types

type CustomResourceQuota added in v0.3.0

type CustomResourceQuota struct {
	LimitsCPU       string `yaml:"limits.cpu,omitempty"`
	LimitsMemory    string `yaml:"limits.memory,omitempty"`
	Buckets         int    `yaml:"count/objectbucketclaims.objectbucket.io,omitempty"`
	RequestsCPU     string `yaml:"requests.cpu,omitempty"`
	RequestsMemory  string `yaml:"requests.memory,omitempty"`
	RequestsStorage string `yaml:"requests.storage,omitempty"`
}

type Group

type Group struct {
	Resource `yaml:",inline"`
	Users    []string
}

Group represents a group of users.

func NewGroup

func NewGroup(name string, users []string) Group

NewGroup creates a new Group object.

type Metadata

type Metadata struct {
	Name        string
	Annotations kvmap `yaml:",omitempty"`
	Labels      kvmap `yaml:",omitempty"`
}

Metadata represents the metadata section of a Kubernetes resource.

type Namespace

type Namespace struct {
	Resource `yaml:",inline"`
}

Namespace represents a Kubernetes Namespace.

func NewNamespace

func NewNamespace(name, owner, displayName string) Namespace

NewNamespace creates a new Namespace object. The object's metadata.name is set to the value of the "name" parameter. The "owner" and "displayName" parameters are used to initialize the "openshift.io/requester" and ""openshift.io/display-name" annotations.

type OnboardNamespace added in v0.3.0

type OnboardNamespace struct {
	EnableMonitoring   bool
	Name               string
	Quota              string
	CustomQuota        CustomResourceQuota `yaml:"custom_quota,omitempty"`
	DisableLimitRange  bool                `yaml:"disable_limit_range,omitempty"`
	ProjectDisplayName string              `yaml:"project_display_name,omitempty"`
}

type OnboardingRequest added in v0.3.0

type OnboardingRequest struct {
	Env                string `yaml:",omitempty"`
	Namespaces         []OnboardNamespace
	ProjectDescription string   `yaml:"project_description"`
	TargetCluster      string   `yaml:"target_cluster"`
	TeamName           string   `yaml:"team_name"`
	Users              []string `yaml:",omitempty"`
}

func OnboardRequestFromYAMLPath added in v0.3.0

func OnboardRequestFromYAMLPath(path string) (OnboardingRequest, error)

type OperatorGroup

type OperatorGroup struct {
	Resource `yaml:",inline"`
	Spec     OperatorGroupSpec
}

OperatorGroup represents a Kubernetes OLM OperatorGroup resource.

func NewOperatorGroup

func NewOperatorGroup(namespace string, singleNamespace bool) OperatorGroup

NewOperatorGroup creates a new OperatorGroup object. The object's metadata.name is set to the value of the "namespace" parameter. If the "singleNamespace" is true, spec.targetNamespaces is set to include the "namespace" string

type OperatorGroupSpec

type OperatorGroupSpec struct {
	TargetNamespaces []string `yaml:"targetNamespaces,omitempty"`
}

type Resource

type Resource struct {
	APIVersion string `yaml:"apiVersion"`
	Kind       string
	Metadata   Metadata `yaml:",omitempty"`
}

Resource represents the core attributes of a Kubernetes resource. This struct is embedded in all other Kubernetes resource models.

type ResourceQuota added in v0.3.0

type ResourceQuota struct {
	APIVersion string `yaml:"apiVersion"`
	Kind       string
	Metadata   Metadata
	Spec       ResourceQuotaSpec
}

func NewCustomResourceQuota added in v0.3.0

func NewCustomResourceQuota(namespace string, customResourceQuota CustomResourceQuota) ResourceQuota

type ResourceQuotaSpec added in v0.3.0

type ResourceQuotaSpec struct {
	Hard CustomResourceQuota
}

type RoleBinding

type RoleBinding struct {
	Resource `yaml:",inline"`
	RoleRef  Subject `yaml:"roleRef"`
	Subjects []Subject
}

RoleBinding represents a Kubernetes RoleBinding object. It links one or more subjects to a role.

func NewRoleBinding

func NewRoleBinding(name string, role string) RoleBinding

NewRoleBinding creates a new RoleBinding object. The "name" parameter is used to initialize "metadata.name". The "role" parameter is used to set the name of the "roleRef".

func (*RoleBinding) AddGroup

func (rolebinding *RoleBinding) AddGroup(groupName string)

AddGroup adds an entry for the named Group to the list of subjects in the RoleBinding.

type Subject

type Subject struct {
	APIGroup string `yaml:"apiGroup"`
	Kind     string
	Name     string
}

Subject represents a participant in a RoleBinding.

func NewGroupSubject

func NewGroupSubject(groupName string) Subject

NewGroupSubject creates a new Subject referring to the named group.

type Subscription

type Subscription struct {
	Resource `yaml:",inline"`
	Spec     SubscriptionSpec
}

Subscription represents a Kubernetes OLM Subscription resource.

func NewSubscription

func NewSubscription(name, catalog, channel, strategy string) Subscription

NewSubscription creates a new Subscription object. The object's metadata.name is set to the value of the "name" parameter. The "catalog" parameter defines spec.source. The "strategy" parameter is allowed to be either Automatic or Manual and initialized spec.installPlanApproval. Optional "channel" parameters sets spec.channel

type SubscriptionSpec

type SubscriptionSpec struct {
	Channel             string `yaml:",omitempty"`
	InstallPlanApproval string `yaml:"installPlanApproval"`
	Name                string
	Source              string
	SourceNamespace     string `yaml:"sourceNamespace"`
}

Jump to

Keyboard shortcuts

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