Skip to content

Commit 3af3eb9

Browse files
authored
feat(opensearchaclconfig): add OpenSearch ACL management (#1139)
1 parent 17205d2 commit 3af3eb9

14 files changed

Lines changed: 1560 additions & 0 deletions

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
- Add `ServiceUser` field `accessControl`, type `object`: AccessControl configures service-specific access control rules for the user.
66
When this block is present, the operator manages the full access-control scope it contains
7+
- Add `OpenSearchACLConfig` to manage OpenSearch ACL
78

89
## v0.36.0 - 2026-03-05
910

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
// Copyright (c) 2024 Aiven, Helsinki, Finland. https://aiven.io/
2+
3+
package v1alpha1
4+
5+
import (
6+
"github.com/aiven/go-client-codegen/handler/opensearch"
7+
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
8+
)
9+
10+
// OpenSearchACLConfigSpec defines the desired state of OpenSearchACLConfig.
11+
type OpenSearchACLConfigSpec struct {
12+
ServiceDependant `json:",inline"`
13+
14+
// Enable OpenSearch ACLs. When disabled, authenticated service users have unrestricted access
15+
Enabled bool `json:"enabled"`
16+
17+
// List of OpenSearch ACLs
18+
// +listType=map
19+
// +listMapKey=username
20+
Acls []OpenSearchACLConfigACL `json:"acls,omitempty"`
21+
}
22+
23+
// OpenSearchACLConfigACL defines a single OpenSearch ACL entry.
24+
type OpenSearchACLConfigACL struct {
25+
// +kubebuilder:validation:MinLength=1
26+
// Username
27+
Username string `json:"username"`
28+
29+
// +kubebuilder:validation:Required
30+
// OpenSearch rules
31+
Rules []OpenSearchACLConfigRule `json:"rules"`
32+
}
33+
34+
// OpenSearchACLConfigRule defines a single OpenSearch ACL rule.
35+
type OpenSearchACLConfigRule struct {
36+
// +kubebuilder:validation:MinLength=1
37+
// OpenSearch index pattern
38+
Index string `json:"index"`
39+
40+
// +kubebuilder:validation:Enum=admin;deny;read;readwrite;write
41+
// OpenSearch permission
42+
Permission opensearch.PermissionType `json:"permission"`
43+
}
44+
45+
// OpenSearchACLConfigStatus defines the observed state of OpenSearchACLConfig
46+
type OpenSearchACLConfigStatus struct {
47+
// Conditions represent the latest available observations of an OpenSearchACLConfig state
48+
Conditions []metav1.Condition `json:"conditions"`
49+
}
50+
51+
// +kubebuilder:object:root=true
52+
// +kubebuilder:subresource:status
53+
54+
// OpenSearchACLConfig is the Schema for the opensearchaclconfigs API.
55+
// Manages the full OpenSearch ACL configuration for one Aiven OpenSearch service.
56+
// +kubebuilder:printcolumn:name="Service Name",type="string",JSONPath=".spec.serviceName"
57+
// +kubebuilder:printcolumn:name="Project",type="string",JSONPath=".spec.project"
58+
// +kubebuilder:printcolumn:name="Enabled",type="boolean",JSONPath=".spec.enabled"
59+
type OpenSearchACLConfig struct {
60+
metav1.TypeMeta `json:",inline"`
61+
metav1.ObjectMeta `json:"metadata,omitempty"`
62+
63+
Spec OpenSearchACLConfigSpec `json:"spec,omitempty"`
64+
Status OpenSearchACLConfigStatus `json:"status,omitempty"`
65+
}
66+
67+
var _ AivenManagedObject = &OpenSearchACLConfig{}
68+
69+
func (in *OpenSearchACLConfig) AuthSecretRef() *AuthSecretReference {
70+
return in.Spec.AuthSecretRef
71+
}
72+
73+
func (in *OpenSearchACLConfig) Conditions() *[]metav1.Condition {
74+
return &in.Status.Conditions
75+
}
76+
77+
func (in *OpenSearchACLConfig) GetObjectMeta() *metav1.ObjectMeta {
78+
return &in.ObjectMeta
79+
}
80+
81+
func (*OpenSearchACLConfig) NoSecret() bool {
82+
return true
83+
}
84+
85+
// +kubebuilder:object:root=true
86+
87+
// OpenSearchACLConfigList contains a list of OpenSearchACLConfig.
88+
type OpenSearchACLConfigList struct {
89+
metav1.TypeMeta `json:",inline"`
90+
metav1.ListMeta `json:"metadata,omitempty"`
91+
Items []OpenSearchACLConfig `json:"items"`
92+
}
93+
94+
func init() {
95+
SchemeBuilder.Register(&OpenSearchACLConfig{}, &OpenSearchACLConfigList{})
96+
}

api/v1alpha1/zz_generated.deepcopy.go

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

0 commit comments

Comments
 (0)