Skip to content

Commit

Permalink
chore: move packages in internal to pkg (apecloud#5505)
Browse files Browse the repository at this point in the history
  • Loading branch information
ldming authored Oct 18, 2023
1 parent 15cf37c commit 9965cba
Show file tree
Hide file tree
Showing 1,116 changed files with 2,049 additions and 2,047 deletions.
2 changes: 1 addition & 1 deletion .github/utils/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ get_trigger_mode() {
.github/*|.devcontainer/*|githooks/*|examples/*)
add_trigger_mode "[other]"
;;
internal/cli/cmd/*)
pkg/cli/cmd/*)
add_trigger_mode "[cli][test]"
;;
*)
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cicd-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ jobs:
run: |
bash .github/utils/utils.sh --type 14 \
--file cover.out \
--ignore-pkgs "cmd/|internal/cli|internal/controller/consensusset|internal/controller/model|controllers/k8score"
--ignore-pkgs "cmd/|pkg/cli|pkg/controller/consensusset|pkg/controller/model|controllers/k8score"
- name: upload coverage report
uses: codecov/codecov-action@v3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/cicd-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ jobs:
run: |
bash .github/utils/utils.sh --type 14 \
--file cover.out \
--ignore-pkgs "cmd/|internal/cli|internal/controller/consensusset|internal/controller/model|controllers/k8score"
--ignore-pkgs "cmd/|pkg/cli|pkg/controller/consensusset|pkg/controller/model|controllers/k8score"
- name: upload coverage report
uses: codecov/codecov-action@v3
Expand Down
10 changes: 5 additions & 5 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
.DS_Store

# ignore go generate code files
internal/testutil/k8s/mocks/*_mocks.go
internal/configuration/proto/mocks/*_mocks.go
internal/configuration/container/mocks/*_mocks.go
# internal/configuration/proto/*.pb.go
pkg/testutil/k8s/mocks/*_mocks.go
pkg/configuration/proto/mocks/*_mocks.go
pkg/configuration/container/mocks/*_mocks.go
# pkg/configuration/proto/*.pb.go

# ignore go mock temporary files
**/gomock_reflect*/
Expand Down Expand Up @@ -65,4 +65,4 @@ deploy/**/Chart.lock
deploy/**/charts

# cli embed chart directory
internal/cli/cluster/charts/
pkg/cli/cluster/charts/
6 changes: 3 additions & 3 deletions LICENSING.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ deploy/**
docker/**
externalapis/**
hack/**
pkg/**
pkg/client/**
test/**
tools/**
```

The following directories and their subdirectories are licensed under their original upstream licenses:

```
cmd/probe/internal/component/
internal/cli/cmd/plugin/download/**
cmd/probe/pkg/component/
pkg/cli/cmd/plugin/download/**
vendor/
```
14 changes: 7 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,14 +152,14 @@ client-sdk-gen: module ## Generate CRD client code.
.PHONY: manager-go-generate
manager-go-generate: ## Run go generate against lifecycle manager code.
ifeq ($(SKIP_GO_GEN), false)
$(GO) generate -x ./internal/configuration/proto
$(GO) generate -x ./pkg/configuration/proto
endif

.PHONY: test-go-generate
test-go-generate: ## Run go generate against test code.
$(GO) generate -x ./internal/testutil/k8s/mocks/...
$(GO) generate -x ./internal/configuration/container/mocks/...
$(GO) generate -x ./internal/configuration/proto/mocks/...
$(GO) generate -x ./pkg/testutil/k8s/mocks/...
$(GO) generate -x ./pkg/configuration/container/mocks/...
$(GO) generate -x ./pkg/configuration/proto/mocks/...

.PHONY: fmt
fmt: ## Run go fmt against code.
Expand Down Expand Up @@ -205,7 +205,7 @@ module: ## Run go mod tidy->verify against go modules.
$(GO) mod tidy -compat=1.21
$(GO) mod verify

TEST_PACKAGES ?= ./internal/... ./apis/... ./controllers/... ./cmd/...
TEST_PACKAGES ?= ./pkg/... ./apis/... ./controllers/... ./cmd/...

CLUSTER_TYPES=minikube k3d
.PHONY: add-k8s-host
Expand Down Expand Up @@ -284,7 +284,7 @@ kbcli-fast: build-kbcli-embed-chart
@mv bin/kbcli.$(OS).$(ARCH) bin/kbcli

create-kbcli-embed-charts-dir:
mkdir -p internal/cli/cluster/charts/
mkdir -p pkg/cli/cluster/charts/
build-single-kbcli-embed-chart.%: chart=$(word 2,$(subst ., ,$@))
build-single-kbcli-embed-chart.%:
$(HELM) dependency update deploy/$(chart) --skip-refresh
Expand All @@ -293,7 +293,7 @@ ifeq ($(VERSION), latest)
else
$(HELM) package deploy/$(chart) --version $(VERSION)
endif
mv $(chart)-*.tgz internal/cli/cluster/charts/$(chart).tgz
mv $(chart)-*.tgz pkg/cli/cluster/charts/$(chart).tgz

.PHONY: build-kbcli-embed-chart
build-kbcli-embed-chart: helmtool create-kbcli-embed-charts-dir \
Expand Down
4 changes: 2 additions & 2 deletions apis/apps/v1alpha1/cluster_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import (

dpv1alpha1 "github.com/apecloud/kubeblocks/apis/dataprotection/v1alpha1"
workloads "github.com/apecloud/kubeblocks/apis/workloads/v1alpha1"
"github.com/apecloud/kubeblocks/internal/constant"
viper "github.com/apecloud/kubeblocks/internal/viperx"
"github.com/apecloud/kubeblocks/pkg/constant"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

// ClusterSpec defines the desired state of Cluster.
Expand Down
4 changes: 2 additions & 2 deletions apis/apps/v1alpha1/cluster_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ import (
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/yaml"

"github.com/apecloud/kubeblocks/internal/constant"
viper "github.com/apecloud/kubeblocks/internal/viperx"
"github.com/apecloud/kubeblocks/pkg/constant"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

var _ = Describe("", func() {
Expand Down
1 change: 1 addition & 0 deletions apis/apps/v1alpha1/clusterdefinition_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

appsv1 "k8s.io/api/apps/v1"
"k8s.io/apimachinery/pkg/util/intstr"
"k8s.io/apimachinery/pkg/util/yaml"
Expand Down
2 changes: 1 addition & 1 deletion apis/apps/v1alpha1/configconstraint_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ type ReloadOptions struct {
type UnixSignalTrigger struct {
// signal is valid for unix signal.
// e.g: SIGHUP
// url: ../../internal/configuration/configmap/handler.go:allUnixSignals
// url: ../../pkg/configuration/configmap/handler.go:allUnixSignals
// +kubebuilder:validation:Required
Signal SignalType `json:"signal"`

Expand Down
2 changes: 1 addition & 1 deletion apis/apps/v1alpha1/opsrequest_webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
"sigs.k8s.io/controller-runtime/pkg/webhook"
"sigs.k8s.io/controller-runtime/pkg/webhook/admission"

"github.com/apecloud/kubeblocks/internal/constant"
"github.com/apecloud/kubeblocks/pkg/constant"
)

// log is for logging in this package.
Expand Down
4 changes: 2 additions & 2 deletions apis/apps/v1alpha1/opsrequest_webhook_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ import (
"k8s.io/kubectl/pkg/util/storage"
"sigs.k8s.io/controller-runtime/pkg/client"

"github.com/apecloud/kubeblocks/internal/constant"
// testapps "github.com/apecloud/kubeblocks/internal/testutil/apps"
"github.com/apecloud/kubeblocks/pkg/constant"
// testapps "github.com/apecloud/kubeblocks/pkg/testutil/apps"
)

var _ = Describe("OpsRequest webhook", func() {
Expand Down
5 changes: 3 additions & 2 deletions apis/apps/v1alpha1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import (

. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

corev1 "k8s.io/api/core/v1"

admissionv1 "k8s.io/api/admission/v1"
Expand All @@ -43,8 +44,8 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/apecloud/kubeblocks/internal/testutil"
viper "github.com/apecloud/kubeblocks/internal/viperx"
"github.com/apecloud/kubeblocks/pkg/testutil"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
Expand Down
7 changes: 4 additions & 3 deletions apis/apps/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion apis/dataprotection/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions apis/extensions/v1alpha1/addon_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/version"

"github.com/apecloud/kubeblocks/internal/constant"
viper "github.com/apecloud/kubeblocks/internal/viperx"
"github.com/apecloud/kubeblocks/pkg/constant"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

// AddonSpec defines the desired state of an add-on.
Expand Down
2 changes: 1 addition & 1 deletion apis/extensions/v1alpha1/addon_types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import (
corev1 "k8s.io/api/core/v1"
"k8s.io/apimachinery/pkg/api/resource"

"github.com/apecloud/kubeblocks/internal/testutil"
"github.com/apecloud/kubeblocks/pkg/testutil"
)

func TestSelectorRequirementString(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion apis/extensions/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion apis/storage/v1alpha1/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 @@ -23,11 +23,10 @@ import (
. "github.com/onsi/ginkgo/v2"
. "github.com/onsi/gomega"

"github.com/apecloud/kubeblocks/internal/constant"

corev1 "k8s.io/api/core/v1"

metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"

"github.com/apecloud/kubeblocks/pkg/constant"
)

var _ = Describe("ReplicatedStateMachine Webhook", func() {
Expand Down
8 changes: 4 additions & 4 deletions apis/workloads/v1alpha1/webhook_suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ import (
. "github.com/onsi/gomega"

admissionv1beta1 "k8s.io/api/admission/v1beta1"
//+kubebuilder:scaffold:imports
// +kubebuilder:scaffold:imports
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/client-go/rest"
ctrl "sigs.k8s.io/controller-runtime"
Expand All @@ -41,7 +41,7 @@ import (
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/apecloud/kubeblocks/internal/testutil"
"github.com/apecloud/kubeblocks/pkg/testutil"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
Expand Down Expand Up @@ -87,7 +87,7 @@ var _ = BeforeSuite(func() {
err = admissionv1beta1.AddToScheme(scheme)
Expect(err).NotTo(HaveOccurred())

//+kubebuilder:scaffold:scheme
// +kubebuilder:scaffold:scheme

k8sClient, err = client.New(cfg, client.Options{Scheme: scheme})
Expect(err).NotTo(HaveOccurred())
Expand All @@ -110,7 +110,7 @@ var _ = BeforeSuite(func() {

testCtx = testutil.NewDefaultTestContext(ctx, k8sClient, testEnv)

//+kubebuilder:scaffold:webhook
// +kubebuilder:scaffold:webhook

go func() {
defer GinkgoRecover()
Expand Down
2 changes: 1 addition & 1 deletion apis/workloads/v1alpha1/zz_generated.deepcopy.go

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

4 changes: 2 additions & 2 deletions cmd/cli/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ package main
import (
"k8s.io/component-base/cli"

"github.com/apecloud/kubeblocks/internal/cli/cmd"
"github.com/apecloud/kubeblocks/internal/cli/util"
"github.com/apecloud/kubeblocks/pkg/cli/cmd"
"github.com/apecloud/kubeblocks/pkg/cli/util"
)

func main() {
Expand Down
8 changes: 4 additions & 4 deletions cmd/dataprotection/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ import (
dpv1alpha1 "github.com/apecloud/kubeblocks/apis/dataprotection/v1alpha1"
storagev1alpha1 "github.com/apecloud/kubeblocks/apis/storage/v1alpha1"
dpcontrollers "github.com/apecloud/kubeblocks/controllers/dataprotection"
"github.com/apecloud/kubeblocks/internal/constant"
intctrlutil "github.com/apecloud/kubeblocks/internal/controllerutil"
dptypes "github.com/apecloud/kubeblocks/internal/dataprotection/types"
viper "github.com/apecloud/kubeblocks/internal/viperx"
"github.com/apecloud/kubeblocks/pkg/constant"
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
dptypes "github.com/apecloud/kubeblocks/pkg/dataprotection/types"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

// added lease.coordination.k8s.io for leader election
Expand Down
4 changes: 2 additions & 2 deletions cmd/lorry/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,13 @@ import (
ctrl "sigs.k8s.io/controller-runtime"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

"github.com/apecloud/kubeblocks/internal/constant"
viper "github.com/apecloud/kubeblocks/internal/viperx"
"github.com/apecloud/kubeblocks/lorry/component"
"github.com/apecloud/kubeblocks/lorry/highavailability"
customgrpc "github.com/apecloud/kubeblocks/lorry/middleware/grpc"
probe2 "github.com/apecloud/kubeblocks/lorry/middleware/probe"
"github.com/apecloud/kubeblocks/lorry/util"
"github.com/apecloud/kubeblocks/pkg/constant"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

var (
Expand Down
6 changes: 3 additions & 3 deletions cmd/manager/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,9 @@ import (
k8scorecontrollers "github.com/apecloud/kubeblocks/controllers/k8score"
storagecontrollers "github.com/apecloud/kubeblocks/controllers/storage"
workloadscontrollers "github.com/apecloud/kubeblocks/controllers/workloads"
"github.com/apecloud/kubeblocks/internal/constant"
intctrlutil "github.com/apecloud/kubeblocks/internal/controllerutil"
viper "github.com/apecloud/kubeblocks/internal/viperx"
"github.com/apecloud/kubeblocks/pkg/constant"
intctrlutil "github.com/apecloud/kubeblocks/pkg/controllerutil"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

// added lease.coordination.k8s.io for leader election
Expand Down
6 changes: 3 additions & 3 deletions cmd/reloader/app/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,9 @@ import (
"go.uber.org/zap/zapcore"
"google.golang.org/grpc"

cfgcore "github.com/apecloud/kubeblocks/internal/configuration/config_manager"
cfgutil "github.com/apecloud/kubeblocks/internal/configuration/core"
cfgproto "github.com/apecloud/kubeblocks/internal/configuration/proto"
cfgcore "github.com/apecloud/kubeblocks/pkg/configuration/config_manager"
cfgutil "github.com/apecloud/kubeblocks/pkg/configuration/core"
cfgproto "github.com/apecloud/kubeblocks/pkg/configuration/proto"
)

var logger *zap.SugaredLogger
Expand Down
6 changes: 3 additions & 3 deletions cmd/reloader/app/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ import (
"github.com/spf13/pflag"

appsv1alpha1 "github.com/apecloud/kubeblocks/apis/apps/v1alpha1"
cfgutil "github.com/apecloud/kubeblocks/internal/configuration/container"
cfgcore "github.com/apecloud/kubeblocks/internal/configuration/core"
viper "github.com/apecloud/kubeblocks/internal/viperx"
cfgutil "github.com/apecloud/kubeblocks/pkg/configuration/container"
cfgcore "github.com/apecloud/kubeblocks/pkg/configuration/core"
viper "github.com/apecloud/kubeblocks/pkg/viperx"
)

type NotifyEventType int
Expand Down
Loading

0 comments on commit 9965cba

Please sign in to comment.