Skip to content

Commit

Permalink
Update go mod
Browse files Browse the repository at this point in the history
Signed-off-by: Sabbir <[email protected]>
  • Loading branch information
sabbir-hossain70 committed Sep 6, 2024
1 parent b244a33 commit 1fb863f
Show file tree
Hide file tree
Showing 17 changed files with 432 additions and 65 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ require (
k8s.io/klog/v2 v2.130.1
kmodules.xyz/client-go v0.30.13
kmodules.xyz/custom-resources v0.30.0
kubedb.dev/apimachinery v0.47.1-0.20240822044956-3da387889ca5
kubedb.dev/apimachinery v0.47.1-0.20240905094616-0f3ede79a000
sigs.k8s.io/controller-runtime v0.18.4
xorm.io/xorm v1.3.6
)
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -802,8 +802,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.1-0.20240822044956-3da387889ca5 h1:+gfLsub9ZyzO9XSydpELJPz1WUsp1rjAR6p2JF3b34k=
kubedb.dev/apimachinery v0.47.1-0.20240822044956-3da387889ca5/go.mod h1:VSzi3IpellQ8ZqtEu3FokfN6siZdG2AB87wPXv9Xh54=
kubedb.dev/apimachinery v0.47.1-0.20240905094616-0f3ede79a000 h1:eU5wtcyAPXJpGqiJ7yWrYBFoT4QsGT5t95bCE56w/os=
kubedb.dev/apimachinery v0.47.1-0.20240905094616-0f3ede79a000/go.mod h1:iD6XKg9Blvfd9iYEO0N9GKiSz6r+yzEPZnfkYdESNG4=
kubeops.dev/petset v0.0.5-0.20240603165102-e2d9decb8abe h1:uWyps3VIDFwGuL0yQa0eMGaLg4ofVwpy59U14Trxnz8=
kubeops.dev/petset v0.0.5-0.20240603165102-e2d9decb8abe/go.mod h1:A15vh0r979NsvL65DTIZKWsa/NoX9VapHBAEw1ZsdYI=
lukechampine.com/uint128 v1.1.1/go.mod h1:c4eWIwlEGaxC/+H1VguhU4PHXNWDCDMUlWdIWl2j1gk=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ import (
)

