Skip to content

Commit c433fcf

Browse files
authored
Merge pull request #243 from vshn/add/mariadb_user_mgmt
Add MariaDB user management
2 parents 88cb04c + 69fddb1 commit c433fcf

17 files changed

+550
-10
lines changed

apis/vshn/v1/dbaas_vshn_mariadb.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ type VSHNMariaDBServiceSpec struct {
9898
// ServiceLevel defines the service level of this service. Either Best Effort or Guaranteed Availability is allowed.
9999
ServiceLevel VSHNDBaaSServiceLevel `json:"serviceLevel,omitempty"`
100100

101-
// +kubebuilder:default="standalone"
102-
// +kubebuilder:validation:Enum=replication;standalone
101+
// Access defines additional users and databases for this instance.
102+
Access []VSHNAccess `json:"access,omitempty"`
103103
}
104104

105105
// VSHNMariaDBTLSSpec contains settings to control tls traffic of a service.

apis/vshn/v1/dbaas_vshn_postgresql.go

+1
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ type VSHNPostgreSQLServiceSpec struct {
153153
// +kubebuilder:default=false
154154
VacuumEnabled bool `json:"vacuumEnabled,omitempty"`
155155

156+
// Access defines additional users and databases for this instance.
156157
Access []VSHNAccess `json:"access,omitempty"`
157158
}
158159

apis/vshn/v1/zz_generated.deepcopy.go

+8-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crds/vshn.appcat.vshn.io_vshnkeycloaks.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9776,6 +9776,7 @@ spec:
97769776
description: Service contains PostgreSQL DBaaS specific properties
97779777
properties:
97789778
access:
9779+
description: Access defines additional users and databases for this instance.
97799780
items:
97809781
properties:
97819782
database:

crds/vshn.appcat.vshn.io_vshnmariadbs.yaml

+41
Original file line numberDiff line numberDiff line change
@@ -4843,6 +4843,47 @@ spec:
48434843
service:
48444844
description: Service contains MariaDB DBaaS specific properties
48454845
properties:
4846+
access:
4847+
description: Access defines additional users and databases for this instance.
4848+
items:
4849+
properties:
4850+
database:
4851+
description: Database is the name of the database to create, defaults to user.
4852+
type: string
4853+
privileges:
4854+
description: |-
4855+
Privileges specifies the privileges to grant the user. Please check
4856+
the database's docs for available privileges.
4857+
items:
4858+
type: string
4859+
type: array
4860+
user:
4861+
description: |-
4862+
User specifies the username. If all other fields are left empty
4863+
then a new database with the same name and all permissions will be created.
4864+
type: string
4865+
writeConnectionSecretToRef:
4866+
description: |-
4867+
WriteConnectionSecretToReference specifies the namespace and name of a
4868+
Secret to which any connection details for this user should
4869+
be written.
4870+
If not specified, a secret with the name $claimname-$username will be
4871+
created in the namespace where the claim is located.
4872+
properties:
4873+
name:
4874+
description: Name of the secret.
4875+
type: string
4876+
namespace:
4877+
description: Namespace of the secret.
4878+
type: string
4879+
required:
4880+
- name
4881+
- namespace
4882+
type: object
4883+
required:
4884+
- user
4885+
type: object
4886+
type: array
48464887
mariadbSettings:
48474888
description: MariadbSettings contains additional MariaDB settings.
48484889
type: string

crds/vshn.appcat.vshn.io_vshnnextclouds.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -9742,6 +9742,7 @@ spec:
97429742
description: Service contains PostgreSQL DBaaS specific properties
97439743
properties:
97449744
access:
9745+
description: Access defines additional users and databases for this instance.
97459746
items:
97469747
properties:
97479748
database:

crds/vshn.appcat.vshn.io_vshnpostgresqls.yaml

+1
Original file line numberDiff line numberDiff line change
@@ -4966,6 +4966,7 @@ spec:
49664966
description: Service contains PostgreSQL DBaaS specific properties
49674967
properties:
49684968
access:
4969+
description: Access defines additional users and databases for this instance.
49694970
items:
49704971
properties:
49714972
database:

crds/vshn.appcat.vshn.io_xvshnkeycloaks.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -11556,6 +11556,8 @@ spec:
1155611556
properties
1155711557
properties:
1155811558
access:
11559+
description: Access defines additional users and databases
11560+
for this instance.
1155911561
items:
1156011562
properties:
1156111563
database:

crds/vshn.appcat.vshn.io_xvshnmariadbs.yaml

+43
Original file line numberDiff line numberDiff line change
@@ -5567,6 +5567,49 @@ spec:
55675567
service:
55685568
description: Service contains MariaDB DBaaS specific properties
55695569
properties:
5570+
access:
5571+
description: Access defines additional users and databases
5572+
for this instance.
5573+
items:
5574+
properties:
5575+
database:
5576+
description: Database is the name of the database to
5577+
create, defaults to user.
5578+
type: string
5579+
privileges:
5580+
description: |-
5581+
Privileges specifies the privileges to grant the user. Please check
5582+
the database's docs for available privileges.
5583+
items:
5584+
type: string
5585+
type: array
5586+
user:
5587+
description: |-
5588+
User specifies the username. If all other fields are left empty
5589+
then a new database with the same name and all permissions will be created.
5590+
type: string
5591+
writeConnectionSecretToRef:
5592+
description: |-
5593+
WriteConnectionSecretToReference specifies the namespace and name of a
5594+
Secret to which any connection details for this user should
5595+
be written.
5596+
If not specified, a secret with the name $claimname-$username will be
5597+
created in the namespace where the claim is located.
5598+
properties:
5599+
name:
5600+
description: Name of the secret.
5601+
type: string
5602+
namespace:
5603+
description: Namespace of the secret.
5604+
type: string
5605+
required:
5606+
- name
5607+
- namespace
5608+
type: object
5609+
required:
5610+
- user
5611+
type: object
5612+
type: array
55705613
mariadbSettings:
55715614
description: MariadbSettings contains additional MariaDB settings.
55725615
type: string

crds/vshn.appcat.vshn.io_xvshnnextclouds.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -11520,6 +11520,8 @@ spec:
1152011520
properties
1152111521
properties:
1152211522
access:
11523+
description: Access defines additional users and databases
11524+
for this instance.
1152311525
items:
1152411526
properties:
1152511527
database:

crds/vshn.appcat.vshn.io_xvshnpostgresqls.yaml

+2
Original file line numberDiff line numberDiff line change
@@ -5648,6 +5648,8 @@ spec:
56485648
description: Service contains PostgreSQL DBaaS specific properties
56495649
properties:
56505650
access:
5651+
description: Access defines additional users and databases
5652+
for this instance.
56515653
items:
56525654
properties:
56535655
database:

pkg/comp-functions/functions/vshnmariadb/register.go

+4
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,10 @@ func init() {
3939
Name: "billing",
4040
Execute: AddServiceBillingLabel,
4141
},
42+
{
43+
Name: "user-management",
44+
Execute: UserManagement,
45+
},
4246
},
4347
})
4448
}

0 commit comments

Comments
 (0)