state

package
v0.26.0 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2018 License: Apache-2.0 Imports: 19 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Empty

type Empty struct{}

func (Empty) CurrentCAs added in v0.26.0

func (Empty) CurrentCAs() map[string]util.CAType

func (Empty) CurrentCerts added in v0.26.0

func (Empty) CurrentCerts() map[string]util.CertType

func (Empty) CurrentConfig

func (Empty) CurrentConfig() map[string]interface{}

func (Empty) CurrentHelmValues

func (Empty) CurrentHelmValues() string

func (Empty) CurrentHelmValuesDefaults

func (Empty) CurrentHelmValuesDefaults() string

func (Empty) CurrentKustomize

func (Empty) CurrentKustomize() *Kustomize

func (Empty) CurrentKustomizeOverlay

func (Empty) CurrentKustomizeOverlay(string) (string, bool)

func (Empty) CurrentReleaseName added in v0.20.0

func (Empty) CurrentReleaseName() string

func (Empty) IsEmpty added in v0.16.0

func (Empty) IsEmpty() bool

func (Empty) Upstream

func (Empty) Upstream() string

func (Empty) Versioned

func (Empty) Versioned() VersionedState

type Kustomize

type Kustomize struct {
	Overlays map[string]Overlay `json:"overlays,omitempty" yaml:"overlays,omitempty" hcl:"overlays,omitempty"`
}

func (*Kustomize) Ship

func (k *Kustomize) Ship() Overlay

type Lifeycle

type Lifeycle struct {
	StepsCompleted StepsCompleted `json:"stepsCompleted,omitempty" yaml:"stepsCompleted,omitempty" hcl:"stepsCompleted,omitempty"`
}

func (*Lifeycle) WithCompletedStep

func (l *Lifeycle) WithCompletedStep(step api.Step) *Lifeycle

type MManager

type MManager struct {
	Logger  log.Logger
	FS      afero.Afero
	V       *viper.Viper
	Patcher patch.Patcher
}

MManager is the saved output of a plan run to load on future runs

func (*MManager) AddCA added in v0.26.0

func (m *MManager) AddCA(name string, newCA util.CAType) error

func (*MManager) AddCert added in v0.26.0

func (m *MManager) AddCert(name string, newCert util.CertType) error

func (*MManager) RemoveStateFile

func (m *MManager) RemoveStateFile() error

RemoveStateFile will attempt to remove the state file from disk

func (*MManager) ResetLifecycle added in v0.16.0

func (m *MManager) ResetLifecycle() error

ResetLifecycle is used by `ship update --headed` to reset the saved stepsCompleted in the state.json

func (*MManager) Save

func (m *MManager) Save(v VersionedState) error

func (*MManager) SaveKustomize

func (m *MManager) SaveKustomize(kustomize *Kustomize) error

func (*MManager) SerializeAppMetadata added in v0.16.0

func (m *MManager) SerializeAppMetadata(metadata api.ReleaseMetadata) error

SerializeAppMetadata is used by `ship app` to serialize replicated app metadata to state file

func (*MManager) SerializeConfig

func (m *MManager) SerializeConfig(assets []api.Asset, meta api.ReleaseMetadata, templateContext map[string]interface{}) error

SerializeConfig takes the application data and input params and serializes a state file to disk

func (*MManager) SerializeContentSHA

func (m *MManager) SerializeContentSHA(contentSHA string) error

SerializeContentSHA writes the contentSHA to the state file

func (*MManager) SerializeHelmValues

func (m *MManager) SerializeHelmValues(values string, defaults string) error

SerializeHelmValues takes user input helm values and serializes a state file to disk

func (*MManager) SerializeListsMetadata added in v0.22.0

func (m *MManager) SerializeListsMetadata(list util.List) error

func (*MManager) SerializeReleaseName added in v0.20.0

func (m *MManager) SerializeReleaseName(name string) error

SerializeReleaseName serializes to disk the name to use for helm template

func (*MManager) SerializeShipMetadata added in v0.16.0

func (m *MManager) SerializeShipMetadata(metadata api.ShipAppMetadata, applicationType string) error

SerializeShipMetadata is used by `ship init` to serialize metadata from ship applications to state file

func (*MManager) SerializeUpstream

func (m *MManager) SerializeUpstream(upstream string) error

