openshift

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2020 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KindMapping = map[string]string{
		"svc":                   "Service",
		"service":               "Service",
		"route":                 "Route",
		"dc":                    "DeploymentConfig",
		"deploymentconfig":      "DeploymentConfig",
		"deployment":            "Deployment",
		"bc":                    "BuildConfig",
		"buildconfig":           "BuildConfig",
		"is":                    "ImageStream",
		"imagestream":           "ImageStream",
		"pvc":                   "PersistentVolumeClaim",
		"persistentvolumeclaim": "PersistentVolumeClaim",
		"template":              "Template",
		"cm":                    "ConfigMap",
		"configmap":             "ConfigMap",
		"secret":                "Secret",
		"rolebinding":           "RoleBinding",
		"serviceaccount":        "ServiceAccount",
		"cronjob":               "CronJob",
		"cj":                    "CronJob",
		"limitrange":            "LimitRange",
		"resourcequota":         "ResourceQuota",
		"quota":                 "ResourceQuota",
	}
)

Functions

func DecryptedParams

func DecryptedParams(input, privateKey, passphrase string) (string, error)

DecryptedParams is used to edit/reveal secrets

func EncodedParams

func EncodedParams(input, privateKey, passphrase string) (string, error)

EncodedParams is used to pass params to oc

func EncryptedParams

func EncryptedParams(input, previous, publicKeyDir, privateKey, passphrase string) (string, error)

EncryptedParams is used to save cleartext params to file

func ExportAsTemplateFile

func ExportAsTemplateFile(filter *ResourceFilter, withAnnotations bool, namespace string, withHardcodedNamespace bool, ocClient cli.OcClientExporter) (string, error)

ExportAsTemplateFile exports resources in template format.

func ProcessTemplate

func ProcessTemplate(templateDir string, name string, paramDir string, compareOptions *cli.CompareOptions, ocClient cli.OcClientProcessor) ([]byte, error)

ProcessTemplate processes template "name" in "templateDir".

Types

type Change

type Change struct {
	Action       string
	Kind         string
	Name         string
	CurrentState string
	DesiredState string
}

Change is a description of a drift between current and desired state, and the required patches to bring them back in sync.

func NewChange

func NewChange(templateItem *ResourceItem, platformItem *ResourceItem) *Change

NewChange creates a new change for given template/platform item.

func (*Change) Diff

func (c *Change) Diff(revealSecrets bool) string

Diff returns a unified diff text for the change.

func (*Change) ItemName

func (c *Change) ItemName() string

ItemName returns the kind/name of the resource the change relates to.

type Changeset

type Changeset struct {
	Create []*Change
	Update []*Change
	Delete []*Change
	Noop   []*Change
}

func NewChangeset

func NewChangeset(platformBasedList, templateBasedList *ResourceList, upsertOnly bool, allowRecreate bool, preservePaths []string) (*Changeset, error)

func (*Changeset) Add

func (c *Changeset) Add(changes ...*Change)

Add adds given changes to the changeset.

func (*Changeset) Blank

func (c *Changeset) Blank() bool

Blank is true when there is no change across Create, Update, Delete.

func (*Changeset) ExactlyOne added in v1.1.0

func (c *Changeset) ExactlyOne() bool

ExactlyOne is true when there is just a single change across Create, Update, Delete.

type ResourceFilter

type ResourceFilter struct {
	Kinds          []string
	Name           string
	Label          string
	ExcludedKinds  []string
	ExcludedNames  []string
	ExcludedLabels []string
}

func NewResourceFilter

func NewResourceFilter(kindArg string, selectorFlag string, excludeFlag string) (*ResourceFilter, error)

NewResourceFilter returns a filter based on kinds and flags. kindArg might be blank, or a list of kinds (e.g. 'pvc,dc') or a kind/name combination (e.g. 'dc/foo'). selectorFlag might be blank or a key and a label, e.g. 'name=foo'.

func (*ResourceFilter) ConvertToKinds

func (f *ResourceFilter) ConvertToKinds() string

func (*ResourceFilter) ConvertToTarget

func (f *ResourceFilter) ConvertToTarget() string

func (*ResourceFilter) SatisfiedBy

func (f *ResourceFilter) SatisfiedBy(item *ResourceItem) bool

func (*ResourceFilter) String

func (f *ResourceFilter) String() string

type ResourceItem

type ResourceItem struct {
	Source                   string
	Kind                     string
	Name                     string
	Labels                   map[string]interface{}
	Annotations              map[string]interface{}
	Paths                    []string
	Config                   map[string]interface{}
	AnnotationsPresent       bool
	LastAppliedConfiguration map[string]interface{}
	LastAppliedAnnotations   map[string]interface{}
	Comparable               bool
}

func NewResourceItem

func NewResourceItem(m map[string]interface{}, source string) (*ResourceItem, error)

func (*ResourceItem) DesiredConfig added in v0.10.3

func (i *ResourceItem) DesiredConfig() (string, error)

func (*ResourceItem) FullName

func (i *ResourceItem) FullName() string

func (*ResourceItem) HasLabel

func (i *ResourceItem) HasLabel(label string) bool

func (*ResourceItem) YamlConfig

func (i *ResourceItem) YamlConfig() string

type ResourceList

type ResourceList struct {
	Filter *ResourceFilter
	Items  []*ResourceItem
}

ResourceList is a collection of resources that conform to a filter.

func NewPlatformBasedResourceList

func NewPlatformBasedResourceList(filter *ResourceFilter, inputs ...[]byte) (*ResourceList, error)

NewPlatformBasedResourceList assembles a ResourceList from an input that is treated as coming from an OpenShift cluster (current state).

func NewTemplateBasedResourceList

func NewTemplateBasedResourceList(filter *ResourceFilter, inputs ...[]byte) (*ResourceList, error)

NewTemplateBasedResourceList assembles a ResourceList from an input that is treated as coming from a local template (desired state).

func (*ResourceList) Length

func (l *ResourceList) Length() int

Length returns the number of items in the resource list

Jump to

Keyboard shortcuts

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