Skip to content

Commit

Permalink
Remove unnecessary apis for singlestore (#1117)
Browse files Browse the repository at this point in the history
Signed-off-by: ashraful <ashraf@appscode.com>
Co-authored-by: raihankhan <raihan@appscode.com>
  • Loading branch information
AshrafulHaqueToni and raihankhan authored Jan 19, 2024
1 parent 6e98cd4 commit e78c6ff
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 202 deletions.
31 changes: 1 addition & 30 deletions apis/catalog/v1alpha1/openapi_generated.go

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

8 changes: 0 additions & 8 deletions apis/catalog/v1alpha1/singlestore_version_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,6 @@ type SinglestoreVersionSpec struct {
// Deprecated versions usable but regarded as obsolete and best avoided, typically due to having been superseded.
// +optional
Deprecated bool `json:"deprecated,omitempty"`
// PSP names
// +optional
PodSecurityPolicies SinglestoreVersionPodSecurityPolicy `json:"podSecurityPolicies"`
// Stash defines backup and restore task definitions.
// +optional
Stash appcat.StashAddonSpec `json:"stash,omitempty"`
Expand Down Expand Up @@ -100,11 +97,6 @@ type SinglestoreInitContainer struct {
Image string `json:"image"`
}

// SinglestoreVersionPodSecurityPolicy is the Singlestore pod security policies
type SinglestoreVersionPodSecurityPolicy struct {
DatabasePolicyName string `json:"databasePolicyName"`
}

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

// SinglestoreVersionList contains a list of SinglestoreVersions
Expand Down
17 changes: 0 additions & 17 deletions apis/catalog/v1alpha1/zz_generated.deepcopy.go

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

32 changes: 18 additions & 14 deletions apis/kubedb/v1alpha2/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,20 +322,24 @@ const (
MariaDBDataVolumeName = "data"

// =========================== SingleStore Constants ============================
SinglestoreDatabasePortName = "db"
SinglestorePrimaryServicePortName = "primary"
SinglestoreDatabasePort = 3306
SinglestoreRootUserName = "ROOT_USERNAME"
SinglestoreRootPassword = "ROOT_PASSWORD"
SinglestoreRootUser = "root"
DatabasePodMaster = "Master"
DatabasePodAggregator = "Aggregator"
DatabasePodLeaf = "Leaf"
StatefulSetTypeMasterAggregator = "master-aggregator"
StatefulSetTypeLeaf = "leaf"
SinglestoreCoordinatorContainerName = "singlestore-coordinator"
SinglestoreContainerName = "singlestore"
SinglestoreInitContainerName = "singlestore-init"
SinglestoreDatabasePortName = "db"
SinglestorePrimaryServicePortName = "primary"
SinglestoreDatabasePort = 3306
SinglestoreRootUserName = "ROOT_USERNAME"
SinglestoreRootPassword = "ROOT_PASSWORD"
SinglestoreRootUser = "root"
DatabasePodMaster = "Master"
DatabasePodAggregator = "Aggregator"
DatabasePodLeaf = "Leaf"
StatefulSetTypeMasterAggregator = "master-aggregator"
StatefulSetTypeLeaf = "leaf"
SinglestoreDatabaseHealth = "singlestore_health"
SinglestoreTableHealth = "singlestore_health_table"

SinglestoreCoordinatorContainerName = "singlestore-coordinator"
SinglestoreContainerName = "singlestore"
SinglestoreInitContainerName = "singlestore-init"

SinglestoreVolumeNameUserInitScript = "initial-script"
SinglestoreVolumeMountPathUserInitScript = "/docker-entrypoint-initdb.d"
SinglestoreVolumeNameCustomConfig = "custom-config"
Expand Down
44 changes: 1 addition & 43 deletions apis/kubedb/v1alpha2/openapi_generated.go

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

15 changes: 0 additions & 15 deletions apis/kubedb/v1alpha2/singlestore_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ type SinglestoreSpec struct {
// To enable ssl for http layer
EnableSSL bool `json:"enableSSL,omitempty"`

// disable security. It disables authentication security of user.
// If unset, default is false
// +optional
DisableSecurity bool `json:"disableSecurity,omitempty"`

// Init is used to initialize database
// +optional
Init *InitSpec `json:"init,omitempty"`
Expand Down Expand Up @@ -142,16 +137,6 @@ type SinglestoreNode struct {
// PodTemplate is an optional configuration for pods used to expose database
// +optional
PodTemplate *ofst.PodTemplateSpec `json:"podTemplate,omitempty"`

// NodeSelector is a selector which must be true for the pod to fit on a node.
// Selector which must match a node's labels for the pod to be scheduled on that node.
// More info: https://kubernetes.io/docs/concepts/configuration/assign-pod-node/
// +optional
// +mapType=atomic
NodeSelector map[string]string `json:"nodeSelector,omitempty"`
// If specified, the pod's tolerations.
// +optional
Tolerations []core.Toleration `json:"tolerations,omitempty"`
}

// SinglestoreStatus defines the observed state of Singlestore
Expand Down
23 changes: 13 additions & 10 deletions apis/kubedb/v1alpha2/singlestore_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ limitations under the License.
package v1alpha2

import (
"context"

catalog "kubedb.dev/apimachinery/apis/catalog/v1alpha1"

"github.com/pkg/errors"
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"
Expand Down Expand Up @@ -218,10 +223,6 @@ func (s *Singlestore) ValidateCreateOrUpdate() field.ErrorList {
return allErr
}

var sdbAvailableVersions = []string{
"8.1.32",
}

// reserved volume and volumes mounts for singlestore
var sdbReservedVolumes = []string{
SinglestoreVolumeNameUserInitScript,
Expand All @@ -238,13 +239,15 @@ var sdbReservedVolumesMountPaths = []string{
}

func sdbValidateVersion(s *Singlestore) error {
version := s.Spec.Version
for _, v := range sdbAvailableVersions {
if v == version {
return nil
}
var sdbVersion catalog.SinglestoreVersion
err := DefaultClient.Get(context.TODO(), types.NamespacedName{
Name: s.Spec.Version,
}, &sdbVersion)
if err != nil {
return errors.New("version not supported")
}
return errors.New("version not supported")

return nil
}

func sdbValidateVolumes(podTemplate *ofst.PodTemplateSpec) error {
Expand Down
14 changes: 0 additions & 14 deletions apis/kubedb/v1alpha2/zz_generated.deepcopy.go

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

7 changes: 0 additions & 7 deletions crds/catalog.kubedb.com_singlestoreversions.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,6 @@ spec:
required:
- image
type: object
podSecurityPolicies:
properties:
databasePolicyName:
type: string
required:
- databasePolicyName
type: object
securityContext:
properties:
runAsGroup:
Expand Down
Loading

0 comments on commit e78c6ff

Please sign in to comment.