forked from kubedb/apimachinery
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ProxySQLVersion types (kubedb#442)
- Loading branch information
Showing
16 changed files
with
1,391 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
package v1alpha1 | ||
|
||
import ( | ||
apiextensions "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" | ||
crdutils "kmodules.xyz/client-go/apiextensions/v1beta1" | ||
"kubedb.dev/apimachinery/apis" | ||
) | ||
|
||
var _ apis.ResourceInfo = &ProxySQLVersion{} | ||
|
||
func (p ProxySQLVersion) ResourceShortCode() string { | ||
return "" | ||
} | ||
|
||
func (p ProxySQLVersion) ResourceKind() string { | ||
return ResourceKindProxySQLVersion | ||
} | ||
|
||
func (p ProxySQLVersion) ResourceSingular() string { | ||
return ResourceSingularProxySQLVersion | ||
} | ||
|
||
func (p ProxySQLVersion) ResourcePlural() string { | ||
return ResourcePluralProxySQLVersion | ||
} | ||
|
||
func (p ProxySQLVersion) CustomResourceDefinition() *apiextensions.CustomResourceDefinition { | ||
return crdutils.NewCustomResourceDefinition(crdutils.Config{ | ||
Group: SchemeGroupVersion.Group, | ||
Plural: ResourcePluralProxySQLVersion, | ||
Singular: ResourceSingularProxySQLVersion, | ||
Kind: ResourceKindProxySQLVersion, | ||
Categories: []string{"datastore", "kubedb", "appscode"}, | ||
ResourceScope: string(apiextensions.ClusterScoped), | ||
Versions: []apiextensions.CustomResourceDefinitionVersion{ | ||
{ | ||
Name: SchemeGroupVersion.Version, | ||
Served: true, | ||
Storage: true, | ||
}, | ||
}, | ||
Labels: crdutils.Labels{ | ||
LabelsMap: map[string]string{"app": "kubedb"}, | ||
}, | ||
SpecDefinitionName: "kubedb.dev/apimachinery/apis/catalog/v1alpha1.ProxySQLVersion", | ||
EnableValidation: true, | ||
GetOpenAPIDefinitions: GetOpenAPIDefinitions, | ||
EnableStatusSubresource: false, | ||
AdditionalPrinterColumns: []apiextensions.CustomResourceColumnDefinition{ | ||
{ | ||
Name: "Version", | ||
Type: "string", | ||
JSONPath: ".spec.version", | ||
}, | ||
{ | ||
Name: "PROXYSQL_IMAGE", | ||
Type: "string", | ||
JSONPath: ".spec.proxysql.image", | ||
}, | ||
{ | ||
Name: "Deprecated", | ||
Type: "boolean", | ||
JSONPath: ".spec.deprecated", | ||
}, | ||
{ | ||
Name: "Age", | ||
Type: "date", | ||
JSONPath: ".metadata.creationTimestamp", | ||
}, | ||
}, | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package v1alpha1 | ||
|
||
import metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" | ||
|
||
const ( | ||
ResourceKindProxySQLVersion = "ProxySQLVersion" | ||
ResourceSingularProxySQLVersion = "proxysqlversion" | ||
ResourcePluralProxySQLVersion = "proxysqlversions" | ||
) | ||
|
||
// ProxySQLVersion defines a ProxySQL load-balancer version. | ||
|
||
// +genclient | ||
// +genclient:nonNamespaced | ||
// +genclient:skipVerbs=updateStatus | ||
// +k8s:openapi-gen=true | ||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// +kubebuilder:object:root=true | ||
// +kubebuilder:resource:path=proxysqlversions,singular=proxysqlversion,scope=Cluster,categories={datastore,kubedb,appscode} | ||
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version" | ||
// +kubebuilder:printcolumn:name="DB_IMAGE",type="string",JSONPath=".spec.db.image" | ||
// +kubebuilder:printcolumn:name="Deprecated",type="boolean",JSONPath=".spec.deprecated" | ||
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" | ||
type ProxySQLVersion struct { | ||
metav1.TypeMeta `json:",inline,omitempty"` | ||
metav1.ObjectMeta `json:"metadata,omitempty"` | ||
Spec ProxySQLVersionSpec `json:"spec,omitempty"` | ||
} | ||
|
||
// ProxySQLVersionSpec is the spec for ProxySQL version | ||
type ProxySQLVersionSpec struct { | ||
// Version | ||
Version string `json:"version"` | ||
// Proxysql Image | ||
Proxysql ProxySQLVersionProxysql `json:"proxysql"` | ||
// Exporter Image | ||
Exporter ProxySQLVersionExporter `json:"exporter"` | ||
// Deprecated versions usable but regarded as obsolete and best avoided, typically due to having been superseded. | ||
// +optional | ||
Deprecated bool `json:"deprecated,omitempty"` | ||
// PSP names | ||
PodSecurityPolicies ProxySQLVersionPodSecurityPolicy `json:"podSecurityPolicies"` | ||
} | ||
|
||
// ProxySQLVersionProxysql is the proxysql image | ||
type ProxySQLVersionProxysql struct { | ||
Image string `json:"image"` | ||
} | ||
|
||
// ProxySQLVersionExporter is the image for the ProxySQL exporter | ||
type ProxySQLVersionExporter struct { | ||
Image string `json:"image"` | ||
} | ||
|
||
// ProxySQLVersionPodSecurityPolicy is the ProxySQL pod security policies | ||
type ProxySQLVersionPodSecurityPolicy struct { | ||
DatabasePolicyName string `json:"databasePolicyName"` | ||
} | ||
|
||
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object | ||
|
||
// ProxySQLVersionList is a list of ProxySQLVersions | ||
type ProxySQLVersionList struct { | ||
metav1.TypeMeta `json:",inline"` | ||
metav1.ListMeta `json:"metadata,omitempty"` | ||
// Items is a list of ProxySQLVersion CRD objects | ||
Items []ProxySQLVersion `json:"items,omitempty"` | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.