Skip to content

Commit

Permalink
Update go mod
Browse files Browse the repository at this point in the history
Signed-off-by: obaydullahmhs <[email protected]>
  • Loading branch information
obaydullahmhs committed Jan 12, 2024
1 parent 6fbb6c2 commit 4e7165b
Show file tree
Hide file tree
Showing 8 changed files with 47 additions and 32 deletions.
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ require (
k8s.io/apimachinery v0.29.0
k8s.io/klog/v2 v2.110.1
kmodules.xyz/client-go v0.29.6
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240109105410-a133af5310e3
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240112111342-1ee5ee41dd90
sigs.k8s.io/controller-runtime v0.16.3
xorm.io/xorm v1.3.2
)
Expand Down
6 changes: 4 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -600,6 +600,7 @@ golang.org/x/crypto v0.0.0-20210322153248-0c34fe9e7dc2/go.mod h1:T9bdIzuCu7OtxOm
golang.org/x/crypto v0.0.0-20210616213533-5ff15b29337e/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc=
golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4=
golang.org/x/crypto v0.6.0/go.mod h1:OFC/31mSvZgRz0V1QTNCzfAI1aIRzbiufJtkMIlEp58=
golang.org/x/crypto v0.14.0/go.mod h1:MVFd36DqK4CsrnJYDkBA3VC4m2GkXAM0PvzMCn4JQf4=
golang.org/x/crypto v0.17.0 h1:r8bRNjWL3GshPW3gkd+RpvzWrZAwPS49OmTGZ/uhM4k=
golang.org/x/crypto v0.17.0/go.mod h1:gCAAfMLgwOJRpTjQ2zCCt2OcSfYMTeZVSRtQlPC7Nq4=
Expand Down Expand Up @@ -644,6 +645,7 @@ golang.org/x/net v0.0.0-20211216030914-fe4d6282115f/go.mod h1:9nx3DQGgdP8bBQD5qx
golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c=
golang.org/x/net v0.1.0/go.mod h1:Cx3nUiGt4eDBEyega/BKRp+/AlGL8hYe7U9odMt2Cco=
golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.7.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs=
golang.org/x/net v0.10.0/go.mod h1:0qNGK6F8kojg2nk9dLZ2mShWaEBan6FAoqfSigmmuDg=
golang.org/x/net v0.17.0/go.mod h1:NxSsAGuq816PNPmqtQdLE42eU2Fs7NoRIZrHJAlaCOE=
golang.org/x/net v0.19.0 h1:zTwKpTd2XuCqf8huc7Fo2iSy+4RHPd10s4KzeTnVr1c=
Expand Down Expand Up @@ -846,8 +848,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.29.0 h1:GHLhxxT9jU1N8+FvOCCeJNyU5g0duYS46UGrs6AHNLY=
kmodules.xyz/offshoot-api v0.29.0/go.mod h1:5NxhBblXoDHWStx9HCDJR2KFTwYjEZ7i1Id3jelIunw=
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240109105410-a133af5310e3 h1:3eTj+WH8usOIdHRoE+DAyzWULkDRlATa3UgUrcmX4Nc=
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240109105410-a133af5310e3/go.mod h1:K49m/e80L1K/oJSMcaIDBTPCbzCpq5wU/o7sWOx81m0=
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240112111342-1ee5ee41dd90 h1:LzIRLJq9ivwnupw/rPfJvZsophBeo+LU7EVt+zRmFzo=
kubedb.dev/apimachinery v0.41.0-beta.0.0.20240112111342-1ee5ee41dd90/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
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ func (k *ConnectCluster) CertSecretVolumeMountPath(configDir string, cert string

func (k *ConnectCluster) SetHealthCheckerDefaults() {
if k.Spec.HealthChecker.PeriodSeconds == nil {
k.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(20)
k.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if k.Spec.HealthChecker.TimeoutSeconds == nil {
k.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,20 @@ limitations under the License.
package v1alpha1

import (
"strconv"
"context"
"strings"

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

"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"
"k8s.io/klog/v2"
coreutil "kmodules.xyz/client-go/core/v1"
ctrl "sigs.k8s.io/controller-runtime"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"
Expand All @@ -36,14 +39,6 @@ import (
// log is for logging in this package.
var connectClusterLog = logf.Log.WithName("connectCluster-resource")

func (k *ConnectCluster) SetupWebhookWithManager(mgr ctrl.Manager) error {
return ctrl.NewWebhookManagedBy(mgr).
For(k).
Complete()
}

//+kubebuilder:webhook:path=/mutate-kafka-kubedb-com-v1alpha1-connectcluster,mutating=true,failurePolicy=fail,sideEffects=None,groups=kafka.kubedb.com,resources=connectclusters,verbs=create;update,versions=v1alpha1,name=mconnectcluster.kb.io,admissionReviewVersions=v1

var _ webhook.Defaulter = &ConnectCluster{}

// Default implements webhook.Defaulter so a webhook will be registered for the type
Expand All @@ -55,8 +50,6 @@ func (k *ConnectCluster) Default() {
k.SetDefaults()
}

//+kubebuilder:webhook:path=/validate-kafka-kubedb-com-v1alpha1-connectcluster,mutating=false,failurePolicy=fail,sideEffects=None,groups=kafka.kubedb.com,resources=connectclusters,verbs=create;update,delete,versions=v1alpha1,name=vconnectcluster.kb.io,admissionReviewVersions=v1

var _ webhook.Validator = &ConnectCluster{}

// ValidateCreate implements webhook.Validator so a webhook will be registered for the type
Expand Down Expand Up @@ -166,17 +159,11 @@ func (k *ConnectCluster) ValidateCreateOrUpdate() field.ErrorList {
return allErr
}

var availableVersions = []string{
"3.3.0",
"3.3.2",
"3.4.0",
"3.4.1",
"3.5.1",
"3.6.0",
}

func validateEnvVars(connect *ConnectCluster) error {
container := coreutil.GetContainerByName(connect.Spec.PodTemplate.Spec.Containers, ConnectClusterContainerName)
if container == nil {
return errors.New("container not found")
}
env := coreutil.GetEnvByName(container.Env, ConnectClusterModeEnv)
if env != nil {
if *connect.Spec.Replicas > 1 && env.Value == string(ConnectClusterNodeRoleStandalone) {
Expand All @@ -186,6 +173,15 @@ func validateEnvVars(connect *ConnectCluster) error {
return nil
}

var availableVersions = []string{
"3.3.0",
"3.3.2",
"3.4.0",
"3.4.1",
"3.5.1",
"3.6.0",
}

func validateVersion(connect *ConnectCluster) error {
version := connect.Spec.Version
for _, v := range availableVersions {
Expand Down Expand Up @@ -235,6 +231,9 @@ var reservedVolumeMountPaths = []string{

func validateContainerVolumeMountPaths(connect *ConnectCluster) error {
container := coreutil.GetContainerByName(connect.Spec.PodTemplate.Spec.Containers, ConnectClusterContainerName)
if container == nil {
return errors.New("container not found")
}
rPaths := reservedVolumeMountPaths
volumeMountPaths := container.VolumeMounts
for _, rvm := range rPaths {
Expand All @@ -248,9 +247,17 @@ func validateContainerVolumeMountPaths(connect *ConnectCluster) error {
}

func validateInitContainerVolumeMountPaths(connect *ConnectCluster) error {
for i := range connect.Spec.ConnectorPlugins {
// TODO():
initContainer := coreutil.GetContainerByName(connect.Spec.PodTemplate.Spec.InitContainers, "connector-"+strconv.Itoa(i))
for _, name := range connect.Spec.ConnectorPlugins {
connectorVersion := &catalog.KafkaConnectorVersion{}
err := DefaultClient.Get(context.TODO(), types.NamespacedName{Name: name}, connectorVersion)
if err != nil {
klog.Errorf("can't get the kafka connector version object %s for %s \n", err.Error(), name)
return errors.New("no connector version found for " + name)
}
initContainer := coreutil.GetContainerByName(connect.Spec.PodTemplate.Spec.InitContainers, strings.ToLower(connectorVersion.Spec.Type))
if initContainer == nil {
return errors.New("init container not found for " + strings.ToLower(connectorVersion.Spec.Type))
}
volumeMount := coreutil.GetVolumeMountByName(initContainer.VolumeMounts, ConnectorPluginsVolumeName)
if volumeMount != nil && volumeMount.MountPath == ConnectorPluginsVolumeDir {
return errors.New("Cannot use a reserve volume mount path: " + ConnectorPluginsVolumeDir)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package v1alpha1
import "kubedb.dev/apimachinery/apis/kafka"

const (
Finalizer = kafka.GroupName
Finalizer = kafka.GroupName + "/finalizer"
)

const (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func (k *Kafka) PVCName(alias string) string {

func (k *Kafka) SetHealthCheckerDefaults() {
if k.Spec.HealthChecker.PeriodSeconds == nil {
k.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(20)
k.Spec.HealthChecker.PeriodSeconds = pointer.Int32P(10)
}
if k.Spec.HealthChecker.TimeoutSeconds == nil {
k.Spec.HealthChecker.TimeoutSeconds = pointer.Int32P(10)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1073,6 +1073,12 @@ func (m *MongoDB) ReplicasAreReady(lister appslister.StatefulSetLister) (bool, s
if m.Spec.ShardTopology != nil {
expectedItems = 2 + int(m.Spec.ShardTopology.Shard.Shards)
}
if m.Spec.Arbiter != nil {
expectedItems++
}
if m.Spec.Hidden != nil {
expectedItems++
}
return checkReplicas(lister.StatefulSets(m.Namespace), labels.SelectorFromSet(m.OffshootLabels()), expectedItems)
}

Expand Down
4 changes: 2 additions & 2 deletions vendor/modules.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1380,7 +1380,7 @@ k8s.io/utils/trace
# kmodules.xyz/apiversion v0.2.0
## explicit; go 1.14
kmodules.xyz/apiversion
# kmodules.xyz/client-go v0.29.6-0.20240106073345-92f92b4d6985
# kmodules.xyz/client-go v0.29.6
## explicit; go 1.21.5
kmodules.xyz/client-go
kmodules.xyz/client-go/api/v1
Expand All @@ -1404,7 +1404,7 @@ kmodules.xyz/monitoring-agent-api/api/v1
## explicit; go 1.21.5
kmodules.xyz/offshoot-api/api/v1
kmodules.xyz/offshoot-api/api/v2
# kubedb.dev/apimachinery v0.41.0-beta.0.0.20240109105410-a133af5310e3
# kubedb.dev/apimachinery v0.41.0-beta.0.0.20240112111342-1ee5ee41dd90
## explicit; go 1.21.5
kubedb.dev/apimachinery/apis
kubedb.dev/apimachinery/apis/catalog
Expand Down

0 comments on commit 4e7165b

Please sign in to comment.