|
| 1 | +/* |
| 2 | +** Copyright (c) 2023 Oracle and/or its affiliates. |
| 3 | +** |
| 4 | +** The Universal Permissive License (UPL), Version 1.0 |
| 5 | +** |
| 6 | +** Subject to the condition set forth below, permission is hereby granted to any |
| 7 | +** person obtaining a copy of this software, associated documentation and/or data |
| 8 | +** (collectively the "Software"), free of charge and under any and all copyright |
| 9 | +** rights in the Software, and any and all patent rights owned or freely |
| 10 | +** licensable by each licensor hereunder covering either (i) the unmodified |
| 11 | +** Software as contributed to or provided by such licensor, or (ii) the Larger |
| 12 | +** Works (as defined below), to deal in both |
| 13 | +** |
| 14 | +** (a) the Software, and |
| 15 | +** (b) any piece of software and/or hardware listed in the lrgrwrks.txt file if |
| 16 | +** one is included with the Software (each a "Larger Work" to which the Software |
| 17 | +** is contributed by such licensors), |
| 18 | +** |
| 19 | +** without restriction, including without limitation the rights to copy, create |
| 20 | +** derivative works of, display, perform, and distribute the Software and make, |
| 21 | +** use, sell, offer for sale, import, export, have made, and have sold the |
| 22 | +** Software and the Larger Work(s), and to sublicense the foregoing rights on |
| 23 | +** either these or other terms. |
| 24 | +** |
| 25 | +** This license is subject to the following condition: |
| 26 | +** The above copyright notice and either this complete permission notice or at |
| 27 | +** a minimum a reference to the UPL must be included in all copies or |
| 28 | +** substantial portions of the Software. |
| 29 | +** |
| 30 | +** THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 31 | +** IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 32 | +** FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 33 | +** AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 34 | +** LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, |
| 35 | +** OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE |
| 36 | +** SOFTWARE. |
| 37 | + */ |
| 38 | + |
| 39 | +package v1alpha1 |
| 40 | + |
| 41 | +import ( |
| 42 | + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" |
| 43 | +) |
| 44 | + |
| 45 | +// EDIT THIS FILE! THIS IS SCAFFOLDING FOR YOU TO OWN! |
| 46 | +// NOTE: json tags are required. Any new fields you add must have json tags for the fields to be serialized. |
| 47 | + |
| 48 | +// DataguardBrokerSpec defines the desired state of DataguardBroker |
| 49 | +type DataguardBrokerSpec struct { |
| 50 | + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster |
| 51 | + // Important: Run "make" to regenerate code after modifying this file |
| 52 | + |
| 53 | + PrimaryDatabaseRef string `json:"primaryDatabaseRef"` |
| 54 | + StandbyDatabaseRefs []string `json:"standbyDatabaseRefs"` |
| 55 | + SetAsPrimaryDatabase string `json:"setAsPrimaryDatabase,omitempty"` |
| 56 | + LoadBalancer bool `json:"loadBalancer,omitempty"` |
| 57 | + |
| 58 | + // +kubebuilder:validation:Enum=MaxPerformance;MaxAvailability |
| 59 | + ProtectionMode string `json:"protectionMode"` |
| 60 | + NodeSelector map[string]string `json:"nodeSelector,omitempty"` |
| 61 | + FastStartFailOver DataguardBrokerFastStartFailOver `json:"fastStartFailOver,omitempty"` |
| 62 | + AdminPassword DataguardBrokerPassword `json:"adminPassword"` |
| 63 | +} |
| 64 | + |
| 65 | +// DataguardBrokerPassword defines the secret containing Password mapped to secretKey |
| 66 | +type DataguardBrokerPassword struct { |
| 67 | + SecretName string `json:"secretName,omitempty"` |
| 68 | + SecretKey string `json:"secretKey"` |
| 69 | + KeepSecret bool `json:"keepSecret"` |
| 70 | +} |
| 71 | + |
| 72 | +type DataguardBrokerFastStartFailOver struct { |
| 73 | + Enable bool `json:"enable,omitempty"` |
| 74 | + Strategy []DataguardBrokerStrategy `json:"strategy,omitempty"` |
| 75 | +} |
| 76 | + |
| 77 | +// FSFO strategy |
| 78 | +type DataguardBrokerStrategy struct { |
| 79 | + SourceDatabaseRef string `json:"sourceDatabaseRef,omitempty"` |
| 80 | + TargetDatabaseRefs string `json:"targetDatabaseRefs,omitempty"` |
| 81 | +} |
| 82 | + |
| 83 | +// DataguardBrokerStatus defines the observed state of DataguardBroker |
| 84 | +type DataguardBrokerStatus struct { |
| 85 | + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
| 86 | + // Important: Run "make" to regenerate code after modifying this file |
| 87 | + |
| 88 | + PrimaryDatabaseRef string `json:"primaryDatabaseRef,omitempty"` |
| 89 | + ProtectionMode string `json:"protectionMode,omitempty"` |
| 90 | + PrimaryDatabase string `json:"primaryDatabase,omitempty"` |
| 91 | + StandbyDatabases string `json:"standbyDatabases,omitempty"` |
| 92 | + ExternalConnectString string `json:"externalConnectString,omitempty"` |
| 93 | + ClusterConnectString string `json:"clusterConnectString,omitempty"` |
| 94 | + Status string `json:"status,omitempty"` |
| 95 | +} |
| 96 | + |
| 97 | +//+kubebuilder:object:root=true |
| 98 | +//+kubebuilder:subresource:status |
| 99 | +// +kubebuilder:printcolumn:JSONPath=".status.primaryDatabase",name="Primary",type="string" |
| 100 | +// +kubebuilder:printcolumn:JSONPath=".status.standbyDatabases",name="Standbys",type="string" |
| 101 | +// +kubebuilder:printcolumn:JSONPath=".spec.protectionMode",name="Protection Mode",type="string" |
| 102 | +// +kubebuilder:printcolumn:JSONPath=".status.clusterConnectString",name="Cluster Connect Str",type="string",priority=1 |
| 103 | +// +kubebuilder:printcolumn:JSONPath=".status.externalConnectString",name="Connect Str",type="string" |
| 104 | +// +kubebuilder:printcolumn:JSONPath=".spec.primaryDatabaseRef",name="Primary Database",type="string" |
| 105 | +// +kubebuilder:printcolumn:JSONPath=".status.status",name="Status",type="string" |
| 106 | + |
| 107 | +// DataguardBroker is the Schema for the dataguardbrokers API |
| 108 | +type DataguardBroker struct { |
| 109 | + metav1.TypeMeta `json:",inline"` |
| 110 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 111 | + |
| 112 | + Spec DataguardBrokerSpec `json:"spec,omitempty"` |
| 113 | + Status DataguardBrokerStatus `json:"status,omitempty"` |
| 114 | +} |
| 115 | + |
| 116 | +//+kubebuilder:object:root=true |
| 117 | + |
| 118 | +// DataguardBrokerList contains a list of DataguardBroker |
| 119 | +type DataguardBrokerList struct { |
| 120 | + metav1.TypeMeta `json:",inline"` |
| 121 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 122 | + Items []DataguardBroker `json:"items"` |
| 123 | +} |
| 124 | + |
| 125 | +func init() { |
| 126 | + SchemeBuilder.Register(&DataguardBroker{}, &DataguardBrokerList{}) |
| 127 | +} |
0 commit comments