config

package
v2.0.0-...-6831f71 Latest Latest
Warning

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

Go to latest
Published: Apr 30, 2024 License: Apache-2.0 Imports: 25 Imported by: 2

Documentation

Overview

Copyright 2020 IBM Corp.

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

This section is empty.

Variables

View Source
var GetConfig = ProvideConfig

Functions

This section is empty.

Types

type ControllerValues

type ControllerValues struct {
	DeploymentNamespace           string        `env:"POD_NAMESPACE" envDefault:"openshift-redhat-marketplace" json:"deploymentNamespace"`
	MeterDefControllerRequeueRate time.Duration `env:"METER_DEF_CONTROLLER_REQUEUE_RATE" envDefault:"1h" json:"meterDefControllerRequeueRate"`
}

type EnvConfig

type EnvConfig struct {
	Features         *Features               `json:"features,omitempty"`
	Controller       *ControllerValues       `json:"controller,omitempty"`
	ReportController *ReportControllerConfig `json:"reportController,omitempty"`
	MeterController  *MeterBaseValues        `json:"meterController,omitempty"`
	Resources        *Resources              `json:"resources,omitempty"`
}

ENVCONFIG is a map of containerName to a corev1 resource requirements intended to set children

type Features

type Features struct {
	IBMCatalog bool `env:"FEATURE_IBMCATALOG" envDefault:"true" json:"IBMCatalog"`
}

Features store feature flags

type FileServerValues

type FileServerValues struct {
	FileServerURL string `env:"CATALOG_URL" envDefault:""`
}

type ImageStreamValues

type ImageStreamValues struct {
	ImageStreamID  string `env:"IMAGE_STREAM_ID" envDefault:"rhm-meterdefinition-file-server:v1"`
	ImageStreamTag string `env:"IMAGE_STREAM_TAG" envDefault:"v1"`
}

type Infrastructure

type Infrastructure struct {
	sync.Mutex
	// contains filtered or unexported fields
}

Infrastructure stores Kubernetes/Openshift clients

func NewInfrastructure

func NewInfrastructure(
	c client.Client,
	dc *discovery.DiscoveryClient,
) (*Infrastructure, error)

func (*Infrastructure) HasOpenshift

func (i *Infrastructure) HasOpenshift() bool

HasOpenshift checks if Openshift is available

func (*Infrastructure) IsDefined

func (i *Infrastructure) IsDefined() bool

IsDefined tells you if the infrastructure has been created

func (*Infrastructure) KubernetesPlatform

func (i *Infrastructure) KubernetesPlatform() string

Platform returns platform information

func (*Infrastructure) KubernetesVersion

func (i *Infrastructure) KubernetesVersion() string

Version gets Kubernetes Git version

func (*Infrastructure) OpenshiftParsedVersion

func (i *Infrastructure) OpenshiftParsedVersion() *semver.Version

Version gets Openshift parsed version

func (*Infrastructure) OpenshiftVersion

func (i *Infrastructure) OpenshiftVersion() string

Version gets Openshift version√

func (*Infrastructure) SubscriptionConfig

func (i *Infrastructure) SubscriptionConfig() *olmv1alpha1.SubscriptionConfig

SubscriptionConfig returns the SubscriptionConfig of the Subscription owning this operator

type KubernetesInfra

type KubernetesInfra struct {
	Version,
	Platform string
}

KubernetesInfra stores Kubernetes information

type Marketplace

type Marketplace struct {
	URL            string `env:"MARKETPLACE_URL" envDefault:"" json:"url"`
	InsecureClient bool   `env:"MARKETPLACE_HTTP_INSECURE_MODE" envDefault:"false" json:"insecureClient"`
}

Marketplace configuration

type MeterBaseValues

type MeterBaseValues struct {
	TransitionTime time.Duration `env:"METERBASE_TRANSITION_TIME" envDefault:"72h" json:"transitionTime"`
}

type MeterdefinitionCatalog

type MeterdefinitionCatalog struct {
	ImageStreamValues
	FileServerValues
}

type OLMInformation

type OLMInformation struct {
	OwnerName      string `env:"OLM_OWNER_NAME"`
	OwnerNamespace string `env:"OLM_OWNER_NAMESPACE"`
	OwnerKind      string `env:"OLM_OWNER_KIND"`
}

type OSRelatedImages

