Skip to content

feat: update catalog source spec with config #173

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions crds/operators.coreos.com_catalogsources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,41 @@ spec:
displayName:
description: Metadata
type: string
grpcPodConfig:
description: GrpcPodConfig exposes different overrides for the pod spec of the CatalogSource Pod. Only used when SourceType = SourceTypeGrpc and Image is set.
type: object
properties:
nodeSelector:
description: NodeSelector is a selector which must be true for the pod to fit on a node. Selector which must match a node's labels for the pod to be scheduled on that node.
type: object
additionalProperties:
type: string
priorityClassName:
description: If specified, indicates the pod's priority. If not specified, the pod priority will be default or zero if there is no default.
type: string
tolerations:
description: Tolerations are the catalog source's pod's tolerations.
type: array
items:
description: The pod this Toleration is attached to tolerates any taint that matches the triple <key,value,effect> using the matching operator <operator>.
type: object
properties:
effect:
description: Effect indicates the taint effect to match. Empty means match all taint effects. When specified, allowed values are NoSchedule, PreferNoSchedule and NoExecute.
type: string
key:
description: Key is the taint key that the toleration applies to. Empty means match all taint keys. If the key is empty, operator must be Exists; this combination means to match all values and all keys.
type: string
operator:
description: Operator represents a key's relationship to the value. Valid operators are Exists and Equal. Defaults to Equal. Exists is equivalent to wildcard for value, so that a pod can tolerate all taints of a particular category.
type: string
tolerationSeconds:
description: TolerationSeconds represents the period of time the toleration (which must be of effect NoExecute, otherwise this field is ignored) tolerates the taint. By default, it is not set, which means tolerate the taint forever (do not evict). Zero and negative values will be treated as 0 (evict immediately) by the system.
type: integer
format: int64
value:
description: Value is the taint value the toleration matches to. If the operator is Exists, the value should be empty, otherwise just a regular string.
type: string
icon:
type: object
required:
Expand Down
4 changes: 2 additions & 2 deletions crds/zz_defs.go

Large diffs are not rendered by default.

36 changes: 30 additions & 6 deletions pkg/operators/v1alpha1/catalogsource_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package v1alpha1

import (
"fmt"
corev1 "k8s.io/api/core/v1"
"time"

"github.com/sirupsen/logrus"
Expand Down Expand Up @@ -48,35 +49,40 @@ type CatalogSourceSpec struct {
// The range of the priority value can go from positive to negative in the range of int32.
// The default value to a catalog source with unassigned priority would be 0.
// The catalog source with the same priority values will be ranked lexicographically based on its name.
// +Optional
// +optional
Priority int `json:"priority,omitempty"`

// ConfigMap is the name of the ConfigMap to be used to back a configmap-server registry.
// Only used when SourceType = SourceTypeConfigmap or SourceTypeInternal.
// +Optional
// +optional
ConfigMap string `json:"configMap,omitempty"`

// Address is a host that OLM can use to connect to a pre-existing registry.
// Format: <registry-host or ip>:<port>
// Only used when SourceType = SourceTypeGrpc.
// Ignored when the Image field is set.
// +Optional
// +optional
Address string `json:"address,omitempty"`

// Image is an operator-registry container image to instantiate a registry-server with.
// Only used when SourceType = SourceTypeGrpc.
// If present, the address field is ignored.
// +Optional
// +optional
Image string `json:"image,omitempty"`

// GrpcPodConfig exposes different overrides for the pod spec of the CatalogSource Pod.
// Only used when SourceType = SourceTypeGrpc and Image is set.
// +optional
GrpcPodConfig *GrpcPodConfig `json:"grpcPodConfig,omitempty"`

// UpdateStrategy defines how updated catalog source images can be discovered
// Consists of an interval that defines polling duration and an embedded strategy type
// +Optional
// +optional
UpdateStrategy *UpdateStrategy `json:"updateStrategy,omitempty"`

// Secrets represent set of secrets that can be used to access the contents of the catalog.
// It is best to keep this list small, since each will need to be tried for every catalog entry.
// +Optional
// +optional
Secrets []string `json:"secrets,omitempty"`

// Metadata
Expand All @@ -86,6 +92,24 @@ type CatalogSourceSpec struct {
Icon Icon `json:"icon,omitempty"`
}

// GrpcPodConfig contains configuration specified for a catalog source
type GrpcPodConfig struct {
// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// +optional
NodeSelector map[string]string `json:"nodeSelector,omitempty"`

// Tolerations are the catalog source's pod's tolerations.
// +optional
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`

// If specified, indicates the pod's priority.
// If not specified, the pod priority will be default or zero if there is no
// default.
// +optional
PriorityClassName string `json:"priorityClassName,omitempty" protobuf:"bytes,24,opt,name=priorityClassName"`
}

// UpdateStrategy holds all the different types of catalog source update strategies
// Currently only registry polling strategy is implemented
type UpdateStrategy struct {
Expand Down
70 changes: 52 additions & 18 deletions pkg/operators/v1alpha1/zz_generated.deepcopy.go

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

10 changes: 5 additions & 5 deletions pkg/validation/internal/bundle.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,11 +52,11 @@ func validateServiceAccounts(bundle *manifests.Bundle) []errors.Error {
sa := v1.ServiceAccount{}
if err := runtime.DefaultUnstructuredConverter.FromUnstructured(obj.Object, &sa); err == nil {
if _, ok := saNamesFromCSV[sa.Name]; ok {
errs = append(errs, errors.ErrInvalidBundle(fmt.Sprintf("invalid service account found in bundle. " +
"This service account %s in your bundle is not valid, because a service account with the same name " +
"was already specified in your CSV. If this was unintentional, please remove the service account " +
"manifest from your bundle. If it was intentional to specify a separate service account, " +
"please rename the SA in either the bundle manifest or the CSV.",sa.Name), sa.Name))
errs = append(errs, errors.ErrInvalidBundle(fmt.Sprintf("invalid service account found in bundle. "+
"This service account %s in your bundle is not valid, because a service account with the same name "+
"was already specified in your CSV. If this was unintentional, please remove the service account "+
"manifest from your bundle. If it was intentional to specify a separate service account, "+
"please rename the SA in either the bundle manifest or the CSV.", sa.Name), sa.Name))
}
}
}
Expand Down