|
| 1 | +/* |
| 2 | +** Copyright (c) 2022 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 | +type StatusEnum string |
| 46 | + |
| 47 | +// DatabaseObserverSpec defines the desired state of DatabaseObserver |
| 48 | +type DatabaseObserverSpec struct { |
| 49 | + // INSERT ADDITIONAL SPEC FIELDS - desired state of cluster |
| 50 | + // Important: Run "make" to regenerate code after modifying this file |
| 51 | + |
| 52 | + Database DatabaseObserverDatabase `json:"database,omitempty"` |
| 53 | + Exporter DatabaseObserverExporterConfig `json:"exporter,omitempty"` |
| 54 | + Prometheus PrometheusConfig `json:"prometheus,omitempty"` |
| 55 | + Replicas int32 `json:"replicas,omitempty"` |
| 56 | +} |
| 57 | + |
| 58 | +// DatabaseObserverDatabase defines the database details used for DatabaseObserver |
| 59 | +type DatabaseObserverDatabase struct { |
| 60 | + DBName string `json:"dbName,omitempty"` |
| 61 | + //DBUser DBSecret `json:"dbUser,omitempty"` |
| 62 | + //DBServiceName DBSecret `json:"dbServiceName,omitempty"` |
| 63 | + DBPassword DBSecret `json:"dbPassword,omitempty"` |
| 64 | + DBWallet DBSecret `json:"dbWallet,omitempty"` |
| 65 | + DBConnectionString DBSecret `json:"dbConnectionString,omitempty"` |
| 66 | +} |
| 67 | + |
| 68 | +// DatabaseObserverExporterConfig defines the configuration details related to the exporters of DatabaseObserver |
| 69 | +type DatabaseObserverExporterConfig struct { |
| 70 | + ExporterImage string `json:"image,omitempty"` |
| 71 | + ExporterConfig DatabaseObserverConfigMap `json:"configuration,omitempty"` |
| 72 | + Service DatabaseObserverService `json:"service,omitempty"` |
| 73 | +} |
| 74 | + |
| 75 | +// DatabaseObserverService defines the exporter service component of DatabaseObserver |
| 76 | +type DatabaseObserverService struct { |
| 77 | + Port int32 `json:"port,omitempty"` |
| 78 | +} |
| 79 | + |
| 80 | +// PrometheusConfig defines the generated resources for Prometheus |
| 81 | +type PrometheusConfig struct { |
| 82 | + Labels map[string]string `json:"labels,omitempty"` |
| 83 | + Port string `json:"port,omitempty"` |
| 84 | +} |
| 85 | + |
| 86 | +type DBSecret struct { |
| 87 | + Key string `json:"key,omitempty"` |
| 88 | + SecretName string `json:"secret,omitempty"` |
| 89 | + VaultOCID string `json:"vaultOCID,omitempty"` |
| 90 | + VaultSecretName string `json:"vaultSecretName,omitempty"` |
| 91 | +} |
| 92 | + |
| 93 | +type DatabaseObserverConfigMap struct { |
| 94 | + Configmap ConfigMapDetails `json:"configmap,omitempty"` |
| 95 | +} |
| 96 | + |
| 97 | +// ConfigMapDetails defines the configmap name |
| 98 | +type ConfigMapDetails struct { |
| 99 | + Key string `json:"key,omitempty"` |
| 100 | + Name string `json:"configmapName,omitempty"` |
| 101 | +} |
| 102 | + |
| 103 | +// DatabaseObserverStatus defines the observed state of DatabaseObserver |
| 104 | +type DatabaseObserverStatus struct { |
| 105 | + // INSERT ADDITIONAL STATUS FIELD - define observed state of cluster |
| 106 | + // Important: Run "make" to regenerate code after modifying this file |
| 107 | + Conditions []metav1.Condition `json:"conditions"` |
| 108 | + Status string `json:"status,omitempty"` |
| 109 | + ExporterConfig string `json:"exporterConfig"` |
| 110 | + Replicas int `json:"replicas,omitempty"` |
| 111 | +} |
| 112 | + |
| 113 | +//+kubebuilder:object:root=true |
| 114 | +//+kubebuilder:subresource:status |
| 115 | + |
| 116 | +// DatabaseObserver is the Schema for the databaseobservers API |
| 117 | +// +kubebuilder:printcolumn:JSONPath=".status.exporterConfig",name="ExporterConfig",type=string |
| 118 | +// +kubebuilder:printcolumn:JSONPath=".status.status",name="Status",type=string |
| 119 | +type DatabaseObserver struct { |
| 120 | + metav1.TypeMeta `json:",inline"` |
| 121 | + metav1.ObjectMeta `json:"metadata,omitempty"` |
| 122 | + |
| 123 | + Spec DatabaseObserverSpec `json:"spec,omitempty"` |
| 124 | + Status DatabaseObserverStatus `json:"status,omitempty"` |
| 125 | +} |
| 126 | + |
| 127 | +//+kubebuilder:object:root=true |
| 128 | + |
| 129 | +// DatabaseObserverList contains a list of DatabaseObserver |
| 130 | +type DatabaseObserverList struct { |
| 131 | + metav1.TypeMeta `json:",inline"` |
| 132 | + metav1.ListMeta `json:"metadata,omitempty"` |
| 133 | + Items []DatabaseObserver `json:"items"` |
| 134 | +} |
| 135 | + |
| 136 | +func init() { |
| 137 | + SchemeBuilder.Register(&DatabaseObserver{}, &DatabaseObserverList{}) |
| 138 | +} |
0 commit comments