Skip to content

Commit

Permalink
MSSQL -> MSSQLServer
Browse files Browse the repository at this point in the history
Signed-off-by: Arnob kumar saha <[email protected]>
  • Loading branch information
ArnobKumarSaha committed Apr 26, 2024
1 parent 8638376 commit 9515ec0
Show file tree
Hide file tree
Showing 36 changed files with 11,794 additions and 16,971 deletions.
4 changes: 2 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ require (
k8s.io/klog/v2 v2.120.1
kmodules.xyz/client-go v0.29.13
kmodules.xyz/custom-resources v0.29.1
kubedb.dev/apimachinery v0.44.1-0.20240426055822-7fb3d5619cd2
kubedb.dev/apimachinery v0.44.1-0.20240426133114-c659e5cc168e
sigs.k8s.io/controller-runtime v0.17.2
xorm.io/xorm v1.3.6
)
Expand Down Expand Up @@ -126,7 +126,7 @@ require (
k8s.io/utils v0.0.0-20240102154912-e7106e64919e // indirect
kmodules.xyz/apiversion v0.2.0 // indirect
kmodules.xyz/monitoring-agent-api v0.29.0 // indirect
kmodules.xyz/offshoot-api v0.29.1 // indirect
kmodules.xyz/offshoot-api v0.29.2 // indirect
kubeops.dev/petset v0.0.5 // indirect
modernc.org/memory v1.5.0 // indirect
modernc.org/token v1.1.0 // indirect
Expand Down
8 changes: 4 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -607,10 +607,10 @@ kmodules.xyz/custom-resources v0.29.1 h1:xiNylhs3ILRbcUhxxy306AOy9GMA4Mq7xFIptZK
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/offshoot-api v0.29.1 h1:Pm83nzYHbqfCYKPCHrK0io387yXTaBmSydoAP6nF0WU=
kmodules.xyz/offshoot-api v0.29.1/go.mod h1:SeGhKGXxNAy56cLnskEcLgCH+LRFN+MhJzvrZzPqUlM=
kubedb.dev/apimachinery v0.44.1-0.20240426055822-7fb3d5619cd2 h1:Mv6PlqBRD3YimORjoC8f2VqGFNfGFgFHrmlpsNfZcug=
kubedb.dev/apimachinery v0.44.1-0.20240426055822-7fb3d5619cd2/go.mod h1:0uGwbmD4XN00LeU236LLOgoocK+UBoB9ojdstnZeJd8=
kmodules.xyz/offshoot-api v0.29.2 h1:akXmvkNqFz1n9p1STVs9iP7ODYET0S7BhcYCMXEjK4A=
kmodules.xyz/offshoot-api v0.29.2/go.mod h1:Wv7Xo8wbvznI+8bhaylRFHFjkt30xRDOUOnqV8kOAxM=
kubedb.dev/apimachinery v0.44.1-0.20240426133114-c659e5cc168e h1:a4GFtNZfMBdDBn4fXprPc0sejKFXK+CkzXweNq9O1y8=
kubedb.dev/apimachinery v0.44.1-0.20240426133114-c659e5cc168e/go.mod h1:mVmsjSF2KmJzFrIx0rZo9KWee/zUcYmw8OqgcuvR2TA=
kubeops.dev/petset v0.0.5 h1:VVXi39JhjondlbHyZ98z0MLp6VCmiCMinL59K48Y2zA=
kubeops.dev/petset v0.0.5/go.mod h1:ijtKT1HlAht2vBEZj5LW7C00XEs3B0d1VdCQgd5V4cA=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
Expand Down
6 changes: 3 additions & 3 deletions mssql/kubedb_client_builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ import (

type KubeDBClientBuilder struct {
kc client.Client
db *api.MSSQL
db *api.MSSQLServer
url string
podName string
ctx context.Context
}

func NewKubeDBClientBuilder(kc client.Client, db *api.MSSQL) *KubeDBClientBuilder {
func NewKubeDBClientBuilder(kc client.Client, db *api.MSSQLServer) *KubeDBClientBuilder {
return &KubeDBClientBuilder{
kc: kc,
db: db,
Expand Down Expand Up @@ -67,7 +67,7 @@ func (o *KubeDBClientBuilder) GetMSSQLXormClient() (*XormClient, error) {
return nil, err
}

engine, err := xorm.NewEngine(api.ResourceSingularMSSQL, connector)
engine, err := xorm.NewEngine(api.ResourceSingularMSSQLServer, connector)
if err != nil {
return nil, err
}
Expand Down
33 changes: 1 addition & 32 deletions vendor/kmodules.xyz/offshoot-api/api/v2/openapi_generated.go

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

13 changes: 0 additions & 13 deletions vendor/kmodules.xyz/offshoot-api/api/v2/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -161,9 +161,6 @@ type PodSpec struct {
// +patchMergeKey=name
// +patchStrategy=merge
ImagePullSecrets []core.LocalObjectReference `json:"imagePullSecrets,omitempty" patchStrategy:"merge" patchMergeKey:"name"`
// If specified, the pod's scheduling constraints
// +optional
Affinity *core.Affinity `json:"affinity,omitempty"`
// If specified, the pod will be dispatched by specified scheduler.
// If not specified, the pod will be dispatched by default scheduler.
// +optional
Expand Down Expand Up @@ -229,16 +226,6 @@ type PodSpec struct {
// More info: https://git.k8s.io/enhancements/keps/sig-node/688-pod-overhead/README.md
// +optional
Overhead core.ResourceList `json:"overhead,omitempty"`
// TopologySpreadConstraints describes how a group of pods ought to spread across topology
// domains. Scheduler will schedule pods in a way which abides by the constraints.
// All topologySpreadConstraints are ANDed.
// +optional
// +patchMergeKey=topologyKey
// +patchStrategy=merge
// +listType=map
// +listMapKey=topologyKey
// +listMapKey=whenUnsatisfiable
TopologySpreadConstraints []core.TopologySpreadConstraint `json:"topologySpreadConstraints,omitempty" patchStrategy:"merge" patchMergeKey:"topologyKey"`
// If true the pod's hostname will be configured as the pod's FQDN, rather than the leaf name (the default).
// In Linux containers, this means setting the FQDN in the hostname field of the kernel (the nodename field of struct utsname).
// In Windows containers, this means setting the registry value of hostname for the registry key HKEY_LOCAL_MACHINE\\SYSTEM\\CurrentControlSet\\Services\\Tcpip\\Parameters to FQDN.
Expand Down
12 changes: 0 additions & 12 deletions vendor/kmodules.xyz/offshoot-api/api/v2/zz_generated.deepcopy.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 @@ -26,35 +26,35 @@ import (
"kmodules.xyz/client-go/apiextensions"
)

func (m MSSQLVersion) CustomResourceDefinition() *apiextensions.CustomResourceDefinition {
return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralMSSQLVersion))
func (m MSSQLServerVersion) CustomResourceDefinition() *apiextensions.CustomResourceDefinition {
return crds.MustCustomResourceDefinition(SchemeGroupVersion.WithResource(ResourcePluralMSSQLServerVersion))
}

var _ apis.ResourceInfo = &MSSQLVersion{}
var _ apis.ResourceInfo = &MSSQLServerVersion{}

func (m MSSQLVersion) ResourceFQN() string {
return fmt.Sprintf("%s.%s", ResourcePluralMSSQLVersion, catalog.GroupName)
func (m MSSQLServerVersion) ResourceFQN() string {
return fmt.Sprintf("%s.%s", ResourcePluralMSSQLServerVersion, catalog.GroupName)
}

func (m MSSQLVersion) ResourceShortCode() string {
return ResourceCodeMSSQLVersion
func (m MSSQLServerVersion) ResourceShortCode() string {
return ResourceCodeMSSQLServerVersion
}

func (m MSSQLVersion) ResourceKind() string {
return ResourceKindMSSQLVersion
func (m MSSQLServerVersion) ResourceKind() string {
return ResourceKindMSSQLServerVersion
}

func (m MSSQLVersion) ResourceSingular() string {
return ResourceSingularMSSQLVersion
func (m MSSQLServerVersion) ResourceSingular() string {
return ResourceSingularMSSQLServerVersion
}

func (m MSSQLVersion) ResourcePlural() string {
return ResourcePluralMSSQLVersion
func (m MSSQLServerVersion) ResourcePlural() string {
return ResourcePluralMSSQLServerVersion
}

func (m MSSQLVersion) ValidateSpecs() error {
func (m MSSQLServerVersion) ValidateSpecs() error {
if m.Spec.Version == "" || m.Spec.DB.Image == "" || m.Spec.Coordinator.Image == "" {
return fmt.Errorf(`at least one of the following specs is not set for MSSQLVersion "%v":
return fmt.Errorf(`at least one of the following specs is not set for MSSQLServerVersion "%v":
spec.version,
spec.coordinator.image,
spec.initContainer.image`, m.Name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ import (
)

const (
ResourceCodeMSSQLVersion = "msversion"
ResourceKindMSSQLVersion = "MSSQLVersion"
ResourceSingularMSSQLVersion = "mssqlversion"
ResourcePluralMSSQLVersion = "mssqlversions"
ResourceCodeMSSQLServerVersion = "msversion"
ResourceKindMSSQLServerVersion = "MSSQLServerVersion"
ResourceSingularMSSQLServerVersion = "mssqlserverversion"
ResourcePluralMSSQLServerVersion = "mssqlserverversions"
)

// +genclient
Expand All @@ -35,28 +35,28 @@ const (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=mssqlversions,singular=mssqlversion,scope=Cluster,shortName=msversion,categories={datastore,kubedb,appscode}
// +kubebuilder:resource:path=mssqlserverversions,singular=mssqlserverversion,scope=Cluster,shortName=msversion,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"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type MSSQLVersion struct {
type MSSQLServerVersion struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec MSSQLVersionSpec `json:"spec,omitempty"`
Spec MSSQLServerVersionSpec `json:"spec,omitempty"`
}

// MSSQLVersionSpec defines the desired state of MSSQL Version
type MSSQLVersionSpec struct {
// MSSQLServerVersionSpec defines the desired state of MSSQLServer Version
type MSSQLServerVersionSpec struct {
// Version
Version string `json:"version"`
// Database Image
DB MSSQLVersionDatabase `json:"db"`
DB MSSQLServerDatabase `json:"db"`
// Coordinator Image
// +optional
Coordinator MSSQLCoordinator `json:"coordinator,omitempty"`
Coordinator MSSQLServerCoordinator `json:"coordinator,omitempty"`
// Init container Image
InitContainer MSSQLInitContainer `json:"initContainer"`
InitContainer MSSQLServerInitContainer `json:"initContainer"`
// Deprecated versions usable but regarded as obsolete and best avoided, typically due to having been superseded.
// +optional
Deprecated bool `json:"deprecated,omitempty"`
Expand All @@ -70,37 +70,26 @@ type MSSQLVersionSpec struct {
UpdateConstraints UpdateConstraints `json:"updateConstraints,omitempty"`
}

// MSSQLVersionDatabase is the MSSQL Database image
type MSSQLVersionDatabase struct {
// MSSQLServerDatabase is the MSSQLServer Database image
type MSSQLServerDatabase struct {
Image string `json:"image"`
}

// MSSQLCoordinator is the MSSQL coordinator Container image
type MSSQLCoordinator struct {
// MSSQLServerCoordinator is the MSSQLServer coordinator Container image
type MSSQLServerCoordinator struct {
Image string `json:"image"`
}

// MSSQLInitContainer is the MSSQL Container initializer
type MSSQLInitContainer struct {
// MSSQLServerInitContainer is the MSSQLServer Container initializer
type MSSQLServerInitContainer struct {
Image string `json:"image"`
}

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

// MSSQLSecurityContext is for additional configuration for the MSSQL database container
type MSSQLSecurityContext struct {
RunAsUser *int64 `json:"runAsUser,omitempty"`
RunAsGroup *int64 `json:"runAsGroup,omitempty"`
}

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

// MSSQLVersionList contains a list of MSSQLVersion
type MSSQLVersionList struct {
// MSSQLServerVersionList contains a list of MSSQLServerVersion
type MSSQLServerVersionList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []MSSQLVersion `json:"items"`
Items []MSSQLServerVersion `json:"items"`
}
Loading

0 comments on commit 9515ec0

Please sign in to comment.