type OSRelatedImages struct {
	Reporter           string `env:"RELATED_IMAGE_REPORTER" envDefault:"reporter:latest"`
	KubeRbacProxy      string `env:"OS_IMAGE_KUBE_RBAC_PROXY" envDefault:"quay.io/brancz/kube-rbac-proxy:latest"`
	MetricState        string `env:"RELATED_IMAGE_METRIC_STATE" envDefault:"metric-state:latest"`
	AuthChecker        string `env:"RELATED_IMAGE_AUTHCHECK" envDefault:"authcheck:latest"`
	DQLite             string `env:"RELATED_IMAGE_DQLITE" envDefault:"dqlite:latest"`
	RemoteResource     string `env:"RELATED_IMAGE_RHM_RRS_DEPLOYMENT" envDefault:"us.icr.io/armada-master/remoteresource:2.1.19_7f655fe"`
	WatchKeeper        string `env:"RELATED_IMAGE_RHM_WATCH_KEEPER_DEPLOYMENT" envDefault:"us.icr.io/armada-master/watch-keeper:0.8.10_7f655fe"`
	MeterDefFileServer string `env:"RELATED_IMAGE_METERDEF_FILE_SERVER" envDefault:"quay.io/rh-marketplace/rhm-meterdefinition-file-server:v1"`
}

OSRelatedImages stores open source related images for the operator

type OpenshiftInfra

type OpenshiftInfra struct {
	Version            string
	ParsedVersion      semver.Version
	SubscriptionConfig *olmv1alpha1.SubscriptionConfig
}

OpenshiftInfra stores Openshift information (if Openshift is present)

type OperatorConfig

type OperatorConfig struct {
	DeployedNamespace string `env:"POD_NAMESPACE"`
	DeployedPodName   string `env:"POD_NAME"`
	ControllerValues  ControllerValues
	ReportController  ReportControllerConfig
	RelatedImages
	OSRelatedImages
	Features
	Marketplace
	*Infrastructure
	OLMInformation
	MeterBaseValues
	MeterdefinitionCatalog
	Config         EnvConfig `env:"CONFIG"`
	IsDisconnected bool      `env:"IS_DISCONNECTED" envDefault:"false"`
	// contains filtered or unexported fields
}

OperatorConfig is the configuration for the operator

func ProvideConfig

func ProvideConfig() (*OperatorConfig, error)

ProvideConfig gets the config from env vars

func ProvideInfrastructureAwareConfig

func ProvideInfrastructureAwareConfig(
	c rhmclient.SimpleClient,
	dc *discovery.DiscoveryClient,
) (*OperatorConfig, error)

ProvideInfrastructureAwareConfig loads Operator Config with Infrastructure information

type RelatedImages

type RelatedImages struct {
	Reporter           string `env:"RELATED_IMAGE_REPORTER" envDefault:"reporter:latest"`
	KubeRbacProxy      string `env:"RELATED_IMAGE_KUBE_RBAC_PROXY" envDefault:"registry.redhat.io/openshift4/ose-kube-rbac-proxy:v4.14"`
	MetricState        string `env:"RELATED_IMAGE_METRIC_STATE" envDefault:"metric-state:latest"`
	AuthChecker        string `env:"RELATED_IMAGE_AUTHCHECK" envDefault:"authcheck:latest"`
	DQLite             string `env:"RELATED_IMAGE_DQLITE" envDefault:"dqlite:latest"`
	RemoteResource     string `env:"RELATED_IMAGE_RHM_RRS_DEPLOYMENT" envDefault:"us.icr.io/armada-master/remoteresource:2.1.19_7f655fe"`
	WatchKeeper        string `env:"RELATED_IMAGE_RHM_WATCH_KEEPER_DEPLOYMENT" envDefault:"us.icr.io/armada-master/watch-keeper:0.8.10_7f655fe"`
	MeterDefFileServer string `env:"RELATED_IMAGE_METERDEF_FILE_SERVER" envDefault:"quay.io/rh-marketplace/rhm-meterdefinition-file-server:v1"`
}

RelatedImages stores relatedimages for the operator

type ReportControllerConfig

type ReportControllerConfig struct {
	RetryTime             time.Duration `env:"REPORT_RETRY_TIME_DURATION" envDefault:"6h"`
	RetryLimit            *int32        `env:"REPORT_RETRY_LIMIT"`
	PollTime              time.Duration `env:"REPORT_POLL_TIME_DURATION" envDefault:"1h"`
	UploadTargetsOverride []string      `env:"UPLOADTARGETSOVERRIDE" envSeparator:","`
	ReporterSchema        string        `env:"REPORTERSCHEMA"`
}

ReportConfig stores some changeable information for creating a report

type Resources

type Resources struct {
	Containers map[string]corev1.ResourceRequirements `json:"containers"`
}

Jump to

Keyboard shortcuts

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