Skip to content

Commit

Permalink
fix syncing; distinguish by catalog; fix property value
Browse files Browse the repository at this point in the history
Signed-off-by: Joe Lanford <joe.lanford@gmail.com>
  • Loading branch information
joelanford committed May 26, 2023
1 parent d1b23bf commit abc5a78
Show file tree
Hide file tree
Showing 8 changed files with 193 additions and 93 deletions.
17 changes: 11 additions & 6 deletions config/crd/bases/catalogd.operatorframework.io_bundlemetadata.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,16 @@ spec:
spec:
description: BundleMetadataSpec defines the desired state of BundleMetadata
properties:
catalogSource:
description: CatalogSource is the name of the Catalog that provides
this bundle
type: string
catalog:
description: Catalog is the name of the Catalog that provides this
bundle
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
x-kubernetes-map-type: atomic
image:
description: Image is a reference to the image that provides the bundle
contents
Expand All @@ -54,7 +60,6 @@ spec:
type:
type: string
value:
type: object
x-kubernetes-preserve-unknown-fields: true
required:
- type
Expand All @@ -79,7 +84,7 @@ spec:
type: object
type: array
required:
- catalogSource
- catalog
- image
- package
- properties
Expand Down
27 changes: 17 additions & 10 deletions config/crd/bases/catalogd.operatorframework.io_packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,16 @@ spec:
spec:
description: PackageSpec defines the desired state of Package
properties:
catalogSource:
description: CatalogSource is the name of the Catalog this package
belongs to
type: string
catalogSourceDisplayName:
type: string
catalogSourcePublisher:
type: string
catalog:
description: Catalog is the name of the Catalog this package belongs
to
properties:
name:
description: 'Name of the referent. More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names/#names
TODO: Add other useful fields. apiVersion, kind, uid?'
type: string
type: object
x-kubernetes-map-type: atomic
channels:
description: Channels are the declared channels for the package, ala
`stable` or `alpha`.
Expand Down Expand Up @@ -89,16 +91,21 @@ spec:
description: Icon is the Base64data image of the package for console
display
properties:
base64data:
data:
format: byte
type: string
mediatype:
type: string
type: object
packageName:
description: Name is the name of the package, ala `etcd`.
type: string
required:
- catalogSource
- catalog
- channels
- defaultChannel
- description
- packageName
type: object
status:
description: PackageStatus defines the observed state of Package
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
k8s.io/api v0.26.0
k8s.io/apimachinery v0.26.0
k8s.io/client-go v0.26.0
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448
sigs.k8s.io/controller-runtime v0.14.0
)

Expand Down Expand Up @@ -75,7 +76,6 @@ require (
k8s.io/component-base v0.26.0 // indirect
k8s.io/klog/v2 v2.80.1 // indirect
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
k8s.io/utils v0.0.0-20221128185143-99ec85e7a448 // indirect
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
sigs.k8s.io/yaml v1.3.0 // indirect
Expand Down
11 changes: 7 additions & 4 deletions pkg/apis/core/v1beta1/bundlemetadata_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,10 @@ limitations under the License.
package v1beta1

import (
"encoding/json"

corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
)

//+kubebuilder:object:root=true
Expand All @@ -45,8 +47,8 @@ type BundleMetadataList struct {

// BundleMetadataSpec defines the desired state of BundleMetadata
type BundleMetadataSpec struct {
// CatalogSource is the name of the Catalog that provides this bundle
CatalogSource string `json:"catalogSource"`
// Catalog is the name of the Catalog that provides this bundle
Catalog corev1.LocalObjectReference `json:"catalog"`

// Package is the name of the package that provides this bundle
Package string `json:"package"`
Expand All @@ -65,7 +67,8 @@ type Property struct {
Type string `json:"type"`

// +kubebuilder:pruning:PreserveUnknownFields
Value runtime.RawExtension `json:"value"`
// +kubebuilder:validation:Schemaless
Value json.RawMessage `json:"value"`
}

// TODO: In the future we should remove this in favor of using `declcfg.RelatedImage` (or similar) from
Expand Down
18 changes: 8 additions & 10 deletions pkg/apis/core/v1beta1/package_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ limitations under the License.
package v1beta1

import (
corev1 "k8s.io/api/core/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

Expand Down Expand Up @@ -44,14 +45,11 @@ type PackageList struct {

// PackageSpec defines the desired state of Package
type PackageSpec struct {
// CatalogSource is the name of the Catalog this package belongs to
CatalogSource string `json:"catalogSource"`
CatalogSourceDisplayName string `json:"catalogSourceDisplayName,omitempty"`
CatalogSourcePublisher string `json:"catalogSourcePublisher,omitempty"`
// Catalog is the name of the Catalog this package belongs to
Catalog corev1.LocalObjectReference `json:"catalog"`

// TODO(everettraven): can we remove this? Can the package metadata.name can be used instead?
// // PackageName is the name of the overall package, ala `etcd`.
// PackageName string `json:"packageName"`
// Name is the name of the package, ala `etcd`.
Name string `json:"packageName"`

// Description is the description of the package
Description string `json:"description"`
Expand All @@ -60,7 +58,7 @@ type PackageSpec struct {
Channels []PackageChannel `json:"channels"`

//Icon is the Base64data image of the package for console display
Icon Icon `json:"icon,omitempty"`
Icon *Icon `json:"icon,omitempty"`

// DefaultChannel 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
Expand All @@ -87,8 +85,8 @@ type ChannelEntry struct {

// Icon defines a base64 encoded icon and media type
type Icon struct {
Base64Data string `json:"base64data,omitempty"`
Mediatype string `json:"mediatype,omitempty"`
Data []byte `json:"data,omitempty"`
MediaType string `json:"mediatype,omitempty"`
}

// PackageStatus defines the observed state of Package
Expand Down
22 changes: 19 additions & 3 deletions pkg/apis/core/v1beta1/zz_generated.deepcopy.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit abc5a78

Please sign in to comment.