const (
ResourceCodeCassandraVersion = "csversion"
ResourceCodeCassandraVersion = "casversion"
ResourceKindCassandraVersion = "CassandraVersion"
ResourceSingularCassandraVersion = "cassandraversion"
ResourcePluralCassandraVersion = "cassandraversions"
Expand All @@ -36,7 +36,7 @@ const (
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=cassandraversions,singular=cassandraversion,scope=Cluster,shortName=csversion,categories={catalog,kubedb,appscode}
// +kubebuilder:resource:path=cassandraversions,singular=cassandraversion,scope=Cluster,shortName=casversion,categories={catalog,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
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ type MemcachedVersionSpec struct {
Deprecated bool `json:"deprecated,omitempty"`
// PSP names
PodSecurityPolicies MemcachedVersionPodSecurityPolicy `json:"podSecurityPolicies"`
// update constraints
UpdateConstraints UpdateConstraints `json:"updateConstraints,omitempty"`
// SecurityContext is for the additional config for the DB container
// +optional
SecurityContext SecurityContext `json:"securityContext"`
Expand Down

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

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

42 changes: 41 additions & 1 deletion vendor/kubedb.dev/apimachinery/apis/kubedb/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1348,14 +1348,54 @@ const (
// =========================== Cassandra Constants ============================

const (
CassandraNativeTCP = 9042
CassandraNativeTcpPort = 9042
CassandraInterNodePort = 7000
CassandraJmxPort = 7199

CassandraUserAdmin = "admin"

CassandraOperatorConfigDir = "/tmp/config/operator-config"
CassandraMainConfigDir = "/etc/cassandra"
CassandraCustomConfigDir = "/tmp/config/custom-config"
CassandraScriptDir = "/tmp/sc"

CassandraVolumeOperatorConfig = "operator-config-volume"
CassandraVolumeMainConfig = "main-config-volume"
CassandraVolumeCustomConfig = "custom-config"
CassandraVolumeScript = "script-volume"

CassandraVolumeData = "data"
CassandraDataDir = "/var/lib/cassandra"
CassandraServerLogDir = "var/log/cassandra-server/cassandra-server.log"
CassandraServerErrorLogDir = "var/log/cassandra-server/cassandra-server.err.log"
CassandraContainerName = "cassandra"
CassandraInitContainerName = "cassandra-init"
CassandraMainConfigFile = "cassandra.yaml"
CassandraRackConfigFile = "rack-config.yaml"
CassandraStandalone = "standalone"
CassandraServerConfigFile = "server-config.yaml"

EnvNameCassandraEndpointSnitch = "CASSANDRA_ENDPOINT_SNITCH"
EnvValCassandraEndpointSnitch = "GossipingPropertyFileSnitch"

EnvNameCassandraRack = "CASSANDRA_RACK"
EnvNameCassandraPodNamespace = "CASSANDRA_POD_NAMESPACE"
EnvNameCassandraService = "CASSANDRA_SERVICE"
EnvNameCassandraMaxHeapSize = "MAX_HEAP_SIZE"
EnvValCassandraMaxHeapSize = "512M"
EnvNameCassandraHeapNewSize = "HEAP_NEWSIZE"
EnvValCassandraHeapNewSize = "100M"
EnvNameCassandraListenAddress = "CASSANDRA_LISTEN_ADDRESS"
EnvNameCassandraBroadcastAddress = "CASSANDRA_BROADCAST_ADDRESS"
EnvNameCassandraRpcAddress = "CASSANDRA_RPC_ADDRESS"
EnvValCassandraRpcAddress = "0.0.0.0"
EnvNameCassandraNumTokens = "CASSANDRA_NUM_TOKENS"
EnvValCassandraNumTokens = "256"
EnvNameCassandraStartRpc = "CASSANDRA_START_RPC"
EnvNameCassandraSeeds = "CASSANDRA_SEEDS"
EnvNameCassandraPodName = "CASSANDRA_POD_NAME"
EnvNameCassandraUser = "CASSANDRA_USER"
EnvNameCassandraPassword = "CASSANDRA_PASSWORD"
)

// Resource kind related constants
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import (

"gomodules.xyz/pointer"
core "k8s.io/api/core/v1"
"k8s.io/api/resource/v1alpha2"
meta "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/types"
"k8s.io/klog/v2"
Expand Down Expand Up @@ -63,7 +62,7 @@ func (r CassandraApp) Type() appcat.AppType {

// Owner returns owner reference to resources
func (r *Cassandra) Owner() *meta.OwnerReference {
return meta.NewControllerRef(r, v1alpha2.SchemeGroupVersion.WithKind(r.ResourceKind()))
return meta.NewControllerRef(r, SchemeGroupVersion.WithKind(r.ResourceKind()))
}

func (r *Cassandra) ResourceKind() string {
Expand Down Expand Up @@ -181,7 +180,7 @@ func (r *Cassandra) GetConnectionScheme() string {

func (r *Cassandra) SetHealthCheckerDefaults() {
if r.Spec.HealthChecker.PeriodSeconds == nil {
r.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
r.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(60)
}
if r.Spec.HealthChecker.TimeoutSeconds == nil {
r.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
Expand All @@ -200,10 +199,26 @@ func (r *Cassandra) ResourceSingular() string {
}

func (r *Cassandra) SetDefaults() {
var csVersion catalog.CassandraVersion
if r.Spec.DeletionPolicy == "" {
r.Spec.DeletionPolicy = TerminationPolicyDelete
}

if !r.Spec.DisableSecurity {
if r.Spec.AuthSecret == nil {
r.Spec.AuthSecret = &SecretReference{
LocalObjectReference: core.LocalObjectReference{
Name: r.DefaultUserCredSecretName(kubedb.CassandraUserAdmin),
},
ExternallyManaged: false,
}
}

}

var casVersion catalog.CassandraVersion
err := DefaultClient.Get(context.TODO(), types.NamespacedName{
Name: r.Spec.Version,
}, &csVersion)
}, &casVersion)
if err != nil {
klog.Errorf("can't get the cassandra version object %s for %s \n", err.Error(), r.Spec.Version)
return
Expand Down Expand Up @@ -238,25 +253,22 @@ func (r *Cassandra) SetDefaults() {
if dbContainer != nil && (dbContainer.Resources.Requests == nil && dbContainer.Resources.Limits == nil) {
apis.SetDefaultResourceLimits(&dbContainer.Resources, kubedb.DefaultResources)
}
r.setDefaultContainerSecurityContext(&csVersion, rack.PodTemplate)
r.setDefaultContainerSecurityContext(&casVersion, rack.PodTemplate)
racks[index] = rack
}
r.Spec.Topology.Rack = racks
} else {
if r.Spec.Replicas == nil {
r.Spec.Replicas = pointer.Int32P(1)
}
if r.Spec.DeletionPolicy == "" {
r.Spec.DeletionPolicy = TerminationPolicyDelete
}
if r.Spec.StorageType == "" {
r.Spec.StorageType = StorageTypeDurable
}

if r.Spec.PodTemplate == nil {
r.Spec.PodTemplate = &ofst.PodTemplateSpec{}
}
r.setDefaultContainerSecurityContext(&csVersion, r.Spec.PodTemplate)
r.setDefaultContainerSecurityContext(&casVersion, r.Spec.PodTemplate)
dbContainer := coreutil.GetContainerByName(r.Spec.PodTemplate.Spec.Containers, kubedb.CassandraContainerName)
if dbContainer != nil && (dbContainer.Resources.Requests == nil && dbContainer.Resources.Limits == nil) {
apis.SetDefaultResourceLimits(&dbContainer.Resources, kubedb.DefaultResources)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const (
ResourceKindCassandra = "Cassandra"
ResourceSingularCassandra = "cassandra"
ResourcePluralCassandra = "cassandras"
ResourceCodeCassandra = "cs"
ResourceCodeCassandra = "cas"
)

// +genclient
Expand All @@ -36,7 +36,7 @@ const (

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:path=cassandras,singular=cassandra,shortName=cs,categories={datastore,kubedb,appscode,all}
// +kubebuilder:resource:path=cassandras,singular=cassandra,shortName=cas,categories={datastore,kubedb,appscode,all}
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".apiVersion"
// +kubebuilder:printcolumn:name="Version",type="string",JSONPath=".spec.version"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase"
Expand All @@ -54,11 +54,11 @@ type CassandraSpec struct {
// Version of Cassandra to be deployed.
Version string `json:"version"`

// Number of instances to deploy for a Cassandra database.
// Number of replicas for Cassandra database.
// +optional
Replicas *int32 `json:"replicas,omitempty"`

// rack
// Cassandra Topology for Racks
// +optional
Topology *Topology `json:"topology,omitempty"`

Expand Down Expand Up @@ -96,12 +96,12 @@ type CassandraSpec struct {

// HealthChecker defines attributes of the health checker
// +optional
// +kubebuilder:default={periodSeconds: 20, timeoutSeconds: 10, failureThreshold: 3}
// +kubebuilder:default={periodSeconds: 30, timeoutSeconds: 10, failureThreshold: 3}
HealthChecker kmapi.HealthCheckSpec `json:"healthChecker"`
}

type Topology struct {
// cassandra rack Structure
// cassandra rack structure
Rack []RackSpec `json:"rack,omitempty"`
}

Expand Down
Loading

0 comments on commit 1fb863f

Please sign in to comment.