Skip to content

Commit

Permalink
Prepare for release v0.41.0-rc.0
Browse files Browse the repository at this point in the history
ProductLine: KubeDB

Release: v2024.1.26-rc.0

Release-tracker: kubedb/CHANGELOG#82
Signed-off-by: 1gtm <[email protected]>
  • Loading branch information
1gtm committed Jan 27, 2024
1 parent d188eae commit 2c5898a
Show file tree
Hide file tree
Showing 53 changed files with 994 additions and 237 deletions.
10 changes: 5 additions & 5 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down
20 changes: 10 additions & 10 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -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=
Expand Down Expand Up @@ -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=
Expand All @@ -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=
Expand Down
2 changes: 2 additions & 0 deletions vendor/github.com/go-sql-driver/mysql/AUTHORS

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions vendor/github.com/go-sql-driver/mysql/CHANGELOG.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/go-sql-driver/mysql/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions vendor/github.com/go-sql-driver/mysql/connection.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/go-sql-driver/mysql/const.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion vendor/github.com/go-sql-driver/mysql/errors.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand All @@ -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
}
Expand All @@ -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")
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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&...&paramN=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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&GaleraArbitratorConfiguration{},
&MongoDBConfiguration{},
&SinglestoreConfiguration{},
)

scheme.AddKnownTypes(SchemeGroupVersion,
Expand Down
Loading

0 comments on commit 2c5898a

Please sign in to comment.