Documentation
¶
Index ¶
- func NewClient(kubeconfig string, logger *logrus.Entry) (clientset marketplace.Interface, err error)
- func NewKubeClient(kubeconfig string, logger *logrus.Entry) (clientset *kubernetes.Clientset, err error)
- type AppregistryLoader
- type CRDKey
- type ClusterServiceVersion
- type CustomResourceDefinition
- type Input
- type ManifestYAMLParser
- type PackageChannel
- type PackageManifest
- type RawOperatorManifestData
- type StructuredOperatorManifestData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewKubeClient ¶
Types ¶
type AppregistryLoader ¶
type AppregistryLoader struct {
// contains filtered or unexported fields
}
func NewLoader ¶
func NewLoader(kubeconfig string, logger *logrus.Entry) (*AppregistryLoader, error)
func (*AppregistryLoader) Load ¶
func (a *AppregistryLoader) Load(dbName string, csvSources string, csvPackages string) (store *sqlite.SQLQuerier, err error)
type CRDKey ¶
type CRDKey struct { Kind string `json:"kind"` Name string `json:"name"` Version string `json:"version"` }
CRDKey contains metadata needed to uniquely identify a CRD.
OLM uses CRDKey to uniquely identify a CustomResourceDefinition object. We are following the same pattern to be consistent.
func (CRDKey) String ¶
String returns a string representation of this CRDKey object with Kind, Name and Version concatenated.
CRDKey is used as the key to map of CustomResourceDefinition object(s). This function ensures that Kind, Name and Version are taken into account to compute the key associated with a CustomResourceDefinition object.
type ClusterServiceVersion ¶
type ClusterServiceVersion struct { // Type metadata. metav1.TypeMeta `json:",inline"` // Object metadata. metav1.ObjectMeta `json:"metadata"` // Spec is the raw representation of the 'spec' element of // ClusterServiceVersion object. Since we are // not interested in the content of spec we are not parsing it. Spec json.RawMessage `json:"spec"` }
ClusterServiceVersion is a structured representation of cluster service version object(s) specified inside the 'clusterServiceVersions' section of an operator manifest.
func (*ClusterServiceVersion) GetCustomResourceDefintions ¶
func (csv *ClusterServiceVersion) GetCustomResourceDefintions() (owned []*CRDKey, required []*CRDKey, err error)
GetCustomResourceDefintions returns a list of owned and required CustomResourceDefinition object(s) specified inside the 'customresourcedefinitions' section of a ClusterServiceVersion 'spec'.
owned represents the list of CRD(s) managed by this ClusterServiceVersion object. required represents the list of CRD(s) that this ClusterServiceVersion object depends on.
If owned or required is not defined in the spec then an empty list is returned respectively.
func (*ClusterServiceVersion) GetReplaces ¶
func (csv *ClusterServiceVersion) GetReplaces() (string, error)
GetReplaces returns the name of the older ClusterServiceVersion object that is replaced by this ClusterServiceVersion object.
If not defined, the function returns an empty string.
type CustomResourceDefinition ¶
type CustomResourceDefinition struct {
v1beta1.CustomResourceDefinition `json:",inline"`
}
CustomResourceDefinition is a structured representation of custom resource definition(s) specified in `customResourceDefinitions` section of an operator manifest.
func (*CustomResourceDefinition) Key ¶
func (crd *CustomResourceDefinition) Key() CRDKey
Key returns an instance of CRDKey which uniquely identifies a given CustomResourceDefinition object.
type Input ¶
type Input struct { // Sources is the set of namespaced name(s) of OperatorSource objects from // which we need to pull packages. Sources []*types.NamespacedName // Packages is the set of package name(s) specified. Packages []string }
func (*Input) PackagesToMap ¶
type ManifestYAMLParser ¶
type ManifestYAMLParser interface { // Unmarshal unmarshals raw operator manifest YAML into structured // representation. // // The function accepts raw yaml specified in rawYAML and converts it into // an instance of StructuredOperatorManifestData. Unmarshal(rawYAML []byte) (marshaled *StructuredOperatorManifestData, err error) // Marshal marshals a structured representation of an operator manifest into // raw YAML representation so that it can be used to create a configMap // object for a catalog source in OLM. // // The function accepts a structured representation of operator manifest(s) // specified in marshaled and returns a raw yaml representation of it. Marshal(bundle *StructuredOperatorManifestData) (*RawOperatorManifestData, error) }
ManifestYAMLParser is an interface that is responsible for marshaling raw operator manifest into structured representation and vice versa.
type PackageChannel ¶
type PackageChannel struct { // Name is the name of the channel, e.g. `alpha` or `stable`. Name string `json:"name"` // CurrentCSVName defines a reference to the CSV holding the version of // this package currently for the channel. CurrentCSVName string `json:"currentCSV"` }
PackageChannel defines a single channel under a package, pointing to a version of that package.
The following type has been directly copied as is from OLM. See https://github.com/operator-framework/operator-lifecycle-manager/blob/724b209ccfff33b6208cc5d05283800d6661d441/pkg/controller/registry/types.go#L105.
We use it to unmarshal 'packages/package/channels' element of an operator manifest.
type PackageManifest ¶
type PackageManifest struct { // PackageName is the name of the overall package, ala `etcd`. PackageName string `json:"packageName"` // Channels are the declared channels for the package, // ala `stable` or `alpha`. Channels []PackageChannel `json:"channels"` // DefaultChannelName is, if specified, the name of the default channel for // the package. The default channel will be installed if no other channel is // explicitly given. If the package has a single channel, then that // channel is implicitly the default. DefaultChannelName string `json:"defaultChannel"` }
PackageManifest holds information about a package, which is a reference to one (or more) channels under a single package.
The following type has been copied as is from OLM. See https://github.com/operator-framework/operator-lifecycle-manager/blob/724b209ccfff33b6208cc5d05283800d6661d441/pkg/controller/registry/types.go#L78:6.
We use it to unmarshal 'packages' element of an operator manifest.
type RawOperatorManifestData ¶
type RawOperatorManifestData struct { // CustomResourceDefinitions is the set of custom resource definition(s) // associated with this package manifest. CustomResourceDefinitions string `yaml:"customResourceDefinitions"` // ClusterServiceVersions is the set of cluster service version(s) // associated with this package manifest. ClusterServiceVersions string `yaml:"clusterServiceVersions"` // Packages is the set of package(s) associated with this operator manifest. Packages string `yaml:"packages"` }
RawOperatorManifestData encapsulates the list of CRD(s), CSV(s) and package(s) associated with a set of manifest(s).
type StructuredOperatorManifestData ¶
type StructuredOperatorManifestData struct { // CustomResourceDefinitions is the list of custom resource definition(s) // associated with this operator manifest. CustomResourceDefinitions []CustomResourceDefinition `json:"customResourceDefinitions"` // ClusterServiceVersions is the list of cluster service version(s) //associated with this operators manifest. ClusterServiceVersions []ClusterServiceVersion `json:"clusterServiceVersions"` // Packages is the list of package(s) associated with this operator manifest. Packages []PackageManifest `json:"packages"` }
StructuredOperatorManifestData is a structured representation of operator manifest(s). An operator manifest is a YAML document with the following sections: - customResourceDefinitions - clusterServiceVersions - packages
An operator manifest is unmarshaled into this type so that we can perform certain operations like, but not limited to:
- Construct a new operator manifest object to be used by a CatalogSourceConfig by combining a set of existing operator manifest(s).
- Construct a new operator manifest object by extracting a certain operator/package from a a given operator manifest.