postgresql_types.go 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 DB
  28. DB 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_Running Status = "running"
  39. Status_Error Status = "error"
  40. )
  41. //+kubebuilder:object:root=true
  42. //+kubebuilder:subresource:status
  43. // PostgreSQL is the Schema for the postgresqls API
  44. type PostgreSQL struct {
  45. metav1.TypeMeta `json:",inline"`
  46. metav1.ObjectMeta `json:"metadata,omitempty"`
  47. Spec PostgreSQLSpec `json:"spec,omitempty"`
  48. Status PostgreSQLStatus `json:"status,omitempty"`
  49. }
  50. //+kubebuilder:object:root=true
  51. // PostgreSQLList contains a list of PostgreSQL
  52. type PostgreSQLList struct {
  53. metav1.TypeMeta `json:",inline"`
  54. metav1.ListMeta `json:"metadata,omitempty"`
  55. Items []PostgreSQL `json:"items"`
  56. }
  57. func init() {
  58. SchemeBuilder.Register(&PostgreSQL{}, &PostgreSQLList{})
  59. }