package upgrade

import "github.com/oslokommune/okctl/pkg/upgrade"

Package upgrade knows how to upgrade okctl

Index

Constants

const (
	// DotCountForRegularSemver contains the amount of dots in a regular semver version
	DotCountForRegularSemver = 3
	// DotCountForSemverWithHotfix contains the amount of dots in a semver plus hotfix version
	DotCountForSemverWithHotfix = 4
)
const (
	// ChecksumsTxt contains the file name of the checksum file asset in a Github release
	ChecksumsTxt = "okctl-upgrade-checksums.txt"
)
const DocumentationURL = "https://okctl.io/getting-started/upgrading"

DocumentationURL is the URL to the upgrade documentation

const OkctlUpgradeRepo = "okctl-upgrade"

OkctlUpgradeRepo contains the repository for upgrades

Variables

var OkctlUpgradeRepoURL = fmt.Sprintf("https://github.com/oslokommune/%s", OkctlUpgradeRepo) //nolint:gochecknoglobals

OkctlUpgradeRepoURL contains URL for the upgrade repository

Functions

func ToUpgradeVersion

func ToUpgradeVersion(tagName string) string

ToUpgradeVersion converts a git tag to an upgrade version

Types

type ChecksumDownloader

type ChecksumDownloader interface {
	Download(checksumAsset *github.ReleaseAsset) ([]byte, error)
}

ChecksumDownloader knows how to download the checksums for a github release asset

type ChecksumHTTPDownloader

type ChecksumHTTPDownloader struct{}

ChecksumHTTPDownloader knows how to download the checksums for a github release asset through HTTP

func NewChecksumDownloader

func NewChecksumDownloader() ChecksumHTTPDownloader

NewChecksumDownloader returns a new ChecksumHTTPDownloader

func (ChecksumHTTPDownloader) Download

func (c ChecksumHTTPDownloader) Download(checksumAsset *github.ReleaseAsset) ([]byte, error)

Download downloads the given checksum asset1

type FetcherOpts

type FetcherOpts struct {
	Host  state.Host
	Store storage.Storer
}

FetcherOpts contains data needed to initialize a fetch.Provider

type GithubReleaseParser

type GithubReleaseParser struct {
	// contains filtered or unexported fields
}

GithubReleaseParser parses Github releases

func NewGithubReleaseParser

func NewGithubReleaseParser(checksumDownloader ChecksumDownloader) GithubReleaseParser

NewGithubReleaseParser returns a new GithubReleaseParser

func (GithubReleaseParser) ToUpgradeBinaries

func (g GithubReleaseParser) ToUpgradeBinaries(releases []*github.RepositoryRelease) ([]okctlUpgradeBinary, error)

ToUpgradeBinaries converts the provided github releases to okctl upgrade binaries

type Opts

type Opts struct {
	Debug                      bool
	AutoConfirm                bool
	Logger                     *logrus.Logger
	Out                        io.Writer
	RepositoryDirectory        string
	GithubService              client.GithubService
	ChecksumDownloader         ChecksumHTTPDownloader
	ClusterVersioner           clusterversion.Versioner
	OriginalClusterVersioner   originalclusterversion.Versioner
	Surveyor                   survey.Surveyor
	FetcherOpts                FetcherOpts
	OkctlVersion               string
	State                      client.UpgradeState
	ClusterID                  api.ID
	BinaryEnvironmentVariables map[string]string
}

Opts contains all data needed to create an Upgrader

func (Opts) Validate

func (o Opts) Validate() error

Validate validates the given parameters

type Upgrader

type Upgrader struct {
	// contains filtered or unexported fields
}

Upgrader knows how to upgrade okctl

func New

func New(opts Opts) (Upgrader, error)

New returns a new Upgrader, or an error if initialization fails

func (Upgrader) Run

func (u Upgrader) Run() error

Run upgrades okctl

Source Files

binary_provider.go checksum_downloader.go filter.go github_release_parser.go okctl_ugrade_binary.go parse_file_name.go upgrade.go upgrade_binary_version.go

Directories

PathSynopsis
pkg/upgrade/clusterversionPackage clusterversion manages the cluster version
pkg/upgrade/originalclusterversionPackage originalclusterversion knows how to save the original version of a cluster
pkg/upgrade/surveyPackage survey knows how to get input from the user
pkg/upgrade/testutilsPackage testutils provides test utilities for upgrade
Version
v0.0.106 (latest)
Published
Oct 21, 2022
Platform
linux/amd64
Imports
28 packages
Last checked
2 days ago

Tools for package owners.