Skip to content

Commit

Permalink
Add Singlestore API from Apimachinery
Browse files Browse the repository at this point in the history
Signed-off-by: ashraful <[email protected]>
  • Loading branch information
AshrafulHaqueToni committed Jan 16, 2024
1 parent 4f883a2 commit 9e2486b
Show file tree
Hide file tree
Showing 29 changed files with 13,709 additions and 815 deletions.
5 changes: 2 additions & 3 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,8 @@ require (
go.mongodb.org/mongo-driver v1.10.2
k8s.io/api v0.29.0
k8s.io/klog/v2 v2.110.1
kmodules.xyz/client-go v0.29.4
kubedb.dev/apimachinery v0.40.1-0.20240101000103-032b27211164
kubedb.dev/singlestore v0.0.0-20231229114848-09611a2eb558
kmodules.xyz/client-go v0.29.6
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240115173822-556a36dfe734
sigs.k8s.io/controller-runtime v0.16.3
xorm.io/xorm v1.3.6
)
Expand Down
10 changes: 4 additions & 6 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -517,18 +517,16 @@ k8s.io/utils v0.0.0-20231127182322-b307cd553661 h1:FepOBzJ0GXm8t0su67ln2wAZjbQ6R
k8s.io/utils v0.0.0-20231127182322-b307cd553661/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0=
kmodules.xyz/apiversion v0.2.0 h1:vAQYqZFm4xu4pbB1cAdHbFEPES6EQkcR4wc06xdTOWk=
kmodules.xyz/apiversion v0.2.0/go.mod h1:oPX8g8LvlPdPX3Yc5YvCzJHQnw3YF/X4/jdW0b1am80=
kmodules.xyz/client-go v0.29.4 h1:WW4vlYtzLc9JXrJjcFuJO4DX/kIZ5ia7QtDyhNDUwfI=
kmodules.xyz/client-go v0.29.4/go.mod h1:xWlS/1zWkx1sIKCAkzULy9570mHZYi2exDECEoP1ek4=
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/monitoring-agent-api v0.29.0 h1:gpFl6OZrlMLb/ySMHdREI9EwGtnJ91oZBn9H1UFRwB4=
kmodules.xyz/monitoring-agent-api v0.29.0/go.mod h1:iNbvaMTgVFOI5q2LJtGK91j4Dmjv4ZRiRdasGmWLKQI=
kmodules.xyz/offshoot-api v0.29.0 h1:GHLhxxT9jU1N8+FvOCCeJNyU5g0duYS46UGrs6AHNLY=
kmodules.xyz/offshoot-api v0.29.0/go.mod h1:5NxhBblXoDHWStx9HCDJR2KFTwYjEZ7i1Id3jelIunw=
kubedb.dev/apimachinery v0.40.1-0.20240101000103-032b27211164 h1:EQSWdD4JNJx/nqp0sP0eUJ4JXgEDiy1Y4W9bQqvCERM=
kubedb.dev/apimachinery v0.40.1-0.20240101000103-032b27211164/go.mod h1:xg6q1DCjO24xgMuZ9h2zPgdfo+vGxrE6fJfeTsAbZVc=
kubedb.dev/singlestore v0.0.0-20231229114848-09611a2eb558 h1:tq4aNnE10Zt6TLbM8b40NwZYLT/PxH+KZVSv4DCjJYA=
kubedb.dev/singlestore v0.0.0-20231229114848-09611a2eb558/go.mod h1:wUVx8gUHT8LyOV7IDMrUkwEA0MDVuP+IXtrelIIfsO0=
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240115173822-556a36dfe734 h1:o9vbQDfONuHUblmemfFrjt+bLvvN2rdQJk564i8IChc=
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240115173822-556a36dfe734/go.mod h1:K49m/e80L1K/oJSMcaIDBTPCbzCpq5wU/o7sWOx81m0=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
lukechampine.com/uint128 v1.2.0 h1:mBi/5l91vocEN8otkC5bDLhi2KdCticRiwbdB0O+rjI=
lukechampine.com/uint128 v1.2.0/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
Expand Down
16 changes: 16 additions & 0 deletions singlestore/client.go
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
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 singlestore

import (
Expand Down
21 changes: 18 additions & 3 deletions singlestore/kubedb_client_builder.go
Original file line number Diff line number Diff line change
@@ -1,13 +1,30 @@
/*
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 singlestore

import (
"context"
"database/sql"
"fmt"

_ "github.com/go-sql-driver/mysql"
core "k8s.io/api/core/v1"
"k8s.io/klog/v2"
api "kubedb.dev/singlestore/api/v1alpha2"
api "kubedb.dev/apimachinery/apis/kubedb/v1alpha2"
"sigs.k8s.io/controller-runtime/pkg/client"
"xorm.io/xorm"
)
Expand Down Expand Up @@ -75,11 +92,9 @@ func (o *KubeDBClientBuilder) GetSinglestoreXormClient() (*XormClient, error) {
o.ctx = context.Background()
}
connector, err := o.getConnectionString()
klog.Infoln("-----------connector: ", connector)
if err != nil {
return nil, err
}
//klog.Infoln("------------ hi--------------------")
engine, err := xorm.NewEngine("mysql", connector)
if err != nil {
return nil, err
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ type MongoDBVersionSpec struct {
GitSyncer GitSyncer `json:"gitSyncer,omitempty"`
// SecurityContext is for the additional config for the DB container
// +optional
SecurityContext SecurityContext `json:"securityContext"`
SecurityContext MongoDBSecurityContext `json:"securityContext"`
// Archiver defines the walg & kube-stash-addon related specifications
Archiver ArchiverSpec `json:"archiver,omitempty"`
}
Expand All @@ -102,6 +102,15 @@ type MongoDBVersionPodSecurityPolicy struct {
DatabasePolicyName string `json:"databasePolicyName"`
}

// MongoDBSecurityContext provides additional securityContext settings for the MongoDBSecurityContext Image
type MongoDBSecurityContext struct {
// RunAsUser is default UID for the DB container.
RunAsUser *int64 `json:"runAsUser,omitempty"`

// RunAsGroup is default GID for the DB container.
RunAsGroup *int64 `json:"runAsGroup,omitempty"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// MongoDBVersionList is a list of MongoDBVersions
Expand Down
Loading

0 comments on commit 9e2486b

Please sign in to comment.