SerializeUpstream is used by `ship init` to serialize a state file with ChartURL to disk

func (*MManager) TryLoad

func (m *MManager) TryLoad() (State, error)

TryLoad will attempt to load a state file from disk, if present

type Manager

type Manager interface {
	SerializeHelmValues(values string, defaults string) error
	SerializeReleaseName(name string) error
	SerializeConfig(
		assets []api.Asset,
		meta api.ReleaseMetadata,
		templateContext map[string]interface{},
	) error
	TryLoad() (State, error)
	RemoveStateFile() error
	SaveKustomize(kustomize *Kustomize) error
	SerializeUpstream(URL string) error
	SerializeContentSHA(contentSHA string) error
	SerializeShipMetadata(api.ShipAppMetadata, string) error
	SerializeAppMetadata(api.ReleaseMetadata) error
	SerializeListsMetadata(util.List) error
	Save(v VersionedState) error
	ResetLifecycle() error

	AddCert(name string, newCert util.CertType) error
	AddCA(name string, newCA util.CAType) error
}

func NewManager

func NewManager(
	logger log.Logger,
	fs afero.Afero,
	v *viper.Viper,
	patcher patch.Patcher,
) Manager

type Metadata added in v0.17.1

type Metadata struct {
	ApplicationType string      `json:"applicationType" yaml:"applicationType" hcl:"applicationType"`
	Icon            string      `json:"icon,omitempty" yaml:"icon,omitempty" hcl:"icon,omitempty"`
	Name            string      `json:"name,omitempty" yaml:"name,omitempty" hcl:"name,omitempty"`
	ReleaseNotes    string      `json:"releaseNotes" yaml:"releaseNotes" hcl:"releaseNotes"`
	Version         string      `json:"version" yaml:"version" hcl:"version"`
	CustomerID      string      `json:"customerID,omitempty" yaml:"customerID,omitempty" hcl:"customerID,omitempty"`
	InstallationID  string      `json:"installationID,omitempty" yaml:"installationID,omitempty" hcl:"installationID,omitempty"`
	Lists           []util.List `json:"lists,omitempty" yaml:"lists,omitempty" hcl:"lists,omitempty"`
}

type Overlay

type Overlay struct {
	ExcludedBases     []string          `json:"excludedBases,omitempty" yaml:"excludedBases,omitempty" hcl:"excludedBases,omitempty"`
	Patches           map[string]string `json:"patches,omitempty" yaml:"patches,omitempty" hcl:"patches,omitempty"`
	Resources         map[string]string `json:"resources,omitempty" yaml:"resources,omitempty" hcl:"resources,omitempty"`
	KustomizationYAML string            `json:"kustomization_yaml,omitempty" yaml:"kustomization_yaml,omitempty" hcl:"kustomization_yaml,omitempty"`
}

func NewOverlay added in v0.17.0

func NewOverlay() Overlay

type State

type State interface {
	CurrentConfig() map[string]interface{}
	CurrentKustomize() *Kustomize
	CurrentKustomizeOverlay(filename string) (string, bool)
	CurrentHelmValues() string
	CurrentHelmValuesDefaults() string
	CurrentReleaseName() string
	Upstream() string
	Versioned() VersionedState
	IsEmpty() bool
	CurrentCAs() map[string]util.CAType
	CurrentCerts() map[string]util.CertType
}

now that we have Versioned(), we probably don't need nearly so broad an interface here

type StepsCompleted

type StepsCompleted map[string]interface{}

func (StepsCompleted) String

func (s StepsCompleted) String() string

type Terraform added in v0.21.0

type Terraform struct {
	RawState string           `json:"rawState,omitempty" yaml:"rawState,omitempty" hcl:"rawState,omitempty"`
	State    *terraform.State `json:"state,omitempty" yaml:"state,omitempty" hcl:"state,omitempty"`
}

type V0

type V0 map[string]interface{}

func (V0) CurrentCAs added in v0.26.0

func (v V0) CurrentCAs() map[string]util.CAType

func (V0) CurrentCerts added in v0.26.0

func (v V0) CurrentCerts() map[string]util.CertType

func (V0) CurrentConfig

func (v V0) CurrentConfig() map[string]interface{}

func (V0) CurrentHelmValues

func (v V0) CurrentHelmValues() string

func (V0) CurrentHelmValuesDefaults

