Documentation

Overview

Copyright 2020 Mirantis, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Mirantis, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Mirantis, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2020 Mirantis, Inc.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Index

Constants

View Source
const (
	// NameLabel stack label
	NameLabel = "k0s.k0sproject.io/stack"

	// ChecksumAnnotation defines the annotation key to used for stack checksums
	ChecksumAnnotation = "k0s.k0sproject.io/stack-checksum"

	// LastConfigAnnotation defines the annotation to be used for last applied configs
	LastConfigAnnotation = "k0s.k0sproject.io/last-applied-configuration"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Applier

type Applier struct {
	Name       string
	Dir        string
	KubeConfig string

	// contains filtered or unexported fields

}

Applier manages all the "static" manifests and applies them on the k8s API

func NewApplier

func NewApplier(dir string, kubeconfig string) Applier

NewApplier creates new Applier

func (*Applier) Apply

func (a *Applier) Apply() error

Apply resources

func (*Applier) Delete

func (a *Applier) Delete() error

Delete deletes the entire stack by applying it with empty set of resources

type Manager

type Manager struct {
	K0sVars constant.CfgVars

	// contains filtered or unexported fields

}

Manager is the Component interface wrapper for Applier

func (*Manager) Healthy

func (m *Manager) Healthy() error

Health-check interface

func (*Manager) Init

func (m *Manager) Init() error

Init initializes the Manager

func (*Manager) Run

func (m *Manager) Run() error

Run runs the Manager

func (*Manager) Stop

func (m *Manager) Stop() error

Stop stops the Manager

type Stack

type Stack struct {
	Name      string
	Resources []*unstructured.Unstructured

	Client    dynamic.Interface
	Discovery discovery.CachedDiscoveryInterface // contains filtered or unexported fields

}

Stack is a k8s resource bundle

func (*Stack) Apply

func (s *Stack) Apply(ctx context.Context, prune bool) error

Apply applies stack resources by creating or updating the resources. If prune is requested, the previously applied stack resources which are not part of the current stack are removed from k8s api

type StackApplier

type StackApplier struct {
	Path string

	// contains filtered or unexported fields

}

StackApplier handles each directory as a Stack and watches for changes

func NewStackApplier

func NewStackApplier(path string, kubeConfig string) (*StackApplier, error)

NewStackApplier crates new stack applier to manage a stack

func (*StackApplier) DeleteStack

func (s *StackApplier) DeleteStack() error

DeleteStack deletes the associated stack

func (*StackApplier) Healthy

func (s *StackApplier) Healthy() error

Health-check interface

func (*StackApplier) Start

func (s *StackApplier) Start() error

Start both the initial apply and also the watch for a single stack

func (*StackApplier) Stop

func (s *StackApplier) Stop() error

Stop stops the stack applier and removes the stack