Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
6bba692
feat: add support for multiple SCP composition
pkoutsovasilis Nov 21, 2025
400b02d
ci: add unit-tests
pkoutsovasilis Nov 21, 2025
dd18a2d
fix: move SoftOwnerRefsAnnotation from commonannotations to reconcile…
pkoutsovasilis Nov 25, 2025
b5eaad2
refactor: config policy merging and use namespaced secret sources for…
pkoutsovasilis Nov 25, 2025
994a33e
feat: add scp weight as printable column
pkoutsovasilis Nov 25, 2025
4004fc7
fix: reduce the scope of err vars
pkoutsovasilis Nov 27, 2025
5e03e79
fix: improve code readability in mergeElasticsearchSpecs func
pkoutsovasilis Nov 27, 2025
0b83045
fix: change SoftOwnerRefsAnnotation annotation value from map to list
pkoutsovasilis Nov 27, 2025
5c216cc
doc: add comment for file-settings secret soft owners
pkoutsovasilis Nov 27, 2025
48f510a
fix: reconciler unit-tests
pkoutsovasilis Nov 27, 2025
cfd5cb1
fix: rework secure-settings getter funcs
pkoutsovasilis Nov 27, 2025
6c4e575
fix: update main.md
pkoutsovasilis Nov 27, 2025
0f5d39b
Merge remote-tracking branch 'origin/main' into feature/multi-scp-com…
pkoutsovasilis Nov 28, 2025
3bf7a08
fix: rework secret mounts and sources merging
pkoutsovasilis Dec 1, 2025
799744b
fix: rework config merging
pkoutsovasilis Dec 1, 2025
025c76f
fix: relocate soft owners related funcs
pkoutsovasilis Dec 1, 2025
e3639c5
fix: reword secret mounts merge conflict errs
pkoutsovasilis Dec 1, 2025
ad6e3b1
fix: include the deprecated field of secure settings in merging
pkoutsovasilis Dec 1, 2025
8406a6c
fix: make linter happy
pkoutsovasilis Dec 1, 2025
e199c44
ci: add e2e tests
pkoutsovasilis Dec 1, 2025
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
10 changes: 10 additions & 0 deletions config/crds/v1/all-crds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10673,6 +10673,9 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .spec.weight
name: Weight
type: integer
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -10932,6 +10935,13 @@ spec:
- secretName
type: object
type: array
weight:
default: 0
description: |-
Weight determines the priority of this policy when multiple policies target the same resource.
Lower weight values take precedence. Defaults to 0.
format: int32
type: integer
type: object
status:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .spec.weight
name: Weight
type: integer
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -288,6 +291,13 @@ spec:
- secretName
type: object
type: array
weight:
default: 0
description: |-
Weight determines the priority of this policy when multiple policies target the same resource.
Lower weight values take precedence. Defaults to 0.
format: int32
type: integer
type: object
status:
properties:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10743,6 +10743,9 @@ spec:
- jsonPath: .metadata.creationTimestamp
name: Age
type: date
- jsonPath: .spec.weight
name: Weight
type: integer
name: v1alpha1
schema:
openAPIV3Schema:
Expand Down Expand Up @@ -11002,6 +11005,13 @@ spec:
- secretName
type: object
type: array
weight:
default: 0
description: |-
Weight determines the priority of this policy when multiple policies target the same resource.
Lower weight values take precedence. Defaults to 0.
format: int32
type: integer
type: object
status:
properties:
Expand Down
3 changes: 3 additions & 0 deletions docs/reference/api-reference/main.md
Original file line number Diff line number Diff line change
Expand Up @@ -1991,6 +1991,8 @@ Package v1alpha1 contains API schema definitions for managing StackConfigPolicy
| *`secureSettings`* __[SecretSource](#secretsource) array__ | SecureSettings are additional Secrets that contain data to be configured to Elasticsearch's keystore. |




### IndexTemplates [#indextemplates]


Expand Down Expand Up @@ -2068,6 +2070,7 @@ StackConfigPolicy represents a StackConfigPolicy resource in a Kubernetes cluste
| Field | Description |
| --- | --- |
| *`resourceSelector`* __[LabelSelector](https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.32/#labelselector-v1-meta)__ | |
| *`weight`* __integer__ | Weight determines the priority of this policy when multiple policies target the same resource.<br>Lower weight values take precedence. Defaults to 0. |
| *`secureSettings`* __[SecretSource](#secretsource) array__ | Deprecated: SecureSettings only applies to Elasticsearch and is deprecated. It must be set per application instead. |
| *`elasticsearch`* __[ElasticsearchConfigPolicySpec](#elasticsearchconfigpolicyspec)__ | |
| *`kibana`* __[KibanaConfigPolicySpec](#kibanaconfigpolicyspec)__ | |
Expand Down
60 changes: 60 additions & 0 deletions pkg/apis/stackconfigpolicy/v1alpha1/stackconfigpolicy_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ func init() {
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.readyCount",description="Resources configured"
// +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:printcolumn:name="Weight",type="integer",JSONPath=".spec.weight"
// +kubebuilder:subresource:status
// +kubebuilder:storageversion
type StackConfigPolicy struct {
Expand All @@ -55,6 +56,10 @@ type StackConfigPolicyList struct {

type StackConfigPolicySpec struct {
ResourceSelector metav1.LabelSelector `json:"resourceSelector,omitempty"`
// Weight determines the priority of this policy when multiple policies target the same resource.
// Lower weight values take precedence. Defaults to 0.
// +kubebuilder:default=0
Weight int32 `json:"weight,omitempty"`
// Deprecated: SecureSettings only applies to Elasticsearch and is deprecated. It must be set per application instead.
SecureSettings []commonv1.SecretSource `json:"secureSettings,omitempty"`
Elasticsearch ElasticsearchConfigPolicySpec `json:"elasticsearch,omitempty"`
Expand Down Expand Up @@ -94,6 +99,53 @@ type ElasticsearchConfigPolicySpec struct {
SecureSettings []commonv1.SecretSource `json:"secureSettings,omitempty"`
}

// GetElasticsearchNamespacedSecureSettings returns the Elasticsearch secure settings from this policy
// as NamespacedSecretSources, with each secret source namespaced to the policy's namespace.
// Returns nil if the policy is nil or has no Elasticsearch secure settings defined.
func (p *StackConfigPolicy) GetElasticsearchNamespacedSecureSettings() []commonv1.NamespacedSecretSource {
if p == nil {
return nil
}
return toNamespacedSecretSources(&p.Spec.Elasticsearch, p.Namespace)
}

// GetKibanaNamespacedSecureSettings returns the Kibana secure settings from this policy
// as NamespacedSecretSources, with each secret source namespaced to the policy's namespace.
// Returns nil if the policy is nil or has no Kibana secure settings defined.
func (p *StackConfigPolicy) GetKibanaNamespacedSecureSettings() []commonv1.NamespacedSecretSource {
if p == nil {
return nil
}
return toNamespacedSecretSources(&p.Spec.Kibana, p.Namespace)
}

// HasSecureSettings represents a ConfigPolicySpec that has secure settings.
// +kubebuilder:object:generate=false
type HasSecureSettings interface {
GetSecureSettings() []commonv1.SecretSource
}

func toNamespacedSecretSources(hasSecureSettings HasSecureSettings, inNamespace string) []commonv1.NamespacedSecretSource {
secureSettings := hasSecureSettings.GetSecureSettings()
namespacedSecretSources := make([]commonv1.NamespacedSecretSource, len(secureSettings))
for i, s := range secureSettings {
namespacedSecretSources[i] = commonv1.NamespacedSecretSource{
Namespace: inNamespace,
SecretName: s.SecretName,
Entries: s.Entries,
}
}
return namespacedSecretSources
}

// GetSecureSettings returns the secure settings of the ElasticsearchConfigPolicySpec.
func (e *ElasticsearchConfigPolicySpec) GetSecureSettings() []commonv1.SecretSource {
if e == nil {
return nil
}
return e.SecureSettings
}

type KibanaConfigPolicySpec struct {
// Config holds the settings that go into kibana.yml.
// +kubebuilder:pruning:PreserveUnknownFields
Expand All @@ -103,6 +155,14 @@ type KibanaConfigPolicySpec struct {
SecureSettings []commonv1.SecretSource `json:"secureSettings,omitempty"`
}

// GetSecureSettings returns the secure settings of the KibanaConfigPolicySpec.
func (k *KibanaConfigPolicySpec) GetSecureSettings() []commonv1.SecretSource {
if k == nil {
return nil
}
return k.SecureSettings
}

type ResourceType string

const (
Expand Down
Loading