Skip to content

Commit 4c158ae

Browse files
committed
Define MariaDBAccount CRD
1 parent e04d916 commit 4c158ae

File tree

4 files changed

+148
-15
lines changed

4 files changed

+148
-15
lines changed

api/bases/mariadb.openstack.org_mariadbaccounts.yaml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,67 @@ spec:
3535
spec:
3636
description: MariaDBAccountSpec defines the desired state of MariaDBAccount
3737
properties:
38-
foo:
39-
description: Foo is an example field of MariaDBAccount. Edit mariadbaccount_types.go
40-
to remove/update
38+
secret:
39+
description: Name of secret which contains DatabasePassword
4140
type: string
41+
userName:
42+
description: UserName for new account
43+
type: string
44+
required:
45+
- secret
46+
- userName
4247
type: object
4348
status:
4449
description: MariaDBAccountStatus defines the observed state of MariaDBAccount
50+
properties:
51+
conditions:
52+
description: Deployment Conditions
53+
items:
54+
description: Condition defines an observation of a API resource
55+
operational state.
56+
properties:
57+
lastTransitionTime:
58+
description: Last time the condition transitioned from one status
59+
to another. This should be when the underlying condition changed.
60+
If that is not known, then using the time when the API field
61+
changed is acceptable.
62+
format: date-time
63+
type: string
64+
message:
65+
description: A human readable message indicating details about
66+
the transition.
67+
type: string
68+
reason:
69+
description: The reason for the condition's last transition
70+
in CamelCase.
71+
type: string
72+
severity:
73+
description: Severity provides a classification of Reason code,
74+
so the current situation is immediately understandable and
75+
could act accordingly. It is meant for situations where Status=False
76+
and it should be indicated if it is just informational, warning
77+
(next reconciliation might fix it) or an error (e.g. DB create
78+
issue and no actions to automatically resolve the issue can/should
79+
be done). For conditions where Status=Unknown or Status=True
80+
the Severity should be SeverityNone.
81+
type: string
82+
status:
83+
description: Status of the condition, one of True, False, Unknown.
84+
type: string
85+
type:
86+
description: Type of condition in CamelCase.
87+
type: string
88+
required:
89+
- lastTransitionTime
90+
- status
91+
- type
92+
type: object
93+
type: array
94+
hash:
95+
additionalProperties:
96+
type: string
97+
description: Map of hashes to track e.g. job status
98+
type: object
4599
type: object
46100
type: object
47101
served: true

api/v1beta1/mariadbaccount_types.go

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,25 +17,36 @@ limitations under the License.
1717
package v1beta1
1818

1919
import (
20+
condition "github.com/openstack-k8s-operators/lib-common/modules/common/condition"
2021
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
2122
)
2223

23-
// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
24-
// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
24+
const (
25+
// AccountCreateHash hash
26+
AccountCreateHash = "accountcreate"
27+
28+
// AccountDeleteHash hash
29+
AccountDeleteHash = "accountdelete"
30+
)
2531

2632
// MariaDBAccountSpec defines the desired state of MariaDBAccount
2733
type MariaDBAccountSpec struct {
28-
// INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
29-
// Important: Run "make" to regenerate code after modifying this file
34+
// UserName for new account
35+
// +kubebuilder:validation:Required
36+
UserName string `json:"userName"`
3037

31-
// Foo is an example field of MariaDBAccount. Edit mariadbaccount_types.go to remove/update
32-
Foo string `json:"foo,omitempty"`
38+
// Name of secret which contains DatabasePassword
39+
// +kubebuilder:validation:Required
40+
Secret string `json:"secret"`
3341
}
3442

3543
// MariaDBAccountStatus defines the observed state of MariaDBAccount
3644
type MariaDBAccountStatus struct {
37-
// INSERT ADDITIONAL STATUS FIELD - define observed state of cluster
38-
// Important: Run "make" to regenerate code after modifying this file
45+
// Deployment Conditions
46+
Conditions condition.Conditions `json:"conditions,omitempty" optional:"true"`
47+
48+
// Map of hashes to track e.g. job status
49+
Hash map[string]string `json:"hash,omitempty"`
3950
}
4051

4152
//+kubebuilder:object:root=true

api/v1beta1/zz_generated.deepcopy.go

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

config/crd/bases/mariadb.openstack.org_mariadbaccounts.yaml

Lines changed: 57 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,13 +35,67 @@ spec:
3535
spec:
3636
description: MariaDBAccountSpec defines the desired state of MariaDBAccount
3737
properties:
38-
foo:
39-
description: Foo is an example field of MariaDBAccount. Edit mariadbaccount_types.go
40-
to remove/update
38+
secret:
39+
description: Name of secret which contains DatabasePassword
4140
type: string
41+
userName:
42+
description: UserName for new account
43+
type: string
44+
required:
45+
- secret
46+
- userName
4247
type: object
4348
status:
4449
description: MariaDBAccountStatus defines the observed state of MariaDBAccount
50+
properties:
51+
conditions:
52+
description: Deployment Conditions
53+
items:
54+
description: Condition defines an observation of a API resource
55+
operational state.
56+
properties:
57+
lastTransitionTime:
58+
description: Last time the condition transitioned from one status
59+
to another. This should be when the underlying condition changed.
60+
If that is not known, then using the time when the API field
61+
changed is acceptable.
62+
format: date-time
63+
type: string
64+
message:
65+
description: A human readable message indicating details about
66+
the transition.
67+
type: string
68+
reason:
69+
description: The reason for the condition's last transition
70+
in CamelCase.
71+
type: string
72+
severity:
73+
description: Severity provides a classification of Reason code,
74+
so the current situation is immediately understandable and
75+
could act accordingly. It is meant for situations where Status=False
76+
and it should be indicated if it is just informational, warning
77+
(next reconciliation might fix it) or an error (e.g. DB create
78+
issue and no actions to automatically resolve the issue can/should
79+
be done). For conditions where Status=Unknown or Status=True
80+
the Severity should be SeverityNone.
81+
type: string
82+
status:
83+
description: Status of the condition, one of True, False, Unknown.
84+
type: string
85+
type:
86+
description: Type of condition in CamelCase.
87+
type: string
88+
required:
89+
- lastTransitionTime
90+
- status
91+
- type
92+
type: object
93+
type: array
94+
hash:
95+
additionalProperties:
96+
type: string
97+
description: Map of hashes to track e.g. job status
98+
type: object
4599
type: object
46100
type: object
47101
served: true

0 commit comments

Comments
 (0)