diff --git a/go.mod b/go.mod index 3a3648cf8..04a36c857 100644 --- a/go.mod +++ b/go.mod @@ -13,6 +13,7 @@ require ( github.com/elastic/go-elasticsearch/v6 v6.8.10 github.com/elastic/go-elasticsearch/v7 v7.15.1 github.com/elastic/go-elasticsearch/v8 v8.4.0 + github.com/go-logr/logr v1.4.2 github.com/go-resty/resty/v2 v2.11.0 github.com/go-sql-driver/mysql v1.8.1 github.com/grafadruid/go-druid v0.0.6 @@ -31,7 +32,7 @@ require ( k8s.io/klog/v2 v2.130.1 kmodules.xyz/client-go v0.30.9 kmodules.xyz/custom-resources v0.30.0 - kubedb.dev/apimachinery v0.47.0-rc.1 + kubedb.dev/apimachinery v0.47.0-rc.1.0.20240717082707-f8438b7e77c7 sigs.k8s.io/controller-runtime v0.18.4 xorm.io/xorm v1.3.6 ) @@ -57,7 +58,6 @@ require ( github.com/fsnotify/fsnotify v1.7.0 // indirect github.com/go-faster/city v1.0.1 // indirect github.com/go-faster/errors v0.7.1 // indirect - github.com/go-logr/logr v1.4.2 // indirect github.com/go-openapi/jsonpointer v0.21.0 // indirect github.com/go-openapi/jsonreference v0.21.0 // indirect github.com/go-openapi/swag v0.23.0 // indirect @@ -117,13 +117,13 @@ require ( github.com/zeebo/xxh3 v1.0.2 // indirect go.opentelemetry.io/otel v1.26.0 // indirect go.opentelemetry.io/otel/trace v1.26.0 // indirect - golang.org/x/crypto v0.24.0 // indirect + golang.org/x/crypto v0.25.0 // indirect golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 // indirect - golang.org/x/net v0.26.0 // indirect + golang.org/x/net v0.27.0 // indirect golang.org/x/oauth2 v0.21.0 // indirect golang.org/x/sync v0.7.0 // indirect - golang.org/x/sys v0.21.0 // indirect - golang.org/x/term v0.21.0 // indirect + golang.org/x/sys v0.22.0 // indirect + golang.org/x/term v0.22.0 // indirect golang.org/x/text v0.16.0 // indirect golang.org/x/time v0.5.0 // indirect gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect diff --git a/go.sum b/go.sum index 7cec898dc..d9cef16a3 100644 --- a/go.sum +++ b/go.sum @@ -542,8 +542,8 @@ golang.org/x/crypto v0.11.0/go.mod h1:xgJhtzW8F9jGdVFWZESrid1U1bjeNy4zgy5cRr/CIi golang.org/x/crypto v0.12.0/go.mod h1:NF0Gs7EO5K4qLn+Ylc+fih8BSTeIjAP05siRnAh98yw= golang.org/x/crypto v0.13.0/go.mod h1:y6Z2r+Rw4iayiXXAIxJIDAJ1zMW4yaTpebo8fPOliYc= golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4= -golang.org/x/crypto v0.24.0 h1:mnl8DM0o513X8fdIkmyFE/5hTYxbwYOjDS/+rK6qpRI= -golang.org/x/crypto v0.24.0/go.mod h1:Z1PMYSOR5nyMcyAVAIQSKCDwalqy85Aqn1x3Ws4L5DM= +golang.org/x/crypto v0.25.0 h1:ypSNr+bnYL2YhwoMt2zPxHFmbAN1KZs/njMG3hxUp30= +golang.org/x/crypto v0.25.0/go.mod h1:T+wALwcMOSE0kXgUAnPAHqTLW+XHgcELELW8VaDgm/M= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 h1:vr/HnozRka3pE4EsMEg1lgkXJkTFJCVUX+S/ZT6wYzM= golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842/go.mod h1:XtvwrStGgqGPLc4cjQfWqZHG1YFdYs6swckp8vpsjnc= golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= @@ -593,8 +593,8 @@ golang.org/x/net v0.14.0/go.mod h1:PpSgVXXLK0OxS0F31C1/tv6XNguvCrnXIDrFMspZIUI= golang.org/x/net v0.15.0/go.mod h1:idbUs1IY1+zTqbi8yxTbhexhEEk5ur9LInksu6HrEpk= golang.org/x/net v0.16.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE= -golang.org/x/net v0.26.0 h1:soB7SVo0PWrY4vPW/+ay0jKDNScG2X9wFeYlXIvJsOQ= -golang.org/x/net v0.26.0/go.mod h1:5YKkiSynbBIh3p6iOc/vibscux0x38BZDkn8sCUPxHE= +golang.org/x/net v0.27.0 h1:5K3Njcw06/l2y9vpGCSdcxWOYHOUk3dVNGDXN+FvAys= +golang.org/x/net v0.27.0/go.mod h1:dDi0PyhWNoiUOrAS8uXv/vnScO4wnHQO4mj9fn/RytE= golang.org/x/oauth2 v0.21.0 h1:tsimM75w1tF/uws5rbeHzIWxEqElMehnc+iW793zsZs= golang.org/x/oauth2 v0.21.0/go.mod h1:XYTD2NtWslqkgxebSiOHnXEap4TF09sJSc7H1sXbhtI= golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -651,8 +651,8 @@ golang.org/x/sys v0.11.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.14.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= -golang.org/x/sys v0.21.0 h1:rF+pYz3DAGSQAxAu1CbC7catZg4ebC4UIeIhKxBZvws= -golang.org/x/sys v0.21.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.22.0 h1:RI27ohtqKCnwULzJLqkv897zojh5/DwS/ENaMzUOaWI= +golang.org/x/sys v0.22.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= @@ -667,8 +667,8 @@ golang.org/x/term v0.10.0/go.mod h1:lpqdcUyK/oCiQxvxVrppt5ggO2KCZ5QblwqPnfZ6d5o= golang.org/x/term v0.11.0/go.mod h1:zC9APTIj3jG3FdV/Ons+XE1riIZXG4aZ4GTHiPZJPIU= golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU= golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U= -golang.org/x/term v0.21.0 h1:WVXCp+/EBEHOj53Rvu+7KiT/iElMrO8ACK16SMZ3jaA= -golang.org/x/term v0.21.0/go.mod h1:ooXLefLobQVslOqselCNF4SxFAaoS6KujMbsGzSDmX0= +golang.org/x/term v0.22.0 h1:BbsgPEJULsl2fV/AT3v15Mjva5yXKQDyKf+TbDz7QJk= +golang.org/x/term v0.22.0/go.mod h1:F3qCibpT5AMpCRfhfT53vVJwhLtIVHhB9XDjfFvnMI4= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= @@ -793,8 +793,8 @@ kmodules.xyz/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9 kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI= kmodules.xyz/offshoot-api v0.30.0 h1:dq9F93pu4Q8rL9oTcCk+vGGy8vpS7RNt0GSwx7Bvhec= kmodules.xyz/offshoot-api v0.30.0/go.mod h1:o9VoA3ImZMDBp3lpLb8+kc2d/KBxioRwCpaKDfLIyDw= -kubedb.dev/apimachinery v0.47.0-rc.1 h1:5DXoahPbJ1n1Fowa+lv3xobTWRLzDDKGhJaNiWjV/tk= -kubedb.dev/apimachinery v0.47.0-rc.1/go.mod h1:AUV5sXVwo77ctiYyrFWsSrhkuvy5fru5baiX7xF6LBA= +kubedb.dev/apimachinery v0.47.0-rc.1.0.20240717082707-f8438b7e77c7 h1:HqdKBHKbi5fhHRHstoDggFXpX6v7r+2P8/XevDdHjeg= +kubedb.dev/apimachinery v0.47.0-rc.1.0.20240717082707-f8438b7e77c7/go.mod h1:Gs/kwdVYmGjJmYmvCUNDmNbbprXqi/gbSj/JrsoM9sE= kubeops.dev/petset v0.0.6 h1:0IbvxD9fadZfH+3iMZWzN6ZHsO0vX458JlioamwyPKQ= kubeops.dev/petset v0.0.6/go.mod h1:A15vh0r979NsvL65DTIZKWsa/NoX9VapHBAEw1ZsdYI= lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk= diff --git a/kafka/client.go b/kafka/client.go index 216f20cdb..c7630b7d9 100644 --- a/kafka/client.go +++ b/kafka/client.go @@ -17,9 +17,10 @@ limitations under the License. package kafka import ( - "fmt" "time" + "fmt" + kafkago "github.com/IBM/sarama" "k8s.io/klog/v2" ) diff --git a/kafka/connect/kubedb_client_builder.go b/kafka/connect/kubedb_client_builder.go index be8b7a268..59e3d08d4 100644 --- a/kafka/connect/kubedb_client_builder.go +++ b/kafka/connect/kubedb_client_builder.go @@ -21,11 +21,12 @@ import ( "crypto/tls" "crypto/x509" "errors" - "fmt" "net" "net/http" "time" + "fmt" + "github.com/go-resty/resty/v2" core "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/types" diff --git a/mssqlserver/kubedb_client_builder.go b/mssqlserver/kubedb_client_builder.go index b1bed02c5..d26e81385 100644 --- a/mssqlserver/kubedb_client_builder.go +++ b/mssqlserver/kubedb_client_builder.go @@ -18,6 +18,7 @@ package mssql import ( "context" + "fmt" _ "github.com/microsoft/go-mssqldb" diff --git a/pgpool/kubedb_client_builder.go b/pgpool/kubedb_client_builder.go index f0cd15d37..4867cba44 100644 --- a/pgpool/kubedb_client_builder.go +++ b/pgpool/kubedb_client_builder.go @@ -18,6 +18,7 @@ package pgpool import ( "context" + "fmt" olddbapi "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" diff --git a/rabbitmq/kubedb_client_builder.go b/rabbitmq/kubedb_client_builder.go index c54157b88..a71863066 100644 --- a/rabbitmq/kubedb_client_builder.go +++ b/rabbitmq/kubedb_client_builder.go @@ -19,6 +19,7 @@ package rabbitmq import ( "context" "errors" + "fmt" "strings" diff --git a/singlestore/kubedb_client_builder.go b/singlestore/kubedb_client_builder.go index 289935d68..58aac421d 100644 --- a/singlestore/kubedb_client_builder.go +++ b/singlestore/kubedb_client_builder.go @@ -21,6 +21,7 @@ import ( "crypto/tls" "crypto/x509" "database/sql" + "fmt" sql_driver "github.com/go-sql-driver/mysql" diff --git a/solr/api.go b/solr/api.go new file mode 100644 index 000000000..2452c8ea0 --- /dev/null +++ b/solr/api.go @@ -0,0 +1,47 @@ +package solr + +import ( + "context" + + "github.com/go-logr/logr" + "github.com/go-resty/resty/v2" +) + +const ( + writeCollectionName = "kubedb-system" + Action = "action" + ActionBackup = "BACKUP" + ActionRestore = "RESTORE" + ActionCreate = "CREATE" + ActionDeleteBackup = "DELETEBACKUP" + Name = "name" + Location = "location" + Repository = "repository" + Collection = "collection" + Async = "async" + PurgeUnused = "purgeUnused" + BackupId = "backupId" + DeleteStatus = "DELETESTATUS" + RequestStatus = "REQUESTSTATUS" + RequestId = "requestid" + NumShards = "numShards" + ReplicationFactor = "replicationFactor" +) + +type SLClient interface { + GetClusterStatus() (*Response, error) + ListCollection() (*Response, error) + CreateCollection() (*Response, error) + WriteCollection() (*Response, error) + ReadCollection() (*Response, error) + BackupCollection(ctx context.Context, collection string, backupName string, location string, repository string) (*Response, error) + RestoreCollection(ctx context.Context, collection string, backupName string, location string, repository string, backupId int) (*Response, error) + FlushStatus(asyncId string) (*Response, error) + RequestStatus(asyncId string) (*Response, error) + DeleteBackup(ctx context.Context, backupName string, collection string, location string, repository string, backupId int, snap string) (*Response, error) + PurgeBackup(ctx context.Context, backupName string, collection string, location string, repository string, snap string) (*Response, error) + GetConfig() *Config + GetClient() *resty.Client + GetLog() logr.Logger + DecodeBackupResponse(data map[string]interface{}, collection string) ([]byte, error) +} diff --git a/solr/client.go b/solr/client.go new file mode 100644 index 000000000..c5736db0e --- /dev/null +++ b/solr/client.go @@ -0,0 +1,62 @@ +package solr + +import ( + "context" + "io" + "net/http" + + "github.com/go-logr/logr" + api "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +type Client struct { + SLClient +} + +type ClientOptions struct { + KBClient client.Client + DB *api.Solr + Ctx context.Context + Log logr.Logger +} + +type Config struct { + host string + connectionScheme string + transport *http.Transport + log logr.Logger +} + +type Response struct { + Code int + header http.Header + body io.ReadCloser +} + +type Doc struct { + Id int `json:"id,omitempty" yaml:"id,omitempty"` + DB string `json:"db,omitempty" yaml:"db,omitempty"` +} + +type Data struct { + CommitWithin int `json:"commitWithin,omitempty" yaml:"commitWithin,omitempty"` + Overwrite bool `json:"overwrite,omitempty" yaml:"overwrite,omitempty"` + Doc *Doc `json:"doc,omitempty" yaml:"doc,omitempty"` +} + +type ADD struct { + Add *Data `json:"add,omitempty" yaml:"add,omitempty"` +} + +type QueryParams struct { + Query string `json:"query,omitempty" yaml:"query,omitempty"` + Limit int `json:"limit,omitempty" yaml:"limit,omitempty"` +} + +type CreateParams struct { + Name string `json:"name,omitempty" yaml:"name,omitempty"` + Config string `json:"config,omitempty" yaml:"config,omitempty"` + NumShards int `json:"numShards,omitempty" yaml:"numShards,omitempty"` + ReplicationFactor int `json:"replicationFactor,omitempty" yaml:"replicationFactor,omitempty"` +} diff --git a/solr/kubedb_client_builder.go b/solr/kubedb_client_builder.go new file mode 100644 index 000000000..f4df93688 --- /dev/null +++ b/solr/kubedb_client_builder.go @@ -0,0 +1,137 @@ +package solr + +import ( + "context" + "errors" + "net" + "net/http" + "time" + + "github.com/Masterminds/semver/v3" + gerr "github.com/pkg/errors" + core "k8s.io/api/core/v1" + "k8s.io/apimachinery/pkg/types" + "kubedb.dev/apimachinery/apis/kubedb" + + "fmt" + + "github.com/go-logr/logr" + "github.com/go-resty/resty/v2" + api "kubedb.dev/apimachinery/apis/kubedb/v1alpha2" + "sigs.k8s.io/controller-runtime/pkg/client" +) + +type KubeDBClientBuilder struct { + kc client.Client + db *api.Solr + url string + podName string + ctx context.Context + log logr.Logger +} + +func NewKubeDBClientBuilder(kc client.Client, db *api.Solr) *KubeDBClientBuilder { + return &KubeDBClientBuilder{ + kc: kc, + db: db, + } +} + +func (o *KubeDBClientBuilder) WithPod(podName string) *KubeDBClientBuilder { + o.podName = podName + return o +} + +func (o *KubeDBClientBuilder) WithURL(url string) *KubeDBClientBuilder { + o.url = url + return o +} + +func (o *KubeDBClientBuilder) WithLog(log logr.Logger) *KubeDBClientBuilder { + o.log = log + return o +} + +func (o *KubeDBClientBuilder) WithContext(ctx context.Context) *KubeDBClientBuilder { + o.ctx = ctx + return o +} + +func (o *KubeDBClientBuilder) GetSolrClient() (*Client, error) { + if o.podName != "" { + o.url = o.GetHostPath(o.db) + } + if o.url == "" { + o.url = o.GetHostPath(o.db) + } + if o.db == nil { + return nil, errors.New("db is empty") + } + config := Config{ + host: o.url, + transport: &http.Transport{ + IdleConnTimeout: time.Second * 10, + DialContext: (&net.Dialer{ + Timeout: time.Second * 30, + KeepAlive: time.Second * 30, + }).DialContext, + TLSHandshakeTimeout: time.Second * 20, + ResponseHeaderTimeout: time.Second * 20, + ExpectContinueTimeout: time.Second * 20, + }, + connectionScheme: o.db.GetConnectionScheme(), + log: o.log, + } + + var authSecret core.Secret + if !o.db.Spec.DisableSecurity { + err := o.kc.Get(o.ctx, types.NamespacedName{ + Name: o.db.Spec.AuthSecret.Name, + Namespace: o.db.Namespace, + }, &authSecret) + if err != nil { + config.log.Error(err, "failed to get auth secret to get solr client") + return nil, err + } + } + version, err := semver.NewVersion(o.db.Spec.Version) + if err != nil { + return nil, gerr.Wrap(err, "failed to parse version") + } + + switch { + case version.Major() >= 9: + newClient := resty.New() + newClient.SetScheme(config.connectionScheme).SetBaseURL(config.host).SetTransport(config.transport) + newClient.SetTimeout(time.Second * 30) + newClient.SetHeader("Accept", "application/json") + newClient.SetDisableWarn(true) + newClient.SetBasicAuth(string(authSecret.Data[core.BasicAuthUsernameKey]), string(authSecret.Data[core.BasicAuthPasswordKey])) + return &Client{ + &SLClientV9{ + Client: newClient, + Config: &config, + }, + }, nil + case version.Major() == 8: + newClient := resty.New() + newClient.SetScheme(config.connectionScheme).SetBaseURL(config.host).SetTransport(config.transport) + newClient.SetTimeout(time.Second * 30) + newClient.SetHeader("Accept", "application/json") + newClient.SetDisableWarn(true) + newClient.SetBasicAuth(string(authSecret.Data[core.BasicAuthUsernameKey]), string(authSecret.Data[core.BasicAuthPasswordKey])) + return &Client{ + &SLClientV8{ + Client: newClient, + Config: &config, + }, + }, nil + } + + return nil, fmt.Errorf("unknown version: %s", o.db.Spec.Version) + +} + +func (o *KubeDBClientBuilder) GetHostPath(db *api.Solr) string { + return fmt.Sprintf("%v://%s.%s.svc.cluster.local:%d", db.GetConnectionScheme(), db.ServiceName(), db.GetNamespace(), kubedb.SolrRestPort) +} diff --git a/solr/solrv8.go b/solr/solrv8.go new file mode 100644 index 000000000..59f69e9b5 --- /dev/null +++ b/solr/solrv8.go @@ -0,0 +1,328 @@ +package solr + +import ( + "context" + "encoding/json" + "fmt" + "strconv" + + "github.com/go-logr/logr" + "github.com/go-resty/resty/v2" + "k8s.io/klog/v2" +) + +type SLClientV8 struct { + Client *resty.Client + Config *Config +} + +func (sc *SLClientV8) GetClusterStatus() (*Response, error) { + sc.Config.log.V(5).Info("GETTING CLUSTER STATUS") + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetQueryParam("action", "CLUSTERSTATUS") + res, err := req.Get("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request") + return nil, err + } + + clusterResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return clusterResponse, nil +} + +func (sc *SLClientV8) ListCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("SEARCHING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetQueryParam("action", "LIST") + res, err := req.Get("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request while getting colection list") + return nil, err + } + response := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return response, nil +} + +func (sc *SLClientV8) CreateCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("CREATING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + params := map[string]string{ + Action: ActionCreate, + Name: writeCollectionName, + NumShards: "1", + ReplicationFactor: "1", + } + + req.SetQueryParams(params) + res, err := req.Post("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to create a collection") + return nil, err + } + + collectionResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return collectionResponse, nil +} + +func (sc *SLClientV8) WriteCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("WRITING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + data1 := &Data{ + CommitWithin: 5000, + Overwrite: true, + Doc: &Doc{ + Id: 1, + DB: "elasticsearch", + }, + } + add := ADD{ + Add: data1, + } + req.SetBody(add) + res, err := req.Post(fmt.Sprintf("/solr/%s/update", writeCollectionName)) + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to add document in collect") + return nil, err + } + + writeResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return writeResponse, nil +} + +func (sc *SLClientV8) ReadCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("READING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetQueryParam("q", "*:*") + res, err := req.Get(fmt.Sprintf("/solr/%s/select", writeCollectionName)) + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to read a collection") + return nil, err + } + + writeResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return writeResponse, nil +} + +func (sc *SLClientV8) BackupCollection(ctx context.Context, collection string, backupName string, location string, repository string) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("BACKUP COLLECTION: %s", collection)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + params := map[string]string{ + Action: ActionBackup, + Name: backupName, + Collection: collection, + Location: location, + Repository: repository, + Async: fmt.Sprintf("%s-backup", collection), + } + + req.SetQueryParams(params) + + res, err := req.Post("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to backup a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV8) RestoreCollection(ctx context.Context, collection string, backupName string, location string, repository string, backupId int) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("RESTORE COLLECTION: %s", collection)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + params := map[string]string{ + Action: ActionRestore, + Name: backupName, + Location: location, + Collection: collection, + Repository: repository, + BackupId: strconv.Itoa(backupId), + Async: fmt.Sprintf("%s-restore", collection), + } + + req.SetQueryParams(params) + + res, err := req.Post("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to restore a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV8) FlushStatus(asyncId string) (*Response, error) { + sc.Config.log.V(5).Info("Flush Status") + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + + params := map[string]string{ + Action: DeleteStatus, + RequestId: asyncId, + } + req.SetQueryParams(params) + res, err := req.Get("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to flush status") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV8) RequestStatus(asyncId string) (*Response, error) { + sc.Config.log.V(5).Info("Request Status") + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + params := map[string]string{ + Action: RequestStatus, + RequestId: asyncId, + } + req.SetQueryParams(params) + res, err := req.Get("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to request status") + return nil, err + } + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV8) DeleteBackup(ctx context.Context, backupName string, collection string, location string, repository string, backupId int, snap string) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("DELETE BACKUP ID %d of BACKUP %s", backupId, backupName)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + async := fmt.Sprintf("%s-delete", collection) + if snap != "" { + async = fmt.Sprintf("%s-%s", async, snap) + } + params := map[string]string{ + Action: ActionDeleteBackup, + Name: backupName, + Location: location, + Repository: repository, + BackupId: strconv.Itoa(backupId), + Async: async, + } + req.SetQueryParams(params) + + res, err := req.Delete("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to restore a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV8) PurgeBackup(ctx context.Context, backupName string, collection string, location string, repository string, snap string) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("PURGE BACKUP ID %s", backupName)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + async := fmt.Sprintf("%s-purge", collection) + if snap != "" { + async = fmt.Sprintf("%s-%s", async, snap) + } + params := map[string]string{ + Action: ActionDeleteBackup, + Name: backupName, + Location: location, + Repository: repository, + PurgeUnused: "true", + Async: async, + } + req.SetQueryParams(params) + res, err := req.Put("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to restore a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV8) GetConfig() *Config { + return sc.Config +} + +func (sc *SLClientV8) GetClient() *resty.Client { + return sc.Client +} + +func (sc *SLClientV8) GetLog() logr.Logger { + return sc.Config.log +} + +func (sc *SLClientV8) DecodeBackupResponse(data map[string]interface{}, collection string) ([]byte, error) { + sc.Config.log.V(5).Info("Decode Backup Data") + backupResponse, ok := data["response"].([]interface{}) + if !ok { + err := fmt.Errorf("didn't find status for collection %s\n", collection) + return nil, err + } + mp := make(map[string]interface{}) + for i := 0; i < len(backupResponse); i += 2 { + a := backupResponse[i].(string) + b := backupResponse[i+1] + mp[a] = b + } + b, err := json.Marshal(mp) + if err != nil { + klog.Error(fmt.Sprintf("Could not format response for collection %s into json", collection)) + return nil, err + } + return b, nil + +} diff --git a/solr/solrv9.go b/solr/solrv9.go new file mode 100644 index 000000000..2badd2260 --- /dev/null +++ b/solr/solrv9.go @@ -0,0 +1,316 @@ +package solr + +import ( + "context" + "encoding/json" + "fmt" + "strconv" + + "github.com/go-logr/logr" + "github.com/go-resty/resty/v2" + "k8s.io/klog/v2" +) + +type SLClientV9 struct { + Client *resty.Client + Config *Config +} + +func (sc *SLClientV9) GetClusterStatus() (*Response, error) { + sc.Config.log.V(5).Info("GETTING CLUSTER STATUS") + req := sc.Client.R().SetDoNotParseResponse(true) + res, err := req.Get("/api/cluster") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request") + return nil, err + } + + clusterResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return clusterResponse, nil +} + +func (sc *SLClientV9) ListCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("SEARCHING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + res, err := req.Get("/api/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request while getting colection list") + return nil, err + } + response := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return response, nil +} + +func (sc *SLClientV9) CreateCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("CREATING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + createParams := &CreateParams{ + Name: writeCollectionName, + NumShards: 1, + ReplicationFactor: 1, + } + + req.SetBody(createParams) + res, err := req.Post("/api/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to create a collection") + return nil, err + } + + collectionResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return collectionResponse, nil +} + +type ADDList []ADD + +func (sc *SLClientV9) WriteCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("WRITING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + data1 := &Data{ + CommitWithin: 5000, + Overwrite: true, + Doc: &Doc{ + Id: 1, + DB: "elasticsearch", + }, + } + add := ADD{ + Add: data1, + } + req.SetBody(add) + res, err := req.Post(fmt.Sprintf("/solr/%s/update", writeCollectionName)) + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to add document in collect") + return nil, err + } + + writeResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return writeResponse, nil +} + +func (sc *SLClientV9) ReadCollection() (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("READING COLLECTION: %s", writeCollectionName)) + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + queryParams := QueryParams{ + Query: "*:*", + Limit: 10, + } + req.SetBody(queryParams) + res, err := req.Get(fmt.Sprintf("/solr/%s/select", writeCollectionName)) + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to read a collection") + return nil, err + } + + writeResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return writeResponse, nil +} + +func (sc *SLClientV9) BackupCollection(ctx context.Context, collection string, backupName string, location string, repository string) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("BACKUP COLLECTION: %s", collection)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + backupParams := map[string]string{ + Action: ActionBackup, + Name: backupName, + Collection: collection, + Location: location, + Repository: repository, + Async: fmt.Sprintf("%s-backup", collection), + } + req.SetQueryParams(backupParams) + + res, err := req.Post("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to backup a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV9) RestoreCollection(ctx context.Context, collection string, backupName string, location string, repository string, backupId int) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("RESTORE COLLECTION: %s", collection)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + restoreParams := map[string]string{ + Action: ActionRestore, + Name: backupName, + Location: location, + Collection: collection, + Repository: repository, + BackupId: strconv.Itoa(backupId), + Async: fmt.Sprintf("%s-restore", collection), + } + req.SetQueryParams(restoreParams) + + res, err := req.Post("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to restore a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV9) FlushStatus(asyncId string) (*Response, error) { + sc.Config.log.V(5).Info("Flush Status") + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + + res, err := req.Delete(fmt.Sprintf("/api/cluster/command-status/%s", asyncId)) + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to flush status") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV9) RequestStatus(asyncId string) (*Response, error) { + sc.Config.log.V(5).Info("Request Status") + req := sc.Client.R().SetDoNotParseResponse(true) + req.SetHeader("Content-Type", "application/json") + res, err := req.Get(fmt.Sprintf("/api/cluster/command-status/%s", asyncId)) + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to request status") + return nil, err + } + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV9) DeleteBackup(ctx context.Context, backupName string, collection string, location string, repository string, backupId int, snap string) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("DELETE BACKUP ID %d of BACKUP %s", backupId, backupName)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + async := fmt.Sprintf("%s-delete", collection) + if snap != "" { + async = fmt.Sprintf("%s-%s", async, snap) + } + params := map[string]string{ + Action: ActionDeleteBackup, + Name: backupName, + Location: location, + Repository: repository, + BackupId: strconv.Itoa(backupId), + Async: async, + } + req.SetQueryParams(params) + + res, err := req.Get("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to restore a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV9) PurgeBackup(ctx context.Context, backupName string, collection string, location string, repository string, snap string) (*Response, error) { + sc.Config.log.V(5).Info(fmt.Sprintf("PURGE BACKUP ID %s", backupName)) + req := sc.Client.R().SetDoNotParseResponse(true).SetContext(ctx) + req.SetHeader("Content-Type", "application/json") + async := fmt.Sprintf("%s-purge", collection) + if snap != "" { + async = fmt.Sprintf("%s-%s", async, snap) + } + params := map[string]string{ + Action: ActionDeleteBackup, + Name: backupName, + Location: location, + Repository: repository, + PurgeUnused: "true", + Async: async, + } + req.SetQueryParams(params) + + res, err := req.Get("/solr/admin/collections") + if err != nil { + sc.Config.log.Error(err, "Failed to send http request to restore a collection") + return nil, err + } + + backupResponse := &Response{ + Code: res.StatusCode(), + header: res.Header(), + body: res.RawBody(), + } + return backupResponse, nil +} + +func (sc *SLClientV9) GetConfig() *Config { + return sc.Config +} + +func (sc *SLClientV9) GetClient() *resty.Client { + return sc.Client +} + +func (sc *SLClientV9) GetLog() logr.Logger { + return sc.Config.log +} + +func (sc *SLClientV9) DecodeBackupResponse(data map[string]interface{}, collection string) ([]byte, error) { + sc.Config.log.V(5).Info("Decode Backup Data") + backupResponse, ok := data["response"].(map[string]interface{}) + if !ok { + err := fmt.Errorf("didn't find status for collection %s\n", collection) + return nil, err + } + klog.Info("backup response ", backupResponse) + b, err := json.Marshal(backupResponse) + if err != nil { + klog.Error(fmt.Sprintf("Could not format response for collection %s into json", collection)) + return nil, err + } + klog.Info(fmt.Sprintf("Response for collection %s\n%v", collection, string(b))) + return b, nil +} diff --git a/solr/util.go b/solr/util.go new file mode 100644 index 000000000..e5e69242d --- /dev/null +++ b/solr/util.go @@ -0,0 +1,126 @@ +package solr + +import ( + "encoding/json" + "fmt" + "io" + + "github.com/pkg/errors" +) + +func (sc *Client) DecodeResponse(response *Response) (map[string]interface{}, error) { + defer func(Body io.ReadCloser) { + err := Body.Close() + if err != nil { + err1 := errors.Wrap(err, "failed to parse response body") + if err1 != nil { + return + } + return + } + }(response.body) + + responseBody := make(map[string]interface{}) + if err := json.NewDecoder(response.body).Decode(&responseBody); err != nil { + return nil, fmt.Errorf("failed to deserialize the response: %v", err) + } + + return responseBody, nil +} + +func (sc *Client) GetResponseStatus(responseBody map[string]interface{}) (int, error) { + err, ok := responseBody["error"].(map[string]interface{}) + if ok { + msg, ok := err["msg"].(string) + if !ok { + return -1, errors.New("no msg found in error message while getting response status") + + } + code, ok := err["code"].(float64) + if !ok { + return -1, errors.New("error occurred but didn't found error code while getting response status") + + } + return -1, errors.New(fmt.Sprintf("Error: %v with code %d", msg, int(code))) + } + responseHeader, ok := responseBody["responseHeader"].(map[string]interface{}) + if !ok { + return -1, errors.New("didn't find responseHeader") + } + + status, ok := responseHeader["status"].(float64) + if !ok { + return -1, errors.New("didn't find status") + } + + if int(status) != 0 { + msg, ok := responseBody["message"].(string) + if !ok { + return -1, errors.New("no msg found in error message") + + } + return -1, errors.New(fmt.Sprintf("Error: %v with code %d", msg, int(status))) + } + return int(status), nil +} + +func (sc *Client) GetAsyncStatus(responseBody map[string]interface{}) (string, error) { + status, ok := responseBody["status"].(map[string]interface{}) + if !ok { + return "unknown", errors.New("didn't find status") + } + + state, ok := status["state"].(string) + if !ok { + return "unknown", errors.New("didn't find state") + } + + return state, nil +} + +func (sc *Client) DecodeCollectionHealth(responseBody map[string]interface{}) error { + clusterInfo, ok := responseBody["cluster"].(map[string]interface{}) + if !ok { + return errors.New(fmt.Sprintf("did not find cluster %v\n", responseBody)) + } + collections, ok := clusterInfo["collections"].(map[string]interface{}) + if !ok { + return errors.New("didn't find collections") + } + for name, info := range collections { + collectionInfo := info.(map[string]interface{}) + health, ok := collectionInfo["health"].(string) + if !ok { + return errors.New("didn't find health") + } + if health != "GREEN" { + config := sc.GetConfig() + config.log.Error(errors.New(""), fmt.Sprintf("Health of collection %s IS NOT GREEN", name)) + return errors.New(fmt.Sprintf("health for collection %s is not green", name)) + } + } + return nil +} + +func (sc *Client) GetCollectionList(responseBody map[string]interface{}) ([]string, error) { + collectionList, ok := responseBody["collections"].([]interface{}) + if !ok { + return []string{}, errors.New("didn't find collection list") + } + + collections := make([]string, 0) + + for idx := range collectionList { + collections = append(collections, collectionList[idx].(string)) + } + return collections, nil +} + +func (sc *Client) SearchCollection(collections []string) bool { + for _, collection := range collections { + if collection == "kubedb-system" { + return true + } + } + return false +} diff --git a/vendor/golang.org/x/crypto/md4/md4.go b/vendor/golang.org/x/crypto/md4/md4.go index d1911c2e8..7d9281e02 100644 --- a/vendor/golang.org/x/crypto/md4/md4.go +++ b/vendor/golang.org/x/crypto/md4/md4.go @@ -7,7 +7,7 @@ // Deprecated: MD4 is cryptographically broken and should only be used // where compatibility with legacy systems, not security, is the goal. Instead, // use a secure hash like SHA-256 (from crypto/sha256). -package md4 // import "golang.org/x/crypto/md4" +package md4 import ( "crypto" diff --git a/vendor/golang.org/x/crypto/ocsp/ocsp.go b/vendor/golang.org/x/crypto/ocsp/ocsp.go index bf2259537..e6c645e7c 100644 --- a/vendor/golang.org/x/crypto/ocsp/ocsp.go +++ b/vendor/golang.org/x/crypto/ocsp/ocsp.go @@ -5,7 +5,7 @@ // Package ocsp parses OCSP responses as specified in RFC 2560. OCSP responses // are signed messages attesting to the validity of a certificate for a small // period of time. This is used to manage revocation for X.509 certificates. -package ocsp // import "golang.org/x/crypto/ocsp" +package ocsp import ( "crypto" diff --git a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go index 904b57e01..28cd99c7f 100644 --- a/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go +++ b/vendor/golang.org/x/crypto/pbkdf2/pbkdf2.go @@ -16,7 +16,7 @@ Hash Functions SHA-1, SHA-224, SHA-256, SHA-384 and SHA-512 for HMAC. To choose, you can pass the `New` functions from the different SHA packages to pbkdf2.Key. */ -package pbkdf2 // import "golang.org/x/crypto/pbkdf2" +package pbkdf2 import ( "crypto/hmac" diff --git a/vendor/golang.org/x/crypto/scrypt/scrypt.go b/vendor/golang.org/x/crypto/scrypt/scrypt.go index c971a99fa..76fa40fb2 100644 --- a/vendor/golang.org/x/crypto/scrypt/scrypt.go +++ b/vendor/golang.org/x/crypto/scrypt/scrypt.go @@ -5,7 +5,7 @@ // Package scrypt implements the scrypt key derivation function as defined in // Colin Percival's paper "Stronger Key Derivation via Sequential Memory-Hard // Functions" (https://www.tarsnap.com/scrypt/scrypt.pdf). -package scrypt // import "golang.org/x/crypto/scrypt" +package scrypt import ( "crypto/sha256" diff --git a/vendor/golang.org/x/net/http2/transport.go b/vendor/golang.org/x/net/http2/transport.go index 98a49c6b6..61f511f97 100644 --- a/vendor/golang.org/x/net/http2/transport.go +++ b/vendor/golang.org/x/net/http2/transport.go @@ -827,10 +827,6 @@ func (t *Transport) newClientConn(c net.Conn, singleUse bool) (*ClientConn, erro cc.henc.SetMaxDynamicTableSizeLimit(t.maxEncoderHeaderTableSize()) cc.peerMaxHeaderTableSize = initialHeaderTableSize - if t.AllowHTTP { - cc.nextStreamID = 3 - } - if cs, ok := c.(connectionStater); ok { state := cs.ConnectionState() cc.tlsState = &state diff --git a/vendor/golang.org/x/sys/unix/mremap.go b/vendor/golang.org/x/sys/unix/mremap.go index fd45fe529..3a5e776f8 100644 --- a/vendor/golang.org/x/sys/unix/mremap.go +++ b/vendor/golang.org/x/sys/unix/mremap.go @@ -50,3 +50,8 @@ func (m *mremapMmapper) Mremap(oldData []byte, newLength int, flags int) (data [ func Mremap(oldData []byte, newLength int, flags int) (data []byte, err error) { return mapper.Mremap(oldData, newLength, flags) } + +func MremapPtr(oldAddr unsafe.Pointer, oldSize uintptr, newAddr unsafe.Pointer, newSize uintptr, flags int) (ret unsafe.Pointer, err error) { + xaddr, err := mapper.mremap(uintptr(oldAddr), oldSize, newSize, flags, uintptr(newAddr)) + return unsafe.Pointer(xaddr), err +} diff --git a/vendor/golang.org/x/sys/unix/syscall_darwin.go b/vendor/golang.org/x/sys/unix/syscall_darwin.go index 59542a897..4cc7b0059 100644 --- a/vendor/golang.org/x/sys/unix/syscall_darwin.go +++ b/vendor/golang.org/x/sys/unix/syscall_darwin.go @@ -542,6 +542,18 @@ func SysctlKinfoProcSlice(name string, args ...int) ([]KinfoProc, error) { } } +//sys pthread_chdir_np(path string) (err error) + +func PthreadChdir(path string) (err error) { + return pthread_chdir_np(path) +} + +//sys pthread_fchdir_np(fd int) (err error) + +func PthreadFchdir(fd int) (err error) { + return pthread_fchdir_np(fd) +} + //sys sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) //sys shmat(id int, addr uintptr, flag int) (ret uintptr, err error) diff --git a/vendor/golang.org/x/sys/unix/syscall_unix.go b/vendor/golang.org/x/sys/unix/syscall_unix.go index 77081de8c..4e92e5aa4 100644 --- a/vendor/golang.org/x/sys/unix/syscall_unix.go +++ b/vendor/golang.org/x/sys/unix/syscall_unix.go @@ -154,6 +154,15 @@ func Munmap(b []byte) (err error) { return mapper.Munmap(b) } +func MmapPtr(fd int, offset int64, addr unsafe.Pointer, length uintptr, prot int, flags int) (ret unsafe.Pointer, err error) { + xaddr, err := mapper.mmap(uintptr(addr), length, prot, flags, fd, offset) + return unsafe.Pointer(xaddr), err +} + +func MunmapPtr(addr unsafe.Pointer, length uintptr) (err error) { + return mapper.munmap(uintptr(addr), length) +} + func Read(fd int, p []byte) (n int, err error) { n, err = read(fd, p) if raceenabled { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go index ccb02f240..07642c308 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.go @@ -760,6 +760,39 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pthread_chdir_np(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_pthread_chdir_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_chdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_chdir_np pthread_chdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pthread_fchdir_np(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_pthread_fchdir_np_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_fchdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_fchdir_np pthread_fchdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s index 8b8bb2840..923e08cb7 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_amd64.s @@ -228,6 +228,16 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_pthread_chdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_chdir_np(SB) +GLOBL ·libc_pthread_chdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_chdir_np_trampoline_addr(SB)/8, $libc_pthread_chdir_np_trampoline<>(SB) + +TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_fchdir_np(SB) +GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go index 1b40b997b..7d73dda64 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.go @@ -760,6 +760,39 @@ var libc_sysctl_trampoline_addr uintptr // THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT +func pthread_chdir_np(path string) (err error) { + var _p0 *byte + _p0, err = BytePtrFromString(path) + if err != nil { + return + } + _, _, e1 := syscall_syscall(libc_pthread_chdir_np_trampoline_addr, uintptr(unsafe.Pointer(_p0)), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_chdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_chdir_np pthread_chdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + +func pthread_fchdir_np(fd int) (err error) { + _, _, e1 := syscall_syscall(libc_pthread_fchdir_np_trampoline_addr, uintptr(fd), 0, 0) + if e1 != 0 { + err = errnoErr(e1) + } + return +} + +var libc_pthread_fchdir_np_trampoline_addr uintptr + +//go:cgo_import_dynamic libc_pthread_fchdir_np pthread_fchdir_np "/usr/lib/libSystem.B.dylib" + +// THIS FILE IS GENERATED BY THE COMMAND AT THE TOP; DO NOT EDIT + func sendfile(infd int, outfd int, offset int64, len *int64, hdtr unsafe.Pointer, flags int) (err error) { _, _, e1 := syscall_syscall6(libc_sendfile_trampoline_addr, uintptr(infd), uintptr(outfd), uintptr(offset), uintptr(unsafe.Pointer(len)), uintptr(hdtr), uintptr(flags)) if e1 != 0 { diff --git a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s index 08362c1ab..057700111 100644 --- a/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s +++ b/vendor/golang.org/x/sys/unix/zsyscall_darwin_arm64.s @@ -228,6 +228,16 @@ TEXT libc_sysctl_trampoline<>(SB),NOSPLIT,$0-0 GLOBL ·libc_sysctl_trampoline_addr(SB), RODATA, $8 DATA ·libc_sysctl_trampoline_addr(SB)/8, $libc_sysctl_trampoline<>(SB) +TEXT libc_pthread_chdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_chdir_np(SB) +GLOBL ·libc_pthread_chdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_chdir_np_trampoline_addr(SB)/8, $libc_pthread_chdir_np_trampoline<>(SB) + +TEXT libc_pthread_fchdir_np_trampoline<>(SB),NOSPLIT,$0-0 + JMP libc_pthread_fchdir_np(SB) +GLOBL ·libc_pthread_fchdir_np_trampoline_addr(SB), RODATA, $8 +DATA ·libc_pthread_fchdir_np_trampoline_addr(SB)/8, $libc_pthread_fchdir_np_trampoline<>(SB) + TEXT libc_sendfile_trampoline<>(SB),NOSPLIT,$0-0 JMP libc_sendfile(SB) GLOBL ·libc_sendfile_trampoline_addr(SB), RODATA, $8 diff --git a/vendor/golang.org/x/sys/windows/security_windows.go b/vendor/golang.org/x/sys/windows/security_windows.go index 6f7d2ac70..97651b5bd 100644 --- a/vendor/golang.org/x/sys/windows/security_windows.go +++ b/vendor/golang.org/x/sys/windows/security_windows.go @@ -894,7 +894,7 @@ type ACL struct { aclRevision byte sbz1 byte aclSize uint16 - aceCount uint16 + AceCount uint16 sbz2 uint16 } @@ -1087,6 +1087,27 @@ type EXPLICIT_ACCESS struct { Trustee TRUSTEE } +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header +type ACE_HEADER struct { + AceType uint8 + AceFlags uint8 + AceSize uint16 +} + +// https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-access_allowed_ace +type ACCESS_ALLOWED_ACE struct { + Header ACE_HEADER + Mask ACCESS_MASK + SidStart uint32 +} + +const ( + // Constants for AceType + // https://learn.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-ace_header + ACCESS_ALLOWED_ACE_TYPE = 0 + ACCESS_DENIED_ACE_TYPE = 1 +) + // This type is the union inside of TRUSTEE and must be created using one of the TrusteeValueFrom* functions. type TrusteeValue uintptr @@ -1158,6 +1179,7 @@ type OBJECTS_AND_NAME struct { //sys makeSelfRelativeSD(absoluteSD *SECURITY_DESCRIPTOR, selfRelativeSD *SECURITY_DESCRIPTOR, selfRelativeSDSize *uint32) (err error) = advapi32.MakeSelfRelativeSD //sys setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCESS, oldACL *ACL, newACL **ACL) (ret error) = advapi32.SetEntriesInAclW +//sys GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) = advapi32.GetAce // Control returns the security descriptor control bits. func (sd *SECURITY_DESCRIPTOR) Control() (control SECURITY_DESCRIPTOR_CONTROL, revision uint32, err error) { diff --git a/vendor/golang.org/x/sys/windows/zsyscall_windows.go b/vendor/golang.org/x/sys/windows/zsyscall_windows.go index 9f73df75b..eba761018 100644 --- a/vendor/golang.org/x/sys/windows/zsyscall_windows.go +++ b/vendor/golang.org/x/sys/windows/zsyscall_windows.go @@ -91,6 +91,7 @@ var ( procEnumServicesStatusExW = modadvapi32.NewProc("EnumServicesStatusExW") procEqualSid = modadvapi32.NewProc("EqualSid") procFreeSid = modadvapi32.NewProc("FreeSid") + procGetAce = modadvapi32.NewProc("GetAce") procGetLengthSid = modadvapi32.NewProc("GetLengthSid") procGetNamedSecurityInfoW = modadvapi32.NewProc("GetNamedSecurityInfoW") procGetSecurityDescriptorControl = modadvapi32.NewProc("GetSecurityDescriptorControl") @@ -1224,6 +1225,14 @@ func setEntriesInAcl(countExplicitEntries uint32, explicitEntries *EXPLICIT_ACCE return } +func GetAce(acl *ACL, aceIndex uint32, pAce **ACCESS_ALLOWED_ACE) (ret error) { + r0, _, _ := syscall.Syscall(procGetAce.Addr(), 3, uintptr(unsafe.Pointer(acl)), uintptr(aceIndex), uintptr(unsafe.Pointer(pAce))) + if r0 == 0 { + ret = GetLastError() + } + return +} + func SetKernelObjectSecurity(handle Handle, securityInformation SECURITY_INFORMATION, securityDescriptor *SECURITY_DESCRIPTOR) (err error) { r1, _, e1 := syscall.Syscall(procSetKernelObjectSecurity.Addr(), 3, uintptr(handle), uintptr(securityInformation), uintptr(unsafe.Pointer(securityDescriptor))) if r1 == 0 { diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/constants.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/constants.go index 78a28e577..16eb693ec 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/constants.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/constants.go @@ -689,6 +689,10 @@ const ( DatabaseWriteAccess = "DatabaseWriteAccess" // check dependencies are ready DatabaseDependencyReady = "DatabaseDependencyReady" + // update config secret for backup in solr + PatchConfigSecretUpdateForBackup = "PatchConfigSecretUpdatesForBackup" + // sync db to update configuration + SyncDatabaseForConfigurationUpdate = "SyncDatabaseForConfigurationUpdate" // Condition reasons DataRestoreStartedByExternalInitializer = "DataRestoreStartedByExternalInitializer" diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/conversion.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/conversion.go index cbe892276..fd347d990 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/conversion.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/conversion.go @@ -662,11 +662,13 @@ func Convert_v1alpha2_RedisSpec_To_v1_RedisSpec(in *RedisSpec, out *v1.RedisSpec return err } - if out.Cluster == nil { - out.Cluster = &v1.RedisClusterSpec{} - } - if err := Convert_v1alpha2_RedisClusterSpec_To_v1_RedisClusterSpec(in.Cluster, out.Cluster, s); err != nil { - return err + if in.Mode == RedisModeCluster { + if out.Cluster == nil { + out.Cluster = &v1.RedisClusterSpec{} + } + if err := Convert_v1alpha2_RedisClusterSpec_To_v1_RedisClusterSpec(in.Cluster, out.Cluster, s); err != nil { + return err + } } out.Version = in.Version @@ -730,11 +732,13 @@ func Convert_v1_RedisSpec_To_v1alpha2_RedisSpec(in *v1.RedisSpec, out *RedisSpec return err } - if out.Cluster == nil { - out.Cluster = &RedisClusterSpec{} - } - if err := Convert_v1_RedisClusterSpec_To_v1alpha2_RedisClusterSpec(in.Cluster, out.Cluster, s); err != nil { - return err + if in.Mode == v1.RedisModeCluster { + if out.Cluster == nil { + out.Cluster = &RedisClusterSpec{} + } + if err := Convert_v1_RedisClusterSpec_To_v1alpha2_RedisClusterSpec(in.Cluster, out.Cluster, s); err != nil { + return err + } } out.Version = in.Version diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_helpers.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_helpers.go index 60f3bb472..d0708704c 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_helpers.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_helpers.go @@ -181,8 +181,8 @@ func (e *Etcd) SetDefaults() { if e.Spec.StorageType == "" { e.Spec.StorageType = StorageTypeDurable } - if e.Spec.TerminationPolicy == "" { - e.Spec.TerminationPolicy = TerminationPolicyDelete + if e.Spec.DeletionPolicy == "" { + e.Spec.DeletionPolicy = TerminationPolicyDelete } e.Spec.Monitor.SetDefaults() diff --git a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_types.go b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_types.go index caa57e978..cbf151b15 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_types.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/etcd_types.go @@ -90,9 +90,9 @@ type EtcdSpec struct { // +optional Halted bool `json:"halted,omitempty"` - // TerminationPolicy controls the delete operation for database + // DeletionPolicy controls the delete operation for database // +optional - TerminationPolicy TerminationPolicy `json:"terminationPolicy,omitempty"` + DeletionPolicy TerminationPolicy `json:"deletionPolicy,omitempty"` } type TLSPolicy struct { 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 f0cb1d2f0..bb77c0167 100644 --- a/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/openapi_generated.go +++ b/vendor/kubedb.dev/apimachinery/apis/kubedb/v1alpha2/openapi_generated.go @@ -27409,9 +27409,9 @@ func schema_apimachinery_apis_kubedb_v1alpha2_EtcdSpec(ref common.ReferenceCallb Format: "", }, }, - "terminationPolicy": { + "deletionPolicy": { SchemaProps: spec.SchemaProps{ - Description: "TerminationPolicy controls the delete operation for database", + Description: "DeletionPolicy controls the delete operation for database", Type: []string{"string"}, Format: "", }, diff --git a/vendor/kubedb.dev/apimachinery/crds/kubedb.com_etcds.yaml b/vendor/kubedb.dev/apimachinery/crds/kubedb.com_etcds.yaml index 2f93dee89..55f5741d0 100644 --- a/vendor/kubedb.dev/apimachinery/crds/kubedb.com_etcds.yaml +++ b/vendor/kubedb.dev/apimachinery/crds/kubedb.com_etcds.yaml @@ -57,6 +57,13 @@ spec: type: string type: object x-kubernetes-map-type: atomic + deletionPolicy: + enum: + - Halt + - Delete + - WipeOut + - DoNotTerminate + type: string halted: type: boolean init: @@ -4064,13 +4071,6 @@ spec: - Durable - Ephemeral type: string - terminationPolicy: - enum: - - Halt - - Delete - - WipeOut - - DoNotTerminate - type: string tls: properties: member: diff --git a/vendor/kubedb.dev/apimachinery/crds/ops.kubedb.com_solropsrequests.yaml b/vendor/kubedb.dev/apimachinery/crds/ops.kubedb.com_solropsrequests.yaml index 0a67ea29d..71b048e34 100644 --- a/vendor/kubedb.dev/apimachinery/crds/ops.kubedb.com_solropsrequests.yaml +++ b/vendor/kubedb.dev/apimachinery/crds/ops.kubedb.com_solropsrequests.yaml @@ -61,8 +61,231 @@ spec: type: string type: enum: + - VerticalScaling + - VolumeExpansion - Restart type: string + verticalScaling: + properties: + coordinator: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + data: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + node: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + overseer: + properties: + nodeSelectionPolicy: + type: string + resources: + properties: + claims: + items: + properties: + name: + type: string + required: + - name + type: object + type: array + x-kubernetes-list-map-keys: + - name + x-kubernetes-list-type: map + limits: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + requests: + additionalProperties: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + type: object + type: object + topology: + properties: + key: + type: string + value: + type: string + required: + - key + - value + type: object + type: object + type: object + volumeExpansion: + properties: + coordinator: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + data: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + mode: + enum: + - Offline + - Online + type: string + node: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + overseer: + anyOf: + - type: integer + - type: string + pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ + x-kubernetes-int-or-string: true + required: + - mode + type: object required: - databaseRef - type diff --git a/vendor/modules.txt b/vendor/modules.txt index 266a6a33e..2c41cf6d3 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1110,8 +1110,8 @@ go.opentelemetry.io/otel/internal/attribute ## explicit; go 1.21 go.opentelemetry.io/otel/trace go.opentelemetry.io/otel/trace/embedded -# golang.org/x/crypto v0.24.0 -## explicit; go 1.18 +# golang.org/x/crypto v0.25.0 +## explicit; go 1.20 golang.org/x/crypto/md4 golang.org/x/crypto/ocsp golang.org/x/crypto/pbkdf2 @@ -1119,7 +1119,7 @@ golang.org/x/crypto/scrypt # golang.org/x/exp v0.0.0-20240506185415-9bf2ced13842 ## explicit; go 1.20 golang.org/x/exp/maps -# golang.org/x/net v0.26.0 +# golang.org/x/net v0.27.0 ## explicit; go 1.18 golang.org/x/net/http/httpguts golang.org/x/net/http2 @@ -1136,13 +1136,13 @@ golang.org/x/oauth2/internal ## explicit; go 1.18 golang.org/x/sync/errgroup golang.org/x/sync/singleflight -# golang.org/x/sys v0.21.0 +# golang.org/x/sys v0.22.0 ## explicit; go 1.18 golang.org/x/sys/cpu golang.org/x/sys/plan9 golang.org/x/sys/unix golang.org/x/sys/windows -# golang.org/x/term v0.21.0 +# golang.org/x/term v0.22.0 ## explicit; go 1.18 golang.org/x/term # golang.org/x/text v0.16.0 @@ -1552,7 +1552,7 @@ kmodules.xyz/offshoot-api/api/v1 kmodules.xyz/offshoot-api/api/v1/conversion kmodules.xyz/offshoot-api/api/v2 kmodules.xyz/offshoot-api/util -# kubedb.dev/apimachinery v0.47.0-rc.1 +# kubedb.dev/apimachinery v0.47.0-rc.1.0.20240717082707-f8438b7e77c7 ## explicit; go 1.22.1 kubedb.dev/apimachinery/apis kubedb.dev/apimachinery/apis/catalog