Skip to content

Commit

Permalink
chore: remove dependency on pkg k8s.io/kubernetes (#7937)
Browse files Browse the repository at this point in the history
  • Loading branch information
free6om authored Aug 7, 2024
1 parent 643cfb1 commit 513f2ab
Show file tree
Hide file tree
Showing 43 changed files with 7,381 additions and 2,058 deletions.
2 changes: 1 addition & 1 deletion apis/apps/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -993,7 +993,7 @@ type PersistentVolumeClaimSpec struct {
//
// +kubebuilder:pruning:PreserveUnknownFields
// +optional
Resources corev1.ResourceRequirements `json:"resources,omitempty" protobuf:"bytes,2,opt,name=resources"`
Resources corev1.VolumeResourceRequirements `json:"resources,omitempty" protobuf:"bytes,2,opt,name=resources"`

// The name of the StorageClass required by the claim.
// More info: https://kubernetes.io/docs/concepts/storage/persistent-volumes#class-1.
Expand Down
1 change: 1 addition & 0 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ func init() {
viper.SetDefault(constant.CfgKBReconcileWorkers, 8)
viper.SetDefault(constant.FeatureGateIgnoreConfigTemplateDefaultMode, false)
viper.SetDefault(constant.FeatureGateComponentReplicasAnnotation, true)
viper.SetDefault(constant.FeatureGateInPlacePodVerticalScaling, false)
}

type flagName string
Expand Down
1,377 changes: 1,105 additions & 272 deletions config/crd/bases/apps.kubeblocks.io_clusters.yaml

Large diffs are not rendered by default.

351 changes: 314 additions & 37 deletions config/crd/bases/apps.kubeblocks.io_componentdefinitions.yaml

Large diffs are not rendered by default.

613 changes: 484 additions & 129 deletions config/crd/bases/apps.kubeblocks.io_components.yaml

Large diffs are not rendered by default.

357 changes: 321 additions & 36 deletions config/crd/bases/apps.kubeblocks.io_opsdefinitions.yaml

Large diffs are not rendered by default.

630 changes: 491 additions & 139 deletions config/crd/bases/apps.kubeblocks.io_opsrequests.yaml

Large diffs are not rendered by default.

226 changes: 162 additions & 64 deletions config/crd/bases/dataprotection.kubeblocks.io_restores.yaml

Large diffs are not rendered by default.

794 changes: 665 additions & 129 deletions config/crd/bases/workloads.kubeblocks.io_instancesets.yaml

Large diffs are not rendered by default.

10 changes: 7 additions & 3 deletions controllers/apps/transform_utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,10 @@ func sendWarningEventWithError(
recorder.Event(obj, corev1.EventTypeWarning, reason, err.Error())
}

func isVolumeResourceRequirementsEqual(a, b corev1.VolumeResourceRequirements) bool {
return isResourceEqual(a.Requests, b.Requests) && isResourceEqual(a.Limits, b.Limits)
}

func isResourceRequirementsEqual(a, b corev1.ResourceRequirements) bool {
return isResourceEqual(a.Requests, b.Requests) && isResourceEqual(a.Limits, b.Limits)
}
Expand All @@ -156,13 +160,13 @@ func isVolumeClaimTemplatesEqual(a, b []appsv1alpha1.ClusterComponentVolumeClaim
// first check resource requirements
c := a[i].DeepCopy()
d := b[i].DeepCopy()
if !isResourceRequirementsEqual(c.Spec.Resources, d.Spec.Resources) {
if !isVolumeResourceRequirementsEqual(c.Spec.Resources, d.Spec.Resources) {
return false
}

// then clear resource requirements and check other fields
c.Spec.Resources = corev1.ResourceRequirements{}
d.Spec.Resources = corev1.ResourceRequirements{}
c.Spec.Resources = corev1.VolumeResourceRequirements{}
d.Spec.Resources = corev1.VolumeResourceRequirements{}
if !reflect.DeepEqual(c, d) {
return false
}
Expand Down
2 changes: 1 addition & 1 deletion controllers/apps/transform_utils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ func TestIsVolumeClaimTemplatesEqual(t *testing.T) {
{
Name: "data",
Spec: appsv1alpha1.PersistentVolumeClaimSpec{
Resources: corev1.ResourceRequirements{
Resources: corev1.VolumeResourceRequirements{
Requests: corev1.ResourceList{
corev1.ResourceStorage: resource.MustParse(size),
},
Expand Down
1,377 changes: 1,105 additions & 272 deletions deploy/helm/crds/apps.kubeblocks.io_clusters.yaml

Large diffs are not rendered by default.

351 changes: 314 additions & 37 deletions deploy/helm/crds/apps.kubeblocks.io_componentdefinitions.yaml

Large diffs are not rendered by default.

613 changes: 484 additions & 129 deletions deploy/helm/crds/apps.kubeblocks.io_components.yaml

Large diffs are not rendered by default.

357 changes: 321 additions & 36 deletions deploy/helm/crds/apps.kubeblocks.io_opsdefinitions.yaml

Large diffs are not rendered by default.

630 changes: 491 additions & 139 deletions deploy/helm/crds/apps.kubeblocks.io_opsrequests.yaml

Large diffs are not rendered by default.

226 changes: 162 additions & 64 deletions deploy/helm/crds/dataprotection.kubeblocks.io_restores.yaml

Large diffs are not rendered by default.

794 changes: 665 additions & 129 deletions deploy/helm/crds/workloads.kubeblocks.io_instancesets.yaml

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions deploy/helm/templates/deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ spec:
{{- end }}
- name: COMPONENT_REPLICAS_ANNOTATION
value: {{ .Values.featureGates.componentReplicasAnnotation.enabled | quote }}
- name: IN_PLACE_POD_VERTICAL_SCALING
value: {{ .Values.featureGates.inPlacePodVerticalScaling.enabled | quote }}
{{- with .Values.securityContext }}
securityContext:
{{- toYaml . | nindent 12 }}
Expand Down
2 changes: 2 additions & 0 deletions deploy/helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1925,6 +1925,8 @@ featureGates:
enabled: false
componentReplicasAnnotation:
enabled: true
inPlacePodVerticalScaling:
enabled: false

vmagent:

Expand Down
8 changes: 4 additions & 4 deletions docs/developer_docs/api-reference/cluster.md
Original file line number Diff line number Diff line change
Expand Up @@ -4803,8 +4803,8 @@ More info: <a href="https://kubernetes.io/docs/concepts/storage/persistent-volum
<td>
<code>resources</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#resourcerequirements-v1-core">
Kubernetes core/v1.ResourceRequirements
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#volumeresourcerequirements-v1-core">
Kubernetes core/v1.VolumeResourceRequirements
</a>
</em>
</td>
Expand Down Expand Up @@ -13685,8 +13685,8 @@ More info: <a href="https://kubernetes.io/docs/concepts/storage/persistent-volum
<td>
<code>resources</code><br/>
<em>
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#resourcerequirements-v1-core">
Kubernetes core/v1.ResourceRequirements
<a href="https://kubernetes.io/docs/reference/generated/kubernetes-api/v1.25/#volumeresourcerequirements-v1-core">
Kubernetes core/v1.VolumeResourceRequirements
</a>
</em>
</td>
Expand Down
139 changes: 52 additions & 87 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -28,13 +28,13 @@ require (
github.com/hashicorp/vault/sdk v0.9.2
github.com/imdario/mergo v0.3.14
github.com/jackc/pgx/v5 v5.5.4
github.com/klauspost/compress v1.17.6
github.com/klauspost/compress v1.17.8
github.com/kubernetes-csi/external-snapshotter/client/v3 v3.0.0
github.com/kubernetes-csi/external-snapshotter/client/v6 v6.2.0
github.com/magiconair/properties v1.8.7
github.com/mitchellh/mapstructure v1.5.1-0.20220423185008-bf980b35cac4
github.com/onsi/ginkgo/v2 v2.14.0
github.com/onsi/gomega v1.30.0
github.com/onsi/ginkgo/v2 v2.15.0
github.com/onsi/gomega v1.31.0
github.com/opencontainers/image-spec v1.1.0
github.com/pashagolub/pgxmock/v2 v2.11.0
github.com/pkg/errors v0.9.1
Expand All @@ -52,40 +52,38 @@ require (
github.com/spf13/cobra v1.8.0
github.com/spf13/pflag v1.0.5
github.com/spf13/viper v1.16.0
github.com/stretchr/testify v1.8.4
github.com/stretchr/testify v1.9.0
github.com/sykesm/zap-logfmt v0.0.4
github.com/valyala/fasthttp v1.50.0
github.com/vmware-tanzu/velero v1.10.1
github.com/vmware-tanzu/velero v1.13.2
go.etcd.io/etcd/client/v3 v3.5.10
go.etcd.io/etcd/server/v3 v3.5.10
go.mongodb.org/mongo-driver v1.11.6
go.uber.org/automaxprocs v1.5.2
go.uber.org/zap v1.26.0
golang.org/x/crypto v0.21.0
go.uber.org/zap v1.27.0
golang.org/x/crypto v0.22.0
golang.org/x/exp v0.0.0-20240119083558-1b970713d09a
golang.org/x/net v0.23.0
golang.org/x/net v0.24.0
golang.org/x/text v0.14.0
google.golang.org/grpc v1.61.0
google.golang.org/grpc v1.63.2
google.golang.org/protobuf v1.33.0
gopkg.in/ini.v1 v1.67.0
gopkg.in/yaml.v2 v2.4.0
helm.sh/helm/v3 v3.12.3
k8s.io/api v0.29.0
k8s.io/api v0.29.2
k8s.io/apiextensions-apiserver v0.29.0
k8s.io/apimachinery v0.29.0
k8s.io/apiserver v0.29.0
k8s.io/cli-runtime v0.28.3
k8s.io/client-go v12.0.0+incompatible
k8s.io/code-generator v0.28.3
k8s.io/component-helpers v0.28.3
k8s.io/cri-api v0.28.3
k8s.io/apimachinery v0.29.2
k8s.io/cli-runtime v0.29.0
k8s.io/client-go v0.29.2
k8s.io/code-generator v0.29.0
k8s.io/component-helpers v0.29.0
k8s.io/cri-api v0.29.0
k8s.io/gengo v0.0.0-20230829151522-9cce18d56c01
k8s.io/klog v1.0.0
k8s.io/klog/v2 v2.110.1
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00
k8s.io/kubectl v0.28.2
k8s.io/kubelet v0.26.1
k8s.io/kubernetes v1.28.3
k8s.io/klog/v2 v2.120.1
k8s.io/kube-openapi v0.0.0-20240228011516-70dd3763d340
k8s.io/kubectl v0.29.0
k8s.io/kubelet v0.29.0
k8s.io/utils v0.0.0-20231127182322-b307cd553661
sigs.k8s.io/controller-runtime v0.17.2
sigs.k8s.io/yaml v1.4.0
Expand All @@ -95,8 +93,6 @@ require (
cuelabs.dev/go/oci/ociregistry v0.0.0-20240314152124-224736b49f2e // indirect
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Azure/go-ansiterm v0.0.0-20230124172434-306776ec8161 // indirect
github.com/Azure/go-autorest/autorest/azure/auth v0.5.12 // indirect
github.com/Azure/go-autorest/autorest/azure/cli v0.4.6 // indirect
github.com/BurntSushi/toml v1.3.2 // indirect
github.com/MakeNowJust/heredoc v1.0.0 // indirect
github.com/Masterminds/goutils v1.1.1 // indirect
Expand Down Expand Up @@ -145,37 +141,38 @@ require (
github.com/go-errors/errors v1.4.2 // indirect
github.com/go-gorp/gorp/v3 v3.0.5 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/go-ole/go-ole v1.2.6 // indirect
github.com/go-ole/go-ole v1.3.0 // indirect
github.com/go-openapi/jsonpointer v0.19.6 // indirect
github.com/go-openapi/jsonreference v0.20.2 // indirect
github.com/go-openapi/swag v0.22.4 // indirect
github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 // indirect
github.com/gobwas/glob v0.2.3 // indirect
github.com/gofrs/uuid v4.4.0+incompatible // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang-jwt/jwt/v4 v4.5.0 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/golang/protobuf v1.5.4 // indirect
github.com/golang/snappy v0.0.4 // indirect
github.com/google/btree v1.1.2 // indirect
github.com/google/cel-go v0.17.7 // indirect
github.com/google/cel-go v0.17.8 // indirect
github.com/google/gnostic-models v0.6.8 // indirect
github.com/google/gofuzz v1.2.0 // indirect
github.com/google/pprof v0.0.0-20230323073829-e72429f035bd // indirect
github.com/google/pprof v0.0.0-20230602150820-91b7bce49751 // indirect
github.com/google/shlex v0.0.0-20191202100458-e7afc7fbc510 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/gorilla/websocket v1.5.0 // indirect
github.com/gosuri/uitable v0.0.4 // indirect
github.com/gregjones/httpcache v0.0.0-20180305231024-9cad4c3443a7 // indirect
github.com/grpc-ecosystem/go-grpc-middleware v1.4.0 // indirect
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.1-0.20210315223345-82c243799c99 // indirect
github.com/grpc-ecosystem/grpc-gateway v1.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.16.0 // indirect
github.com/grpc-ecosystem/grpc-gateway/v2 v2.19.0 // indirect
github.com/hashicorp/errwrap v1.1.0 // indirect
github.com/hashicorp/go-immutable-radix v1.3.1 // indirect
github.com/hashicorp/go-kms-wrapping/v2 v2.0.8 // indirect
github.com/hashicorp/go-multierror v1.1.1 // indirect
github.com/hashicorp/go-plugin v1.4.8 // indirect
github.com/hashicorp/go-plugin v1.6.0 // indirect
github.com/hashicorp/go-secure-stdlib/base62 v0.1.2 // indirect
github.com/hashicorp/go-secure-stdlib/mlock v0.1.2 // indirect
github.com/hashicorp/go-secure-stdlib/strutil v0.1.2 // indirect
Expand All @@ -196,9 +193,7 @@ require (
github.com/josharian/intern v1.0.0 // indirect
github.com/json-iterator/go v1.1.12 // indirect
github.com/kardianos/osext v0.0.0-20190222173326-2bc1f35cddc0 // indirect
github.com/klauspost/cpuid/v2 v2.2.4 // indirect
github.com/kopia/kopia v0.10.7 // indirect
github.com/kubernetes-csi/external-snapshotter/client/v4 v4.2.0 // indirect
github.com/kubernetes-csi/external-snapshotter/client/v7 v7.0.0 // indirect
github.com/lann/builder v0.0.0-20180802200727-47ae307949d0 // indirect
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
github.com/lib/pq v1.10.9 // indirect
Expand All @@ -223,15 +218,16 @@ require (
github.com/montanaflynn/stats v0.6.6 // indirect
github.com/morikuni/aec v1.0.0 // indirect
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f // indirect
github.com/oklog/run v1.1.0 // indirect
github.com/opencontainers/go-digest v1.0.0 // indirect
github.com/pelletier/go-toml/v2 v2.0.8 // indirect
github.com/peterbourgon/diskv v2.0.1+incompatible // indirect
github.com/pierrec/lz4 v2.6.1+incompatible // indirect
github.com/pmezard/go-difflib v1.0.1-0.20181226105442-5d4384ee4fb2 // indirect
github.com/power-devops/perfstat v0.0.0-20210106213030-5aafc221ea8c // indirect
github.com/prometheus/client_model v0.5.0 // indirect
github.com/prometheus/common v0.48.0 // indirect
github.com/prometheus/client_model v0.6.1 // indirect
github.com/prometheus/common v0.52.3 // indirect
github.com/prometheus/procfs v0.12.0 // indirect
github.com/protocolbuffers/txtpbfmt v0.0.0-20230328191034-3462fbc510c0 // indirect
github.com/rivo/uniseg v0.4.6 // indirect
Expand Down Expand Up @@ -269,73 +265,42 @@ require (
go.etcd.io/etcd/client/v2 v2.305.10 // indirect
go.etcd.io/etcd/pkg/v3 v3.5.10 // indirect
go.etcd.io/etcd/raft/v3 v3.5.10 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.47.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.47.0 // indirect
go.opentelemetry.io/otel v1.22.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.20.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.20.0 // indirect
go.opentelemetry.io/otel/metric v1.22.0 // indirect
go.opentelemetry.io/otel/sdk v1.21.0 // indirect
go.opentelemetry.io/otel/trace v1.22.0 // indirect
go.opentelemetry.io/proto/otlp v1.0.0 // indirect
go.opentelemetry.io/contrib/instrumentation/google.golang.org/grpc/otelgrpc v0.49.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.49.0 // indirect
go.opentelemetry.io/otel v1.25.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.24.0 // indirect
go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.24.0 // indirect
go.opentelemetry.io/otel/metric v1.25.0 // indirect
go.opentelemetry.io/otel/sdk v1.25.0 // indirect
go.opentelemetry.io/otel/trace v1.25.0 // indirect
go.opentelemetry.io/proto/otlp v1.1.0 // indirect
go.starlark.net v0.0.0-20230525235612-a134d8f9ddca // indirect
go.uber.org/atomic v1.11.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/mod v0.16.0 // indirect
golang.org/x/oauth2 v0.18.0 // indirect
golang.org/x/sync v0.6.0 // indirect
golang.org/x/sys v0.18.0 // indirect
golang.org/x/term v0.18.0 // indirect
golang.org/x/mod v0.17.0 // indirect
golang.org/x/oauth2 v0.19.0 // indirect
golang.org/x/sync v0.7.0 // indirect
golang.org/x/sys v0.19.0 // indirect
golang.org/x/term v0.19.0 // indirect
golang.org/x/time v0.5.0 // indirect
golang.org/x/tools v0.19.0 // indirect
gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect
google.golang.org/api v0.161.0 // indirect
google.golang.org/appengine v1.6.8 // indirect
google.golang.org/genproto v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240125205218-1f4bbc51befe // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/api v0.0.0-20240314234333-6e1732d8331c // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240401170217-c3f982113cda // indirect
gopkg.in/inf.v0 v0.9.1 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.2.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
gotest.tools/v3 v3.5.0 // indirect
k8s.io/apiserver v0.29.0 // indirect
k8s.io/component-base v0.29.0 // indirect
k8s.io/gengo/v2 v2.0.0-20240228010128-51d4e06bde70 // indirect
k8s.io/metrics v0.29.0 // indirect
oras.land/oras-go v1.2.4 // indirect
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
sigs.k8s.io/kustomize/api v0.13.5-0.20230601165947-6ce0bf390ce3 // indirect
sigs.k8s.io/kustomize/kyaml v0.14.3 // indirect
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
)

replace (
golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb
k8s.io/api => k8s.io/api v0.28.3
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.28.3
k8s.io/apimachinery => k8s.io/apimachinery v0.28.3
k8s.io/apiserver => k8s.io/apiserver v0.28.3
k8s.io/cli-runtime => k8s.io/cli-runtime v0.28.3
k8s.io/client-go => k8s.io/client-go v0.28.3
k8s.io/cloud-provider => k8s.io/cloud-provider v0.28.3
k8s.io/cluster-bootstrap => k8s.io/cluster-bootstrap v0.28.3
k8s.io/code-generator => k8s.io/code-generator v0.28.3
k8s.io/component-base => k8s.io/component-base v0.28.3
k8s.io/component-helpers => k8s.io/component-helpers v0.28.3
k8s.io/controller-manager => k8s.io/controller-manager v0.28.3
k8s.io/cri-api => k8s.io/cri-api v0.28.3
k8s.io/csi-translation-lib => k8s.io/csi-translation-lib v0.28.3
k8s.io/dynamic-resource-allocation => k8s.io/dynamic-resource-allocation v0.28.3
k8s.io/endpointslice => k8s.io/endpointslice v0.28.3
k8s.io/kms => k8s.io/kms v0.28.3
k8s.io/kube-aggregator => k8s.io/kube-aggregator v0.28.3
k8s.io/kube-controller-manager => k8s.io/kube-controller-manager v0.28.3
k8s.io/kube-proxy => k8s.io/kube-proxy v0.28.3
k8s.io/kube-scheduler => k8s.io/kube-scheduler v0.28.3
k8s.io/kubectl => k8s.io/kubectl v0.28.3
k8s.io/kubelet => k8s.io/kubelet v0.28.3
k8s.io/legacy-cloud-providers => k8s.io/legacy-cloud-providers v0.28.3
k8s.io/metrics => k8s.io/metrics v0.28.3
k8s.io/mount-utils => k8s.io/mount-utils v0.28.3
k8s.io/pod-security-admission => k8s.io/pod-security-admission v0.28.3
k8s.io/sample-apiserver => k8s.io/sample-apiserver v0.28.3
k8s.io/sample-cli-plugin => k8s.io/sample-cli-plugin v0.28.3
k8s.io/sample-controller => k8s.io/sample-controller v0.28.3
)
replace golang.org/x/exp => golang.org/x/exp v0.0.0-20230711153332-06a737ee72cb
Loading

0 comments on commit 513f2ab

Please sign in to comment.