Skip to content
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
3 changes: 3 additions & 0 deletions api/v1alpha1/operandregistry_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ type Operator struct {
// SubscriptionConfig is used to override operator configuration.
// +optional
SubscriptionConfig *olmv1alpha1.SubscriptionConfig `json:"subscriptionConfig,omitempty"`
// OperatorConfig is the name of the OperatorConfig
// +optional
OperatorConfig string `json:"operatorConfig,omitempty"`
}

// +kubebuilder:validation:Enum=public;private
Expand Down
43 changes: 40 additions & 3 deletions api/v1alpha1/operatorconfig_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,49 @@
package v1alpha1

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

// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.

// OperatorConfigSpec defines the desired state of OperatorConfig
// +kubebuilder:pruning:PreserveUnknownFields
type OperatorConfigSpec struct {
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
// Important: Run "make" to regenerate code after modifying this file

// Foo is an example field of OperatorConfig. Edit operatorconfig_types.go to remove/update
Foo string `json:"foo,omitempty"`

// Services is a list of services to be configured, specifically their operators
// +kubebuilder:pruning:PreserveUnknownFields
Services []ServiceOperatorConfig `json:"services,omitempty"`
}

// ServiceOperatorConfig defines the configuration of the service.
type ServiceOperatorConfig struct {
// Name is the operator name as requested in the OperandRequest.
Name string `json:"name"`
// If specified, the pod's scheduling constraints
// +optional
Affinity *corev1.Affinity `json:"affinity,omitempty" protobuf:"bytes,18,opt,name=affinity"`
// Number of desired pods. This is a pointer to distinguish between explicit
// zero and not specified. Defaults to 1.
// +optional
Replicas *int32 `json:"replicas,omitempty" protobuf:"varint,1,opt,name=replicas"`
// TopologySpreadConstraints describes how a group of pods ought to spread across topology
// domains. Scheduler will schedule pods in a way which abides by the constraints.
// All topologySpreadConstraints are ANDed.
// +optional
// +patchMergeKey=topologyKey
// +patchStrategy=merge
// +listType=map
// +listMapKey=topologyKey
// +listMapKey=whenUnsatisfiable
TopologySpreadConstraints []corev1.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty" patchStrategy:"merge" patchMergeKey:"topologyKey" protobuf:"bytes,33,opt,name=topologySpreadConstraints"`
}

// OperatorConfigStatus defines the observed state of OperatorConfig
// +kubebuilder:pruning:PreserveUnknownFields
type OperatorConfigStatus struct {
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
// Important: Run "make" to regenerate code after modifying this file
Expand All @@ -59,6 +86,16 @@ type OperatorConfigList struct {
Items []OperatorConfig `json:"items"`
}

// GetConfigForOperator obtains a particular ServiceOperatorConfig by using operator name for searching.
func (r *OperatorConfig) GetConfigForOperator(name string) *ServiceOperatorConfig {
for _, o := range r.Spec.Services {
if o.Name == name {
return &o
}
}
return nil
}

func init() {
SchemeBuilder.Register(&OperatorConfig{}, &OperatorConfigList{})
}
42 changes: 41 additions & 1 deletion api/v1alpha1/zz_generated.deepcopy.go

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

Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ metadata:
categories: Developer Tools, Monitoring, Logging & Tracing, Security
certified: "false"
containerImage: icr.io/cpopen/odlm:latest
createdAt: "2024-03-20T18:18:08Z"
createdAt: "2024-03-29T03:10:47Z"
description: The Operand Deployment Lifecycle Manager provides a Kubernetes CRD-based API to manage the lifecycle of operands.
nss.operator.ibm.com/managed-operators: ibm-odlm
olm.skipRange: '>=1.2.0 <4.3.0'
Expand Down Expand Up @@ -701,6 +701,9 @@ spec:
- operandbindinfos
- operandbindinfos/status
- operandbindinfos/finalizers
- operatorconfigs
- operatorconfigs/status
- operatorconfigs/finalizers
verbs:
- create
- delete
Expand Down
3 changes: 3 additions & 0 deletions bundle/manifests/operator.ibm.com_operandregistries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,9 @@ spec:
is not set, the operator namespace is the same as OperandRegistry
Namespace
type: string
operatorConfig:
description: OperatorConfig is the name of the OperatorConfig
type: string
packageName:
description: Name of the package that defines the applications.
type: string
Expand Down
Loading