postgresql_types.go 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. Copyright 2023.
  3. Licensed under the Apache License, Version 2.0 (the "License");
  4. you may not use this file except in compliance with the License.
  5. You may obtain a copy of the License at
  6. http://www.apache.org/licenses/LICENSE-2.0
  7. Unless required by applicable law or agreed to in writing, software
  8. distributed under the License is distributed on an "AS IS" BASIS,
  9. WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  10. See the License for the specific language governing permissions and
  11. limitations under the License.
  12. */
  13. package v1
  14. import (
  15. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  16. )
  17. // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
  18. // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
  19. // PostgreSQLSpec defines the desired state of PostgreSQL
  20. type PostgreSQLSpec struct {
  21. // Version of Postgres to deploy. [16.0]
  22. Version string `json:"version"`
  23. // Username for authentication
  24. User string `json:"user"`
  25. // Password for authentication
  26. Password string `json:"password"`
  27. // Autogenerated name for default Database
  28. Database string `json:"database"`
  29. }
  30. // PostgreSQLStatus defines the observed state of PostgreSQL
  31. type PostgreSQLStatus struct {
  32. Status Status `json:"status"`
  33. }
  34. type Status string
  35. const (
  36. Status_Pending Status = "pending"
  37. Status_Initializing Status = "initializing"
  38. Status_NotReady Status = "notReady"
  39. Status_Ready Status = "ready"
  40. Status_Error Status = "error"
  41. )
  42. //+kubebuilder:object:root=true
  43. //+kubebuilder:subresource:status
  44. //+kubebuilder:printcolumn:JSONPath=".status.status",name=Status,type=string
  45. // PostgreSQL is the Schema for the postgresqls API
  46. type PostgreSQL struct {
  47. metav1.TypeMeta `json:",inline"`
  48. metav1.ObjectMeta `json:"metadata,omitempty"`
  49. Spec PostgreSQLSpec `json:"spec,omitempty"`
  50. Status PostgreSQLStatus `json:"status,omitempty"`
  51. }
  52. //+kubebuilder:object:root=true
  53. // PostgreSQLList contains a list of PostgreSQL
  54. type PostgreSQLList struct {
  55. metav1.TypeMeta `json:",inline"`
  56. metav1.ListMeta `json:"metadata,omitempty"`
  57. Items []PostgreSQL `json:"items"`
  58. }
  59. func init() {
  60. SchemeBuilder.Register(&PostgreSQL{}, &PostgreSQLList{})
  61. }