Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
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
6 changes: 3 additions & 3 deletions api/v1alpha1/pluginpreset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ type PluginPresetPluginSpec struct {
DisplayName string `json:"displayName,omitempty"`

// Values are the values for a PluginDefinition instance.
OptionValues []PluginOptionValue `json:"optionValues,omitempty"`
OptionValues []PluginPresetPluginOptionValue `json:"optionValues,omitempty"`

// ReleaseNamespace is the namespace in the remote cluster to which the backend is deployed.
// Defaults to the Greenhouse managed namespace if not set.
Expand Down Expand Up @@ -114,8 +114,8 @@ type PluginPresetPluginValueFromSource struct {
// ClusterOptionOverride defines which plugin option should be override in which cluster
// +Optional
type ClusterOptionOverride struct {
ClusterName string `json:"clusterName"`
Overrides []PluginOptionValue `json:"overrides"`
ClusterName string `json:"clusterName"`
Overrides []PluginPresetPluginOptionValue `json:"overrides"`
}

const (
Expand Down
4 changes: 2 additions & 2 deletions api/v1alpha1/zz_generated.deepcopy.go

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

3 changes: 3 additions & 0 deletions charts/greenhouse/ci/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ global:
expressionEvaluationEnabled: false
integrationEnabled: false
ociMirroringEnabled: false
# PluginPreset configuration for Greenhouse.
pluginPreset:
expressionEvaluationEnabled: true
linkerd_enabled: false
region: greenhouse
registry: ghcr.io/cloudoperators/greenhouse
Expand Down
3 changes: 3 additions & 0 deletions charts/greenhouse/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ global:
expressionEvaluationEnabled: false
integrationEnabled: false
ociMirroringEnabled: false
# PluginPreset configuration for Greenhouse.
pluginPreset:
expressionEvaluationEnabled: false

Comment thread
k-fabryczny marked this conversation as resolved.
postgresqlng:
enabled: true
Expand Down
2 changes: 2 additions & 0 deletions charts/manager/ci/test-values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ global:
expressionEvaluationEnabled: false
integrationEnabled: false
ociMirroringEnabled: false
pluginPreset:
expressionEvaluationEnabled: true

controllerManager:
args:
Expand Down
34 changes: 12 additions & 22 deletions charts/manager/crds/greenhouse.sap_pluginpresets.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,12 @@ spec:
type: string
overrides:
items:
description: PluginOptionValue is the value for a PluginOption.
description: PluginPresetPluginOptionValue is the value for
a PluginOption.
properties:
expression:
description: |-
Expression is a YAML string with ${...} placeholders that will be evaluated as CEL expressions.

Deprecated: Expression is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Expression field.
description: Expression is a YAML string with ${...} placeholders
that will be evaluated as CEL expressions.
type: string
name:
description: Name of the values.
Expand All @@ -87,11 +85,8 @@ spec:
description: ValueFrom references value in another source.
properties:
ref:
description: |-
Ref references values defined in another resource (Plugin, PluginPreset)

Deprecated: Ref is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Ref field.
description: Ref references values defined in another
resource (Plugin, PluginPreset)
properties:
expression:
description: Expression is a CEL expression to
Expand Down Expand Up @@ -307,14 +302,12 @@ spec:
optionValues:
description: Values are the values for a PluginDefinition instance.
items:
description: PluginOptionValue is the value for a PluginOption.
description: PluginPresetPluginOptionValue is the value for
a PluginOption.
properties:
expression:
description: |-
Expression is a YAML string with ${...} placeholders that will be evaluated as CEL expressions.

Deprecated: Expression is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Expression field.
description: Expression is a YAML string with ${...} placeholders
that will be evaluated as CEL expressions.
type: string
name:
description: Name of the values.
Expand All @@ -326,11 +319,8 @@ spec:
description: ValueFrom references value in another source.
properties:
ref:
description: |-
Ref references values defined in another resource (Plugin, PluginPreset)

Deprecated: Ref is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Ref field.
description: Ref references values defined in another
resource (Plugin, PluginPreset)
properties:
expression:
description: Expression is a CEL expression to extract
Expand Down
4 changes: 4 additions & 0 deletions charts/manager/templates/_helpers.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -117,3 +117,7 @@ Define postgresql helpers
{{- define "plugin.ociMirroringEnabled" -}}
{{- printf "%t" (required "global.plugin.ociMirroringEnabled missing" .Values.global.plugin.ociMirroringEnabled) }}
{{- end }}
{{/* Render the pluginPreset expression evaluation flag */}}
{{- define "pluginPreset.expressionEvaluationEnabled" -}}
{{- printf "%t" (required "global.pluginPreset.expressionEvaluationEnabled missing" .Values.global.pluginPreset.expressionEvaluationEnabled) }}
{{- end }}
7 changes: 7 additions & 0 deletions charts/manager/templates/manager/feature-flag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,16 @@ data:
expressionEvaluationEnabled: false / true
integrationEnabled: false / true
ociMirroringEnabled: false / true
# enable pluginPreset features
# expressionEvaluationEnabled allows you to enable or disable CEL expression evaluation in PluginPreset
# when enabled, expressions in PluginPreset.spec.plugin.optionValues are evaluated before creating the Plugin
pluginPreset: |
expressionEvaluationEnabled: false / true
dex: |
storage: {{ include "dex.backend" $ }}
plugin: |
expressionEvaluationEnabled: {{ include "plugin.expressionEvaluationEnabled" $ }}
integrationEnabled: {{ include "plugin.integrationEnabled" $ }}
ociMirroringEnabled: {{ include "plugin.ociMirroringEnabled" $ }}
pluginPreset: |
expressionEvaluationEnabled: {{ include "pluginPreset.expressionEvaluationEnabled" $ }}
8 changes: 7 additions & 1 deletion cmd/greenhouse/controllers.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ var knownControllers = map[string]func(controllerName string, mgr ctrl.Manager)

// Plugin controllers.
"plugin": startPluginReconciler,
"pluginPreset": (&plugincontrollers.PluginPresetReconciler{}).SetupWithManager,
"pluginPreset": startPluginPresetReconciler,

"catalog": startCatalogReconciler,
"pluginDefinition": startPluginDefinitionReconciler,
Expand Down Expand Up @@ -93,6 +93,12 @@ func startPluginReconciler(name string, mgr ctrl.Manager) error {
}).SetupWithManager(name, mgr)
}

func startPluginPresetReconciler(name string, mgr ctrl.Manager) error {
return (&plugincontrollers.PluginPresetReconciler{
ExpressionEvaluationEnabled: featureFlags.IsPresetExpressionEvaluationEnabled(),
}).SetupWithManager(name, mgr)
}

func startPluginDefinitionReconciler(name string, mgr ctrl.Manager) error {
return (&plugindefinitioncontroller.PluginDefinitionReconciler{
OCIMirroringEnabled: featureFlags.IsOCIMirroringEnabled(),
Expand Down
2 changes: 2 additions & 0 deletions dev-env/dev.values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ global:
expressionEvaluationEnabled: true
integrationEnabled: true
ociMirroringEnabled: true
pluginPreset:
expressionEvaluationEnabled: true
alerts:
enabled: false
certManager:
Expand Down
15 changes: 9 additions & 6 deletions docs/reference/api/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -1082,8 +1082,8 @@ <h3 id="greenhouse.sap/v1alpha1.ClusterOptionOverride">ClusterOptionOverride
<td>
<code>overrides</code><br>
<em>
<a href="#greenhouse.sap/v1alpha1.PluginOptionValue">
[]PluginOptionValue
<a href="#greenhouse.sap/v1alpha1.PluginPresetPluginOptionValue">
[]PluginPresetPluginOptionValue
</a>
</em>
</td>
Expand Down Expand Up @@ -3066,8 +3066,6 @@ <h3 id="greenhouse.sap/v1alpha1.PluginOptionValue">PluginOptionValue
</h3>
<p>
(<em>Appears on:</em>
<a href="#greenhouse.sap/v1alpha1.ClusterOptionOverride">ClusterOptionOverride</a>,
<a href="#greenhouse.sap/v1alpha1.PluginPresetPluginSpec">PluginPresetPluginSpec</a>,
<a href="#greenhouse.sap/v1alpha1.PluginSpec">PluginSpec</a>)
</p>
<p>PluginOptionValue is the value for a PluginOption.</p>
Expand Down Expand Up @@ -3260,6 +3258,11 @@ <h3 id="greenhouse.sap/v1alpha1.PluginPreset">PluginPreset
</div>
<h3 id="greenhouse.sap/v1alpha1.PluginPresetPluginOptionValue">PluginPresetPluginOptionValue
</h3>
<p>
(<em>Appears on:</em>
<a href="#greenhouse.sap/v1alpha1.ClusterOptionOverride">ClusterOptionOverride</a>,
<a href="#greenhouse.sap/v1alpha1.PluginPresetPluginSpec">PluginPresetPluginSpec</a>)
</p>
<p>PluginPresetPluginOptionValue is the value for a PluginOption.</p>
<div class="md-typeset__scrollwrap">
<div class="md-typeset__table">
Expand Down Expand Up @@ -3370,8 +3373,8 @@ <h3 id="greenhouse.sap/v1alpha1.PluginPresetPluginSpec">PluginPresetPluginSpec
<td>
<code>optionValues</code><br>
<em>
<a href="#greenhouse.sap/v1alpha1.PluginOptionValue">
[]PluginOptionValue
<a href="#greenhouse.sap/v1alpha1.PluginPresetPluginOptionValue">
[]PluginPresetPluginOptionValue
</a>
</em>
</td>
Expand Down
28 changes: 6 additions & 22 deletions docs/reference/api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1105,14 +1105,10 @@ components:
type: string
overrides:
items:
description: PluginOptionValue is the value for a PluginOption.
description: PluginPresetPluginOptionValue is the value for a PluginOption.
properties:
expression:
description: |-
Expression is a YAML string with ${...} placeholders that will be evaluated as CEL expressions.

Deprecated: Expression is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Expression field.
description: Expression is a YAML string with ${...} placeholders that will be evaluated as CEL expressions.
type: string
name:
description: Name of the values.
Expand All @@ -1124,11 +1120,7 @@ components:
description: ValueFrom references value in another source.
properties:
ref:
description: |-
Ref references values defined in another resource (Plugin, PluginPreset)

Deprecated: Ref is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Ref field.
description: Ref references values defined in another resource (Plugin, PluginPreset)
properties:
expression:
description: Expression is a CEL expression to extract the value from the referenced resource
Expand Down Expand Up @@ -1327,14 +1319,10 @@ components:
optionValues:
description: Values are the values for a PluginDefinition instance.
items:
description: PluginOptionValue is the value for a PluginOption.
description: PluginPresetPluginOptionValue is the value for a PluginOption.
properties:
expression:
description: |-
Expression is a YAML string with ${...} placeholders that will be evaluated as CEL expressions.

Deprecated: Expression is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Expression field.
description: Expression is a YAML string with ${...} placeholders that will be evaluated as CEL expressions.
type: string
name:
description: Name of the values.
Expand All @@ -1346,11 +1334,7 @@ components:
description: ValueFrom references value in another source.
properties:
ref:
description: |-
Ref references values defined in another resource (Plugin, PluginPreset)

Deprecated: Ref is deprecated on standalone Plugins and will be removed in a future release.
Consider using a PluginPreset to deploy Plugins utilizing the Ref field.
description: Ref references values defined in another resource (Plugin, PluginPreset)
properties:
expression:
description: Expression is a CEL expression to extract the value from the referenced resource
Expand Down
Loading
Loading