ocm

package
v0.0.0-...-a56079f Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2024 License: Apache-2.0 Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// OPERATION_ID_HEADER is a header field used to correlate OCM events
	OPERATION_ID_HEADER = "X-Operation-Id"
	// CLUSTERS_V1_PATH is a path to the OCM clusters service
	CLUSTERS_V1_PATH = "/api/clusters_mgmt/v1/clusters"
	// UPGRADEPOLICIES_V1_PATH is a sub-path to the OCM upgrade policies service
	UPGRADEPOLICIES_V1_PATH = "upgrade_policies"
	// STATE_V1_PATH sub-path to the policy state service
	STATE_V1_PATH = "state"
)

Variables

View Source
var (
	// ErrClusterIdNotFound is an error describing the cluster ID can not be found
	ErrClusterIdNotFound = fmt.Errorf("OCM did not return a valid cluster ID: pull-secret may be invalid OR cluster's owner is disabled/banned in OCM")
)

Functions

This section is empty.

Types

type ClusterInfo

type ClusterInfo struct {
	Id                   string               `json:"id"`
	Version              ClusterVersion       `json:"version"`
	NodeDrainGracePeriod NodeDrainGracePeriod `json:"node_drain_grace_period"`
}

ClusterInfo represents a partial unmarshalled Cluster response from Cluster Services

type ClusterList

type ClusterList struct {
	Kind  string        `json:"kind"`
	Page  int64         `json:"page"`
	Size  int64         `json:"size"`
	Total int64         `json:"total"`
	Items []ClusterInfo `json:"items"`
}

ClusterList represents an unmarshalled Cluster List response from Cluster Services

type ClusterVersion

type ClusterVersion struct {
	Id           string `json:"id"`
	ChannelGroup string `json:"channel_group"`
}

ClusterVersion represents a clusters version

type ConfigManager

type ConfigManager struct {
	OcmBaseUrl string `yaml:"ocmBaseUrl"`
}

ConfigManager holds config for ocm client

type NodeDrainGracePeriod

type NodeDrainGracePeriod struct {
	Value int64  `json:"value"`
	Unit  string `json:"unit"`
}

NodeDrainGracePeriod represents a duration for node drain grace periods

type OcmClient

type OcmClient interface {
	GetCluster() (*ClusterInfo, error)
	GetClusterUpgradePolicies(clusterId string) (*UpgradePolicyList, error)
	GetClusterUpgradePolicyState(policyId string, clusterId string) (*UpgradePolicyState, error)
	SetState(value string, description string, policyId string, clusterId string) error
}

OcmClient enables an implementation of an ocm client

type OcmClientBuilder

type OcmClientBuilder interface {
	New(c client.Client, ocmBaseUrl *url.URL) (OcmClient, error)
}

OcmClientBuilder enables implementation of an ocm client.

func NewBuilder

func NewBuilder() OcmClientBuilder

NewBuilder creates a new Notifier instance builder

type OcmClientConfig

type OcmClientConfig struct {
	ConfigManager ConfigManager `yaml:"configManager"`
}

OcmClientConfig holds config for an ocm client

func (*OcmClientConfig) GetOCMBaseURL

func (cfg *OcmClientConfig) GetOCMBaseURL() *url.URL

GetOCMBaseURL returns the URL of OCM

func (*OcmClientConfig) IsValid

func (cfg *OcmClientConfig) IsValid() error

IsValid returns no error if the ocm client config is valid

type UpgradePolicy

type UpgradePolicy struct {
	Id                  string `json:"id"`
	Kind                string `json:"kind"`
	Href                string `json:"href"`
	Schedule            string `json:"schedule"`
	ScheduleType        string `json:"schedule_type"`
	UpgradeType         string `json:"upgrade_type"`
	Version             string `json:"version"`
	NextRun             string `json:"next_run"`
	PrevRun             string `json:"prev_run"`
	ClusterId           string `json:"cluster_id"`
	CapacityReservation *bool  `json:"capacity_reservation"`
}

UpgradePolicy represents an unmarshalled individual Upgrade Policy response from Cluster Services

type UpgradePolicyList

type UpgradePolicyList struct {
	Kind  string          `json:"kind"`
	Page  int64           `json:"page"`
	Size  int64           `json:"size"`
	Total int64           `json:"total"`
	Items []UpgradePolicy `json:"items"`
}

UpgradePolicyList represents an unmarshalled Upgrade Policy response from Cluster Services

type UpgradePolicyState

type UpgradePolicyState struct {
	Kind        string `json:"kind"`
	Href        string `json:"href"`
	Value       string `json:"value"`
	Description string `json:"description"`
}

UpgradePolicyState represents an Upgrade Policy state for notifications

type UpgradePolicyStateRequest

type UpgradePolicyStateRequest struct {
	Value       string `json:"value"`
	Description string `json:"description"`
}

UpgradePolicyStateRequest represents an Upgrade Policy state for notifications

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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