diff --git a/go.mod b/go.mod index b8df55670..b85d4a2d0 100644 --- a/go.mod +++ b/go.mod @@ -6,7 +6,7 @@ require ( github.com/Masterminds/semver/v3 v3.2.1 github.com/cert-manager/cert-manager v1.13.3 github.com/fatih/camelcase v1.0.0 - github.com/go-sql-driver/mysql v1.7.0 + github.com/go-sql-driver/mysql v1.7.1 github.com/prometheus/client_golang v1.18.0 github.com/prometheus/common v0.45.0 github.com/spf13/cobra v1.7.0 @@ -25,10 +25,10 @@ require ( k8s.io/kubectl v0.29.0 kmodules.xyz/cert-manager-util v0.29.0 kmodules.xyz/client-go v0.29.6 - kmodules.xyz/custom-resources v0.29.0 + kmodules.xyz/custom-resources v0.29.1 kmodules.xyz/monitoring-agent-api v0.29.0 - kubedb.dev/apimachinery v0.41.0-beta.1 - kubedb.dev/db-client-go v0.0.9-0.20240119051334-7f4d5847462a + kubedb.dev/apimachinery v0.41.0-rc.0 + kubedb.dev/db-client-go v0.0.9 sigs.k8s.io/controller-runtime v0.16.3 sigs.k8s.io/yaml v1.4.0 stash.appscode.dev/apimachinery v0.32.1-0.20231225221320-6f5a8df2ab6e @@ -137,7 +137,7 @@ require ( kmodules.xyz/prober v0.29.0 // indirect kmodules.xyz/resource-metadata v0.18.2-0.20240105072614-e92a8a48d400 // indirect kubeops.dev/sidekick v0.0.5-0.20231225214445-a15c70833046 // indirect - kubestash.dev/apimachinery v0.4.0-rc.0 // indirect + kubestash.dev/apimachinery v0.4.0-rc.1 // indirect sigs.k8s.io/gateway-api v0.8.0 // indirect sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect diff --git a/go.sum b/go.sum index 55ca42f02..373ef6863 100644 --- a/go.sum +++ b/go.sum @@ -175,8 +175,8 @@ github.com/go-openapi/swag v0.19.5/go.mod h1:POnQmlKehdgb5mhVOsnJFsivZCEZ/vjK9gh github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= github.com/go-openapi/swag v0.22.4 h1:QLMzNJnMGPRNDCbySlcj1x01tzU8/9LTTL9hZZZogBU= github.com/go-openapi/swag v0.22.4/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-sql-driver/mysql v1.7.0 h1:ueSltNNllEqE3qcWBTD0iQd3IpL/6U+mJxLkazJ7YPc= -github.com/go-sql-driver/mysql v1.7.0/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= +github.com/go-sql-driver/mysql v1.7.1 h1:lUIinVbN1DY0xBg0eMOzmmtGoHwWBbvnWubQUrtU8EI= +github.com/go-sql-driver/mysql v1.7.1/go.mod h1:OXbVy3sEdcQ2Doequ6Z5BW6fXNQTmx+9S1MCJN5yJMI= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572/go.mod h1:9Pwr4B2jHnOSGXyyzV8ROjYa2ojvAY6HCGYYfMoC3Ls= @@ -807,8 +807,8 @@ kmodules.xyz/cert-manager-util v0.29.0 h1:HjEaEsv66xeMKiI8LwfTRls0z9V9L0qEvPBdOc kmodules.xyz/cert-manager-util v0.29.0/go.mod h1:0YuaPwp+P3Pw7Spxf6eDhOCMDDNXfNV2xIuxIexT1QU= kmodules.xyz/client-go v0.29.6 h1:xTVq5LZvsPBUTLY7PORq7zveLOj/vpuTDvkpHWOk3RM= kmodules.xyz/client-go v0.29.6/go.mod h1:pHuzpwzEcDUIGjVVvwz9N8lY+6A7HXwvs2d7NtK7Hho= -kmodules.xyz/custom-resources v0.29.0 h1:RaDM2+wSVXiwIvLqmkTVYpwoH83AC8wruXe2p2rOZNY= -kmodules.xyz/custom-resources v0.29.0/go.mod h1:MzZyXtxdg1PDxGk3RTTO1Xv3KiVqZnIonSwmxVbagOY= +kmodules.xyz/custom-resources v0.29.1 h1:xiNylhs3ILRbcUhxxy306AOy9GMA4Mq7xFIptZKgal4= +kmodules.xyz/custom-resources v0.29.1/go.mod h1:829zDY1EjaxPP52h1T73LZx/vgv8Pld9/uTT/ViZTc0= kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9H1UFRwB4= kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI= kmodules.xyz/objectstore-api v0.29.0 h1:dK53fQXdoboyW/EyBBAMjykT8u7jstKrM1DS4RJvhEU= @@ -819,14 +819,14 @@ kmodules.xyz/prober v0.29.0 h1:Ex7m4F9rH7uWNNJlLgP63ROOM+nUATJkC2L5OQ7nwMg= kmodules.xyz/prober v0.29.0/go.mod h1:UtK+HKyI1lFLEKX+HFLyOCVju6TO93zv3kwGpzqmKOo= kmodules.xyz/resource-metadata v0.18.2-0.20240105072614-e92a8a48d400 h1:bmd9/fvbhE55xtMF9hXVzjoUZFLGjMfEoHSHu9Hw6Gc= kmodules.xyz/resource-metadata v0.18.2-0.20240105072614-e92a8a48d400/go.mod h1:XsCdEKjfoulX29tMGviDhjT/jLl158uvMvXlKOhK1as= -kubedb.dev/apimachinery v0.41.0-beta.1 h1:Aa7LRG1HO/da6AwNY3K/3BlfiMunUwiQow3dEbkuiX0= -kubedb.dev/apimachinery v0.41.0-beta.1/go.mod h1:WdyZn+5Ni4IdlUgtpibFVv40RgN5qZV8oJN0rhVCOuM= -kubedb.dev/db-client-go v0.0.9-0.20240119051334-7f4d5847462a h1:0cbpIkRE0H9erqSC6zTcQgTdsv9crvr+zFyHvTpWsvs= -kubedb.dev/db-client-go v0.0.9-0.20240119051334-7f4d5847462a/go.mod h1:RfjD10LuyFdnZdrtVW0p6OSi304yotraYFArBmeypJo= +kubedb.dev/apimachinery v0.41.0-rc.0 h1:229M2WXAQ47ELuwkHCBXOAeDcrGX9lbSbMyk++esRlY= +kubedb.dev/apimachinery v0.41.0-rc.0/go.mod h1:DghpLFmqVyQX0kUcZRTbdV9omaxRwtw9IzdJsPqdqiI= +kubedb.dev/db-client-go v0.0.9 h1:oYfNBjZRLtF5jij1u83NW0yCjz1Is4zE9RI0tG0h5AU= +kubedb.dev/db-client-go v0.0.9/go.mod h1:h37/SUuec3Jnxusxv7JTs3Vl5SX9C/rNPG7qB7hQq4M= kubeops.dev/sidekick v0.0.5-0.20231225214445-a15c70833046 h1:X1ieV+IXqNesmFwSH6NEVF1J2wO0vplC4k6v3Vmq0d0= kubeops.dev/sidekick v0.0.5-0.20231225214445-a15c70833046/go.mod h1:XX6Vhw9EMmX9R8Y13AgaYDAsfeLZdTL8MzymTOAT0nY= -kubestash.dev/apimachinery v0.4.0-rc.0 h1:iElRLTX8WsN4xl49y07Dz1ZD14FCJZp5RZhXwsutNmw= -kubestash.dev/apimachinery v0.4.0-rc.0/go.mod h1:mqOML23d9Hm2kSyzlRy6Gr69RGEUaOCTWYl2egklac8= +kubestash.dev/apimachinery v0.4.0-rc.1 h1:lgYW5JdcsPchBm/YYVtAQAflaju/afzdF9tT/B9Cb6Q= +kubestash.dev/apimachinery v0.4.0-rc.1/go.mod h1:mqOML23d9Hm2kSyzlRy6Gr69RGEUaOCTWYl2egklac8= rsc.io/binaryregexp v0.2.0/go.mod h1:qTv7/COck+e2FymRvadv62gMdZztPaShugOCi3I+8D8= sigs.k8s.io/gateway-api v0.8.0 h1:isQQ3Jx2qFP7vaA3ls0846F0Amp9Eq14P08xbSwVbQg= sigs.k8s.io/gateway-api v0.8.0/go.mod h1:okOnjPNBFbIS/Rw9kAhuIUaIkLhTKEu+ARIuXk2dgaM= diff --git a/vendor/github.com/go-sql-driver/mysql/AUTHORS b/vendor/github.com/go-sql-driver/mysql/AUTHORS index 051327519..fb1478c3b 100644 --- a/vendor/github.com/go-sql-driver/mysql/AUTHORS +++ b/vendor/github.com/go-sql-driver/mysql/AUTHORS @@ -78,11 +78,13 @@ Olivier MenguĂ© oscarzhao Paul Bonser Peter Schultz +Phil Porada Rebecca Chin Reed Allman Richard Wilkes Robert Russell Runrioter Wung +Samantha Frank Santhosh Kumar Tekuri Sho Iizuka Sho Ikeda diff --git a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md index 77024a820..5166e4adb 100644 --- a/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md +++ b/vendor/github.com/go-sql-driver/mysql/CHANGELOG.md @@ -1,3 +1,16 @@ +## Version 1.7.1 (2023-04-25) + +Changes: + + - bump actions/checkout@v3 and actions/setup-go@v3 (#1375) + - Add go1.20 and mariadb10.11 to the testing matrix (#1403) + - Increase default maxAllowedPacket size. (#1411) + +Bugfixes: + + - Use SET syntax as specified in the MySQL documentation (#1402) + + ## Version 1.7 (2022-11-29) Changes: diff --git a/vendor/github.com/go-sql-driver/mysql/README.md b/vendor/github.com/go-sql-driver/mysql/README.md index 25de2e5aa..3b5d229aa 100644 --- a/vendor/github.com/go-sql-driver/mysql/README.md +++ b/vendor/github.com/go-sql-driver/mysql/README.md @@ -282,10 +282,10 @@ Please keep in mind, that param values must be [url.QueryEscape](https://golang. ##### `maxAllowedPacket` ``` Type: decimal number -Default: 4194304 +Default: 64*1024*1024 ``` -Max packet size allowed in bytes. The default value is 4 MiB and should be adjusted to match the server settings. `maxAllowedPacket=0` can be used to automatically fetch the `max_allowed_packet` variable from server *on every connection*. +Max packet size allowed in bytes. The default value is 64 MiB and should be adjusted to match the server settings. `maxAllowedPacket=0` can be used to automatically fetch the `max_allowed_packet` variable from server *on every connection*. ##### `multiStatements` diff --git a/vendor/github.com/go-sql-driver/mysql/connection.go b/vendor/github.com/go-sql-driver/mysql/connection.go index 9539077cb..947a883e3 100644 --- a/vendor/github.com/go-sql-driver/mysql/connection.go +++ b/vendor/github.com/go-sql-driver/mysql/connection.go @@ -71,10 +71,10 @@ func (mc *mysqlConn) handleParams() (err error) { cmdSet.Grow(4 + len(param) + 1 + len(val) + 30*(len(mc.cfg.Params)-1)) cmdSet.WriteString("SET ") } else { - cmdSet.WriteByte(',') + cmdSet.WriteString(", ") } cmdSet.WriteString(param) - cmdSet.WriteByte('=') + cmdSet.WriteString(" = ") cmdSet.WriteString(val) } } diff --git a/vendor/github.com/go-sql-driver/mysql/const.go b/vendor/github.com/go-sql-driver/mysql/const.go index b1e6b85ef..64e2bced6 100644 --- a/vendor/github.com/go-sql-driver/mysql/const.go +++ b/vendor/github.com/go-sql-driver/mysql/const.go @@ -10,7 +10,7 @@ package mysql const ( defaultAuthPlugin = "mysql_native_password" - defaultMaxAllowedPacket = 4 << 20 // 4 MiB + defaultMaxAllowedPacket = 64 << 20 // 64 MiB. See https://github.com/go-sql-driver/mysql/issues/1355 minProtocolVersion = 10 maxPacketSize = 1<<24 - 1 timeFormat = "2006-01-02 15:04:05.999999" diff --git a/vendor/github.com/go-sql-driver/mysql/errors.go b/vendor/github.com/go-sql-driver/mysql/errors.go index 7c037e7d6..ff9a8f088 100644 --- a/vendor/github.com/go-sql-driver/mysql/errors.go +++ b/vendor/github.com/go-sql-driver/mysql/errors.go @@ -27,7 +27,7 @@ var ( ErrOldProtocol = errors.New("MySQL server does not support required protocol 41+") ErrPktSync = errors.New("commands out of sync. You can't run this command now") ErrPktSyncMul = errors.New("commands out of sync. Did you run multiple statements at once?") - ErrPktTooLarge = errors.New("packet for query is too large. Try adjusting the 'max_allowed_packet' variable on the server") + ErrPktTooLarge = errors.New("packet for query is too large. Try adjusting the `Config.MaxAllowedPacket`") ErrBusyBuffer = errors.New("busy buffer") // errBadConnNoWrite is used for connection errors where nothing was sent to the database yet. diff --git a/vendor/kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1/appbinding_helpers.go b/vendor/kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1/appbinding_helpers.go index 622297bf3..b24ead9ef 100644 --- a/vendor/kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1/appbinding_helpers.go +++ b/vendor/kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1/appbinding_helpers.go @@ -81,7 +81,7 @@ func (a AppBinding) Host() (string, error) { } else if c.URL != nil { u, err := url.Parse(*c.URL) if err != nil { - return "", err + return ParseMySQLHost(*c.URL) } return u.Host, nil } @@ -99,7 +99,7 @@ func (a AppBinding) Hostname() (string, error) { } else if c.URL != nil { u, err := url.Parse(*c.URL) if err != nil { - return "", err + return ParseMySQLHostname(*c.URL) } return u.Hostname(), nil } @@ -111,12 +111,18 @@ func (a AppBinding) Port() (int32, error) { if c.Service != nil { // preferred source for MYSQL app binding return c.Service.Port, nil } else if c.URL != nil { + var port string u, err := url.Parse(*c.URL) if err != nil { - return 0, err + port, err = ParseMySQLPort(*c.URL) + if err != nil { + return 0, nil + } + } else { + port = u.Port() } - port, err := strconv.ParseInt(u.Port(), 10, 32) - return int32(port), err + result, err := strconv.ParseInt(port, 10, 32) + return int32(result), err } return 0, errors.New("connection url is missing") } diff --git a/vendor/kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1/mysql.go b/vendor/kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1/mysql.go new file mode 100644 index 000000000..62cc24bb0 --- /dev/null +++ b/vendor/kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1/mysql.go @@ -0,0 +1,93 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "net" + "net/url" + "strings" + + "github.com/go-sql-driver/mysql" +) + +/* +MySQL Go driver (https://github.com/go-sql-driver/mysql) uses a custom connection string (DSN) format. +[username[:password]@][protocol[(address)]]/dbname[?param1=value1&...¶mN=valueN] +*/ + +func (a AppBinding) MySQLDSN() (string, error) { + dsn, err := a.URL() + if err != nil { + return "", err + } + return CanonicalMySQLDSN(dsn) +} + +// CanonicalMySQLDSN will convert a regular URL into MySQL DSN format +func CanonicalMySQLDSN(dsn string) (string, error) { + _, err := mysql.ParseDSN(dsn) + if err == nil { + return dsn, nil + } + + u, err := url.Parse(dsn) + if err != nil { + return "", err + } + + rebuild := mysql.NewConfig() + rebuild.Net = u.Scheme + rebuild.Addr = u.Host + rebuild.DBName = strings.TrimPrefix(u.Path, "/") + if u.User != nil { + rebuild.User = u.User.Username() + if pass, found := u.User.Password(); found { + rebuild.Passwd = pass + } + } + rebuild.Params = map[string]string{} + for k, v := range u.Query() { + rebuild.Params[k] = v[0] + } + return rebuild.FormatDSN(), nil +} + +func ParseMySQLHost(dsn string) (string, error) { + cfg, err := mysql.ParseDSN(dsn) + if err != nil { + return "", err + } + return cfg.Addr, err +} + +func ParseMySQLHostname(dsn string) (string, error) { + cfg, err := mysql.ParseDSN(dsn) + if err != nil { + return "", err + } + host, _, err := net.SplitHostPort(cfg.Addr) + return host, err +} + +func ParseMySQLPort(dsn string) (string, error) { + cfg, err := mysql.ParseDSN(dsn) + if err != nil { + return "", err + } + _, port, err := net.SplitHostPort(cfg.Addr) + return port, err +} diff --git a/vendor/kubedb.dev/apimachinery/apis/catalog/v1alpha1/ferretdb_version_types.go b/vendor/kubedb.dev/apimachinery/apis/catalog/v1alpha1/ferretdb_version_types.go index 4a40e4629..366d9234e 100644 --- a/vendor/kubedb.dev/apimachinery/apis/catalog/v1alpha1/ferretdb_version_types.go +++ b/vendor/kubedb.dev/apimachinery/apis/catalog/v1alpha1/ferretdb_version_types.go @@ -32,7 +32,7 @@ const ( // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +kubebuilder:object:root=true -// +kubebuilder:resource:path=ferretdbversions,singular=ferretdbversion,scope=Cluster,shortName=drversion,categories={datastore,kubedb,appscode} +// +kubebuilder:resource:path=ferretdbversions,singular=ferretdbversion,scope=Cluster,shortName=frversion,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" diff --git a/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/openapi_generated.go b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/openapi_generated.go index 4aa62612f..f694e81c7 100644 --- a/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/openapi_generated.go +++ b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/openapi_generated.go @@ -458,6 +458,7 @@ func GetOpenAPIDefinitions(ref common.ReferenceCallback) map[string]common.OpenA "kubedb.dev/apimachinery/apis/config/v1alpha1.GaleraArbitratorConfiguration": schema_apimachinery_apis_config_v1alpha1_GaleraArbitratorConfiguration(ref), "kubedb.dev/apimachinery/apis/config/v1alpha1.MongoDBConfiguration": schema_apimachinery_apis_config_v1alpha1_MongoDBConfiguration(ref), "kubedb.dev/apimachinery/apis/config/v1alpha1.RedisConfiguration": schema_apimachinery_apis_config_v1alpha1_RedisConfiguration(ref), + "kubedb.dev/apimachinery/apis/config/v1alpha1.SinglestoreConfiguration": schema_apimachinery_apis_config_v1alpha1_SinglestoreConfiguration(ref), } } @@ -22784,3 +22785,61 @@ func schema_apimachinery_apis_config_v1alpha1_RedisConfiguration(ref common.Refe "k8s.io/api/core/v1.LocalObjectReference", "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1.StashAddonSpec"}, } } + +func schema_apimachinery_apis_config_v1alpha1_SinglestoreConfiguration(ref common.ReferenceCallback) common.OpenAPIDefinition { + return common.OpenAPIDefinition{ + Schema: spec.Schema{ + SchemaProps: spec.SchemaProps{ + Description: "SinglestoreConfiguration defines a Singlestore appBinding configuration.", + Type: []string{"object"}, + Properties: map[string]spec.Schema{ + "kind": { + SchemaProps: spec.SchemaProps{ + Description: "Kind is a string value representing the REST resource this object represents. Servers may infer this from the endpoint the client submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds", + Type: []string{"string"}, + Format: "", + }, + }, + "apiVersion": { + SchemaProps: spec.SchemaProps{ + Description: "APIVersion defines the versioned schema of this representation of an object. Servers should convert recognized schemas to the latest internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources", + Type: []string{"string"}, + Format: "", + }, + }, + "replicaSets": { + SchemaProps: spec.SchemaProps{ + Description: "ReplicaSets contains the dns of each replicaset of sharding. The DSNs are in key-value pair, where the keys are host-0, host-1 etc, and the values are DSN of each replicaset. If there is no sharding but only one replicaset, then ReplicaSets field contains only one key-value pair where the key is host-0 and the value is dsn of that replicaset.", + Type: []string{"object"}, + AdditionalProperties: &spec.SchemaOrBool{ + Allows: true, + Schema: &spec.Schema{ + SchemaProps: spec.SchemaProps{ + Default: "", + Type: []string{"string"}, + Format: "", + }, + }, + }, + }, + }, + "masterAggregator": { + SchemaProps: spec.SchemaProps{ + Type: []string{"string"}, + Format: "", + }, + }, + "stash": { + SchemaProps: spec.SchemaProps{ + Description: "Stash defines backup and restore task definitions.", + Default: map[string]interface{}{}, + Ref: ref("kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1.StashAddonSpec"), + }, + }, + }, + }, + }, + Dependencies: []string{ + "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1.StashAddonSpec"}, + } +} diff --git a/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/register.go b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/register.go index ee7fb83dc..deeba4ccb 100644 --- a/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/register.go +++ b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/register.go @@ -56,6 +56,7 @@ func addKnownTypes(scheme *runtime.Scheme) error { scheme.AddKnownTypes(SchemeGroupVersion, &GaleraArbitratorConfiguration{}, &MongoDBConfiguration{}, + &SinglestoreConfiguration{}, ) scheme.AddKnownTypes(SchemeGroupVersion, diff --git a/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/singlestore_config_types.go b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/singlestore_config_types.go new file mode 100644 index 000000000..c0a1e41ed --- /dev/null +++ b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/singlestore_config_types.go @@ -0,0 +1,45 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" +) + +const ( + ResourceKindSinglestoreConfiguration = "SinglestoreConfiguration" +) + +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object + +// SinglestoreConfiguration defines a Singlestore appBinding configuration. +type SinglestoreConfiguration struct { + metav1.TypeMeta `json:",inline,omitempty"` + + // ReplicaSets contains the dns of each replicaset of sharding. The DSNs are in key-value pair, where + // the keys are host-0, host-1 etc, and the values are DSN of each replicaset. If there is no sharding + // but only one replicaset, then ReplicaSets field contains only one key-value pair where the key is + // host-0 and the value is dsn of that replicaset. + ReplicaSets map[string]string `json:"replicaSets,omitempty"` + + MasterAggregator string `json:"masterAggregator,omitempty"` + + // Stash defines backup and restore task definitions. + // +optional + Stash appcat.StashAddonSpec `json:"stash,omitempty"` +} diff --git a/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/zz_generated.deepcopy.go b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/zz_generated.deepcopy.go index 3340edd68..880bee29a 100644 --- a/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/zz_generated.deepcopy.go +++ b/vendor/kubedb.dev/apimachinery/apis/config/v1alpha1/zz_generated.deepcopy.go @@ -115,3 +115,36 @@ func (in *RedisConfiguration) DeepCopyObject() runtime.Object { } return nil } + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *SinglestoreConfiguration) DeepCopyInto(out *SinglestoreConfiguration) { + *out = *in + out.TypeMeta = in.TypeMeta + if in.ReplicaSets != nil { + in, out := &in.ReplicaSets, &out.ReplicaSets + *out = make(map[string]string, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + in.Stash.DeepCopyInto(&out.Stash) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SinglestoreConfiguration. +func (in *SinglestoreConfiguration) DeepCopy() *SinglestoreConfiguration { + if in == nil { + return nil + } + out := new(SinglestoreConfiguration) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *SinglestoreConfiguration) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} diff --git a/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/constants.go b/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/constants.go index 50f1cbed5..4c871b112 100644 --- a/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/constants.go +++ b/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/constants.go @@ -32,7 +32,7 @@ const ( OS_PASSWORD_KEY = "opensearch.password" ElasticsearchDashboardPortServer = "server" - ElasticsearchDashboardConfigMergeCommand = "/usr/local/bin/elasticsearch-config-merger.sh" + ElasticsearchDashboardConfigMergeCommand = "/usr/local/bin/dashboard-config-merger.sh" KibanaConfigDir = "/usr/share/kibana/config" KibanaTempConfigDir = "/kibana/temp-config" @@ -40,11 +40,11 @@ const ( KibanaStatusEndpoint = "/api/status" KibanaConfigFileName = "kibana.yml" - OpensearchDashboardsConfigDir = "/usr/share/opensearch-elasticsearchs/config" - OpensearchDashboardsTempConfigDir = "/opensearch-elasticsearchs/temp-config" - OpensearchDashboardsCustomConfigDir = "/opensearch-elasticsearchs/custom-config" + OpensearchDashboardsConfigDir = "/usr/share/opensearch-dashboards/config" + OpensearchDashboardsTempConfigDir = "/opensearch-dashboards/temp-config" + OpensearchDashboardsCustomConfigDir = "/opensearch-dashboards/custom-config" OpensearchDashboardsStatusEndpoint = "/api/status" - OpensearchDasboardsConfigFileName = "opensearch_elasticsearchs.yml" + OpensearchDasboardsConfigFileName = "opensearch_dashboards.yml" ElasticsearchHostsKey = "elasticsearch.hosts" ElasticsearchSSLCaKey = "elasticsearch.ssl.certificateAuthorities" diff --git a/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/types.go b/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/types.go index 62c904d62..89722b8d9 100644 --- a/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/types.go +++ b/vendor/kubedb.dev/apimachinery/apis/elasticsearch/v1alpha1/types.go @@ -91,9 +91,9 @@ const ( type DashboardVolumeName string const ( - DashboardVolumeCustomConfig DashboardVolumeName = "elasticsearch-custom-config" - DashboardVolumeOperatorGeneratedConfig DashboardVolumeName = "elasticsearch-temp-config" - DashboardVolumeConfig DashboardVolumeName = "elasticsearch-config" + DashboardVolumeCustomConfig DashboardVolumeName = "dashboard-custom-config" + DashboardVolumeOperatorGeneratedConfig DashboardVolumeName = "dashboard-temp-config" + DashboardVolumeConfig DashboardVolumeName = "dashboard-config" DashboardVolumeServerTLS DashboardVolumeName = "server-tls" DashboardVolumeDatabaseClient DashboardVolumeName = "database-client" ) diff --git a/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_helpers.go index 72db16090..2cec62295 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_helpers.go @@ -180,6 +180,17 @@ func (k *ConnectCluster) ConfigSecretName() string { return meta_util.NameWithSuffix(k.OffshootName(), "config") } +func (k *ConnectCluster) GetPersistentSecrets() []string { + var secrets []string + if k.Spec.AuthSecret != nil { + secrets = append(secrets, k.Spec.AuthSecret.Name) + } + if k.Spec.KeystoreCredSecret != nil { + secrets = append(secrets, k.Spec.KeystoreCredSecret.Name) + } + return secrets +} + func (k *ConnectCluster) KafkaClientCredentialsSecretName() string { return meta_util.NameWithSuffix(k.Name, "kafka-client-cred") } diff --git a/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_webhook.go index 95f88422f..c61aaa26a 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_webhook.go +++ b/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connect_cluster_webhook.go @@ -78,7 +78,7 @@ func (k *ConnectCluster) ValidateUpdate(old runtime.Object) (admission.Warnings, if len(allErr) == 0 { return nil, nil } - return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "Kafka"}, k.Name, allErr) + return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "ConnectCluster"}, k.Name, allErr) } // ValidateDelete implements webhook.Validator so a webhook will be registered for the type @@ -111,6 +111,12 @@ func (k *ConnectCluster) ValidateCreateOrUpdate() field.ErrorList { } } + if k.Spec.TerminationPolicy == api.TerminationPolicyHalt { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), + k.Name, + "TerminationPolicyHalt is not supported for ConnectCluster")) + } + // number of replicas can not be 0 or less if k.Spec.Replicas != nil && *k.Spec.Replicas <= 0 { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("replicas"), diff --git a/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connector_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connector_webhook.go new file mode 100644 index 000000000..5028666ce --- /dev/null +++ b/vendor/kubedb.dev/apimachinery/apis/kafka/v1alpha1/connector_webhook.go @@ -0,0 +1,86 @@ +/* +Copyright AppsCode Inc. and Contributors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + api "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + + apierrors "k8s.io/apimachinery/pkg/api/errors" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/util/validation/field" + logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/webhook" + "sigs.k8s.io/controller-runtime/pkg/webhook/admission" +) + +// log is for logging in this package. +var connectorlog = logf.Log.WithName("connector-resource") + +var _ webhook.Defaulter = &Connector{} + +// Default implements webhook.Defaulter so a webhook will be registered for the type +func (k *Connector) Default() { + if k == nil { + return + } + connectClusterLog.Info("default", "name", k.Name) + if k.Spec.TerminationPolicy == "" { + k.Spec.TerminationPolicy = api.TerminationPolicyDelete + } +} + +var _ webhook.Validator = &Connector{} + +// ValidateCreate implements webhook.Validator so a webhook will be registered for the type +func (k *Connector) ValidateCreate() (admission.Warnings, error) { + connectClusterLog.Info("validate create", "name", k.Name) + return nil, k.ValidateCreateOrUpdate() +} + +// ValidateUpdate implements webhook.Validator so a webhook will be registered for the type +func (k *Connector) ValidateUpdate(old runtime.Object) (admission.Warnings, error) { + connectClusterLog.Info("validate update", "name", k.Name) + return nil, k.ValidateCreateOrUpdate() +} + +// ValidateDelete implements webhook.Validator so a webhook will be registered for the type +func (k *Connector) ValidateDelete() (admission.Warnings, error) { + connectorlog.Info("validate delete", "name", k.Name) + + var allErr field.ErrorList + if k.Spec.TerminationPolicy == api.TerminationPolicyDoNotTerminate { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), + k.Name, + "Can not delete as terminationPolicy is set to \"DoNotTerminate\"")) + return nil, apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "Connector"}, k.Name, allErr) + } + return nil, nil +} + +func (k *Connector) ValidateCreateOrUpdate() error { + var allErr field.ErrorList + if k.Spec.TerminationPolicy == api.TerminationPolicyHalt { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), + k.Name, + "TerminationPolicyHalt isn't supported for Connector")) + } + if len(allErr) == 0 { + return nil + } + return apierrors.NewInvalid(schema.GroupKind{Group: "kafka.kubedb.com", Kind: "ConnectCluster"}, k.Name, allErr) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/constants.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/constants.go index 3800e604b..4cf912be8 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/constants.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/constants.go @@ -1015,11 +1015,54 @@ const ( RabbitMQVolumeTempConfig = "temp-config" RabbitMQVolumeCustomConfig = "custom-config" - RabbitMQDataDir = "/var/lib/rabbitmq/mnesia" - RabbitMQPluginsDir = "/etc/rabbitmq/" - RabbitMQCertDir = "/var/private/ssl" - RabbitMQConfigDir = "/config/" - RabbitMQTempConfigDir = "/tmp/config/" + RabbitMQDataDir = "/var/lib/rabbitmq/mnesia" + RabbitMQConfigDir = "/config/" + RabbitMQPluginsDir = "/etc/rabbitmq/" + RabbitMQCertDir = "/var/private/ssl" + RabbitMQTempConfigDir = "/tmp/config/" + RabbitMQCustomConfigDir = "/tmp/config/custom_config/" + + RabbitMQConfigVolName = "rabbitmq-config" + RabbitMQPluginsVolName = "rabbitmq-plugins" + RabbitMQTempConfigVolName = "temp-config" + + RabbitMQContainerName = "rabbitmq" + RabbitMQInitContainerName = "rabbitmq-init" + RabbitMQManagementPlugin = "rabbitmq_management" + RabbitMQPeerdiscoveryPlugin = "rabbitmq_peer_discovery_k8s" + RabbitMQLoopBackUserKey = "loopback_users" + RabbitMQLoopBackUserVal = "none" + RabbitMQDefaultTCPListenerKey = "listeners.tcp.default" + RabbitMQDefaultTCPListenerVal = "5672" + RabbitMQQueueMasterLocatorKey = "queue_master_locator" + RabbitMQQueueMasterLocatorVal = "min-masters" + RabbitMQDiskFreeLimitKey = "disk_free_limit.absolute" + RabbitMQDiskFreeLimitVal = "2GB" + RabbitMQPartitionHandingKey = "cluster_partition_handling" + RabbitMQPartitionHandingVal = "pause_minority" + RabbitMQPeerDiscoveryKey = "cluster_formation.peer_discovery_backend" + RabbitMQPeerDiscoveryVal = "rabbit_peer_discovery_k8s" + RabbitMQK8sHostKey = "cluster_formation.k8s.host" + RabbitMQK8sHostVal = "kubernetes.default.svc.cluster.local" + RabbitMQK8sAddressTypeKey = "cluster_formation.k8s.address_type" + RabbitMQK8sAddressTypeVal = "hostname" + RabbitMQNodeCleanupWarningKey = "cluster_formation.node_cleanup.only_log_warning" + RabbitMQNodeCleanupWarningVal = "true" + RabbitMQLogFileLevelKey = "log.file.level" + RabbitMQLogFileLevelVal = "info" + RabbitMQLogConsoleKey = "log.console" + RabbitMQLogConsoleVal = "true" + RabbitMQLogConsoleLevelKey = "log.console.level" + RabbitMQLogConsoleLevelVal = "info" + RabbitMQDefaultUserKey = "default_user" + RabbitMQDefaultUserVal = "$(RABBITMQ_DEFAULT_USER)" + RabbitMQDefaultPasswordKey = "default_pass" + RabbitMQDefaultPasswordVal = "$(RABBITMQ_DEFAULT_PASS)" + RabbitMQClusterNameKey = "cluster_name" + RabbitMQK8sSvcNameKey = "cluster_formation.k8s.service_name" + RabbitMQConfigFileName = "rabbitmq.conf" + RabbitMQEnabledPluginsFileName = "enabled_plugins" + RabbitMQHealthCheckerQueueName = "kubedb-system" ) // =========================== FerretDB Constants ============================ diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_helpers.go index 82b636f07..02b94210b 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_helpers.go @@ -22,7 +22,6 @@ import ( "strconv" "strings" - "kubedb.dev/apimachinery/apis" catalog "kubedb.dev/apimachinery/apis/catalog/v1alpha1" "kubedb.dev/apimachinery/apis/kubedb" "kubedb.dev/apimachinery/crds" @@ -30,11 +29,14 @@ import ( "gomodules.xyz/pointer" v1 "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + appslister "k8s.io/client-go/listers/apps/v1" "k8s.io/klog/v2" "kmodules.xyz/client-go/apiextensions" coreutil "kmodules.xyz/client-go/core/v1" meta_util "kmodules.xyz/client-go/meta" + "kmodules.xyz/client-go/policy/secomp" appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" ofst "kmodules.xyz/offshoot-api/api/v2" ) @@ -212,7 +214,7 @@ func (d *Druid) GetMetadataStorageConnectURI(appbinding *appcat.AppBinding, meta } func (d *Druid) GetZKServiceHost(appbinding *appcat.AppBinding) string { - return appbinding.Spec.ClientConfig.Service.Name + ":" + strconv.Itoa(int(appbinding.Spec.ClientConfig.Service.Port)) + return fmt.Sprintf("%s.%s.svc:%d", appbinding.Spec.ClientConfig.Service.Name, appbinding.Namespace, int(appbinding.Spec.ClientConfig.Service.Port)) } func (d *Druid) AddDruidExtensionLoadList(druidExtensionLoadList string, extension string) string { @@ -227,7 +229,7 @@ func (d *Druid) AddDruidExtensionLoadList(druidExtensionLoadList string, extensi } func (d *Druid) GetMetadataStorageType(metadataStorage string) DruidMetadataStorageType { - if metadataStorage == string(DruidMetadataStorageMySQL) { + if metadataStorage == string(DruidMetadataStorageMySQL) || metadataStorage == strings.ToLower(string(DruidMetadataStorageMySQL)) { return DruidMetadataStorageMySQL } else { return DruidMetadataStoragePostgreSQL @@ -254,10 +256,16 @@ func (d *Druid) GetDruidSegmentCacheConfig() string { } func (d *Druid) GetDruidStorageSize(storageSize string) string { - storageSize = storageSize[:len(storageSize)-1] - storageSize = strings.ToLower(storageSize) + lastTwoCharacters := storageSize[len(storageSize)-2:] + storageSize = storageSize[:len(storageSize)-2] + intSorageSize, _ := strconv.Atoi(storageSize) - return storageSize + if lastTwoCharacters == "Gi" { + intSorageSize *= 1000000000 + } else { + intSorageSize *= 1000000 + } + return strconv.Itoa(intSorageSize) } func (d *Druid) OffshootSelectors(extraSelectors ...map[string]string) map[string]string { @@ -269,6 +277,15 @@ func (d *Druid) OffshootSelectors(extraSelectors ...map[string]string) map[strin return meta_util.OverwriteKeys(selector, extraSelectors...) } +func (d Druid) OffshootLabels() map[string]string { + return d.offshootLabels(d.OffshootSelectors(), nil) +} + +func (e Druid) offshootLabels(selector, override map[string]string) map[string]string { + selector[meta_util.ComponentLabelKey] = ComponentDatabase + return meta_util.FilterKeys(kubedb.GroupName, selector, meta_util.OverwriteKeys(nil, e.Labels, override)) +} + func (d *Druid) SetDefaults() { if d.Spec.TerminationPolicy == "" { d.Spec.TerminationPolicy = TerminationPolicyDelete @@ -304,11 +321,9 @@ func (d *Druid) SetDefaults() { if d.Spec.Topology.Coordinators.Replicas == nil { d.Spec.Topology.Coordinators.Replicas = pointer.Int32P(1) } - if d.Spec.Topology.Coordinators.PodTemplate.Spec.SecurityContext == nil { d.Spec.Topology.Coordinators.PodTemplate.Spec.SecurityContext = &v1.PodSecurityContext{FSGroup: druidVersion.Spec.SecurityContext.RunAsUser} } - d.Spec.Topology.Coordinators.PodTemplate.Spec.SecurityContext.RunAsGroup = druidVersion.Spec.SecurityContext.RunAsUser d.setDefaultContainerSecurityContext(&druidVersion, &d.Spec.Topology.Coordinators.PodTemplate) d.setDefaultInitContainerSecurityContext(&druidVersion, &d.Spec.Topology.Coordinators.PodTemplate) } @@ -316,11 +331,9 @@ func (d *Druid) SetDefaults() { if d.Spec.Topology.Overlords.Replicas == nil { d.Spec.Topology.Overlords.Replicas = pointer.Int32P(1) } - if d.Spec.Topology.Overlords.PodTemplate.Spec.SecurityContext == nil { d.Spec.Topology.Overlords.PodTemplate.Spec.SecurityContext = &v1.PodSecurityContext{FSGroup: druidVersion.Spec.SecurityContext.RunAsUser} } - d.Spec.Topology.Overlords.PodTemplate.Spec.SecurityContext.RunAsGroup = druidVersion.Spec.SecurityContext.RunAsUser d.setDefaultContainerSecurityContext(&druidVersion, &d.Spec.Topology.Overlords.PodTemplate) d.setDefaultInitContainerSecurityContext(&druidVersion, &d.Spec.Topology.Overlords.PodTemplate) } @@ -328,11 +341,9 @@ func (d *Druid) SetDefaults() { if d.Spec.Topology.MiddleManagers.Replicas == nil { d.Spec.Topology.MiddleManagers.Replicas = pointer.Int32P(1) } - if d.Spec.Topology.MiddleManagers.PodTemplate.Spec.SecurityContext == nil { d.Spec.Topology.MiddleManagers.PodTemplate.Spec.SecurityContext = &v1.PodSecurityContext{FSGroup: druidVersion.Spec.SecurityContext.RunAsUser} } - d.Spec.Topology.MiddleManagers.PodTemplate.Spec.SecurityContext.RunAsGroup = druidVersion.Spec.SecurityContext.RunAsUser d.setDefaultContainerSecurityContext(&druidVersion, &d.Spec.Topology.MiddleManagers.PodTemplate) d.setDefaultInitContainerSecurityContext(&druidVersion, &d.Spec.Topology.MiddleManagers.PodTemplate) } @@ -340,11 +351,9 @@ func (d *Druid) SetDefaults() { if d.Spec.Topology.Historicals.Replicas == nil { d.Spec.Topology.Historicals.Replicas = pointer.Int32P(1) } - if d.Spec.Topology.Historicals.PodTemplate.Spec.SecurityContext == nil { d.Spec.Topology.Historicals.PodTemplate.Spec.SecurityContext = &v1.PodSecurityContext{FSGroup: druidVersion.Spec.SecurityContext.RunAsUser} } - d.Spec.Topology.Historicals.PodTemplate.Spec.SecurityContext.RunAsGroup = druidVersion.Spec.SecurityContext.RunAsUser d.setDefaultContainerSecurityContext(&druidVersion, &d.Spec.Topology.Historicals.PodTemplate) d.setDefaultInitContainerSecurityContext(&druidVersion, &d.Spec.Topology.Historicals.PodTemplate) } @@ -352,11 +361,9 @@ func (d *Druid) SetDefaults() { if d.Spec.Topology.Brokers.Replicas == nil { d.Spec.Topology.Brokers.Replicas = pointer.Int32P(1) } - if d.Spec.Topology.Brokers.PodTemplate.Spec.SecurityContext == nil { d.Spec.Topology.Brokers.PodTemplate.Spec.SecurityContext = &v1.PodSecurityContext{FSGroup: druidVersion.Spec.SecurityContext.RunAsUser} } - d.Spec.Topology.Brokers.PodTemplate.Spec.SecurityContext.RunAsGroup = druidVersion.Spec.SecurityContext.RunAsUser d.setDefaultContainerSecurityContext(&druidVersion, &d.Spec.Topology.Brokers.PodTemplate) d.setDefaultInitContainerSecurityContext(&druidVersion, &d.Spec.Topology.Brokers.PodTemplate) } @@ -364,18 +371,21 @@ func (d *Druid) SetDefaults() { if d.Spec.Topology.Routers.Replicas == nil { d.Spec.Topology.Routers.Replicas = pointer.Int32P(1) } - if d.Spec.Topology.Routers.PodTemplate.Spec.SecurityContext == nil { d.Spec.Topology.Routers.PodTemplate.Spec.SecurityContext = &v1.PodSecurityContext{FSGroup: druidVersion.Spec.SecurityContext.RunAsUser} } - d.Spec.Topology.Routers.PodTemplate.Spec.SecurityContext.RunAsGroup = druidVersion.Spec.SecurityContext.RunAsUser d.setDefaultContainerSecurityContext(&druidVersion, &d.Spec.Topology.Routers.PodTemplate) d.setDefaultInitContainerSecurityContext(&druidVersion, &d.Spec.Topology.Routers.PodTemplate) } } + if d.Spec.MetadataStorage != nil { + if d.Spec.MetadataStorage.Name != nil && d.Spec.MetadataStorage.Namespace == nil { + *d.Spec.MetadataStorage.Namespace = d.Namespace + } + } } -func (d *Druid) setDefaultInitContainerSecurityContext(slVersion *catalog.DruidVersion, podTemplate *ofst.PodTemplateSpec) { +func (d *Druid) setDefaultInitContainerSecurityContext(druidVersion *catalog.DruidVersion, podTemplate *ofst.PodTemplateSpec) { initContainer := coreutil.GetContainerByName(podTemplate.Spec.InitContainers, DruidInitContainer) if initContainer == nil { initContainer = &v1.Container{ @@ -385,8 +395,7 @@ func (d *Druid) setDefaultInitContainerSecurityContext(slVersion *catalog.DruidV if initContainer.SecurityContext == nil { initContainer.SecurityContext = &v1.SecurityContext{} } - apis.SetDefaultResourceLimits(&initContainer.Resources, DefaultResources) - d.assignDefaultContainerSecurityContext(slVersion, initContainer.SecurityContext) + d.assignDefaultContainerSecurityContext(druidVersion, initContainer.SecurityContext) podTemplate.Spec.InitContainers = coreutil.UpsertContainer(podTemplate.Spec.InitContainers, *initContainer) } @@ -400,29 +409,28 @@ func (d *Druid) setDefaultContainerSecurityContext(druidVersion *catalog.DruidVe if container.SecurityContext == nil { container.SecurityContext = &v1.SecurityContext{} } - apis.SetDefaultResourceLimits(&container.Resources, DefaultResources) d.assignDefaultContainerSecurityContext(druidVersion, container.SecurityContext) podTemplate.Spec.Containers = coreutil.UpsertContainer(podTemplate.Spec.Containers, *container) } func (d *Druid) assignDefaultContainerSecurityContext(druidVersion *catalog.DruidVersion, sc *v1.SecurityContext) { - //if sc.AllowPrivilegeEscalation == nil { - // sc.AllowPrivilegeEscalation = pointer.BoolP(false) - //} - //if sc.Capabilities == nil { - // sc.Capabilities = &v1.Capabilities{ - // Drop: []v1.Capability{"ALL"}, - // } - //} - //if sc.RunAsNonRoot == nil { - // sc.RunAsNonRoot = pointer.BoolP(true) - //} - //if sc.RunAsUser == nil { - // sc.RunAsUser = druidVersion.Spec.SecurityContext.RunAsUser - //} - //if sc.SeccompProfile == nil { - // sc.SeccompProfile = secomp.DefaultSeccompProfile() - //} + if sc.AllowPrivilegeEscalation == nil { + sc.AllowPrivilegeEscalation = pointer.BoolP(false) + } + if sc.Capabilities == nil { + sc.Capabilities = &v1.Capabilities{ + Drop: []v1.Capability{"ALL"}, + } + } + if sc.RunAsNonRoot == nil { + sc.RunAsNonRoot = pointer.BoolP(true) + } + if sc.RunAsUser == nil { + sc.RunAsUser = druidVersion.Spec.SecurityContext.RunAsUser + } + if sc.SeccompProfile == nil { + sc.SeccompProfile = secomp.DefaultSeccompProfile() + } } func (d *Druid) GetPersistentSecrets() []string { @@ -436,3 +444,18 @@ func (d *Druid) GetPersistentSecrets() []string { } return secrets } + +func (d *Druid) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + if d.Spec.Topology != nil { + expectedItems = 4 + } + if d.Spec.Topology.Routers != nil { + expectedItems++ + } + if d.Spec.Topology.Overlords != nil { + expectedItems++ + } + return checkReplicas(lister.StatefulSets(d.Namespace), labels.SelectorFromSet(d.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_types.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_types.go index a0de52708..5e3c70d8b 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_types.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_types.go @@ -59,10 +59,6 @@ type DruidSpec struct { // Version of Druid to be deployed. Version string `json:"version"` - // Number of instances to deploy for a Druid database - // +optional - Replicas *int32 `json:"replicas,omitempty"` - // Druid topology for node specification // +optional Topology *DruidClusterTopology `json:"topology,omitempty"` @@ -96,14 +92,14 @@ type DruidSpec struct { //TLS *kmapi.TLSConfig `json:"tls,omitempty"` // MetadataStorage contains information for Druid to connect to external dependency metadata storage - // +optional - MetadataStorage *MetadataStorage `json:"metadataStorage,omitempty"` + MetadataStorage *MetadataStorage `json:"metadataStorage"` // DeepStorage contains specification for druid to connect to the deep storage DeepStorage *DeepStorageSpec `json:"deepStorage"` // ZooKeeper contains information for Druid to connect to external dependency metadata storage - ZooKeeper *ZooKeeperRef `json:"zooKeeper"` + // +optional + ZooKeeper *ZooKeeperRef `json:"zooKeeper,omitempty"` // PodTemplate is an optional configuration // +optional @@ -171,11 +167,16 @@ type DruidNode struct { type MetadataStorage struct { // Name of the appbinding of metadata storage - Name string `json:"name"` + // +optional + Name *string `json:"name,omitempty"` // Namespace of the appbinding of metadata storage // +optional - Namespace string `json:"namespace,omitempty"` + Namespace *string `json:"namespace,omitempty"` + + // If not KubeDB managed, then specify type of the metadata storage + // +optional + Type *string `json:"type,omitempty"` // If Druid has the permission to create new tables // +optional @@ -189,20 +190,22 @@ type DeepStorageSpec struct { // deepStorage.configSecret should contain the necessary data // to connect to the deep storage + // +optional ConfigSecret *core.LocalObjectReference `json:"configSecret"` } type ZooKeeperRef struct { // Name of the appbinding of zookeeper - Name *string `json:"name"` + // +optional + Name *string `json:"name,omitempty"` // Namespace of the appbinding of zookeeper // +optional - Namespace string `json:"namespace"` + Namespace string `json:"namespace,omitempty"` // Base ZooKeeperSpec path // +optional - PathsBase string `json:"pathsBase"` + PathsBase string `json:"pathsBase,omitempty"` } // DruidStatus defines the observed state of Druid diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_webhook.go index e1ea8fb89..4b4873e3d 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_webhook.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/druid_webhook.go @@ -17,11 +17,15 @@ limitations under the License. package v1alpha2 import ( + "context" "errors" + catalog "kubedb.dev/apimachinery/apis/catalog/v1alpha1" + apierrors "k8s.io/apimachinery/pkg/api/errors" "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" + "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/validation/field" ofst "kmodules.xyz/offshoot-api/api/v2" logf "sigs.k8s.io/controller-runtime/pkg/log" @@ -78,10 +82,6 @@ func (d *Druid) ValidateDelete() (admission.Warnings, error) { return nil, nil } -var druidAvailableVersions = []string{ - "25.0.0", -} - var druidReservedVolumes = []string{ DruidVolumeOperatorConfig, DruidVolumeMainConfig, @@ -102,7 +102,7 @@ func (d *Druid) validateCreateOrUpdate() field.ErrorList { if d.Spec.Version == "" { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("version"), d.Name, - "spec.version' is missing")) + "spec.version is missing")) } else { err := druidValidateVersion(d) if err != nil { @@ -127,31 +127,27 @@ func (d *Druid) validateCreateOrUpdate() field.ErrorList { if d.Spec.DeepStorage == nil { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deepStorage"), d.Name, - "spec.deepStorage' is missing")) + "spec.deepStorage is missing")) } else { if d.Spec.DeepStorage.Type == nil { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deepStorage").Child("type"), d.Name, - "spec.deepStorage.type' is missing")) - } - if d.Spec.DeepStorage.ConfigSecret == nil { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("deepStorage").Child("configSecret"), - d.Name, - "spec.deepStorage.configSecret' is missing")) + "spec.deepStorage.type is missing")) } } - if d.Spec.ZooKeeper == nil { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("zooKeeper"), + if d.Spec.MetadataStorage == nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("metadataStorage"), d.Name, - "spec.zooKeeper' is missing")) + "spec.metadataStorage is missing")) } else { - if d.Spec.ZooKeeper.Name == nil { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("zooKeeper").Child("name"), + if d.Spec.MetadataStorage.Name == nil && d.Spec.MetadataStorage.Type == nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("metadataStorage").Child("name"), d.Name, - "spec.zooKeeper.name' is missing")) + "spec.metadataStorage.type and spec.metadataStorage.name both can not be empty simultaneously")) } } + if d.Spec.Topology == nil { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("topology"), d.Name, @@ -236,7 +232,7 @@ func (d *Druid) validateCreateOrUpdate() field.ErrorList { if d.Spec.Topology.Brokers == nil { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("topology").Child("brokers").Child("replicas"), d.Name, - "spec.topology.brokers.replicas' can not be empty")) + "spec.topology.brokers.replicas can not be empty")) } else { if *d.Spec.Topology.Brokers.Replicas <= 0 { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("topology").Child("brokers").Child("replicas"), @@ -306,13 +302,14 @@ func (d *Druid) validateCreateOrUpdate() field.ErrorList { } func druidValidateVersion(d *Druid) error { - version := d.Spec.Version - for _, v := range druidAvailableVersions { - if v == version { - return nil - } + var druidVersion catalog.DruidVersion + err := DefaultClient.Get(context.TODO(), types.NamespacedName{ + Name: d.Spec.Version, + }, &druidVersion) + if err != nil { + return errors.New("version not supported") } - return errors.New("version not supported") + return nil } func druidValidateVolumes(podTemplate *ofst.PodTemplateSpec, nodeType DruidNodeRoleType) error { diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/elasticsearch_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/elasticsearch_helpers.go index 93ca42deb..7107043b7 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/elasticsearch_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/elasticsearch_helpers.go @@ -639,8 +639,13 @@ func (e *Elasticsearch) SetDefaults(esVersion *catalog.ElasticsearchVersion, top func (e *Elasticsearch) SetMetricsExporterDefaults(esVersion *catalog.ElasticsearchVersion) { e.Spec.Monitor.SetDefaults() - if e.Spec.Monitor != nil && e.Spec.Monitor.Prometheus != nil && e.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - e.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = esVersion.Spec.SecurityContext.RunAsUser + if e.Spec.Monitor != nil && e.Spec.Monitor.Prometheus != nil { + if e.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + e.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = esVersion.Spec.SecurityContext.RunAsUser + } + if e.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + e.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = esVersion.Spec.SecurityContext.RunAsUser + } } } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_helpers.go index 092470977..62058fdfe 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_helpers.go @@ -17,9 +17,11 @@ limitations under the License. package v1alpha2 import ( + "context" "fmt" "kubedb.dev/apimachinery/apis" + catalog "kubedb.dev/apimachinery/apis/catalog/v1alpha1" "kubedb.dev/apimachinery/apis/kubedb" "kubedb.dev/apimachinery/crds" @@ -28,10 +30,15 @@ import ( "gomodules.xyz/pointer" core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" + appslister "k8s.io/client-go/listers/apps/v1" + "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" "kmodules.xyz/client-go/apiextensions" coreutil "kmodules.xyz/client-go/core/v1" meta_util "kmodules.xyz/client-go/meta" + "kmodules.xyz/client-go/policy/secomp" appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" mona "kmodules.xyz/monitoring-agent-api/api/v1" ofst "kmodules.xyz/offshoot-api/api/v2" @@ -153,7 +160,7 @@ func (f *FerretDB) SetDefaults() { } if f.Spec.TerminationPolicy == "" { - f.Spec.TerminationPolicy = TerminationPolicyDelete + f.Spec.TerminationPolicy = TerminationPolicyWipeOut } if f.Spec.SSLMode == "" { @@ -168,6 +175,14 @@ func (f *FerretDB) SetDefaults() { f.Spec.PodTemplate = &ofst.PodTemplateSpec{} } + var frVersion catalog.FerretDBVersion + err := DefaultClient.Get(context.TODO(), types.NamespacedName{ + Name: f.Spec.Version, + }, &frVersion) + if err != nil { + klog.Errorf("can't get the FerretDB version object %s for %s \n", err.Error(), f.Spec.Version) + return + } dbContainer := coreutil.GetContainerByName(f.Spec.PodTemplate.Spec.Containers, FerretDBContainerName) if dbContainer == nil { dbContainer = &core.Container{ @@ -178,6 +193,11 @@ func (f *FerretDB) SetDefaults() { if structs.IsZero(dbContainer.Resources) { apis.SetDefaultResourceLimits(&dbContainer.Resources, DefaultResources) } + if dbContainer.SecurityContext == nil { + dbContainer.SecurityContext = &core.SecurityContext{} + } + f.setDefaultContainerSecurityContext(&frVersion, dbContainer.SecurityContext) + f.setDefaultPodTemplateSecurityContext(&frVersion, f.Spec.PodTemplate) if f.Spec.Backend.LinkedDB == "" { if f.Spec.Backend.ExternallyManaged { @@ -186,10 +206,21 @@ func (f *FerretDB) SetDefaults() { f.Spec.Backend.LinkedDB = "ferretdb" } } - if f.Spec.Monitor != nil && f.Spec.Monitor.Prometheus.Exporter.Port == 0 { - // 56790 is default port for Prometheus operator. - f.Spec.Monitor.Prometheus.Exporter.Port = 56790 + if f.Spec.AuthSecret == nil { + f.Spec.AuthSecret = &SecretReference{ + ExternallyManaged: f.Spec.Backend.ExternallyManaged, + } + } + f.Spec.Monitor.SetDefaults() + if f.Spec.Monitor != nil && f.Spec.Monitor.Prometheus != nil { + if f.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + f.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = frVersion.Spec.SecurityContext.RunAsUser + } + if f.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + f.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = frVersion.Spec.SecurityContext.RunAsUser + } } + defaultVersion := "13.13" if !f.Spec.Backend.ExternallyManaged && f.Spec.Backend.Postgres == nil { f.Spec.Backend.Postgres = &PostgresRef{ @@ -200,6 +231,41 @@ func (f *FerretDB) SetDefaults() { f.SetHealthCheckerDefaults() } +func (f *FerretDB) setDefaultPodTemplateSecurityContext(frVersion *catalog.FerretDBVersion, podTemplate *ofst.PodTemplateSpec) { + if podTemplate == nil { + return + } + if podTemplate.Spec.SecurityContext == nil { + podTemplate.Spec.SecurityContext = &core.PodSecurityContext{} + } + if podTemplate.Spec.SecurityContext.FSGroup == nil { + podTemplate.Spec.SecurityContext.FSGroup = frVersion.Spec.SecurityContext.RunAsUser + } +} + +func (f *FerretDB) setDefaultContainerSecurityContext(frVersion *catalog.FerretDBVersion, sc *core.SecurityContext) { + if sc.AllowPrivilegeEscalation == nil { + sc.AllowPrivilegeEscalation = pointer.BoolP(false) + } + if sc.Capabilities == nil { + sc.Capabilities = &core.Capabilities{ + Drop: []core.Capability{"ALL"}, + } + } + if sc.RunAsNonRoot == nil { + sc.RunAsNonRoot = pointer.BoolP(true) + } + if sc.RunAsUser == nil { + sc.RunAsUser = frVersion.Spec.SecurityContext.RunAsUser + } + if sc.RunAsGroup == nil { + sc.RunAsGroup = frVersion.Spec.SecurityContext.RunAsUser + } + if sc.SeccompProfile == nil { + sc.SeccompProfile = secomp.DefaultSeccompProfile() + } +} + func (f *FerretDB) SetTLSDefaults() { if f.Spec.TLS == nil || f.Spec.TLS.IssuerRef == nil { return @@ -288,3 +354,9 @@ func (f *FerretDB) ServiceLabels(alias ServiceAlias, extraLabels ...map[string]s func (f *FerretDB) StatsServiceLabels() map[string]string { return f.ServiceLabels(StatsServiceAlias, map[string]string{LabelRole: RoleStats}) } + +func (f *FerretDB) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + return checkReplicas(lister.StatefulSets(f.Namespace), labels.SelectorFromSet(f.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_types.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_types.go index 8999ca08a..c465967c5 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_types.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_types.go @@ -57,7 +57,8 @@ type FerretDBSpec struct { // Number of instances to deploy for a FerretDB database. Replicas *int32 `json:"replicas,omitempty"` - // Database authentication secret + // Database authentication secret. + // If authSecret is nil, authSecret.externallyManaged will set to backend.externallyManaged // +optional AuthSecret *SecretReference `json:"authSecret,omitempty"` @@ -131,7 +132,7 @@ type Backend struct { // A DB inside backend specifically made for ferretdb // +optional LinkedDB string `json:"linkedDB,omitempty"` - ExternallyManaged bool `json:"externallyManaged,omitempty"` + ExternallyManaged bool `json:"externallyManaged"` } type PostgresRef struct { @@ -143,16 +144,16 @@ type PostgresRef struct { Service *PostgresServiceRef `json:"service,omitempty"` // Which versions pg will be used as backend of ferretdb // +optional - Version *string `json:"version"` + Version *string `json:"version,omitempty"` } type PostgresServiceRef struct { - Name string `json:"name"` - Namespace string `json:"namespace"` + Name *string `json:"name"` + Namespace *string `json:"namespace"` // PgPort is used because the service referred to the // pg pod can have any port between 1 and 65535, inclusive // but targetPort is fixed to 5432 - PgPort string `json:"pgPort"` + PgPort *string `json:"pgPort"` } // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_webhook.go index bb604adde..2d8695f92 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_webhook.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/ferretdb_webhook.go @@ -122,6 +122,7 @@ func (f *FerretDB) ValidateCreateOrUpdate() field.ErrorList { } } + // Storage related if f.Spec.StorageType == "" { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("storageType"), f.Name, @@ -137,45 +138,47 @@ func (f *FerretDB) ValidateCreateOrUpdate() field.ErrorList { f.Name, `'spec.storageType' is set to Ephemeral, so 'spec.storage' needs to be empty`)) } + if !f.Spec.Backend.ExternallyManaged && f.Spec.StorageType == StorageTypeDurable && f.Spec.Storage == nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("storage"), + f.Name, + `'spec.storage' is missing for durable storage type when postgres is internally managed`)) + } + // Auth secret related if f.Spec.AuthSecret != nil && f.Spec.AuthSecret.ExternallyManaged != f.Spec.Backend.ExternallyManaged { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("authSecret"), f.Name, - `when 'spec.backend' is internally manager, 'spec.authSecret' can't be externally managed and vice versa`)) + `when 'spec.backend' is internally managed, 'spec.authSecret' can't be externally managed and vice versa`)) } - if f.Spec.AuthSecret != nil && f.Spec.AuthSecret.ExternallyManaged && f.Spec.AuthSecret.Name == "" { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("authSecret"), f.Name, - `for externallyManaged auth secret, user must configure "spec.authSecret.name"`)) + `'spec.authSecret.name' needs to specify when auth secret is externally managed`)) } + if f.Spec.StorageType == StorageTypeEphemeral && f.Spec.TerminationPolicy == TerminationPolicyHalt { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("storageType"), f.Name, `'spec.terminationPolicy: Halt' can not be used for 'Ephemeral' storage`)) } - if f.Spec.TerminationPolicy == "" { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), - f.Name, - `'spec.terminationPolicy' is missing`)) - } if f.Spec.TerminationPolicy == TerminationPolicyHalt || f.Spec.TerminationPolicy == TerminationPolicyDelete { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("terminationPolicy"), f.Name, `'spec.terminationPolicy' value 'Halt' or 'Delete' is not supported yet for FerretDB`)) } + // Backend related if f.Spec.Backend.ExternallyManaged { if f.Spec.Backend.Postgres == nil { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("backend"), f.Name, `'spec.postgres' is missing when backend is externally managed`)) } - } - if f.Spec.SSLMode == SSLModeAllowSSL || f.Spec.SSLMode == SSLModePreferSSL { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("sslMode"), - f.Name, - `'spec.sslMode' value 'allowSSL' or 'preferSSL' is not supported yet for FerretDB`)) + if f.Spec.Backend.Postgres != nil && f.Spec.Backend.Postgres.URL == nil && f.Spec.Backend.Postgres.Service == nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("backend"), + f.Name, + `Have to provide 'backend.postgres.url' or 'backend.postgres.service' when backend is externally managed`)) + } } if !f.Spec.Backend.ExternallyManaged && f.Spec.Backend.Postgres != nil && f.Spec.Backend.Postgres.Version != nil { err := f.validatePostgresVersion() @@ -186,6 +189,12 @@ func (f *FerretDB) ValidateCreateOrUpdate() field.ErrorList { } } + if f.Spec.SSLMode == SSLModeAllowSSL || f.Spec.SSLMode == SSLModePreferSSL { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("sslMode"), + f.Name, + `'spec.sslMode' value 'allowSSL' or 'preferSSL' is not supported yet for FerretDB`)) + } + return allErr } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/kafka_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/kafka_helpers.go index 17c9c4e07..73aef5e6c 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/kafka_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/kafka_helpers.go @@ -31,7 +31,9 @@ import ( "gomodules.xyz/pointer" core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + appslister "k8s.io/client-go/listers/apps/v1" "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" "kmodules.xyz/client-go/apiextensions" @@ -222,6 +224,17 @@ func (k *Kafka) ConfigSecretName(role KafkaNodeRoleType) string { return meta_util.NameWithSuffix(k.OffshootName(), "config") } +func (k *Kafka) GetPersistentSecrets() []string { + var secrets []string + if k.Spec.AuthSecret != nil { + secrets = append(secrets, k.Spec.AuthSecret.Name) + } + if k.Spec.KeystoreCredSecret != nil { + secrets = append(secrets, k.Spec.KeystoreCredSecret.Name) + } + return secrets +} + func (k *Kafka) CruiseControlConfigSecretName() string { return meta_util.NameWithSuffix(k.OffshootName(), "cruise-control-config") } @@ -307,8 +320,13 @@ func (k *Kafka) SetDefaults() { } k.Spec.Monitor.SetDefaults() - if k.Spec.Monitor != nil && k.Spec.Monitor.Prometheus != nil && k.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - k.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = kfVersion.Spec.SecurityContext.RunAsUser + if k.Spec.Monitor != nil && k.Spec.Monitor.Prometheus != nil { + if k.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + k.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = kfVersion.Spec.SecurityContext.RunAsUser + } + if k.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + k.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = kfVersion.Spec.SecurityContext.RunAsUser + } } if k.Spec.Topology != nil { @@ -442,3 +460,12 @@ func (k *Kafka) GetConnectionScheme() string { func (k *Kafka) GetCruiseControlClientID() string { return meta_util.NameWithSuffix(k.Name, "cruise-control") } + +func (k *Kafka) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + if k.Spec.Topology != nil { + expectedItems = 2 + } + return checkReplicas(lister.StatefulSets(k.Namespace), labels.SelectorFromSet(k.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mariadb_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mariadb_helpers.go index d8ddfb3e2..a5b76aa7d 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mariadb_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mariadb_helpers.go @@ -219,13 +219,19 @@ func (m *MariaDB) SetDefaults(mdVersion *v1alpha1.MariaDBVersion, topology *core m.setDefaultContainerSecurityContext(mdVersion, &m.Spec.PodTemplate) - m.Spec.Monitor.SetDefaults() m.setDefaultAffinity(&m.Spec.PodTemplate, m.OffshootSelectors(), topology) m.SetTLSDefaults() m.SetHealthCheckerDefaults() apis.SetDefaultResourceLimits(&m.Spec.PodTemplate.Spec.Resources, DefaultResources) - if m.Spec.Monitor != nil && m.Spec.Monitor.Prometheus != nil && m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = mdVersion.Spec.SecurityContext.RunAsUser + + m.Spec.Monitor.SetDefaults() + if m.Spec.Monitor != nil && m.Spec.Monitor.Prometheus != nil { + if m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = mdVersion.Spec.SecurityContext.RunAsUser + } + if m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = mdVersion.Spec.SecurityContext.RunAsUser + } } } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mysql_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mysql_helpers.go index 1c9685e00..aa9ac3c65 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mysql_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/mysql_helpers.go @@ -287,13 +287,18 @@ func (m *MySQL) SetDefaults(myVersion *v1alpha1.MySQLVersion, topology *core_uti m.setDefaultContainerSecurityContext(myVersion, &m.Spec.PodTemplate) - m.Spec.Monitor.SetDefaults() m.setDefaultAffinity(&m.Spec.PodTemplate, m.OffshootSelectors(), topology) m.SetTLSDefaults() m.SetHealthCheckerDefaults() apis.SetDefaultResourceLimits(&m.Spec.PodTemplate.Spec.Resources, DefaultResources) - if m.Spec.Monitor != nil && m.Spec.Monitor.Prometheus != nil && m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = myVersion.Spec.SecurityContext.RunAsUser + m.Spec.Monitor.SetDefaults() + if m.Spec.Monitor != nil && m.Spec.Monitor.Prometheus != nil { + if m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = myVersion.Spec.SecurityContext.RunAsUser + } + if m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + m.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = myVersion.Spec.SecurityContext.RunAsUser + } } } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/openapi_generated.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/openapi_generated.go index 19c0c8e56..82a5a0d39 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/openapi_generated.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/openapi_generated.go @@ -23006,11 +23006,13 @@ func schema_apimachinery_apis_kubedb_v1alpha2_Backend(ref common.ReferenceCallba }, "externallyManaged": { SchemaProps: spec.SchemaProps{ - Type: []string{"boolean"}, - Format: "", + Default: false, + Type: []string{"boolean"}, + Format: "", }, }, }, + Required: []string{"externallyManaged"}, }, }, Dependencies: []string{ @@ -23228,7 +23230,7 @@ func schema_apimachinery_apis_kubedb_v1alpha2_DeepStorageSpec(ref common.Referen }, }, }, - Required: []string{"type", "configSecret"}, + Required: []string{"type"}, }, }, Dependencies: []string{ @@ -23487,13 +23489,6 @@ func schema_apimachinery_apis_kubedb_v1alpha2_DruidSpec(ref common.ReferenceCall Format: "", }, }, - "replicas": { - SchemaProps: spec.SchemaProps{ - Description: "Number of instances to deploy for a Druid database", - Type: []string{"integer"}, - Format: "int32", - }, - }, "topology": { SchemaProps: spec.SchemaProps{ Description: "Druid topology for node specification", @@ -23587,7 +23582,7 @@ func schema_apimachinery_apis_kubedb_v1alpha2_DruidSpec(ref common.ReferenceCall }, }, }, - Required: []string{"version", "deepStorage", "zooKeeper"}, + Required: []string{"version", "metadataStorage", "deepStorage"}, }, }, Dependencies: []string{ @@ -24750,7 +24745,7 @@ func schema_apimachinery_apis_kubedb_v1alpha2_FerretDBSpec(ref common.ReferenceC }, "authSecret": { SchemaProps: spec.SchemaProps{ - Description: "Database authentication secret", + Description: "Database authentication secret. If authSecret is nil, authSecret.externallyManaged will set to backend.externallyManaged", Ref: ref("kubedb.dev/apimachinery/apis/kubedb/v1alpha2.SecretReference"), }, }, @@ -26068,7 +26063,6 @@ func schema_apimachinery_apis_kubedb_v1alpha2_MetadataStorage(ref common.Referen "name": { SchemaProps: spec.SchemaProps{ Description: "Name of the appbinding of metadata storage", - Default: "", Type: []string{"string"}, Format: "", }, @@ -26080,6 +26074,13 @@ func schema_apimachinery_apis_kubedb_v1alpha2_MetadataStorage(ref common.Referen Format: "", }, }, + "type": { + SchemaProps: spec.SchemaProps{ + Description: "If not KubeDB managed, then specify type of the metadata storage", + Type: []string{"string"}, + Format: "", + }, + }, "createTables": { SchemaProps: spec.SchemaProps{ Description: "If Druid has the permission to create new tables", @@ -26088,7 +26089,6 @@ func schema_apimachinery_apis_kubedb_v1alpha2_MetadataStorage(ref common.Referen }, }, }, - Required: []string{"name"}, }, }, } @@ -28338,22 +28338,19 @@ func schema_apimachinery_apis_kubedb_v1alpha2_PostgresServiceRef(ref common.Refe Properties: map[string]spec.Schema{ "name": { SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, "namespace": { SchemaProps: spec.SchemaProps{ - Default: "", - Type: []string{"string"}, - Format: "", + Type: []string{"string"}, + Format: "", }, }, "pgPort": { SchemaProps: spec.SchemaProps{ Description: "PgPort is used because the service referred to the pg pod can have any port between 1 and 65535, inclusive but targetPort is fixed to 5432", - Default: "", Type: []string{"string"}, Format: "", }, @@ -31069,7 +31066,6 @@ func schema_apimachinery_apis_kubedb_v1alpha2_ZooKeeperRef(ref common.ReferenceC "namespace": { SchemaProps: spec.SchemaProps{ Description: "Namespace of the appbinding of zookeeper", - Default: "", Type: []string{"string"}, Format: "", }, @@ -31077,13 +31073,11 @@ func schema_apimachinery_apis_kubedb_v1alpha2_ZooKeeperRef(ref common.ReferenceC "pathsBase": { SchemaProps: spec.SchemaProps{ Description: "Base ZooKeeperSpec path", - Default: "", Type: []string{"string"}, Format: "", }, }, }, - Required: []string{"name"}, }, }, } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/perconaxtradb_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/perconaxtradb_helpers.go index 8d2ab393a..1449c70cf 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/perconaxtradb_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/perconaxtradb_helpers.go @@ -231,12 +231,17 @@ func (p *PerconaXtraDB) SetDefaults(pVersion *v1alpha1.PerconaXtraDBVersion, top // Otherwise, We will get write permission denied. p.setDefaultContainerSecurityContext(pVersion, &p.Spec.PodTemplate) - p.Spec.Monitor.SetDefaults() p.setDefaultAffinity(&p.Spec.PodTemplate, p.OffshootSelectors(), topology) p.SetTLSDefaults() apis.SetDefaultResourceLimits(&p.Spec.PodTemplate.Spec.Resources, DefaultResources) - if p.Spec.Monitor != nil && p.Spec.Monitor.Prometheus != nil && p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = pVersion.Spec.SecurityContext.RunAsUser + p.Spec.Monitor.SetDefaults() + if p.Spec.Monitor != nil && p.Spec.Monitor.Prometheus != nil { + if p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = pVersion.Spec.SecurityContext.RunAsUser + } + if p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = pVersion.Spec.SecurityContext.RunAsUser + } } } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgbouncer_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgbouncer_helpers.go index 3bb1f2257..e3445716e 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgbouncer_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgbouncer_helpers.go @@ -211,8 +211,13 @@ func (p *PgBouncer) SetDefaults(pgBouncerVersion *catalog.PgBouncerVersion, uses } p.Spec.Monitor.SetDefaults() - if p.Spec.Monitor != nil && p.Spec.Monitor.Prometheus != nil && p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = pgBouncerVersion.Spec.SecurityContext.RunAsUser + if p.Spec.Monitor != nil && p.Spec.Monitor.Prometheus != nil { + if p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = pgBouncerVersion.Spec.SecurityContext.RunAsUser + } + if p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = pgBouncerVersion.Spec.SecurityContext.RunAsUser + } } apis.SetDefaultResourceLimits(&p.Spec.PodTemplate.Spec.Resources, DefaultResources) } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_helpers.go index ac26dc6e4..8a06a7955 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_helpers.go @@ -27,7 +27,9 @@ import ( "gomodules.xyz/pointer" core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + appslister "k8s.io/client-go/listers/apps/v1" "k8s.io/klog/v2" "kmodules.xyz/client-go/apiextensions" meta_util "kmodules.xyz/client-go/meta" @@ -210,3 +212,9 @@ func (p *Pgpool) GetPersistentSecrets() []string { } return secrets } + +func (p *Pgpool) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + return checkReplicas(lister.StatefulSets(p.Namespace), labels.SelectorFromSet(p.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_webhook.go index dd997172d..73c6390b8 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_webhook.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/pgpool_webhook.go @@ -126,9 +126,9 @@ func (p *Pgpool) ValidateCreateOrUpdate() field.ErrorList { "`spec.replica` must be greater than 0", )) } - if *p.Spec.Replicas > 3 { + if *p.Spec.Replicas > 9 { errorList = append(errorList, field.Required(field.NewPath("spec").Child("replicas"), - "`spec.replica` must be less than 4", + "`spec.replica` must be less than 10", )) } } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/postgres_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/postgres_helpers.go index 5f0aab2b4..c912c7f5b 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/postgres_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/postgres_helpers.go @@ -262,13 +262,19 @@ func (p *Postgres) SetDefaults(postgresVersion *catalog.PostgresVersion, topolog // Otherwise, We will get write permission denied. p.Spec.PodTemplate.Spec.SecurityContext.FSGroup = p.Spec.PodTemplate.Spec.ContainerSecurityContext.RunAsGroup p.SetArbiterDefault() - p.Spec.Monitor.SetDefaults() p.SetTLSDefaults() p.SetHealthCheckerDefaults() apis.SetDefaultResourceLimits(&p.Spec.PodTemplate.Spec.Resources, DefaultResources) p.setDefaultAffinity(&p.Spec.PodTemplate, p.OffshootSelectors(), topology) - if p.Spec.Monitor != nil && p.Spec.Monitor.Prometheus != nil && p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = postgresVersion.Spec.SecurityContext.RunAsUser + + p.Spec.Monitor.SetDefaults() + if p.Spec.Monitor != nil && p.Spec.Monitor.Prometheus != nil { + if p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = postgresVersion.Spec.SecurityContext.RunAsUser + } + if p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + p.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = postgresVersion.Spec.SecurityContext.RunAsUser + } } } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_helpers.go index c5056414c..1fe0dd389 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_helpers.go @@ -17,21 +17,32 @@ limitations under the License. package v1alpha2 import ( + "context" "fmt" "path/filepath" "strings" + "kubedb.dev/apimachinery/apis" + catalog "kubedb.dev/apimachinery/apis/catalog/v1alpha1" "kubedb.dev/apimachinery/apis/kubedb" "kubedb.dev/apimachinery/crds" promapi "github.com/prometheus-operator/prometheus-operator/pkg/apis/monitoring/v1" "gomodules.xyz/pointer" + core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + "k8s.io/apimachinery/pkg/types" + appslister "k8s.io/client-go/listers/apps/v1" + "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" "kmodules.xyz/client-go/apiextensions" + coreutil "kmodules.xyz/client-go/core/v1" meta_util "kmodules.xyz/client-go/meta" + "kmodules.xyz/client-go/policy/secomp" appcat "kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1" mona "kmodules.xyz/monitoring-agent-api/api/v1" + ofst "kmodules.xyz/offshoot-api/api/v2" ) func (r *RabbitMQ) CustomResourceDefinition() *apiextensions.CustomResourceDefinition { @@ -62,6 +73,20 @@ func (r *RabbitMQ) GetConnectionScheme() string { return scheme } +func (r *RabbitMQ) GetAuthSecretName() string { + if r.Spec.AuthSecret != nil && r.Spec.AuthSecret.Name != "" { + return r.Spec.AuthSecret.Name + } + return r.DefaultUserCredSecretName("admin") +} + +func (r *RabbitMQ) GetPersistentSecrets() []string { + var secrets []string + secrets = append(secrets, r.GetAuthSecretName()) + secrets = append(secrets, r.DefaultErlangCookieSecretName()) + return secrets +} + func (r *RabbitMQ) ResourceShortCode() string { return ResourceCodeRabbitmq } @@ -130,6 +155,10 @@ func (r *RabbitMQ) ServiceLabels(alias ServiceAlias, extraLabels ...map[string]s return r.offshootLabels(meta_util.OverwriteKeys(r.OffshootSelectors(), extraLabels...), svcTemplate.Labels) } +func (r *RabbitMQ) Finalizer() string { + return fmt.Sprintf("%s/%s", kubedb.GroupName, apis.Finalizer) +} + type RabbitmqStatsService struct { *RabbitMQ } @@ -245,19 +274,11 @@ func (r *RabbitMQ) PVCName(alias string) string { return meta_util.NameWithSuffix(r.Name, alias) } -func (r *RabbitMQ) SetHealthCheckerDefaults() { - if r.Spec.HealthChecker.PeriodSeconds == nil { - r.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10) - } - if r.Spec.HealthChecker.TimeoutSeconds == nil { - r.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10) - } - if r.Spec.HealthChecker.FailureThreshold == nil { - r.Spec.HealthChecker.FailureThreshold = pointer.Int32P(3) +func (r *RabbitMQ) SetDefaults() { + if r.Spec.Replicas == nil { + r.Spec.Replicas = pointer.Int32P(1) } -} -func (r *RabbitMQ) SetDefaults() { if r.Spec.TerminationPolicy == "" { r.Spec.TerminationPolicy = TerminationPolicyDelete } @@ -266,9 +287,95 @@ func (r *RabbitMQ) SetDefaults() { r.Spec.StorageType = StorageTypeDurable } + var rmVersion catalog.RabbitMQVersion + err := DefaultClient.Get(context.TODO(), types.NamespacedName{ + Name: r.Spec.Version, + }, &rmVersion) + if err != nil { + klog.Errorf("can't get the rabbitmq version object %s for %s \n", err.Error(), r.Spec.Version) + return + } + + r.setDefaultContainerSecurityContext(&rmVersion, &r.Spec.PodTemplate) r.SetHealthCheckerDefaults() } +func (r *RabbitMQ) setDefaultContainerSecurityContext(rmVersion *catalog.RabbitMQVersion, podTemplate *ofst.PodTemplateSpec) { + if podTemplate == nil { + return + } + if podTemplate.Spec.SecurityContext == nil { + podTemplate.Spec.SecurityContext = &core.PodSecurityContext{} + } + if podTemplate.Spec.SecurityContext.FSGroup == nil { + podTemplate.Spec.SecurityContext.FSGroup = rmVersion.Spec.SecurityContext.RunAsUser + } + + container := coreutil.GetContainerByName(podTemplate.Spec.Containers, RabbitMQContainerName) + if container == nil { + container = &core.Container{ + Name: RabbitMQContainerName, + } + podTemplate.Spec.Containers = append(podTemplate.Spec.Containers, *container) + } + if container.SecurityContext == nil { + container.SecurityContext = &core.SecurityContext{} + } + r.assignDefaultContainerSecurityContext(rmVersion, container.SecurityContext) + + initContainer := coreutil.GetContainerByName(podTemplate.Spec.InitContainers, RabbitMQInitContainerName) + if initContainer == nil { + initContainer = &core.Container{ + Name: RabbitMQInitContainerName, + } + podTemplate.Spec.InitContainers = append(podTemplate.Spec.InitContainers, *initContainer) + } + if initContainer.SecurityContext == nil { + initContainer.SecurityContext = &core.SecurityContext{} + } + r.assignDefaultInitContainerSecurityContext(rmVersion, initContainer.SecurityContext) +} + +func (r *RabbitMQ) assignDefaultInitContainerSecurityContext(rmVersion *catalog.RabbitMQVersion, rc *core.SecurityContext) { + if rc.AllowPrivilegeEscalation == nil { + rc.AllowPrivilegeEscalation = pointer.BoolP(false) + } + if rc.Capabilities == nil { + rc.Capabilities = &core.Capabilities{ + Drop: []core.Capability{"ALL"}, + } + } + if rc.RunAsNonRoot == nil { + rc.RunAsNonRoot = pointer.BoolP(true) + } + if rc.RunAsUser == nil { + rc.RunAsUser = rmVersion.Spec.SecurityContext.RunAsUser + } + if rc.SeccompProfile == nil { + rc.SeccompProfile = secomp.DefaultSeccompProfile() + } +} + +func (r *RabbitMQ) assignDefaultContainerSecurityContext(rmVersion *catalog.RabbitMQVersion, rc *core.SecurityContext) { + if rc.AllowPrivilegeEscalation == nil { + rc.AllowPrivilegeEscalation = pointer.BoolP(false) + } + if rc.Capabilities == nil { + rc.Capabilities = &core.Capabilities{ + Drop: []core.Capability{"ALL"}, + } + } + if rc.RunAsNonRoot == nil { + rc.RunAsNonRoot = pointer.BoolP(true) + } + if rc.RunAsUser == nil { + rc.RunAsUser = rmVersion.Spec.SecurityContext.RunAsUser + } + if rc.SeccompProfile == nil { + rc.SeccompProfile = secomp.DefaultSeccompProfile() + } +} + func (r *RabbitMQ) SetTLSDefaults() { if r.Spec.TLS == nil || r.Spec.TLS.IssuerRef == nil { return @@ -276,3 +383,21 @@ func (r *RabbitMQ) SetTLSDefaults() { r.Spec.TLS.Certificates = kmapi.SetMissingSecretNameForCertificate(r.Spec.TLS.Certificates, string(RabbitmqServerCert), r.CertificateName(RabbitmqServerCert)) r.Spec.TLS.Certificates = kmapi.SetMissingSecretNameForCertificate(r.Spec.TLS.Certificates, string(RabbitmqClientCert), r.CertificateName(RabbitmqClientCert)) } + +func (r *RabbitMQ) SetHealthCheckerDefaults() { + if r.Spec.HealthChecker.PeriodSeconds == nil { + r.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10) + } + if r.Spec.HealthChecker.TimeoutSeconds == nil { + r.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10) + } + if r.Spec.HealthChecker.FailureThreshold == nil { + r.Spec.HealthChecker.FailureThreshold = pointer.Int32P(3) + } +} + +func (r *RabbitMQ) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + return checkReplicas(lister.StatefulSets(r.Namespace), labels.SelectorFromSet(r.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_webhook.go index 171dc86fb..698b89242 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_webhook.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/rabbitmq_webhook.go @@ -102,14 +102,20 @@ func (r *RabbitMQ) ValidateCreateOrUpdate() error { "number of replicas can not be 0 or less")) } - err := r.ValidateVersion(r) - if err != nil { + if r.Spec.Version == "" { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("version"), r.Name, - err.Error())) + "spec.version' is missing")) + } else { + err := r.ValidateVersion(r) + if err != nil { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("version"), + r.Name, + err.Error())) + } } - err = r.validateVolumes(r) + err := r.validateVolumes(r) if err != nil { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("podTemplate").Child("spec").Child("volumes"), r.Name, @@ -135,6 +141,12 @@ func (r *RabbitMQ) ValidateCreateOrUpdate() error { } } + if r.Spec.ConfigSecret != nil && r.Spec.ConfigSecret.Name == "" { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("configSecret").Child("name"), + r.Name, + "ConfigSecret Name can not be empty")) + } + if len(allErr) == 0 { return nil } diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_helpers.go index ebe5048e4..89f5064f1 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_helpers.go @@ -241,8 +241,13 @@ func (r *Redis) SetDefaults(rdVersion *catalog.RedisVersion, topology *core_util r.setDefaultAffinity(&r.Spec.PodTemplate, labels, topology) r.Spec.Monitor.SetDefaults() - if r.Spec.Monitor != nil && r.Spec.Monitor.Prometheus != nil && r.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - r.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = rdVersion.Spec.SecurityContext.RunAsUser + if r.Spec.Monitor != nil && r.Spec.Monitor.Prometheus != nil { + if r.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + r.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = rdVersion.Spec.SecurityContext.RunAsUser + } + if r.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + r.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = rdVersion.Spec.SecurityContext.RunAsUser + } } r.SetTLSDefaults() r.SetHealthCheckerDefaults() diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_sentinel_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_sentinel_helpers.go index 824617273..1b01eebec 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_sentinel_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/redis_sentinel_helpers.go @@ -199,8 +199,13 @@ func (rs *RedisSentinel) SetDefaults(rdVersion *catalog.RedisVersion, topology * rs.setDefaultAffinity(&rs.Spec.PodTemplate, rs.OffshootSelectors(), topology) rs.Spec.Monitor.SetDefaults() - if rs.Spec.Monitor != nil && rs.Spec.Monitor.Prometheus != nil && rs.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { - rs.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = rdVersion.Spec.SecurityContext.RunAsUser + if rs.Spec.Monitor != nil && rs.Spec.Monitor.Prometheus != nil { + if rs.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser == nil { + rs.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsUser = rdVersion.Spec.SecurityContext.RunAsUser + } + if rs.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup == nil { + rs.Spec.Monitor.Prometheus.Exporter.SecurityContext.RunAsGroup = rdVersion.Spec.SecurityContext.RunAsUser + } } rs.SetTLSDefaults() rs.SetHealthCheckerDefaults() diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/singlestore_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/singlestore_helpers.go index 91a30c071..9d41bb822 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/singlestore_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/singlestore_helpers.go @@ -28,7 +28,9 @@ import ( "gomodules.xyz/pointer" core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + appslister "k8s.io/client-go/listers/apps/v1" "k8s.io/klog/v2" kmapi "kmodules.xyz/client-go/api/v1" "kmodules.xyz/client-go/apiextensions" @@ -381,3 +383,12 @@ func (s *Singlestore) SetTLSDefaults() { func (s *Singlestore) CertificateName(alias SinglestoreCertificateAlias) string { return metautil.NameWithSuffix(s.Name, fmt.Sprintf("%s-cert", string(alias))) } + +func (s *Singlestore) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + if s.Spec.Topology != nil { + expectedItems = 2 + } + return checkReplicas(lister.StatefulSets(s.Namespace), labels.SelectorFromSet(s.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_helpers.go index b46894760..1b54b0bce 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_helpers.go @@ -28,6 +28,8 @@ import ( "gomodules.xyz/pointer" v1 "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" + appslister "k8s.io/client-go/listers/apps/v1" "kmodules.xyz/client-go/apiextensions" coreutil "kmodules.xyz/client-go/core/v1" meta_util "kmodules.xyz/client-go/meta" @@ -346,3 +348,12 @@ func (s *Solr) GetPersistentSecrets() []string { return secrets } + +func (s *Solr) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + if s.Spec.Topology != nil { + expectedItems = 3 + } + return checkReplicas(lister.StatefulSets(s.Namespace), labels.SelectorFromSet(s.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_webhook.go index 59187e616..888528eaa 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_webhook.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/solr_webhook.go @@ -158,6 +158,11 @@ func (s *Solr) ValidateCreateOrUpdate() field.ErrorList { } if s.Spec.Topology == nil { + if s.Spec.Replicas != nil && *s.Spec.Replicas <= 0 { + allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("replicas"), + s.Name, + "number of replicas can not be less be 0 or less")) + } err := solrValidateVolumes(&s.Spec.PodTemplate) if err != nil { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("podTemplate").Child("spec").Child("volumes"), @@ -176,11 +181,6 @@ func (s *Solr) ValidateCreateOrUpdate() field.ErrorList { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("topology").Child("data"), s.Name, ".spec.topology.data can't be empty in cluster mode")) - if s.Spec.Replicas != nil && *s.Spec.Replicas <= 0 { - allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("replicas"), - s.Name, - "number of replicas can not be less be 0 or less")) - } } if s.Spec.Topology.Data.Replicas != nil && *s.Spec.Topology.Data.Replicas <= 0 { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("topology").Child("data").Child("replicas"), diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_helpers.go index edee47920..c0fdaddc6 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_helpers.go @@ -28,7 +28,9 @@ import ( "gomodules.xyz/pointer" core "k8s.io/api/core/v1" meta "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/apimachinery/pkg/labels" "k8s.io/apimachinery/pkg/types" + appslister "k8s.io/client-go/listers/apps/v1" "k8s.io/klog/v2" "kmodules.xyz/client-go/apiextensions" meta_util "kmodules.xyz/client-go/meta" @@ -171,7 +173,7 @@ func (z *ZooKeeper) SetDefaults() { apis.SetDefaultResourceLimits(&z.Spec.PodTemplate.Spec.Resources, DefaultResources) if z.Spec.Replicas == nil { - z.Spec.Replicas = pointer.Int32P(3) + z.Spec.Replicas = pointer.Int32P(1) } if z.Spec.Halted { @@ -256,3 +258,9 @@ func (z *ZooKeeper) GetConnectionScheme() string { //} return scheme } + +func (z *ZooKeeper) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, string, error) { + // Desire number of statefulSets + expectedItems := 1 + return checkReplicas(lister.StatefulSets(z.Namespace), labels.SelectorFromSet(z.OffshootLabels()), expectedItems) +} diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_webhook.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_webhook.go index 2dfb3bef4..ad23533a4 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_webhook.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zookeeper_webhook.go @@ -87,11 +87,10 @@ func (z *ZooKeeper) ValidateDelete() (admission.Warnings, error) { func (z *ZooKeeper) ValidateCreateOrUpdate() (admission.Warnings, error) { var allErr field.ErrorList - // number of replicas can not be less than 3 - if z.Spec.Replicas != nil && *z.Spec.Replicas < 3 { + if z.Spec.Replicas != nil && *z.Spec.Replicas == 2 { allErr = append(allErr, field.Invalid(field.NewPath("spec").Child("replicas"), z.Name, - "number of replicas can not be less than 3")) + "zookeeper ensemble should have 3 or more replicas")) } err := z.validateVersion() diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zz_generated.deepcopy.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zz_generated.deepcopy.go index 10b494ef2..c8ea9ca1c 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zz_generated.deepcopy.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/zz_generated.deepcopy.go @@ -516,11 +516,6 @@ func (in *DruidNode) DeepCopy() *DruidNode { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *DruidSpec) DeepCopyInto(out *DruidSpec) { *out = *in - if in.Replicas != nil { - in, out := &in.Replicas, &out.Replicas - *out = new(int32) - **out = **in - } if in.Topology != nil { in, out := &in.Topology, &out.Topology *out = new(DruidClusterTopology) @@ -2003,6 +1998,21 @@ func (in *MemcachedStatus) DeepCopy() *MemcachedStatus { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *MetadataStorage) DeepCopyInto(out *MetadataStorage) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.Type != nil { + in, out := &in.Type, &out.Type + *out = new(string) + **out = **in + } if in.CreateTables != nil { in, out := &in.CreateTables, &out.CreateTables *out = new(bool) @@ -3294,7 +3304,7 @@ func (in *PostgresRef) DeepCopyInto(out *PostgresRef) { if in.Service != nil { in, out := &in.Service, &out.Service *out = new(PostgresServiceRef) - **out = **in + (*in).DeepCopyInto(*out) } if in.Version != nil { in, out := &in.Version, &out.Version @@ -3317,6 +3327,21 @@ func (in *PostgresRef) DeepCopy() *PostgresRef { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *PostgresServiceRef) DeepCopyInto(out *PostgresServiceRef) { *out = *in + if in.Name != nil { + in, out := &in.Name, &out.Name + *out = new(string) + **out = **in + } + if in.Namespace != nil { + in, out := &in.Namespace, &out.Namespace + *out = new(string) + **out = **in + } + if in.PgPort != nil { + in, out := &in.PgPort, &out.PgPort + *out = new(string) + **out = **in + } return } diff --git a/vendor/kubedb.dev/apimachinery/crds/catalog.kubedb.com_ferretdbversions.yaml b/vendor/kubedb.dev/apimachinery/crds/catalog.kubedb.com_ferretdbversions.yaml index 4133d915b..1829cbf9e 100644 --- a/vendor/kubedb.dev/apimachinery/crds/catalog.kubedb.com_ferretdbversions.yaml +++ b/vendor/kubedb.dev/apimachinery/crds/catalog.kubedb.com_ferretdbversions.yaml @@ -16,7 +16,7 @@ spec: listKind: FerretDBVersionList plural: ferretdbversions shortNames: - - drversion + - frversion singular: ferretdbversion scope: Cluster versions: diff --git a/vendor/kubedb.dev/apimachinery/crds/kubedb.com_druids.yaml b/vendor/kubedb.dev/apimachinery/crds/kubedb.com_druids.yaml index 2e21aac84..3025980e0 100644 --- a/vendor/kubedb.dev/apimachinery/crds/kubedb.com_druids.yaml +++ b/vendor/kubedb.dev/apimachinery/crds/kubedb.com_druids.yaml @@ -64,7 +64,6 @@ spec: type: type: string required: - - configSecret - type type: object disableSecurity: @@ -100,8 +99,8 @@ spec: type: string namespace: type: string - required: - - name + type: + type: string type: object podTemplate: properties: @@ -3456,9 +3455,6 @@ spec: type: array type: object type: object - replicas: - format: int32 - type: integer serviceTemplates: items: properties: @@ -24361,13 +24357,11 @@ spec: type: string pathsBase: type: string - required: - - name type: object required: - deepStorage + - metadataStorage - version - - zooKeeper type: object status: properties: diff --git a/vendor/kubedb.dev/apimachinery/crds/kubedb.com_ferretdbs.yaml b/vendor/kubedb.dev/apimachinery/crds/kubedb.com_ferretdbs.yaml index 32bdd89fe..641358b03 100644 --- a/vendor/kubedb.dev/apimachinery/crds/kubedb.com_ferretdbs.yaml +++ b/vendor/kubedb.dev/apimachinery/crds/kubedb.com_ferretdbs.yaml @@ -75,6 +75,8 @@ spec: version: type: string type: object + required: + - externallyManaged type: object halted: type: boolean diff --git a/vendor/kubestash.dev/apimachinery/apis/storage/v1alpha1/snapshot_types.go b/vendor/kubestash.dev/apimachinery/apis/storage/v1alpha1/snapshot_types.go index 9e66f3487..f882f05a0 100644 --- a/vendor/kubestash.dev/apimachinery/apis/storage/v1alpha1/snapshot_types.go +++ b/vendor/kubestash.dev/apimachinery/apis/storage/v1alpha1/snapshot_types.go @@ -43,7 +43,6 @@ const ( // +kubebuilder:printcolumn:name="Snapshot-Time",type="string",JSONPath=".status.snapshotTime" // +kubebuilder:printcolumn:name="Deletion-Policy",type="string",JSONPath=".spec.deletionPolicy" // +kubebuilder:printcolumn:name="Phase",type="string",JSONPath=".status.phase" -// +kubebuilder:printcolumn:name="Verification-Status",type="string",JSONPath=".status.verificationStatus" // +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp" // Snapshot represents the state of a backup run to a particular Repository. diff --git a/vendor/kubestash.dev/apimachinery/crds/storage.kubestash.com_snapshots.yaml b/vendor/kubestash.dev/apimachinery/crds/storage.kubestash.com_snapshots.yaml index f819e587f..40904c1ff 100644 --- a/vendor/kubestash.dev/apimachinery/crds/storage.kubestash.com_snapshots.yaml +++ b/vendor/kubestash.dev/apimachinery/crds/storage.kubestash.com_snapshots.yaml @@ -33,9 +33,6 @@ spec: - jsonPath: .status.phase name: Phase type: string - - jsonPath: .status.verificationStatus - name: Verification-Status - type: string - jsonPath: .metadata.creationTimestamp name: Age type: date diff --git a/vendor/modules.txt b/vendor/modules.txt index ecdcb9c4f..25df425c4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -700,7 +700,7 @@ github.com/go-openapi/jsonreference/internal # github.com/go-openapi/swag v0.22.4 ## explicit; go 1.18 github.com/go-openapi/swag -# github.com/go-sql-driver/mysql v1.7.0 +# github.com/go-sql-driver/mysql v1.7.1 ## explicit; go 1.13 github.com/go-sql-driver/mysql # github.com/gogo/protobuf v1.3.2 @@ -1447,7 +1447,7 @@ kmodules.xyz/client-go/meta kmodules.xyz/client-go/policy/secomp kmodules.xyz/client-go/tools/exec kmodules.xyz/client-go/tools/portforward -# kmodules.xyz/custom-resources v0.29.0 +# kmodules.xyz/custom-resources v0.29.1 ## explicit; go 1.21.5 kmodules.xyz/custom-resources/apis/appcatalog kmodules.xyz/custom-resources/apis/appcatalog/v1alpha1 @@ -1481,7 +1481,7 @@ kmodules.xyz/prober/api/v1 kmodules.xyz/resource-metadata/apis/node kmodules.xyz/resource-metadata/apis/node/v1alpha1 kmodules.xyz/resource-metadata/crds -# kubedb.dev/apimachinery v0.41.0-beta.1 +# kubedb.dev/apimachinery v0.41.0-rc.0 ## explicit; go 1.21.5 kubedb.dev/apimachinery/apis kubedb.dev/apimachinery/apis/archiver/v1alpha1 @@ -1523,7 +1523,7 @@ kubedb.dev/apimachinery/crds kubedb.dev/apimachinery/pkg/double_optin kubedb.dev/apimachinery/pkg/factory kubedb.dev/apimachinery/pkg/validator -# kubedb.dev/db-client-go v0.0.9-0.20240119051334-7f4d5847462a +# kubedb.dev/db-client-go v0.0.9 ## explicit; go 1.21.5 kubedb.dev/db-client-go/elasticsearch kubedb.dev/db-client-go/redis @@ -1531,7 +1531,7 @@ kubedb.dev/db-client-go/redis ## explicit; go 1.21.5 kubeops.dev/sidekick/apis/apps kubeops.dev/sidekick/apis/apps/v1alpha1 -# kubestash.dev/apimachinery v0.4.0-rc.0 +# kubestash.dev/apimachinery v0.4.0-rc.1 ## explicit; go 1.21.5 kubestash.dev/apimachinery/apis kubestash.dev/apimachinery/apis/core/v1alpha1