Skip to content

Commit 414ffa9

Browse files
committed
add operator configuration to subscription spec
1 parent e16488d commit 414ffa9

File tree

5 files changed

+237
-9
lines changed

5 files changed

+237
-9
lines changed

pkg/api/apis/operators/subscription_types.go

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,46 @@ type SubscriptionSpec struct {
3333
Channel string
3434
StartingCSV string
3535
InstallPlanApproval Approval
36+
Config SubscriptionConfig
37+
}
38+
39+
// SubscriptionConfig contains configuration specified for a subscription.
40+
type SubscriptionConfig struct {
41+
// Label selector for pods. Existing ReplicaSets whose pods are
42+
// selected by this will be the ones affected by this deployment.
43+
// It must match the pod template's labels.
44+
Selector *metav1.LabelSelector `json:"selector,omitempty"`
45+
46+
// NodeSelector is a selector which must be true for the pod to fit on a node.
47+
// Selector which must match a node's labels for the pod to be scheduled on that node.
48+
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
49+
// +optional
50+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
51+
52+
// If specified, the pod's tolerations.
53+
// +optional
54+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
55+
56+
// Compute Resources required by this container.
57+
// Cannot be updated.
58+
// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
59+
// +optional
60+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
61+
62+
// List of sources to populate environment variables in the container.
63+
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
64+
// will be reported as an event when the container is starting. When a key exists in multiple
65+
// sources, the value associated with the last source will take precedence.
66+
// Values defined by an Env with a duplicate key will take precedence.
67+
// Cannot be updated.
68+
// +optional
69+
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
70+
// List of environment variables to set in the container.
71+
// Cannot be updated.
72+
// +optional
73+
// +patchMergeKey=name
74+
// +patchStrategy=merge
75+
Env []corev1.EnvVar `json:"env,omitempty"`
3676
}
3777

3878
// SubscriptionConditionType indicates an explicit state condition about a Subscription in "abnormal-true"

pkg/api/apis/operators/v1alpha1/subscription_types.go

Lines changed: 47 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,52 @@ const (
2929

3030
// SubscriptionSpec defines an Application that can be installed
3131
type SubscriptionSpec struct {
32-
CatalogSource string `json:"source"`
33-
CatalogSourceNamespace string `json:"sourceNamespace"`
34-
Package string `json:"name"`
35-
Channel string `json:"channel,omitempty"`
36-
StartingCSV string `json:"startingCSV,omitempty"`
37-
InstallPlanApproval Approval `json:"installPlanApproval,omitempty"`
32+
CatalogSource string `json:"source"`
33+
CatalogSourceNamespace string `json:"sourceNamespace"`
34+
Package string `json:"name"`
35+
Channel string `json:"channel,omitempty"`
36+
StartingCSV string `json:"startingCSV,omitempty"`
37+
InstallPlanApproval Approval `json:"installPlanApproval,omitempty"`
38+
Config SubscriptionConfig `json:"config,omitempty"`
39+
}
40+
41+
// SubscriptionConfig contains configuration specified for a subscription.
42+
type SubscriptionConfig struct {
43+
// Label selector for pods. Existing ReplicaSets whose pods are
44+
// selected by this will be the ones affected by this deployment.
45+
// It must match the pod template's labels.
46+
Selector *metav1.LabelSelector `json:"selector,omitempty"`
47+
48+
// NodeSelector is a selector which must be true for the pod to fit on a node.
49+
// Selector which must match a node's labels for the pod to be scheduled on that node.
50+
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
51+
// +optional
52+
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
53+
54+
// If specified, the pod's tolerations.
55+
// +optional
56+
Tolerations []corev1.Toleration `json:"tolerations,omitempty"`
57+
58+
// Compute Resources required by this container.
59+
// Cannot be updated.
60+
// More info: https://kubernetes.io/docs/concepts/configuration/manage-compute-resources-container/
61+
// +optional
62+
Resources corev1.ResourceRequirements `json:"resources,omitempty"`
63+
64+
// List of sources to populate environment variables in the container.
65+
// The keys defined within a source must be a C_IDENTIFIER. All invalid keys
66+
// will be reported as an event when the container is starting. When a key exists in multiple
67+
// sources, the value associated with the last source will take precedence.
68+
// Values defined by an Env with a duplicate key will take precedence.
69+
// Cannot be updated.
70+
// +optional
71+
EnvFrom []corev1.EnvFromSource `json:"envFrom,omitempty"`
72+
// List of environment variables to set in the container.
73+
// Cannot be updated.
74+
// +optional
75+
// +patchMergeKey=name
76+
// +patchStrategy=merge
77+
Env []corev1.EnvVar `json:"env,omitempty"`
3878
}
3979

4080
// SubscriptionConditionType indicates an explicit state condition about a Subscription in "abnormal-true"
@@ -81,7 +121,7 @@ const (
81121
InstallPlanNotYetReconciled = "InstallPlanNotYetReconciled"
82122

83123
// InstallPlanFailed is a reason string for Subscriptions that transitioned due to a referenced InstallPlan failing without setting an explicit failure condition.
84-
InstallPlanFailed = "InstallPlanFailed"
124+
InstallPlanFailed = "InstallPlanFailed"
85125
)
86126

87127
// SubscriptionCondition represents the latest available observations of a Subscription's state.

pkg/api/apis/operators/v1alpha1/zz_generated.conversion.go

Lines changed: 46 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/apis/operators/v1alpha1/zz_generated.deepcopy.go

Lines changed: 52 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pkg/api/apis/operators/zz_generated.deepcopy.go

Lines changed: 52 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)