func (v V0) CurrentHelmValuesDefaults() string

func (V0) CurrentKustomize

func (v V0) CurrentKustomize() *Kustomize

func (V0) CurrentKustomizeOverlay

func (v V0) CurrentKustomizeOverlay(string) (string, bool)

func (V0) CurrentReleaseName added in v0.20.0

func (v V0) CurrentReleaseName() string

func (V0) IsEmpty added in v0.16.0

func (v V0) IsEmpty() bool

func (V0) Upstream

func (v V0) Upstream() string

func (V0) Versioned

func (v V0) Versioned() VersionedState

type V1

type V1 struct {
	Config             map[string]interface{} `json:"config" yaml:"config" hcl:"config"`
	Terraform          *Terraform             `json:"terraform,omitempty" yaml:"terraform,omitempty" hcl:"terraform,omitempty"`
	HelmValues         string                 `json:"helmValues,omitempty" yaml:"helmValues,omitempty" hcl:"helmValues,omitempty"`
	ReleaseName        string                 `json:"releaseName,omitempty" yaml:"releaseName,omitempty" hcl:"releaseName,omitempty"`
	HelmValuesDefaults string                 `json:"helmValuesDefaults,omitempty" yaml:"helmValuesDefaults,omitempty" hcl:"helmValuesDefaults,omitempty"`
	Kustomize          *Kustomize             `json:"kustomize,omitempty" yaml:"kustomize,omitempty" hcl:"kustomize,omitempty"`
	Upstream           string                 `json:"upstream,omitempty" yaml:"upstream,omitempty" hcl:"upstream,omitempty"`
	Metadata           *Metadata              `json:"metadata" yaml:"metadata" hcl:"metadata"`

	//deprecated in favor of upstream
	ChartURL string `json:"chartURL,omitempty" yaml:"chartURL,omitempty" hcl:"chartURL,omitempty"`

	ChartRepoURL string    `json:"ChartRepoURL,omitempty" yaml:"ChartRepoURL,omitempty" hcl:"ChartRepoURL,omitempty"`
	ChartVersion string    `json:"ChartVersion,omitempty" yaml:"ChartVersion,omitempty" hcl:"ChartVersion,omitempty"`
	ContentSHA   string    `json:"contentSHA,omitempty" yaml:"contentSHA,omitempty" hcl:"contentSHA,omitempty"`
	Lifecycle    *Lifeycle `json:"lifecycle,omitempty" yaml:"lifecycle,omitempty" hcl:"lifecycle,omitempty"`

	CAs   map[string]util.CAType   `json:"cas,omitempty" yaml:"cas,omitempty" hcl:"cas,omitempty"`
	Certs map[string]util.CertType `json:"certs,omitempty" yaml:"certs,omitempty" hcl:"certs,omitempty"`
}

type VersionedState

type VersionedState struct {
	V1 *V1 `json:"v1,omitempty" yaml:"v1,omitempty" hcl:"v1,omitempty"`
}

func (VersionedState) CurrentCAs added in v0.26.0

func (v VersionedState) CurrentCAs() map[string]util.CAType

func (VersionedState) CurrentCerts added in v0.26.0

func (v VersionedState) CurrentCerts() map[string]util.CertType

func (VersionedState) CurrentConfig

func (v VersionedState) CurrentConfig() map[string]interface{}

func (VersionedState) CurrentHelmValues

func (v VersionedState) CurrentHelmValues() string

func (VersionedState) CurrentHelmValuesDefaults

func (v VersionedState) CurrentHelmValuesDefaults() string

func (VersionedState) CurrentKustomize

func (v VersionedState) CurrentKustomize() *Kustomize

func (VersionedState) CurrentKustomizeOverlay

func (v VersionedState) CurrentKustomizeOverlay(filename string) (contents string, isResource bool)

func (VersionedState) CurrentReleaseName added in v0.20.0

func (v VersionedState) CurrentReleaseName() string

func (VersionedState) IsEmpty added in v0.16.0

func (v VersionedState) IsEmpty() bool

func (VersionedState) Upstream

func (v VersionedState) Upstream() string

func (VersionedState) Versioned

func (v VersionedState) Versioned() VersionedState

func (VersionedState) WithCompletedStep

func (v VersionedState) WithCompletedStep(step api.Step) VersionedState

Jump to

Keyboard shortcuts

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