bluegreen_types.go 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /*
  2. Copyright 2022.
  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. v1 "k8s.io/api/core/v1"
  16. metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
  17. )
  18. // EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN!
  19. // NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized.
  20. // BlueGreenSpec defines the desired state of BlueGreen
  21. type BlueGreenSpec struct {
  22. // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster
  23. // Important: Run "make" to regenerate code after modifying this file
  24. // Foo is an example field of BlueGreen. Edit bluegreen_types.go to remove/update
  25. RouteTo BlueOrGreen `json:"routeTo,omitempty"`
  26. BlueSpec *v1.PodSpec `json:"blueSpec,omitempty"`
  27. GreenSpec *v1.PodSpec `json:"greenSpec,omitempty"`
  28. }
  29. type BlueOrGreen string
  30. const (
  31. Blue BlueOrGreen = "blue"
  32. Green BlueOrGreen = "green"
  33. )
  34. // BlueGreenStatus defines the observed state of BlueGreen
  35. type BlueGreenStatus struct {
  36. RouteTo BlueOrGreen `json:"routeTo,omitempty"`
  37. }
  38. //+kubebuilder:object:root=true
  39. //+kubebuilder:subresource:status
  40. // BlueGreen is the Schema for the bluegreens API
  41. type BlueGreen struct {
  42. metav1.TypeMeta `json:",inline"`
  43. metav1.ObjectMeta `json:"metadata,omitempty"`
  44. Spec BlueGreenSpec `json:"spec,omitempty"`
  45. Status BlueGreenStatus `json:"status,omitempty"`
  46. }
  47. //+kubebuilder:object:root=true
  48. // BlueGreenList contains a list of BlueGreen
  49. type BlueGreenList struct {
  50. metav1.TypeMeta `json:",inline"`
  51. metav1.ListMeta `json:"metadata,omitempty"`
  52. Items []BlueGreen `json:"items"`
  53. }
  54. func init() {
  55. SchemeBuilder.Register(&BlueGreen{}, &BlueGreenList{})
  56. }