From 0eae9f5e19e4d6dd447e9bd9a31582ff22585a08 Mon Sep 17 00:00:00 2001 From: Piotr Kowalczuk Date: Tue, 4 Jun 2019 00:17:44 +0200 Subject: [PATCH 1/5] pkg into internal - fresh start --- cmd/asinit/main.go | 2 +- cmd/backup/main.go | 6 ++--- cmd/operator/main.go | 24 +++++++++---------- go.mod | 0 go.sum | 1 - hack/update-codegen.sh | 2 +- hack/update-fmt.sh | 2 +- hack/update-openapi.go | 4 ++-- {pkg => internal}/admission/backups.go | 3 +-- {pkg => internal}/admission/cluster.go | 5 ++-- {pkg => internal}/admission/webhook.go | 13 +++++----- .../apis/aerospike/common/types.go | 0 {pkg => internal}/apis/aerospike/register.go | 0 .../apis/aerospike/v1alpha1/backup.go | 2 +- .../apis/aerospike/v1alpha1/cluster.go | 0 .../apis/aerospike/v1alpha1/doc.go | 0 .../apis/aerospike/v1alpha1/register.go | 2 +- .../apis/aerospike/v1alpha1/restore.go | 2 +- .../apis/aerospike/v1alpha1/types.go | 3 +-- .../apis/aerospike/v1alpha2/backup.go | 2 +- .../apis/aerospike/v1alpha2/cluster.go | 0 .../apis/aerospike/v1alpha2/doc.go | 0 .../apis/aerospike/v1alpha2/register.go | 2 +- .../apis/aerospike/v1alpha2/restore.go | 2 +- .../apis/aerospike/v1alpha2/types.go | 3 +-- {pkg => internal}/asutils/asutils.go | 0 {pkg => internal}/backuprestore/constants.go | 0 {pkg => internal}/backuprestore/gcs/gcs.go | 0 {pkg => internal}/backuprestore/handler.go | 13 +++++----- {pkg => internal}/backuprestore/job.go | 14 +++++------ {pkg => internal}/backuprestore/secret.go | 8 +++---- {pkg => internal}/backuprestore/status.go | 4 ++-- {pkg => internal}/backuprestore/utils.go | 0 {pkg => internal}/controller/backup.go | 8 +++---- {pkg => internal}/controller/cluster.go | 8 +++---- .../controller/garbagecollector.go | 8 +++---- {pkg => internal}/controller/generic.go | 0 {pkg => internal}/controller/restore.go | 8 +++---- .../crd/converters/v1alpha2/backup.go | 8 +++---- .../crd/converters/v1alpha2/cluster.go | 10 ++++---- .../crd/converters/v1alpha2/converter.go | 2 +- .../crd/converters/v1alpha2/restore.go | 8 +++---- {pkg => internal}/crd/crds.go | 10 ++++---- {pkg => internal}/crd/registry.go | 6 ++--- .../crd/registry_internal_test.go | 0 {pkg => internal}/debug/debug.go | 0 {pkg => internal}/errors/reconciler.go | 0 .../garbagecollector/asbackups.go | 14 +++++------ {pkg => internal}/garbagecollector/gcs.go | 8 +++---- {pkg => internal}/garbagecollector/pvcs.go | 9 ++++--- {pkg => internal}/logfields/fields.go | 0 {pkg => internal}/meta/key.go | 0 {pkg => internal}/meta/key_test.go | 1 - {pkg => internal}/pointers/basic.go | 0 {pkg => internal}/pointers/basic_test.go | 0 {pkg => internal}/reconciler/backups.go | 13 +++++----- {pkg => internal}/reconciler/cluster.go | 14 +++++------ {pkg => internal}/reconciler/configmap.go | 17 +++++++------ {pkg => internal}/reconciler/constants.go | 0 {pkg => internal}/reconciler/networkpolicy.go | 13 +++++----- {pkg => internal}/reconciler/pod.go | 24 +++++++++---------- {pkg => internal}/reconciler/podutils.go | 5 ++-- {pkg => internal}/reconciler/pvc.go | 17 +++++++------ {pkg => internal}/reconciler/service.go | 13 +++++----- {pkg => internal}/reconciler/status.go | 6 ++--- {pkg => internal}/reconciler/upgrades.go | 13 +++++----- {pkg => internal}/reconciler/validation.go | 6 ++--- {pkg => internal}/signals/signal.go | 0 {pkg => internal}/signals/signal_test.go | 0 {pkg => internal}/utils/doc.go | 0 {pkg => internal}/utils/events/reasons.go | 0 {pkg => internal}/utils/flags/flags.go | 0 .../utils/listoptions/listoptions.go | 4 ++-- {pkg => internal}/utils/selectors/field.go | 0 {pkg => internal}/utils/selectors/label.go | 2 +- {pkg => internal}/utils/strings/strings.go | 0 .../utils/strings/strings_test.go | 0 {pkg => internal}/utils/time/time.go | 0 {pkg => internal}/versioning/operator.go | 0 {pkg => internal}/versioning/strategy.go | 0 {pkg => internal}/versioning/upgrade.go | 0 {pkg => internal}/versioning/upgrade_test.go | 0 {pkg => internal}/versioning/version.go | 0 {pkg => internal}/versioning/version_test.go | 0 {pkg => internal}/versioning/versions.go | 0 test/e2e/backups/backups.go | 5 ++-- test/e2e/cluster/cluster.go | 10 ++++---- test/e2e/cluster/multicluster.go | 3 +-- test/e2e/cluster/podrestart.go | 5 ++-- test/e2e/cluster/pvc.go | 9 ++++--- test/e2e/cluster/scaling.go | 5 ++-- test/e2e/cluster/upgrades.go | 13 +++++----- test/e2e/e2e_test.go | 3 +-- test/e2e/framework/asutils.go | 8 +++---- test/e2e/framework/backups.go | 8 +++---- test/e2e/framework/cluster.go | 14 +++++------ test/e2e/framework/framework.go | 2 +- test/e2e/framework/namespace.go | 1 - test/e2e/framework/upgrades.go | 2 +- test/e2e/garbagecollector/asbackups.go | 5 ++-- test/e2e/garbagecollector/pvcs.go | 5 ++-- 101 files changed, 221 insertions(+), 251 deletions(-) mode change 100644 => 100755 cmd/asinit/main.go mode change 100644 => 100755 cmd/backup/main.go mode change 100644 => 100755 cmd/operator/main.go mode change 100644 => 100755 go.mod mode change 100644 => 100755 hack/update-openapi.go rename {pkg => internal}/admission/backups.go (98%) mode change 100644 => 100755 rename {pkg => internal}/admission/cluster.go (98%) mode change 100644 => 100755 rename {pkg => internal}/admission/webhook.go (97%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/common/types.go (100%) rename {pkg => internal}/apis/aerospike/register.go (100%) rename {pkg => internal}/apis/aerospike/v1alpha1/backup.go (98%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha1/cluster.go (100%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha1/doc.go (100%) rename {pkg => internal}/apis/aerospike/v1alpha1/register.go (96%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha1/restore.go (98%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha1/types.go (92%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha2/backup.go (98%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha2/cluster.go (100%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha2/doc.go (100%) rename {pkg => internal}/apis/aerospike/v1alpha2/register.go (96%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha2/restore.go (98%) mode change 100644 => 100755 rename {pkg => internal}/apis/aerospike/v1alpha2/types.go (92%) mode change 100644 => 100755 rename {pkg => internal}/asutils/asutils.go (100%) rename {pkg => internal}/backuprestore/constants.go (100%) rename {pkg => internal}/backuprestore/gcs/gcs.go (100%) rename {pkg => internal}/backuprestore/handler.go (95%) mode change 100644 => 100755 rename {pkg => internal}/backuprestore/job.go (90%) mode change 100644 => 100755 rename {pkg => internal}/backuprestore/secret.go (91%) mode change 100644 => 100755 rename {pkg => internal}/backuprestore/status.go (93%) mode change 100644 => 100755 rename {pkg => internal}/backuprestore/utils.go (100%) rename {pkg => internal}/controller/backup.go (97%) mode change 100644 => 100755 rename {pkg => internal}/controller/cluster.go (97%) mode change 100644 => 100755 rename {pkg => internal}/controller/garbagecollector.go (97%) mode change 100644 => 100755 rename {pkg => internal}/controller/generic.go (100%) rename {pkg => internal}/controller/restore.go (97%) mode change 100644 => 100755 rename {pkg => internal}/crd/converters/v1alpha2/backup.go (93%) mode change 100644 => 100755 rename {pkg => internal}/crd/converters/v1alpha2/cluster.go (91%) mode change 100644 => 100755 rename {pkg => internal}/crd/converters/v1alpha2/converter.go (97%) mode change 100644 => 100755 rename {pkg => internal}/crd/converters/v1alpha2/restore.go (93%) mode change 100644 => 100755 rename {pkg => internal}/crd/crds.go (97%) mode change 100644 => 100755 rename {pkg => internal}/crd/registry.go (97%) mode change 100644 => 100755 rename {pkg => internal}/crd/registry_internal_test.go (100%) mode change 100644 => 100755 rename {pkg => internal}/debug/debug.go (100%) rename {pkg => internal}/errors/reconciler.go (100%) rename {pkg => internal}/garbagecollector/asbackups.go (91%) mode change 100644 => 100755 rename {pkg => internal}/garbagecollector/gcs.go (88%) mode change 100644 => 100755 rename {pkg => internal}/garbagecollector/pvcs.go (92%) mode change 100644 => 100755 rename {pkg => internal}/logfields/fields.go (100%) rename {pkg => internal}/meta/key.go (100%) rename {pkg => internal}/meta/key_test.go (98%) mode change 100644 => 100755 rename {pkg => internal}/pointers/basic.go (100%) rename {pkg => internal}/pointers/basic_test.go (100%) rename {pkg => internal}/reconciler/backups.go (91%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/cluster.go (94%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/configmap.go (92%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/constants.go (100%) rename {pkg => internal}/reconciler/networkpolicy.go (92%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/pod.go (97%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/podutils.go (97%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/pvc.go (93%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/service.go (88%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/status.go (95%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/upgrades.go (96%) mode change 100644 => 100755 rename {pkg => internal}/reconciler/validation.go (95%) mode change 100644 => 100755 rename {pkg => internal}/signals/signal.go (100%) rename {pkg => internal}/signals/signal_test.go (100%) rename {pkg => internal}/utils/doc.go (100%) rename {pkg => internal}/utils/events/reasons.go (100%) rename {pkg => internal}/utils/flags/flags.go (100%) rename {pkg => internal}/utils/listoptions/listoptions.go (94%) mode change 100644 => 100755 rename {pkg => internal}/utils/selectors/field.go (100%) rename {pkg => internal}/utils/selectors/label.go (98%) mode change 100644 => 100755 rename {pkg => internal}/utils/strings/strings.go (100%) rename {pkg => internal}/utils/strings/strings_test.go (100%) rename {pkg => internal}/utils/time/time.go (100%) rename {pkg => internal}/versioning/operator.go (100%) rename {pkg => internal}/versioning/strategy.go (100%) rename {pkg => internal}/versioning/upgrade.go (100%) rename {pkg => internal}/versioning/upgrade_test.go (100%) rename {pkg => internal}/versioning/version.go (100%) rename {pkg => internal}/versioning/version_test.go (100%) rename {pkg => internal}/versioning/versions.go (100%) mode change 100644 => 100755 test/e2e/backups/backups.go mode change 100644 => 100755 test/e2e/cluster/cluster.go mode change 100644 => 100755 test/e2e/cluster/multicluster.go mode change 100644 => 100755 test/e2e/cluster/podrestart.go mode change 100644 => 100755 test/e2e/cluster/pvc.go mode change 100644 => 100755 test/e2e/cluster/scaling.go mode change 100644 => 100755 test/e2e/cluster/upgrades.go mode change 100644 => 100755 test/e2e/e2e_test.go mode change 100644 => 100755 test/e2e/framework/asutils.go mode change 100644 => 100755 test/e2e/framework/backups.go mode change 100644 => 100755 test/e2e/framework/cluster.go mode change 100644 => 100755 test/e2e/framework/framework.go mode change 100644 => 100755 test/e2e/framework/namespace.go mode change 100644 => 100755 test/e2e/framework/upgrades.go mode change 100644 => 100755 test/e2e/garbagecollector/asbackups.go mode change 100644 => 100755 test/e2e/garbagecollector/pvcs.go diff --git a/cmd/asinit/main.go b/cmd/asinit/main.go old mode 100644 new mode 100755 index 05721c5..5bad24b --- a/cmd/asinit/main.go +++ b/cmd/asinit/main.go @@ -22,7 +22,7 @@ import ( "io/ioutil" "strings" - "github.com/travelaudience/aerospike-operator/pkg/reconciler" + "github.com/travelaudience/aerospike-operator/internal/reconciler" log "github.com/sirupsen/logrus" ) diff --git a/cmd/backup/main.go b/cmd/backup/main.go old mode 100644 new mode 100755 index 7551fc2..3291c40 --- a/cmd/backup/main.go +++ b/cmd/backup/main.go @@ -28,9 +28,9 @@ import ( log "github.com/sirupsen/logrus" "golang.org/x/net/context" - "github.com/travelaudience/aerospike-operator/pkg/backuprestore" - "github.com/travelaudience/aerospike-operator/pkg/backuprestore/gcs" - flagutils "github.com/travelaudience/aerospike-operator/pkg/utils/flags" + "github.com/travelaudience/aerospike-operator/internal/backuprestore" + "github.com/travelaudience/aerospike-operator/internal/backuprestore/gcs" + flagutils "github.com/travelaudience/aerospike-operator/internal/utils/flags" ) const ( diff --git a/cmd/operator/main.go b/cmd/operator/main.go old mode 100644 new mode 100755 index 758d839..0eddda7 --- a/cmd/operator/main.go +++ b/cmd/operator/main.go @@ -24,7 +24,7 @@ import ( "time" log "github.com/sirupsen/logrus" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" kubeinformers "k8s.io/client-go/informers" "k8s.io/client-go/kubernetes" @@ -37,17 +37,17 @@ import ( "k8s.io/client-go/tools/leaderelection/resourcelock" "k8s.io/client-go/tools/record" - "github.com/travelaudience/aerospike-operator/pkg/admission" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikescheme "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned/scheme" - aerospikeinformers "github.com/travelaudience/aerospike-operator/pkg/client/informers/externalversions" - "github.com/travelaudience/aerospike-operator/pkg/controller" - "github.com/travelaudience/aerospike-operator/pkg/crd" - v1alpha2converters "github.com/travelaudience/aerospike-operator/pkg/crd/converters/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/debug" - "github.com/travelaudience/aerospike-operator/pkg/signals" - flagutils "github.com/travelaudience/aerospike-operator/pkg/utils/flags" - "github.com/travelaudience/aerospike-operator/pkg/versioning" + "github.com/travelaudience/aerospike-operator/internal/admission" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikescheme "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned/scheme" + aerospikeinformers "github.com/travelaudience/aerospike-operator/internal/client/informers/externalversions" + "github.com/travelaudience/aerospike-operator/internal/controller" + "github.com/travelaudience/aerospike-operator/internal/crd" + v1alpha2converters "github.com/travelaudience/aerospike-operator/internal/crd/converters/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/debug" + "github.com/travelaudience/aerospike-operator/internal/signals" + flagutils "github.com/travelaudience/aerospike-operator/internal/utils/flags" + "github.com/travelaudience/aerospike-operator/internal/versioning" ) const ( diff --git a/go.mod b/go.mod old mode 100644 new mode 100755 diff --git a/go.sum b/go.sum index 7d7bd79..85707f1 100644 --- a/go.sum +++ b/go.sum @@ -214,7 +214,6 @@ k8s.io/apiextensions-apiserver v0.0.0-20190516231611-bf6753f2aa24 h1:SwpU8lyfh7O k8s.io/apiextensions-apiserver v0.0.0-20190516231611-bf6753f2aa24/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE= k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d h1:Jmdtdt1ZnoGfWWIIik61Z7nKYgO3J+swQJtPYsP9wHA= k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= -k8s.io/apiserver v0.0.0-20190516230822-f89599b3f645 h1:oMjWLjIo6BCIsay+j5r8WbEoHA3Chn/s9duoqXEGzRw= k8s.io/apiserver v0.0.0-20190516230822-f89599b3f645/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w= k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible h1:bK03DJulJi9j05gwnXUufcs2j7h4M85YFvJ0dIlQ9k4= k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 26c3d55..5863ed3 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -44,7 +44,7 @@ export GOPATH="${FAKE_GOPATH}" cd "${FAKE_REPOPATH}" BASE_PACKAGE="github.com/travelaudience/aerospike-operator" -CODEGEN_PACKAGES="${BASE_PACKAGE}/pkg/apis/aerospike/v1alpha1,${BASE_PACKAGE}/pkg/apis/aerospike/v1alpha2" +CODEGEN_PACKAGES="${BASE_PACKAGE}/internal/apis/aerospike/v1alpha1,${BASE_PACKAGE}/internal/apis/aerospike/v1alpha2" "${BINDIR}/deepcopy-gen" \ --input-dirs ${CODEGEN_PACKAGES} \ diff --git a/hack/update-fmt.sh b/hack/update-fmt.sh index a41591c..235cd8f 100755 --- a/hack/update-fmt.sh +++ b/hack/update-fmt.sh @@ -22,7 +22,7 @@ set -o pipefail FILES=$(find . -type f \ -name "*.go" \ -not -path "./vendor/*" \ - -not -path "./pkg/client/*" \ + -not -path "./internal/client/*" \ -not -name "zz_generated*") # gofmt the target files gofmt -w -s ${FILES} diff --git a/hack/update-openapi.go b/hack/update-openapi.go old mode 100644 new mode 100755 index 38926bc..d66d438 --- a/hack/update-openapi.go +++ b/hack/update-openapi.go @@ -28,8 +28,8 @@ import ( utilruntime "k8s.io/apimachinery/pkg/util/runtime" "k8s.io/kube-openapi/pkg/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/crd" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/crd" ) func main() { diff --git a/pkg/admission/backups.go b/internal/admission/backups.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/admission/backups.go rename to internal/admission/backups.go index 768cefd..cc2c78c --- a/pkg/admission/backups.go +++ b/internal/admission/backups.go @@ -22,9 +22,8 @@ import ( av1beta1 "k8s.io/api/admission/v1beta1" "k8s.io/apimachinery/pkg/api/errors" - "k8s.io/apimachinery/pkg/apis/meta/v1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" ) func (s *ValidatingAdmissionWebhook) admitAerospikeNamespaceBackup(ar av1beta1.AdmissionReview) *av1beta1.AdmissionResponse { diff --git a/pkg/admission/cluster.go b/internal/admission/cluster.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/admission/cluster.go rename to internal/admission/cluster.go index a151532..8b95702 --- a/pkg/admission/cluster.go +++ b/internal/admission/cluster.go @@ -21,12 +21,11 @@ import ( "reflect" av1beta1 "k8s.io/api/admission/v1beta1" - "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/api/errors" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/versioning" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/versioning" ) const ( diff --git a/pkg/admission/webhook.go b/internal/admission/webhook.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/admission/webhook.go rename to internal/admission/webhook.go index 9c5f27a..408db86 --- a/pkg/admission/webhook.go +++ b/internal/admission/webhook.go @@ -35,7 +35,6 @@ import ( log "github.com/sirupsen/logrus" admissionv1beta1 "k8s.io/api/admission/v1beta1" admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -44,12 +43,12 @@ import ( "k8s.io/client-go/util/cert" "k8s.io/client-go/util/keyutil" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike" - aerospikev1alpha1 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike" + aerospikev1alpha1 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) var ( diff --git a/pkg/apis/aerospike/common/types.go b/internal/apis/aerospike/common/types.go similarity index 100% rename from pkg/apis/aerospike/common/types.go rename to internal/apis/aerospike/common/types.go diff --git a/pkg/apis/aerospike/register.go b/internal/apis/aerospike/register.go similarity index 100% rename from pkg/apis/aerospike/register.go rename to internal/apis/aerospike/register.go diff --git a/pkg/apis/aerospike/v1alpha1/backup.go b/internal/apis/aerospike/v1alpha1/backup.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/apis/aerospike/v1alpha1/backup.go rename to internal/apis/aerospike/v1alpha1/backup.go index 6ecbe83..365af32 --- a/pkg/apis/aerospike/v1alpha1/backup.go +++ b/internal/apis/aerospike/v1alpha1/backup.go @@ -22,7 +22,7 @@ import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) // +genclient diff --git a/pkg/apis/aerospike/v1alpha1/cluster.go b/internal/apis/aerospike/v1alpha1/cluster.go old mode 100644 new mode 100755 similarity index 100% rename from pkg/apis/aerospike/v1alpha1/cluster.go rename to internal/apis/aerospike/v1alpha1/cluster.go diff --git a/pkg/apis/aerospike/v1alpha1/doc.go b/internal/apis/aerospike/v1alpha1/doc.go similarity index 100% rename from pkg/apis/aerospike/v1alpha1/doc.go rename to internal/apis/aerospike/v1alpha1/doc.go diff --git a/pkg/apis/aerospike/v1alpha1/register.go b/internal/apis/aerospike/v1alpha1/register.go old mode 100644 new mode 100755 similarity index 96% rename from pkg/apis/aerospike/v1alpha1/register.go rename to internal/apis/aerospike/v1alpha1/register.go index d796df8..a6164cc --- a/pkg/apis/aerospike/v1alpha1/register.go +++ b/internal/apis/aerospike/v1alpha1/register.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike" ) // SchemeGroupVersion is group version used to register these objects diff --git a/pkg/apis/aerospike/v1alpha1/restore.go b/internal/apis/aerospike/v1alpha1/restore.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/apis/aerospike/v1alpha1/restore.go rename to internal/apis/aerospike/v1alpha1/restore.go index 3604628..b9271d4 --- a/pkg/apis/aerospike/v1alpha1/restore.go +++ b/internal/apis/aerospike/v1alpha1/restore.go @@ -22,7 +22,7 @@ import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) // +genclient diff --git a/pkg/apis/aerospike/v1alpha1/types.go b/internal/apis/aerospike/v1alpha1/types.go old mode 100644 new mode 100755 similarity index 92% rename from pkg/apis/aerospike/v1alpha1/types.go rename to internal/apis/aerospike/v1alpha1/types.go index f24e978..1cebcc3 --- a/pkg/apis/aerospike/v1alpha1/types.go +++ b/internal/apis/aerospike/v1alpha1/types.go @@ -18,9 +18,8 @@ package v1alpha1 import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" - "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) type BackupRestoreObject interface { diff --git a/pkg/apis/aerospike/v1alpha2/backup.go b/internal/apis/aerospike/v1alpha2/backup.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/apis/aerospike/v1alpha2/backup.go rename to internal/apis/aerospike/v1alpha2/backup.go index 9690caa..18d1e4a --- a/pkg/apis/aerospike/v1alpha2/backup.go +++ b/internal/apis/aerospike/v1alpha2/backup.go @@ -22,7 +22,7 @@ import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) // +genclient diff --git a/pkg/apis/aerospike/v1alpha2/cluster.go b/internal/apis/aerospike/v1alpha2/cluster.go old mode 100644 new mode 100755 similarity index 100% rename from pkg/apis/aerospike/v1alpha2/cluster.go rename to internal/apis/aerospike/v1alpha2/cluster.go diff --git a/pkg/apis/aerospike/v1alpha2/doc.go b/internal/apis/aerospike/v1alpha2/doc.go similarity index 100% rename from pkg/apis/aerospike/v1alpha2/doc.go rename to internal/apis/aerospike/v1alpha2/doc.go diff --git a/pkg/apis/aerospike/v1alpha2/register.go b/internal/apis/aerospike/v1alpha2/register.go old mode 100644 new mode 100755 similarity index 96% rename from pkg/apis/aerospike/v1alpha2/register.go rename to internal/apis/aerospike/v1alpha2/register.go index 8264d6d..87db975 --- a/pkg/apis/aerospike/v1alpha2/register.go +++ b/internal/apis/aerospike/v1alpha2/register.go @@ -21,7 +21,7 @@ import ( "k8s.io/apimachinery/pkg/runtime" "k8s.io/apimachinery/pkg/runtime/schema" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike" ) // SchemeGroupVersion is group version used to register these objects diff --git a/pkg/apis/aerospike/v1alpha2/restore.go b/internal/apis/aerospike/v1alpha2/restore.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/apis/aerospike/v1alpha2/restore.go rename to internal/apis/aerospike/v1alpha2/restore.go index 11d4eac..7298e02 --- a/pkg/apis/aerospike/v1alpha2/restore.go +++ b/internal/apis/aerospike/v1alpha2/restore.go @@ -22,7 +22,7 @@ import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) // +genclient diff --git a/pkg/apis/aerospike/v1alpha2/types.go b/internal/apis/aerospike/v1alpha2/types.go old mode 100644 new mode 100755 similarity index 92% rename from pkg/apis/aerospike/v1alpha2/types.go rename to internal/apis/aerospike/v1alpha2/types.go index 39ba9f5..bf4f78d --- a/pkg/apis/aerospike/v1alpha2/types.go +++ b/internal/apis/aerospike/v1alpha2/types.go @@ -18,9 +18,8 @@ package v1alpha2 import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" - "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) type BackupRestoreObject interface { diff --git a/pkg/asutils/asutils.go b/internal/asutils/asutils.go similarity index 100% rename from pkg/asutils/asutils.go rename to internal/asutils/asutils.go diff --git a/pkg/backuprestore/constants.go b/internal/backuprestore/constants.go similarity index 100% rename from pkg/backuprestore/constants.go rename to internal/backuprestore/constants.go diff --git a/pkg/backuprestore/gcs/gcs.go b/internal/backuprestore/gcs/gcs.go similarity index 100% rename from pkg/backuprestore/gcs/gcs.go rename to internal/backuprestore/gcs/gcs.go diff --git a/pkg/backuprestore/handler.go b/internal/backuprestore/handler.go old mode 100644 new mode 100755 similarity index 95% rename from pkg/backuprestore/handler.go rename to internal/backuprestore/handler.go index d24de72..1948f81 --- a/pkg/backuprestore/handler.go +++ b/internal/backuprestore/handler.go @@ -22,7 +22,6 @@ import ( log "github.com/sirupsen/logrus" batch "k8s.io/api/batch/v1" - "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -31,12 +30,12 @@ import ( batchlistersv1 "k8s.io/client-go/listers/batch/v1" "k8s.io/client-go/tools/record" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikelisters "github.com/travelaudience/aerospike-operator/pkg/client/listers/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/utils/events" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikelisters "github.com/travelaudience/aerospike-operator/internal/client/listers/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/utils/events" ) type AerospikeBackupRestoreHandler struct { diff --git a/pkg/backuprestore/job.go b/internal/backuprestore/job.go old mode 100644 new mode 100755 similarity index 90% rename from pkg/backuprestore/job.go rename to internal/backuprestore/job.go index 35b8b07..3ec6924 --- a/pkg/backuprestore/job.go +++ b/internal/backuprestore/job.go @@ -24,13 +24,13 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/debug" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" - "github.com/travelaudience/aerospike-operator/pkg/versioning" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/debug" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" + "github.com/travelaudience/aerospike-operator/internal/versioning" ) const ( diff --git a/pkg/backuprestore/secret.go b/internal/backuprestore/secret.go old mode 100644 new mode 100755 similarity index 91% rename from pkg/backuprestore/secret.go rename to internal/backuprestore/secret.go index 207cb15..d843210 --- a/pkg/backuprestore/secret.go +++ b/internal/backuprestore/secret.go @@ -22,10 +22,10 @@ import ( corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/listoptions" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/listoptions" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) func (h *AerospikeBackupRestoreHandler) getSecret(obj aerospikev1alpha2.BackupRestoreObject) (*corev1.Secret, error) { diff --git a/pkg/backuprestore/status.go b/internal/backuprestore/status.go old mode 100644 new mode 100755 similarity index 93% rename from pkg/backuprestore/status.go rename to internal/backuprestore/status.go index 83f2aa6..f50eecb --- a/pkg/backuprestore/status.go +++ b/internal/backuprestore/status.go @@ -19,8 +19,8 @@ package backuprestore import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" ) func (h *AerospikeBackupRestoreHandler) updateStatus(obj aerospikev1alpha2.BackupRestoreObject) error { diff --git a/pkg/backuprestore/utils.go b/internal/backuprestore/utils.go similarity index 100% rename from pkg/backuprestore/utils.go rename to internal/backuprestore/utils.go diff --git a/pkg/controller/backup.go b/internal/controller/backup.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/controller/backup.go rename to internal/controller/backup.go index 9ad3f08..a8a827a --- a/pkg/controller/backup.go +++ b/internal/controller/backup.go @@ -27,10 +27,10 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" - "github.com/travelaudience/aerospike-operator/pkg/backuprestore" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikeinformers "github.com/travelaudience/aerospike-operator/pkg/client/informers/externalversions" - aerospikelisters "github.com/travelaudience/aerospike-operator/pkg/client/listers/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/backuprestore" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikeinformers "github.com/travelaudience/aerospike-operator/internal/client/informers/externalversions" + aerospikelisters "github.com/travelaudience/aerospike-operator/internal/client/listers/aerospike/v1alpha2" ) const ( diff --git a/pkg/controller/cluster.go b/internal/controller/cluster.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/controller/cluster.go rename to internal/controller/cluster.go index c51cb8f..28fa36e --- a/pkg/controller/cluster.go +++ b/internal/controller/cluster.go @@ -27,10 +27,10 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikeinformers "github.com/travelaudience/aerospike-operator/pkg/client/informers/externalversions" - aerospikelisters "github.com/travelaudience/aerospike-operator/pkg/client/listers/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/reconciler" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikeinformers "github.com/travelaudience/aerospike-operator/internal/client/informers/externalversions" + aerospikelisters "github.com/travelaudience/aerospike-operator/internal/client/listers/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/reconciler" ) const ( diff --git a/pkg/controller/garbagecollector.go b/internal/controller/garbagecollector.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/controller/garbagecollector.go rename to internal/controller/garbagecollector.go index 9946788..368e78e --- a/pkg/controller/garbagecollector.go +++ b/internal/controller/garbagecollector.go @@ -28,10 +28,10 @@ import ( listersv1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/cache" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikeinformers "github.com/travelaudience/aerospike-operator/pkg/client/informers/externalversions" - aerospikelisters "github.com/travelaudience/aerospike-operator/pkg/client/listers/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/garbagecollector" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikeinformers "github.com/travelaudience/aerospike-operator/internal/client/informers/externalversions" + aerospikelisters "github.com/travelaudience/aerospike-operator/internal/client/listers/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/garbagecollector" ) const ( diff --git a/pkg/controller/generic.go b/internal/controller/generic.go similarity index 100% rename from pkg/controller/generic.go rename to internal/controller/generic.go diff --git a/pkg/controller/restore.go b/internal/controller/restore.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/controller/restore.go rename to internal/controller/restore.go index c4896ba..24a4150 --- a/pkg/controller/restore.go +++ b/internal/controller/restore.go @@ -27,10 +27,10 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/cache" - "github.com/travelaudience/aerospike-operator/pkg/backuprestore" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikeinformers "github.com/travelaudience/aerospike-operator/pkg/client/informers/externalversions" - aerospikelisters "github.com/travelaudience/aerospike-operator/pkg/client/listers/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/backuprestore" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikeinformers "github.com/travelaudience/aerospike-operator/internal/client/informers/externalversions" + aerospikelisters "github.com/travelaudience/aerospike-operator/internal/client/listers/aerospike/v1alpha2" ) const ( diff --git a/pkg/crd/converters/v1alpha2/backup.go b/internal/crd/converters/v1alpha2/backup.go old mode 100644 new mode 100755 similarity index 93% rename from pkg/crd/converters/v1alpha2/backup.go rename to internal/crd/converters/v1alpha2/backup.go index 058f3f6..51d7848 --- a/pkg/crd/converters/v1alpha2/backup.go +++ b/internal/crd/converters/v1alpha2/backup.go @@ -21,10 +21,10 @@ import ( extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha1" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/meta" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/meta" ) func convertAerospikeNamespaceBackups(extsClient *extsclientset.Clientset, aerospikeClient *aerospikeclientset.Clientset) error { diff --git a/pkg/crd/converters/v1alpha2/cluster.go b/internal/crd/converters/v1alpha2/cluster.go old mode 100644 new mode 100755 similarity index 91% rename from pkg/crd/converters/v1alpha2/cluster.go rename to internal/crd/converters/v1alpha2/cluster.go index e4b8100..2098cb8 --- a/pkg/crd/converters/v1alpha2/cluster.go +++ b/internal/crd/converters/v1alpha2/cluster.go @@ -21,11 +21,11 @@ import ( extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha1" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/meta" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/meta" ) var ( diff --git a/pkg/crd/converters/v1alpha2/converter.go b/internal/crd/converters/v1alpha2/converter.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/crd/converters/v1alpha2/converter.go rename to internal/crd/converters/v1alpha2/converter.go index 4ea3d7b..7bf631b --- a/pkg/crd/converters/v1alpha2/converter.go +++ b/internal/crd/converters/v1alpha2/converter.go @@ -19,7 +19,7 @@ package v1alpha2 import ( extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" ) const ( diff --git a/pkg/crd/converters/v1alpha2/restore.go b/internal/crd/converters/v1alpha2/restore.go old mode 100644 new mode 100755 similarity index 93% rename from pkg/crd/converters/v1alpha2/restore.go rename to internal/crd/converters/v1alpha2/restore.go index abbc475..637921e --- a/pkg/crd/converters/v1alpha2/restore.go +++ b/internal/crd/converters/v1alpha2/restore.go @@ -21,10 +21,10 @@ import ( extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha1" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/meta" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/meta" ) func convertAerospikeNamespaceRestores(extsClient *extsclientset.Clientset, aerospikeClient *aerospikeclientset.Clientset) error { diff --git a/pkg/crd/crds.go b/internal/crd/crds.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/crd/crds.go rename to internal/crd/crds.go index c308463..9ed82da --- a/pkg/crd/crds.go +++ b/internal/crd/crds.go @@ -22,11 +22,11 @@ import ( extsv1beta1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1beta1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha1 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - asstrings "github.com/travelaudience/aerospike-operator/pkg/utils/strings" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha1 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/pointers" + asstrings "github.com/travelaudience/aerospike-operator/internal/utils/strings" ) const ( diff --git a/pkg/crd/registry.go b/internal/crd/registry.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/crd/registry.go rename to internal/crd/registry.go index 385d246..416a3ae --- a/pkg/crd/registry.go +++ b/internal/crd/registry.go @@ -32,9 +32,9 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/watch" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) const ( diff --git a/pkg/crd/registry_internal_test.go b/internal/crd/registry_internal_test.go old mode 100644 new mode 100755 similarity index 100% rename from pkg/crd/registry_internal_test.go rename to internal/crd/registry_internal_test.go diff --git a/pkg/debug/debug.go b/internal/debug/debug.go similarity index 100% rename from pkg/debug/debug.go rename to internal/debug/debug.go diff --git a/pkg/errors/reconciler.go b/internal/errors/reconciler.go similarity index 100% rename from pkg/errors/reconciler.go rename to internal/errors/reconciler.go diff --git a/pkg/garbagecollector/asbackups.go b/internal/garbagecollector/asbackups.go old mode 100644 new mode 100755 similarity index 91% rename from pkg/garbagecollector/asbackups.go rename to internal/garbagecollector/asbackups.go index f63ea9b..9202359 --- a/pkg/garbagecollector/asbackups.go +++ b/internal/garbagecollector/asbackups.go @@ -25,13 +25,13 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikelisters "github.com/travelaudience/aerospike-operator/pkg/client/listers/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - astime "github.com/travelaudience/aerospike-operator/pkg/utils/time" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikelisters "github.com/travelaudience/aerospike-operator/internal/client/listers/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + astime "github.com/travelaudience/aerospike-operator/internal/utils/time" ) type AerospikeNamespaceBackupHandler struct { diff --git a/pkg/garbagecollector/gcs.go b/internal/garbagecollector/gcs.go old mode 100644 new mode 100755 similarity index 88% rename from pkg/garbagecollector/gcs.go rename to internal/garbagecollector/gcs.go index 88bc3f7..64d9b15 --- a/pkg/garbagecollector/gcs.go +++ b/internal/garbagecollector/gcs.go @@ -17,11 +17,9 @@ limitations under the License. package garbagecollector import ( - "k8s.io/apimachinery/pkg/apis/meta/v1" - - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/backuprestore" - "github.com/travelaudience/aerospike-operator/pkg/backuprestore/gcs" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/backuprestore" + "github.com/travelaudience/aerospike-operator/internal/backuprestore/gcs" ) func (h *AerospikeNamespaceBackupHandler) deleteBackupDataGCS(asBackup *aerospikev1alpha2.AerospikeNamespaceBackup) error { diff --git a/pkg/garbagecollector/pvcs.go b/internal/garbagecollector/pvcs.go old mode 100644 new mode 100755 similarity index 92% rename from pkg/garbagecollector/pvcs.go rename to internal/garbagecollector/pvcs.go index bfe0c2d..f4549d3 --- a/pkg/garbagecollector/pvcs.go +++ b/internal/garbagecollector/pvcs.go @@ -21,17 +21,16 @@ import ( "time" log "github.com/sirupsen/logrus" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" listersv1 "k8s.io/client-go/listers/core/v1" "k8s.io/client-go/tools/record" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/reconciler" - astime "github.com/travelaudience/aerospike-operator/pkg/utils/time" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/reconciler" + astime "github.com/travelaudience/aerospike-operator/internal/utils/time" ) type PVCsHandler struct { diff --git a/pkg/logfields/fields.go b/internal/logfields/fields.go similarity index 100% rename from pkg/logfields/fields.go rename to internal/logfields/fields.go diff --git a/pkg/meta/key.go b/internal/meta/key.go similarity index 100% rename from pkg/meta/key.go rename to internal/meta/key.go diff --git a/pkg/meta/key_test.go b/internal/meta/key_test.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/meta/key_test.go rename to internal/meta/key_test.go index 7836a6f..7606bbe --- a/pkg/meta/key_test.go +++ b/internal/meta/key_test.go @@ -20,7 +20,6 @@ import ( "testing" "github.com/stretchr/testify/assert" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/pkg/pointers/basic.go b/internal/pointers/basic.go similarity index 100% rename from pkg/pointers/basic.go rename to internal/pointers/basic.go diff --git a/pkg/pointers/basic_test.go b/internal/pointers/basic_test.go similarity index 100% rename from pkg/pointers/basic_test.go rename to internal/pointers/basic_test.go diff --git a/pkg/reconciler/backups.go b/internal/reconciler/backups.go old mode 100644 new mode 100755 similarity index 91% rename from pkg/reconciler/backups.go rename to internal/reconciler/backups.go index c1a0cba..cf54208 --- a/pkg/reconciler/backups.go +++ b/internal/reconciler/backups.go @@ -21,15 +21,14 @@ import ( "strings" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" - "k8s.io/apimachinery/pkg/apis/meta/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/errors" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/errors" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) func (r *AerospikeClusterReconciler) backupCluster(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) error { diff --git a/pkg/reconciler/cluster.go b/internal/reconciler/cluster.go old mode 100644 new mode 100755 similarity index 94% rename from pkg/reconciler/cluster.go rename to internal/reconciler/cluster.go index a381f38..3e1888f --- a/pkg/reconciler/cluster.go +++ b/internal/reconciler/cluster.go @@ -23,13 +23,13 @@ import ( storagelistersv1 "k8s.io/client-go/listers/storage/v1" "k8s.io/client-go/tools/record" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" - aerospikelisters "github.com/travelaudience/aerospike-operator/pkg/client/listers/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/errors" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/versioning" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" + aerospikelisters "github.com/travelaudience/aerospike-operator/internal/client/listers/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/errors" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/versioning" ) type AerospikeClusterReconciler struct { diff --git a/pkg/reconciler/configmap.go b/internal/reconciler/configmap.go old mode 100644 new mode 100755 similarity index 92% rename from pkg/reconciler/configmap.go rename to internal/reconciler/configmap.go index 6f3bd70..06bbe48 --- a/pkg/reconciler/configmap.go +++ b/internal/reconciler/configmap.go @@ -22,18 +22,17 @@ import ( "strings" log "github.com/sirupsen/logrus" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" - asstrings "github.com/travelaudience/aerospike-operator/pkg/utils/strings" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" + asstrings "github.com/travelaudience/aerospike-operator/internal/utils/strings" ) func (r *AerospikeClusterReconciler) ensureConfigMap(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) (*v1.ConfigMap, error) { diff --git a/pkg/reconciler/constants.go b/internal/reconciler/constants.go similarity index 100% rename from pkg/reconciler/constants.go rename to internal/reconciler/constants.go diff --git a/pkg/reconciler/networkpolicy.go b/internal/reconciler/networkpolicy.go old mode 100644 new mode 100755 similarity index 92% rename from pkg/reconciler/networkpolicy.go rename to internal/reconciler/networkpolicy.go index d312823..467b7ea --- a/pkg/reconciler/networkpolicy.go +++ b/internal/reconciler/networkpolicy.go @@ -18,19 +18,18 @@ package reconciler import ( log "github.com/sirupsen/logrus" - "k8s.io/api/core/v1" networkv1 "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) var ( diff --git a/pkg/reconciler/pod.go b/internal/reconciler/pod.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/reconciler/pod.go rename to internal/reconciler/pod.go index 1a985a4..312376a --- a/pkg/reconciler/pod.go +++ b/internal/reconciler/pod.go @@ -36,18 +36,18 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" "k8s.io/apimachinery/pkg/watch" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/asutils" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/debug" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/events" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" - asstrings "github.com/travelaudience/aerospike-operator/pkg/utils/strings" - "github.com/travelaudience/aerospike-operator/pkg/versioning" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/asutils" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/debug" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/events" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" + asstrings "github.com/travelaudience/aerospike-operator/internal/utils/strings" + "github.com/travelaudience/aerospike-operator/internal/versioning" ) const ( diff --git a/pkg/reconciler/podutils.go b/internal/reconciler/podutils.go old mode 100644 new mode 100755 similarity index 97% rename from pkg/reconciler/podutils.go rename to internal/reconciler/podutils.go index e2a1e58..efa8962 --- a/pkg/reconciler/podutils.go +++ b/internal/reconciler/podutils.go @@ -24,7 +24,6 @@ import ( "time" as "github.com/aerospike/aerospike-client-go" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" watchapi "k8s.io/apimachinery/pkg/watch" @@ -32,8 +31,8 @@ import ( "k8s.io/client-go/tools/watch" podutil "k8s.io/kubernetes/pkg/api/v1/pod" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) type byIndex []*v1.Pod diff --git a/pkg/reconciler/pvc.go b/internal/reconciler/pvc.go old mode 100644 new mode 100755 similarity index 93% rename from pkg/reconciler/pvc.go rename to internal/reconciler/pvc.go index 53ac51e..afdbc5e --- a/pkg/reconciler/pvc.go +++ b/internal/reconciler/pvc.go @@ -23,20 +23,19 @@ import ( "time" log "github.com/sirupsen/logrus" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/strategicpatch" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" - astime "github.com/travelaudience/aerospike-operator/pkg/utils/time" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" + astime "github.com/travelaudience/aerospike-operator/internal/utils/time" ) var ( diff --git a/pkg/reconciler/service.go b/internal/reconciler/service.go old mode 100644 new mode 100755 similarity index 88% rename from pkg/reconciler/service.go rename to internal/reconciler/service.go index 1f159d9..0281e4e --- a/pkg/reconciler/service.go +++ b/internal/reconciler/service.go @@ -18,17 +18,16 @@ package reconciler import ( log "github.com/sirupsen/logrus" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/crd" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/crd" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) func (r *AerospikeClusterReconciler) ensureService(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) error { diff --git a/pkg/reconciler/status.go b/internal/reconciler/status.go old mode 100644 new mode 100755 similarity index 95% rename from pkg/reconciler/status.go rename to internal/reconciler/status.go index 5c7493f..bf17674 --- a/pkg/reconciler/status.go +++ b/internal/reconciler/status.go @@ -25,9 +25,9 @@ import ( "k8s.io/apimachinery/pkg/types" "k8s.io/apimachinery/pkg/util/strategicpatch" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" ) // updateStatus updates the status of aerospikeCluster to match the spec. diff --git a/pkg/reconciler/upgrades.go b/internal/reconciler/upgrades.go old mode 100644 new mode 100755 similarity index 96% rename from pkg/reconciler/upgrades.go rename to internal/reconciler/upgrades.go index aaa7524..95a6a6f --- a/pkg/reconciler/upgrades.go +++ b/internal/reconciler/upgrades.go @@ -21,16 +21,15 @@ import ( "time" log "github.com/sirupsen/logrus" - "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/logfields" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/utils/events" - "github.com/travelaudience/aerospike-operator/pkg/versioning" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/logfields" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/utils/events" + "github.com/travelaudience/aerospike-operator/internal/versioning" ) func (r *AerospikeClusterReconciler) maybeUpgradePodWithIndex(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, configMap *v1.ConfigMap, index int, upgrade *versioning.VersionUpgrade) (*v1.Pod, error) { diff --git a/pkg/reconciler/validation.go b/internal/reconciler/validation.go old mode 100644 new mode 100755 similarity index 95% rename from pkg/reconciler/validation.go rename to internal/reconciler/validation.go index 5546ca7..41d71be --- a/pkg/reconciler/validation.go +++ b/internal/reconciler/validation.go @@ -17,12 +17,10 @@ limitations under the License. package reconciler import ( - "k8s.io/api/core/v1" - "k8s.io/apimachinery/pkg/api/errors" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/utils/events" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/utils/events" ) func (r *AerospikeClusterReconciler) validate(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) (bool, error) { diff --git a/pkg/signals/signal.go b/internal/signals/signal.go similarity index 100% rename from pkg/signals/signal.go rename to internal/signals/signal.go diff --git a/pkg/signals/signal_test.go b/internal/signals/signal_test.go similarity index 100% rename from pkg/signals/signal_test.go rename to internal/signals/signal_test.go diff --git a/pkg/utils/doc.go b/internal/utils/doc.go similarity index 100% rename from pkg/utils/doc.go rename to internal/utils/doc.go diff --git a/pkg/utils/events/reasons.go b/internal/utils/events/reasons.go similarity index 100% rename from pkg/utils/events/reasons.go rename to internal/utils/events/reasons.go diff --git a/pkg/utils/flags/flags.go b/internal/utils/flags/flags.go similarity index 100% rename from pkg/utils/flags/flags.go rename to internal/utils/flags/flags.go diff --git a/pkg/utils/listoptions/listoptions.go b/internal/utils/listoptions/listoptions.go old mode 100644 new mode 100755 similarity index 94% rename from pkg/utils/listoptions/listoptions.go rename to internal/utils/listoptions/listoptions.go index 49731aa..49dee36 --- a/pkg/utils/listoptions/listoptions.go +++ b/internal/utils/listoptions/listoptions.go @@ -19,8 +19,8 @@ package listoptions import ( metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) // ObjectByName returns the options for a list/watch operation that searches for an object based on diff --git a/pkg/utils/selectors/field.go b/internal/utils/selectors/field.go similarity index 100% rename from pkg/utils/selectors/field.go rename to internal/utils/selectors/field.go diff --git a/pkg/utils/selectors/label.go b/internal/utils/selectors/label.go old mode 100644 new mode 100755 similarity index 98% rename from pkg/utils/selectors/label.go rename to internal/utils/selectors/label.go index ed48e6f..8292ffb --- a/pkg/utils/selectors/label.go +++ b/internal/utils/selectors/label.go @@ -19,7 +19,7 @@ package selectors import ( "k8s.io/apimachinery/pkg/labels" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" ) const ( diff --git a/pkg/utils/strings/strings.go b/internal/utils/strings/strings.go similarity index 100% rename from pkg/utils/strings/strings.go rename to internal/utils/strings/strings.go diff --git a/pkg/utils/strings/strings_test.go b/internal/utils/strings/strings_test.go similarity index 100% rename from pkg/utils/strings/strings_test.go rename to internal/utils/strings/strings_test.go diff --git a/pkg/utils/time/time.go b/internal/utils/time/time.go similarity index 100% rename from pkg/utils/time/time.go rename to internal/utils/time/time.go diff --git a/pkg/versioning/operator.go b/internal/versioning/operator.go similarity index 100% rename from pkg/versioning/operator.go rename to internal/versioning/operator.go diff --git a/pkg/versioning/strategy.go b/internal/versioning/strategy.go similarity index 100% rename from pkg/versioning/strategy.go rename to internal/versioning/strategy.go diff --git a/pkg/versioning/upgrade.go b/internal/versioning/upgrade.go similarity index 100% rename from pkg/versioning/upgrade.go rename to internal/versioning/upgrade.go diff --git a/pkg/versioning/upgrade_test.go b/internal/versioning/upgrade_test.go similarity index 100% rename from pkg/versioning/upgrade_test.go rename to internal/versioning/upgrade_test.go diff --git a/pkg/versioning/version.go b/internal/versioning/version.go similarity index 100% rename from pkg/versioning/version.go rename to internal/versioning/version.go diff --git a/pkg/versioning/version_test.go b/internal/versioning/version_test.go similarity index 100% rename from pkg/versioning/version_test.go rename to internal/versioning/version_test.go diff --git a/pkg/versioning/versions.go b/internal/versioning/versions.go similarity index 100% rename from pkg/versioning/versions.go rename to internal/versioning/versions.go diff --git a/test/e2e/backups/backups.go b/test/e2e/backups/backups.go old mode 100644 new mode 100755 index 9aeaf14..d1e6098 --- a/test/e2e/backups/backups.go +++ b/test/e2e/backups/backups.go @@ -18,10 +18,9 @@ package backups import ( . "github.com/onsi/gomega" - "k8s.io/api/core/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/cluster.go b/test/e2e/cluster/cluster.go old mode 100644 new mode 100755 index dda6bbd..8a0ede0 --- a/test/e2e/cluster/cluster.go +++ b/test/e2e/cluster/cluster.go @@ -26,11 +26,11 @@ import ( "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/admission" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/asutils" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/listoptions" + "github.com/travelaudience/aerospike-operator/internal/admission" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/asutils" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/listoptions" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/multicluster.go b/test/e2e/cluster/multicluster.go old mode 100644 new mode 100755 index f4af97b..0c56f25 --- a/test/e2e/cluster/multicluster.go +++ b/test/e2e/cluster/multicluster.go @@ -20,10 +20,9 @@ import ( "fmt" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/asutils" + "github.com/travelaudience/aerospike-operator/internal/asutils" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/podrestart.go b/test/e2e/cluster/podrestart.go old mode 100644 new mode 100755 index ca135f8..c361689 --- a/test/e2e/cluster/podrestart.go +++ b/test/e2e/cluster/podrestart.go @@ -20,11 +20,10 @@ import ( "fmt" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/asutils" - "github.com/travelaudience/aerospike-operator/pkg/pointers" + "github.com/travelaudience/aerospike-operator/internal/asutils" + "github.com/travelaudience/aerospike-operator/internal/pointers" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/pvc.go b/test/e2e/cluster/pvc.go old mode 100644 new mode 100755 index b18a039..49dddaa --- a/test/e2e/cluster/pvc.go +++ b/test/e2e/cluster/pvc.go @@ -21,13 +21,12 @@ import ( "strings" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/utils/listoptions" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/utils/listoptions" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/scaling.go b/test/e2e/cluster/scaling.go old mode 100644 new mode 100755 index bd8fb9f..0f5f36a --- a/test/e2e/cluster/scaling.go +++ b/test/e2e/cluster/scaling.go @@ -21,11 +21,10 @@ import ( "math" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/asutils" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/asutils" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/upgrades.go b/test/e2e/cluster/upgrades.go old mode 100644 new mode 100755 index 44787c1..53fb2e2 --- a/test/e2e/cluster/upgrades.go +++ b/test/e2e/cluster/upgrades.go @@ -20,16 +20,15 @@ import ( "fmt" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/asutils" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/reconciler" - "github.com/travelaudience/aerospike-operator/pkg/utils/listoptions" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/asutils" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/reconciler" + "github.com/travelaudience/aerospike-operator/internal/utils/listoptions" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go old mode 100644 new mode 100755 index 9ed1eab..814661c --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -20,10 +20,9 @@ import ( "flag" "testing" - "k8s.io/api/core/v1" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/framework/asutils.go b/test/e2e/framework/asutils.go old mode 100644 new mode 100755 index 95cf81b..2a001b3 --- a/test/e2e/framework/asutils.go +++ b/test/e2e/framework/asutils.go @@ -22,10 +22,10 @@ import ( as "github.com/aerospike/aerospike-client-go" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/asutils" - "github.com/travelaudience/aerospike-operator/pkg/reconciler" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/asutils" + "github.com/travelaudience/aerospike-operator/internal/reconciler" ) type AerospikeClient struct { diff --git a/test/e2e/framework/backups.go b/test/e2e/framework/backups.go old mode 100644 new mode 100755 index a22fb79..8914f12 --- a/test/e2e/framework/backups.go +++ b/test/e2e/framework/backups.go @@ -27,10 +27,10 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/watch" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) const ( diff --git a/test/e2e/framework/cluster.go b/test/e2e/framework/cluster.go old mode 100644 new mode 100755 index ad71165..cfb8648 --- a/test/e2e/framework/cluster.go +++ b/test/e2e/framework/cluster.go @@ -27,13 +27,13 @@ import ( "k8s.io/client-go/tools/cache" "k8s.io/client-go/tools/watch" - "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/common" - aerospikev1alpha1 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha1" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" - "github.com/travelaudience/aerospike-operator/pkg/meta" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - "github.com/travelaudience/aerospike-operator/pkg/utils/selectors" - "github.com/travelaudience/aerospike-operator/pkg/versioning" + "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" + aerospikev1alpha1 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" + "github.com/travelaudience/aerospike-operator/internal/meta" + "github.com/travelaudience/aerospike-operator/internal/pointers" + "github.com/travelaudience/aerospike-operator/internal/utils/selectors" + "github.com/travelaudience/aerospike-operator/internal/versioning" ) const ( diff --git a/test/e2e/framework/framework.go b/test/e2e/framework/framework.go old mode 100644 new mode 100755 index d914f28..1baa9a9 --- a/test/e2e/framework/framework.go +++ b/test/e2e/framework/framework.go @@ -22,7 +22,7 @@ import ( "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/clientcmd" - aerospikeclientset "github.com/travelaudience/aerospike-operator/pkg/client/clientset/versioned" + aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" ) const ( diff --git a/test/e2e/framework/namespace.go b/test/e2e/framework/namespace.go old mode 100644 new mode 100755 index aa487ac..6e87428 --- a/test/e2e/framework/namespace.go +++ b/test/e2e/framework/namespace.go @@ -17,7 +17,6 @@ limitations under the License. package framework import ( - "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/test/e2e/framework/upgrades.go b/test/e2e/framework/upgrades.go old mode 100644 new mode 100755 index 50b7f0e..88d66cc --- a/test/e2e/framework/upgrades.go +++ b/test/e2e/framework/upgrades.go @@ -19,7 +19,7 @@ package framework import ( "k8s.io/apimachinery/pkg/watch" - aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" ) // UpgradeClusterAndWait upgrades an Aerospike cluster to the specified targetVersion diff --git a/test/e2e/garbagecollector/asbackups.go b/test/e2e/garbagecollector/asbackups.go old mode 100644 new mode 100755 index c232a76..56b6eb4 --- a/test/e2e/garbagecollector/asbackups.go +++ b/test/e2e/garbagecollector/asbackups.go @@ -21,12 +21,11 @@ import ( "time" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/pointers" - astime "github.com/travelaudience/aerospike-operator/pkg/utils/time" + "github.com/travelaudience/aerospike-operator/internal/pointers" + astime "github.com/travelaudience/aerospike-operator/internal/utils/time" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/garbagecollector/pvcs.go b/test/e2e/garbagecollector/pvcs.go old mode 100644 new mode 100755 index 904d891..1406b25 --- a/test/e2e/garbagecollector/pvcs.go +++ b/test/e2e/garbagecollector/pvcs.go @@ -21,12 +21,11 @@ import ( "time" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "github.com/travelaudience/aerospike-operator/pkg/asutils" - astime "github.com/travelaudience/aerospike-operator/pkg/utils/time" + "github.com/travelaudience/aerospike-operator/internal/asutils" + astime "github.com/travelaudience/aerospike-operator/internal/utils/time" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) From 10c20c2d0c036bdf3debd8e9a73e16309bd230e5 Mon Sep 17 00:00:00 2001 From: Piotr Kowalczuk Date: Tue, 4 Jun 2019 10:15:55 +0200 Subject: [PATCH 2/5] pkg into internal - import fixes --- .gitignore | 2 +- Makefile | 2 +- go.mod | 2 +- go.sum | 4 -- hack/update-codegen.sh | 12 +++--- hack/update-openapi.go | 8 ++-- hack/update-openapi.sh | 4 +- internal/admission/backups.go | 5 ++- internal/admission/cluster.go | 3 +- internal/admission/webhook.go | 15 ++++---- internal/apis/aerospike/v1alpha1/types.go | 3 +- internal/apis/aerospike/v1alpha2/types.go | 3 +- internal/backuprestore/handler.go | 13 ++++--- internal/crd/converters/v1alpha2/backup.go | 2 +- internal/crd/converters/v1alpha2/cluster.go | 1 + internal/crd/converters/v1alpha2/restore.go | 1 + internal/garbagecollector/asbackups.go | 6 +-- internal/garbagecollector/gcs.go | 4 +- internal/garbagecollector/pvcs.go | 3 +- internal/meta/key_test.go | 1 + internal/reconciler/backups.go | 2 +- internal/reconciler/configmap.go | 9 +++-- internal/reconciler/networkpolicy.go | 6 +-- internal/reconciler/podutils.go | 29 ++++++++------- internal/reconciler/pvc.go | 41 +++++++++++---------- internal/reconciler/service.go | 9 +++-- internal/reconciler/upgrades.go | 21 ++++++----- internal/reconciler/validation.go | 7 ++-- test/e2e/backups/backups.go | 1 + test/e2e/backups/e2e.go | 2 +- test/e2e/cluster/e2e.go | 2 +- test/e2e/cluster/multicluster.go | 1 + test/e2e/cluster/podrestart.go | 1 + test/e2e/cluster/pvc.go | 1 + test/e2e/cluster/scaling.go | 1 + test/e2e/cluster/upgrades.go | 1 + test/e2e/e2e_test.go | 1 + test/e2e/framework/namespace.go | 1 + test/e2e/garbagecollector/asbackups.go | 1 + test/e2e/garbagecollector/e2e.go | 2 +- test/e2e/garbagecollector/pvcs.go | 1 + 41 files changed, 129 insertions(+), 105 deletions(-) mode change 100644 => 100755 .gitignore mode change 100644 => 100755 Makefile diff --git a/.gitignore b/.gitignore old mode 100644 new mode 100755 index 6e353fa..49f1e20 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,7 @@ apiserver.local.config/ bin/ key.json openapi_generated.go -pkg/client/ +internal/client/ tmp/ vendor/ zz_generated.deepcopy.go diff --git a/Makefile b/Makefile old mode 100644 new mode 100755 index f5f30db..d52213e --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ build: GOARCH?=amd64 build: gen @GOOS=$(GOOS) GOARCH=$(GOARCH) CGO_ENABLED=0 go build \ -v \ - -ldflags="-d -s -w -X github.com/travelaudience/aerospike-operator/pkg/versioning.OperatorVersion=$(VERSION)" \ + -ldflags="-d -s -w -X github.com/travelaudience/aerospike-operator/internal/versioning.OperatorVersion=$(VERSION)" \ -tags=netgo \ -installsuffix=netgo \ -o=$(OUT) ./cmd/$(BIN)/main.go diff --git a/go.mod b/go.mod index f7fde81..42cd89d 100755 --- a/go.mod +++ b/go.mod @@ -76,7 +76,7 @@ require ( k8s.io/apiserver v0.0.0-20180910083620-386115dd78fd // indirect k8s.io/client-go v0.0.0-20180910083459-2cefa64ff137 k8s.io/component-base v0.0.0-20190515024022-2354f2393ad4 // indirect - k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22 + k8s.io/kube-openapi v0.0.0-20190510232812-a01b7d5d6c22 // indirect k8s.io/kubernetes v1.14.2 k8s.io/utils v0.0.0-20190520173318-324c5df7d3f0 // indirect sigs.k8s.io/yaml v1.1.0 // indirect diff --git a/go.sum b/go.sum index 85707f1..ebaefd8 100644 --- a/go.sum +++ b/go.sum @@ -208,14 +208,10 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= -k8s.io/api v0.0.0-20190516230258-a675ac48af67 h1:BKg03K4me3EdM340RB08XB3MRlJ57KY+0f5PfI6wPZY= k8s.io/api v0.0.0-20190516230258-a675ac48af67/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= -k8s.io/apiextensions-apiserver v0.0.0-20190516231611-bf6753f2aa24 h1:SwpU8lyfh7Orv1XmveHiN6AD2LxffLHLePQ2gcav4sk= k8s.io/apiextensions-apiserver v0.0.0-20190516231611-bf6753f2aa24/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE= -k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d h1:Jmdtdt1ZnoGfWWIIik61Z7nKYgO3J+swQJtPYsP9wHA= k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= k8s.io/apiserver v0.0.0-20190516230822-f89599b3f645/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w= -k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible h1:bK03DJulJi9j05gwnXUufcs2j7h4M85YFvJ0dIlQ9k4= k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/component-base v0.0.0-20190515024022-2354f2393ad4 h1:TOebDR8jh/AcqOEWnotJ+DYVUNcMA1GT86TR4Bg70KQ= k8s.io/component-base v0.0.0-20190515024022-2354f2393ad4/go.mod h1:pKRi1i5IQdJDpK1LItot8oy27Bc3zL/hQiy9T171rvE= diff --git a/hack/update-codegen.sh b/hack/update-codegen.sh index 5863ed3..cddce35 100755 --- a/hack/update-codegen.sh +++ b/hack/update-codegen.sh @@ -49,26 +49,26 @@ CODEGEN_PACKAGES="${BASE_PACKAGE}/internal/apis/aerospike/v1alpha1,${BASE_PACKAG "${BINDIR}/deepcopy-gen" \ --input-dirs ${CODEGEN_PACKAGES} \ -O zz_generated.deepcopy \ - --bounding-dirs ${BASE_PACKAGE}/pkg/apis \ + --bounding-dirs ${BASE_PACKAGE}/internal/apis \ --go-header-file "${FAKE_REPOPATH}/hack/custom-boilerplate.go.txt" "${BINDIR}/client-gen" \ --clientset-name versioned \ --input-base '' \ --input ${CODEGEN_PACKAGES} \ - --output-package ${BASE_PACKAGE}/pkg/client/clientset \ + --output-package ${BASE_PACKAGE}/internal/client/clientset \ --go-header-file "${FAKE_REPOPATH}/hack/custom-boilerplate.go.txt" "${BINDIR}/lister-gen" \ --input-dirs ${CODEGEN_PACKAGES} \ - --output-package ${BASE_PACKAGE}/pkg/client/listers \ + --output-package ${BASE_PACKAGE}/internal/client/listers \ --go-header-file "${FAKE_REPOPATH}/hack/custom-boilerplate.go.txt" "${BINDIR}/informer-gen" \ --input-dirs ${CODEGEN_PACKAGES} \ - --versioned-clientset-package ${BASE_PACKAGE}/pkg/client/clientset/versioned \ - --listers-package ${BASE_PACKAGE}/pkg/client/listers \ - --output-package ${BASE_PACKAGE}/pkg/client/informers \ + --versioned-clientset-package ${BASE_PACKAGE}/internal/client/clientset/versioned \ + --listers-package ${BASE_PACKAGE}/internal/client/listers \ + --output-package ${BASE_PACKAGE}/internal/client/informers \ --go-header-file "${FAKE_REPOPATH}/hack/custom-boilerplate.go.txt" export GO111MODULE="on" diff --git a/hack/update-openapi.go b/hack/update-openapi.go index d66d438..9c87631 100755 --- a/hack/update-openapi.go +++ b/hack/update-openapi.go @@ -23,10 +23,10 @@ import ( "github.com/go-openapi/spec" log "github.com/sirupsen/logrus" - "k8s.io/apimachinery/pkg/runtime" - "k8s.io/apimachinery/pkg/runtime/serializer" - utilruntime "k8s.io/apimachinery/pkg/util/runtime" - "k8s.io/kube-openapi/pkg/common" + "k8s.io/apimachinery/internal/runtime" + "k8s.io/apimachinery/internal/runtime/serializer" + utilruntime "k8s.io/apimachinery/internal/util/runtime" + "k8s.io/kube-openapi/internal/common" aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" "github.com/travelaudience/aerospike-operator/internal/crd" diff --git a/hack/update-openapi.sh b/hack/update-openapi.sh index 6f67cab..f45b68a 100755 --- a/hack/update-openapi.sh +++ b/hack/update-openapi.sh @@ -24,8 +24,8 @@ SCRIPT_ROOT="$(dirname $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd))" # run openapi-gen ${GOPATH}/bin/openapi-gen \ --go-header-file "${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt" \ - --input-dirs github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime \ - --output-package github.com/travelaudience/aerospike-operator/pkg/apis/aerospike/v1alpha2 + --input-dirs github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2,k8s.io/apimachinery/internal/apis/meta/v1,k8s.io/apimachinery/internal/runtime \ + --output-package github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2 # run hack/openapi.go go run ${SCRIPT_ROOT}/hack/update-openapi.go > ${SCRIPT_ROOT}/docs/design/swagger.json diff --git a/internal/admission/backups.go b/internal/admission/backups.go index cc2c78c..ba3bc08 100755 --- a/internal/admission/backups.go +++ b/internal/admission/backups.go @@ -22,6 +22,7 @@ import ( av1beta1 "k8s.io/api/admission/v1beta1" "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" ) @@ -89,7 +90,7 @@ func (s *ValidatingAdmissionWebhook) admitAerospikeNamespaceRestore(ar av1beta1. func (s *ValidatingAdmissionWebhook) validateBackupRestoreObj(obj aerospikev1alpha2.BackupRestoreObject) error { // make sure that the target cluster exists - aerospikeCluster, err := s.aerospikeClient.AerospikeV1alpha2().AerospikeClusters(obj.GetNamespace()).Get(obj.GetTarget().Cluster, v1.GetOptions{}) + aerospikeCluster, err := s.aerospikeClient.AerospikeV1alpha2().AerospikeClusters(obj.GetNamespace()).Get(obj.GetTarget().Cluster, metav1.GetOptions{}) if err != nil { return err } @@ -115,7 +116,7 @@ func (s *ValidatingAdmissionWebhook) validateBackupRestoreObj(obj aerospikev1alp // make sure that the secret containing cloud storage credentials exists and // matches the expected format secretNamespace := storageSpec.GetSecretNamespace(obj.GetNamespace()) - secret, err := s.kubeClient.CoreV1().Secrets(secretNamespace).Get(storageSpec.GetSecret(), v1.GetOptions{}) + secret, err := s.kubeClient.CoreV1().Secrets(secretNamespace).Get(storageSpec.GetSecret(), metav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { return fmt.Errorf("secret %q not found in namespace %q", storageSpec.GetSecret(), secretNamespace) diff --git a/internal/admission/cluster.go b/internal/admission/cluster.go index 8b95702..6bf1058 100755 --- a/internal/admission/cluster.go +++ b/internal/admission/cluster.go @@ -23,6 +23,7 @@ import ( av1beta1 "k8s.io/api/admission/v1beta1" "k8s.io/apimachinery/pkg/api/errors" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" "github.com/travelaudience/aerospike-operator/internal/versioning" @@ -129,7 +130,7 @@ func (s *ValidatingAdmissionWebhook) validateAerospikeCluster(aerospikeCluster * if aerospikeCluster.Spec.BackupSpec != nil { secretNamespace := aerospikeCluster.Spec.BackupSpec.Storage.GetSecretNamespace(aerospikeCluster.Namespace) secretName := aerospikeCluster.Spec.BackupSpec.Storage.GetSecret() - secret, err := s.kubeClient.CoreV1().Secrets(secretNamespace).Get(secretName, v1.GetOptions{}) + secret, err := s.kubeClient.CoreV1().Secrets(secretNamespace).Get(secretName, metav1.GetOptions{}) if err != nil { if errors.IsNotFound(err) { return fmt.Errorf("secret %q not found in namespace %q", secretName, secretNamespace) diff --git a/internal/admission/webhook.go b/internal/admission/webhook.go index 408db86..21ae9b6 100755 --- a/internal/admission/webhook.go +++ b/internal/admission/webhook.go @@ -35,6 +35,7 @@ import ( log "github.com/sirupsen/logrus" admissionv1beta1 "k8s.io/api/admission/v1beta1" admissionregistrationv1beta1 "k8s.io/api/admissionregistration/v1beta1" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" @@ -111,7 +112,7 @@ func (s *ValidatingAdmissionWebhook) Register() error { return err } // parse the pem-encoded tls artifacts contained in the secret - cert, err := tls.X509KeyPair(sec.Data[v1.TLSCertKey], sec.Data[v1.TLSPrivateKeyKey]) + cert, err := tls.X509KeyPair(sec.Data[corev1.TLSCertKey], sec.Data[corev1.TLSPrivateKeyKey]) if err != nil { return err } @@ -120,7 +121,7 @@ func (s *ValidatingAdmissionWebhook) Register() error { // if the admission webhook is enable, ensure it is correctly registered if Enabled { - return s.ensureWebhookConfig(sec.Data[v1.TLSCertKey]) + return s.ensureWebhookConfig(sec.Data[corev1.TLSCertKey]) } // at this point we know the admission webhook is disabled, so we should @@ -176,7 +177,7 @@ func (s *ValidatingAdmissionWebhook) handleAerospikeNamespaceRestore(res http.Re // ensureTLSSecret generates a certificate and private key to be used for registering and serving the webhook, and // creates a kubernetes secret containing them so they can be used by all running instances of aerospike-operator. // in case such secret already exists, it is read and returned. -func (s *ValidatingAdmissionWebhook) ensureTLSSecret() (*v1.Secret, error) { +func (s *ValidatingAdmissionWebhook) ensureTLSSecret() (*corev1.Secret, error) { // generate the certificate to use when registering and serving the webhook svc := fmt.Sprintf("%s.%s.svc", serviceName, s.namespace) now := time.Now() @@ -212,7 +213,7 @@ func (s *ValidatingAdmissionWebhook) ensureTLSSecret() (*v1.Secret, error) { Bytes: sig, }) // create a kubernetes secret holding the certificate and private key - sec, err := s.kubeClient.CoreV1().Secrets(s.namespace).Create(&v1.Secret{ + sec, err := s.kubeClient.CoreV1().Secrets(s.namespace).Create(&corev1.Secret{ ObjectMeta: metav1.ObjectMeta{ Name: tlsSecretName, Labels: map[string]string{ @@ -220,10 +221,10 @@ func (s *ValidatingAdmissionWebhook) ensureTLSSecret() (*v1.Secret, error) { }, Namespace: s.namespace, }, - Type: v1.SecretTypeTLS, + Type: corev1.SecretTypeTLS, Data: map[string][]byte{ - v1.TLSCertKey: sigBytes, - v1.TLSPrivateKeyKey: keyBytes, + corev1.TLSCertKey: sigBytes, + corev1.TLSPrivateKeyKey: keyBytes, }, }) // if creation was successful, return the created secret diff --git a/internal/apis/aerospike/v1alpha1/types.go b/internal/apis/aerospike/v1alpha1/types.go index 1cebcc3..2b00b37 100755 --- a/internal/apis/aerospike/v1alpha1/types.go +++ b/internal/apis/aerospike/v1alpha1/types.go @@ -18,6 +18,7 @@ package v1alpha1 import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) @@ -27,7 +28,7 @@ type BackupRestoreObject interface { GetKind() string GetName() string GetNamespace() string - GetObjectMeta() *v1.ObjectMeta + GetObjectMeta() *metav1.ObjectMeta GetStorage() *BackupStorageSpec SetStorage(*BackupStorageSpec) GetTarget() *TargetNamespace diff --git a/internal/apis/aerospike/v1alpha2/types.go b/internal/apis/aerospike/v1alpha2/types.go index bf4f78d..8d1dfce 100755 --- a/internal/apis/aerospike/v1alpha2/types.go +++ b/internal/apis/aerospike/v1alpha2/types.go @@ -18,6 +18,7 @@ package v1alpha2 import ( "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" ) @@ -27,7 +28,7 @@ type BackupRestoreObject interface { GetKind() string GetName() string GetNamespace() string - GetObjectMeta() *v1.ObjectMeta + GetObjectMeta() *metav1.ObjectMeta GetStorage() *BackupStorageSpec SetStorage(*BackupStorageSpec) GetTarget() *TargetNamespace diff --git a/internal/backuprestore/handler.go b/internal/backuprestore/handler.go index 1948f81..672db5f 100755 --- a/internal/backuprestore/handler.go +++ b/internal/backuprestore/handler.go @@ -22,6 +22,7 @@ import ( log "github.com/sirupsen/logrus" batch "k8s.io/api/batch/v1" + corev1 "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -125,7 +126,7 @@ func (h *AerospikeBackupRestoreHandler) Handle(obj aerospikev1alpha2.BackupResto // launchJob performs a number of checks and launches the job associated with // obj. -func (h *AerospikeBackupRestoreHandler) launchJob(obj aerospikev1alpha2.BackupRestoreObject, secret *v1.Secret) error { +func (h *AerospikeBackupRestoreHandler) launchJob(obj aerospikev1alpha2.BackupRestoreObject, secret *corev1.Secret) error { // create the backup/restore job job, err := h.createJob(obj, secret) if err != nil { @@ -139,7 +140,7 @@ func (h *AerospikeBackupRestoreHandler) launchJob(obj aerospikev1alpha2.BackupRe }).Debugf("%s job created as %s", obj.GetOperationType(), meta.Key(job)) // record an event indicating the current status h.recorder.Eventf(obj.(runtime.Object), - v1.EventTypeNormal, events.ReasonJobCreated, + corev1.EventTypeNormal, events.ReasonJobCreated, "%s job created as %s", obj.GetOperationType(), meta.Key(job)) // append a condition to the resource indicating the current status condition := apiextensions.CustomResourceDefinitionCondition{ @@ -159,11 +160,11 @@ func (h *AerospikeBackupRestoreHandler) maybeSetConditions(obj aerospikev1alpha2 // look for the complete or failed condition in the associated job for _, c := range job.Status.Conditions { - if c.Type == batch.JobComplete && c.Status == v1.ConditionTrue { + if c.Type == batch.JobComplete && c.Status == corev1.ConditionTrue { jobCondition = batch.JobComplete break } - if c.Type == batch.JobFailed && c.Status == v1.ConditionTrue { + if c.Type == batch.JobFailed && c.Status == corev1.ConditionTrue { jobCondition = batch.JobFailed break } @@ -178,7 +179,7 @@ func (h *AerospikeBackupRestoreHandler) maybeSetConditions(obj aerospikev1alpha2 logfields.Key: meta.Key(obj), }).Debugf("%s job has finished", obj.GetOperationType()) // record an event indicating success - h.recorder.Eventf(obj.(runtime.Object), v1.EventTypeNormal, events.ReasonJobFinished, + h.recorder.Eventf(obj.(runtime.Object), corev1.EventTypeNormal, events.ReasonJobFinished, "%s job has finished", obj.GetOperationType()) // append a jobCondition to the resource's status indicating success obj.SetConditions(append(obj.GetConditions(), apiextensions.CustomResourceDefinitionCondition{ @@ -194,7 +195,7 @@ func (h *AerospikeBackupRestoreHandler) maybeSetConditions(obj aerospikev1alpha2 logfields.Key: meta.Key(obj), }).Debugf("%s job failed %d times", obj.GetOperationType(), job.Status.Failed) // record an event indicating failure - h.recorder.Eventf(obj.(runtime.Object), v1.EventTypeWarning, events.ReasonJobFailed, + h.recorder.Eventf(obj.(runtime.Object), corev1.EventTypeWarning, events.ReasonJobFailed, "%s job failed %d times", obj.GetOperationType(), job.Status.Failed) // append a jobCondition to the resource's status indicating failure obj.SetConditions(append(obj.GetConditions(), apiextensions.CustomResourceDefinitionCondition{ diff --git a/internal/crd/converters/v1alpha2/backup.go b/internal/crd/converters/v1alpha2/backup.go index 51d7848..567189c 100755 --- a/internal/crd/converters/v1alpha2/backup.go +++ b/internal/crd/converters/v1alpha2/backup.go @@ -19,7 +19,7 @@ package v1alpha2 import ( log "github.com/sirupsen/logrus" extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" diff --git a/internal/crd/converters/v1alpha2/cluster.go b/internal/crd/converters/v1alpha2/cluster.go index 2098cb8..7ebfeb6 100755 --- a/internal/crd/converters/v1alpha2/cluster.go +++ b/internal/crd/converters/v1alpha2/cluster.go @@ -20,6 +20,7 @@ import ( log "github.com/sirupsen/logrus" extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" diff --git a/internal/crd/converters/v1alpha2/restore.go b/internal/crd/converters/v1alpha2/restore.go index 637921e..6842f3f 100755 --- a/internal/crd/converters/v1alpha2/restore.go +++ b/internal/crd/converters/v1alpha2/restore.go @@ -20,6 +20,7 @@ import ( log "github.com/sirupsen/logrus" extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" "k8s.io/apimachinery/pkg/apis/meta/v1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" diff --git a/internal/garbagecollector/asbackups.go b/internal/garbagecollector/asbackups.go index 9202359..ebb5241 100755 --- a/internal/garbagecollector/asbackups.go +++ b/internal/garbagecollector/asbackups.go @@ -21,7 +21,7 @@ import ( "time" log "github.com/sirupsen/logrus" - "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" "k8s.io/client-go/tools/record" @@ -59,7 +59,7 @@ func (h *AerospikeNamespaceBackupHandler) Handle(asBackup *aerospikev1alpha2.Aer }).Debug("checking whether aerospikenamespacebackup has expired") // get the corresponding aerospikecluster object - aerospikeCluster, err := h.aerospikeclientset.AerospikeV1alpha2().AerospikeClusters(asBackup.Namespace).Get(asBackup.Spec.Target.Cluster, v1.GetOptions{}) + aerospikeCluster, err := h.aerospikeclientset.AerospikeV1alpha2().AerospikeClusters(asBackup.Namespace).Get(asBackup.Spec.Target.Cluster, metav1.GetOptions{}) if err != nil { return err } @@ -117,7 +117,7 @@ func (h *AerospikeNamespaceBackupHandler) Handle(asBackup *aerospikev1alpha2.Aer } // delete AerospikeNamespaceBackup resource - if err := h.aerospikeclientset.AerospikeV1alpha2().AerospikeNamespaceBackups(asBackup.Namespace).Delete(asBackup.Name, &v1.DeleteOptions{}); err != nil { + if err := h.aerospikeclientset.AerospikeV1alpha2().AerospikeNamespaceBackups(asBackup.Namespace).Delete(asBackup.Name, &metav1.DeleteOptions{}); err != nil { return err } log.WithFields(log.Fields{ diff --git a/internal/garbagecollector/gcs.go b/internal/garbagecollector/gcs.go index 64d9b15..88b373c 100755 --- a/internal/garbagecollector/gcs.go +++ b/internal/garbagecollector/gcs.go @@ -17,6 +17,8 @@ limitations under the License. package garbagecollector import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" "github.com/travelaudience/aerospike-operator/internal/backuprestore" "github.com/travelaudience/aerospike-operator/internal/backuprestore/gcs" @@ -25,7 +27,7 @@ import ( func (h *AerospikeNamespaceBackupHandler) deleteBackupDataGCS(asBackup *aerospikev1alpha2.AerospikeNamespaceBackup) error { // get the secret containing the credentials to access the gcs bucket namespace := asBackup.Spec.Storage.GetSecretNamespace(asBackup.Namespace) - secret, err := h.kubeclientset.CoreV1().Secrets(namespace).Get(asBackup.Spec.Storage.GetSecret(), v1.GetOptions{}) + secret, err := h.kubeclientset.CoreV1().Secrets(namespace).Get(asBackup.Spec.Storage.GetSecret(), metav1.GetOptions{}) if err != nil { return err } diff --git a/internal/garbagecollector/pvcs.go b/internal/garbagecollector/pvcs.go index f4549d3..c6f4fd8 100755 --- a/internal/garbagecollector/pvcs.go +++ b/internal/garbagecollector/pvcs.go @@ -21,6 +21,7 @@ import ( "time" log "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/client-go/kubernetes" @@ -49,7 +50,7 @@ func NewPVCsGCHandler(kubeclientset kubernetes.Interface, } } -func (h *PVCsHandler) Handle(pvc *v1.PersistentVolumeClaim) error { +func (h *PVCsHandler) Handle(pvc *corev1.PersistentVolumeClaim) error { log.WithFields(log.Fields{ logfields.Key: meta.Key(pvc), }).Debug("checking whether pvc has expired") diff --git a/internal/meta/key_test.go b/internal/meta/key_test.go index 7606bbe..2e87ae7 100755 --- a/internal/meta/key_test.go +++ b/internal/meta/key_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/stretchr/testify/assert" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/internal/reconciler/backups.go b/internal/reconciler/backups.go index cf54208..1576d8c 100755 --- a/internal/reconciler/backups.go +++ b/internal/reconciler/backups.go @@ -55,7 +55,7 @@ func (r *AerospikeClusterReconciler) isClusterBackupFinished(aerospikeCluster *a func (r *AerospikeClusterReconciler) createNamespaceBackup(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, ns string) error { backup := aerospikev1alpha2.AerospikeNamespaceBackup{ - ObjectMeta: v1.ObjectMeta{ + ObjectMeta: metav1.ObjectMeta{ Name: GetBackupName(ns, aerospikeCluster.Status.Version, aerospikeCluster.Spec.Version), Labels: map[string]string{ selectors.LabelAppKey: selectors.LabelAppVal, diff --git a/internal/reconciler/configmap.go b/internal/reconciler/configmap.go index 06bbe48..81587b5 100755 --- a/internal/reconciler/configmap.go +++ b/internal/reconciler/configmap.go @@ -22,6 +22,7 @@ import ( "strings" log "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -35,7 +36,7 @@ import ( asstrings "github.com/travelaudience/aerospike-operator/internal/utils/strings" ) -func (r *AerospikeClusterReconciler) ensureConfigMap(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) (*v1.ConfigMap, error) { +func (r *AerospikeClusterReconciler) ensureConfigMap(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) (*corev1.ConfigMap, error) { // grab the desired configmap object desiredConfigMap := buildConfigMap(aerospikeCluster) // try to actually create the configmap resource @@ -56,7 +57,7 @@ func (r *AerospikeClusterReconciler) ensureConfigMap(aerospikeCluster *aerospike } } -func (r *AerospikeClusterReconciler) updateConfigMap(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, desiredConfigMap *v1.ConfigMap) (*v1.ConfigMap, error) { +func (r *AerospikeClusterReconciler) updateConfigMap(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, desiredConfigMap *corev1.ConfigMap) (*corev1.ConfigMap, error) { // get the current configmap resource currentConfigMap, err := r.configMapsLister.ConfigMaps(aerospikeCluster.Namespace).Get(desiredConfigMap.Name) if err != nil { @@ -105,11 +106,11 @@ func buildConfig(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) string { return configMapBuffer.String() } -func buildConfigMap(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) *v1.ConfigMap { +func buildConfigMap(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) *corev1.ConfigMap { // build the aerospike config file based on the current spec aerospikeConfig := buildConfig(aerospikeCluster) // return a configmap object containing aerospikeConfig - return &v1.ConfigMap{ + return &corev1.ConfigMap{ ObjectMeta: metav1.ObjectMeta{ Name: aerospikeCluster.Name, Labels: map[string]string{ diff --git a/internal/reconciler/networkpolicy.go b/internal/reconciler/networkpolicy.go index 467b7ea..98f47ef 100755 --- a/internal/reconciler/networkpolicy.go +++ b/internal/reconciler/networkpolicy.go @@ -18,10 +18,10 @@ package reconciler import ( log "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" networkv1 "k8s.io/api/networking/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" - "k8s.io/apimachinery/pkg/util/intstr" aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" @@ -33,8 +33,8 @@ import ( ) var ( - protocolTCP = v1.ProtocolTCP - protocolUDP = v1.ProtocolUDP + protocolTCP = corev1.ProtocolTCP + protocolUDP = corev1.ProtocolUDP ) func (r *AerospikeClusterReconciler) ensureNetworkPolicy(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) error { diff --git a/internal/reconciler/podutils.go b/internal/reconciler/podutils.go index efa8962..f83e2df 100755 --- a/internal/reconciler/podutils.go +++ b/internal/reconciler/podutils.go @@ -24,6 +24,7 @@ import ( "time" as "github.com/aerospike/aerospike-client-go" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/runtime" watchapi "k8s.io/apimachinery/pkg/watch" @@ -35,7 +36,7 @@ import ( "github.com/travelaudience/aerospike-operator/internal/utils/selectors" ) -type byIndex []*v1.Pod +type byIndex []*corev1.Pod func (p byIndex) Len() int { return len(p) @@ -51,7 +52,7 @@ func (p byIndex) Less(i, j int) bool { return idx1 < idx2 } -func podIndex(pod *v1.Pod) int { +func podIndex(pod *corev1.Pod) int { res, err := strconv.Atoi(strings.TrimPrefix(pod.Name, fmt.Sprintf("%s-", pod.ObjectMeta.Labels[selectors.LabelClusterKey]))) if err != nil { return -1 @@ -59,15 +60,15 @@ func podIndex(pod *v1.Pod) int { return res } -func isPodRunningAndReady(pod *v1.Pod) bool { - return pod.Status.Phase == v1.PodRunning && podutil.IsPodReady(pod) +func isPodRunningAndReady(pod *corev1.Pod) bool { + return pod.Status.Phase == corev1.PodRunning && podutil.IsPodReady(pod) } // isPodInFailureState attempts to checks if the specified pod has reached an error condition from which it is not // expected to recover. -func isPodInFailureState(pod *v1.Pod) bool { +func isPodInFailureState(pod *corev1.Pod) bool { // if the value of ".status.phase" is "Failed", trhe pod is trivially in a failure state - if pod.Status.Phase == v1.PodFailed { + if pod.Status.Phase == corev1.PodFailed { return true } @@ -97,7 +98,7 @@ func isImageError(reason string) bool { return reason == ReasonErrImagePull || reason == ReasonImageInspectError || reason == ReasonImagePullBackOff || reason == ReasonRegistryUnavailable } -func (r *AerospikeClusterReconciler) waitForPodCondition(pod *v1.Pod, fn watch.ConditionFunc, timeout time.Duration) error { +func (r *AerospikeClusterReconciler) waitForPodCondition(pod *corev1.Pod, fn watch.ConditionFunc, timeout time.Duration) error { fs := selectors.ObjectByCoordinates(pod.Namespace, pod.Name) lw := &cache.ListWatch{ ListFunc: func(options metav1.ListOptions) (runtime.Object, error) { @@ -111,7 +112,7 @@ func (r *AerospikeClusterReconciler) waitForPodCondition(pod *v1.Pod, fn watch.C } ctx, cfn := context.WithTimeout(context.Background(), timeout) defer cfn() - last, err := watch.UntilWithSync(ctx, lw, &v1.Pod{}, nil, fn) + last, err := watch.UntilWithSync(ctx, lw, &corev1.Pod{}, nil, fn) if err != nil { return err } @@ -121,7 +122,7 @@ func (r *AerospikeClusterReconciler) waitForPodCondition(pod *v1.Pod, fn watch.C return nil } -func podHasMigrationsInProgress(pod *v1.Pod) (bool, error) { +func podHasMigrationsInProgress(pod *corev1.Pod) (bool, error) { client, err := as.NewClient(pod.Status.PodIP, ServicePort) if err != nil { return false, err @@ -137,7 +138,7 @@ func podHasMigrationsInProgress(pod *v1.Pod) (bool, error) { return false, fmt.Errorf("failed to find node %s in the cluster", pod.Annotations[nodeIdAnnotation]) } -func waitForMigrationsToFinishOnPod(pod *v1.Pod) error { +func waitForMigrationsToFinishOnPod(pod *corev1.Pod) error { client, err := as.NewClient(pod.Status.PodIP, ServicePort) if err != nil { return err @@ -153,7 +154,7 @@ func waitForMigrationsToFinishOnPod(pod *v1.Pod) error { return fmt.Errorf("failed to find node %s in the cluster", pod.Annotations[nodeIdAnnotation]) } -func runInfoCommandOnPod(pod *v1.Pod, command string) (map[string]string, error) { +func runInfoCommandOnPod(pod *corev1.Pod, command string) (map[string]string, error) { addr := fmt.Sprintf("%s:%d", pod.Status.PodIP, ServicePort) conn, err := as.NewConnection(addr, aerospikeClientTimeout) if err != nil { @@ -163,7 +164,7 @@ func runInfoCommandOnPod(pod *v1.Pod, command string) (map[string]string, error) return as.RequestInfo(conn, command) } -func getAerospikeServerVersionFromPod(pod *v1.Pod) (string, error) { +func getAerospikeServerVersionFromPod(pod *corev1.Pod) (string, error) { res, err := runInfoCommandOnPod(pod, "build") if err != nil { return "", err @@ -176,12 +177,12 @@ func getAerospikeServerVersionFromPod(pod *v1.Pod) (string, error) { return version, nil } -func tipClearHostname(pod *v1.Pod, address string) error { +func tipClearHostname(pod *corev1.Pod, address string) error { _, err := runInfoCommandOnPod(pod, fmt.Sprintf("tip-clear:host-port-list=%s:%d", address, HeartbeatPort)) return err } -func alumniReset(pod *v1.Pod) error { +func alumniReset(pod *corev1.Pod) error { _, err := runInfoCommandOnPod(pod, "services-alumni-reset") return err } diff --git a/internal/reconciler/pvc.go b/internal/reconciler/pvc.go index afdbc5e..e5baf52 100755 --- a/internal/reconciler/pvc.go +++ b/internal/reconciler/pvc.go @@ -23,6 +23,7 @@ import ( "time" log "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/resource" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/types" @@ -39,13 +40,13 @@ import ( ) var ( - volumeModeMap = map[string]v1.PersistentVolumeMode{ - common.StorageTypeDevice: v1.PersistentVolumeBlock, - common.StorageTypeFile: v1.PersistentVolumeFilesystem, + volumeModeMap = map[string]corev1.PersistentVolumeMode{ + common.StorageTypeDevice: corev1.PersistentVolumeBlock, + common.StorageTypeFile: corev1.PersistentVolumeFilesystem, } ) -type fromMostRecent []*v1.PersistentVolumeClaim +type fromMostRecent []*corev1.PersistentVolumeClaim func (pvcs fromMostRecent) Len() int { return len(pvcs) @@ -59,7 +60,7 @@ func (pvcs fromMostRecent) Less(i, j int) bool { return pvcs[j].CreationTimestamp.Before(&pvcs[i].CreationTimestamp) } -func (r *AerospikeClusterReconciler) getPersistentVolumeClaim(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, pod *v1.Pod) (*v1.PersistentVolumeClaim, error) { +func (r *AerospikeClusterReconciler) getPersistentVolumeClaim(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, pod *corev1.Pod) (*corev1.PersistentVolumeClaim, error) { // get all the pvcs owned by the aerospikecluster pvcs, err := r.pvcsLister.PersistentVolumeClaims(aerospikeCluster.Namespace).List(selectors.ResourcesByClusterName(aerospikeCluster.Name)) if err != nil { @@ -70,7 +71,7 @@ func (r *AerospikeClusterReconciler) getPersistentVolumeClaim(aerospikeCluster * } // filter the ones associated with the pod - var podPVCs []*v1.PersistentVolumeClaim + var podPVCs []*corev1.PersistentVolumeClaim for _, pvc := range pvcs { // skip pvc if it does not belong to the right pod podName, ok := pvc.Annotations[PodAnnotation] @@ -117,7 +118,7 @@ func (r *AerospikeClusterReconciler) getPersistentVolumeClaim(aerospikeCluster * return podPVCs[0], nil } -func (r *AerospikeClusterReconciler) createPersistentVolumeClaim(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, pod *v1.Pod, namespace *aerospikev1alpha2.AerospikeNamespaceSpec) (*v1.PersistentVolumeClaim, error) { +func (r *AerospikeClusterReconciler) createPersistentVolumeClaim(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, pod *corev1.Pod, namespace *aerospikev1alpha2.AerospikeNamespaceSpec) (*corev1.PersistentVolumeClaim, error) { storageSize, err := resource.ParseQuantity(namespace.Storage.Size) if err != nil { return nil, err @@ -131,7 +132,7 @@ func (r *AerospikeClusterReconciler) createPersistentVolumeClaim(aerospikeCluste persistentVolumeClaimTTL = *namespace.Storage.PersistentVolumeClaimTTL } - claim := &v1.PersistentVolumeClaim{ + claim := &corev1.PersistentVolumeClaim{ ObjectMeta: metav1.ObjectMeta{ GenerateName: fmt.Sprintf("%s-%s-", pod.Name, namespace.Name), Labels: map[string]string{ @@ -155,13 +156,13 @@ func (r *AerospikeClusterReconciler) createPersistentVolumeClaim(aerospikeCluste PVCTTLAnnotation: persistentVolumeClaimTTL, }, }, - Spec: v1.PersistentVolumeClaimSpec{ - AccessModes: []v1.PersistentVolumeAccessMode{ - v1.ReadWriteOnce, + Spec: corev1.PersistentVolumeClaimSpec{ + AccessModes: []corev1.PersistentVolumeAccessMode{ + corev1.ReadWriteOnce, }, - Resources: v1.ResourceRequirements{ - Requests: v1.ResourceList{ - v1.ResourceStorage: storageSize, + Resources: corev1.ResourceRequirements{ + Requests: corev1.ResourceList{ + corev1.ResourceStorage: storageSize, }, }, VolumeMode: &volumeMode, @@ -195,13 +196,13 @@ func getIndexBasedDevicePath(index int) string { return fmt.Sprintf("%s%s", defaultDevicePathPrefix, string('a'+index)) } -func (r *AerospikeClusterReconciler) signalMounted(pvc *v1.PersistentVolumeClaim) error { +func (r *AerospikeClusterReconciler) signalMounted(pvc *corev1.PersistentVolumeClaim) error { oldPVC := pvc.DeepCopy() removePVCAnnotation(pvc, LastUnmountedOnAnnotation) return r.patchPVC(oldPVC, pvc) } -func (r *AerospikeClusterReconciler) signalUnmounted(pvc *v1.PersistentVolumeClaim) error { +func (r *AerospikeClusterReconciler) signalUnmounted(pvc *corev1.PersistentVolumeClaim) error { oldPVC := pvc.DeepCopy() setPVCAnnotation(pvc, LastUnmountedOnAnnotation, time.Now().Format(time.RFC3339)) return r.patchPVC(oldPVC, pvc) @@ -209,7 +210,7 @@ func (r *AerospikeClusterReconciler) signalUnmounted(pvc *v1.PersistentVolumeCla // setPVCAnnotation sets an annotation with the specified key and value in the // aerospikeCluster object -func setPVCAnnotation(pvc *v1.PersistentVolumeClaim, key, value string) { +func setPVCAnnotation(pvc *corev1.PersistentVolumeClaim, key, value string) { if pvc.ObjectMeta.Annotations == nil { pvc.ObjectMeta.Annotations = make(map[string]string) } @@ -218,12 +219,12 @@ func setPVCAnnotation(pvc *v1.PersistentVolumeClaim, key, value string) { // removePVCAnnotation removes the annotation with the specified key from the // aerospikeCluster object -func removePVCAnnotation(pvc *v1.PersistentVolumeClaim, key string) { +func removePVCAnnotation(pvc *corev1.PersistentVolumeClaim, key string) { delete(pvc.ObjectMeta.Annotations, key) } // patchCluster updates the status field of the aerospikeCluster -func (r *AerospikeClusterReconciler) patchPVC(old, new *v1.PersistentVolumeClaim) error { +func (r *AerospikeClusterReconciler) patchPVC(old, new *corev1.PersistentVolumeClaim) error { oldBytes, err := json.Marshal(old) if err != nil { return err @@ -232,7 +233,7 @@ func (r *AerospikeClusterReconciler) patchPVC(old, new *v1.PersistentVolumeClaim if err != nil { return err } - patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldBytes, newBytes, &v1.PersistentVolumeClaim{}) + patchBytes, err := strategicpatch.CreateTwoWayMergePatch(oldBytes, newBytes, &corev1.PersistentVolumeClaim{}) if err != nil { return err } diff --git a/internal/reconciler/service.go b/internal/reconciler/service.go index 0281e4e..d251479 100755 --- a/internal/reconciler/service.go +++ b/internal/reconciler/service.go @@ -18,6 +18,7 @@ package reconciler import ( log "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "k8s.io/apimachinery/pkg/util/intstr" @@ -31,7 +32,7 @@ import ( ) func (r *AerospikeClusterReconciler) ensureService(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) error { - service := &v1.Service{ + service := &corev1.Service{ ObjectMeta: metav1.ObjectMeta{ Name: aerospikeCluster.Name, Labels: map[string]string{ @@ -50,12 +51,12 @@ func (r *AerospikeClusterReconciler) ensureService(aerospikeCluster *aerospikev1 }, }, }, - Spec: v1.ServiceSpec{ + Spec: corev1.ServiceSpec{ Selector: map[string]string{ selectors.LabelAppKey: selectors.LabelAppVal, selectors.LabelClusterKey: aerospikeCluster.Name, }, - Ports: []v1.ServicePort{ + Ports: []corev1.ServicePort{ { Name: servicePortName, Port: ServicePort, @@ -72,7 +73,7 @@ func (r *AerospikeClusterReconciler) ensureService(aerospikeCluster *aerospikev1 TargetPort: intstr.IntOrString{StrVal: aspromPortName}, }, }, - ClusterIP: v1.ClusterIPNone, + ClusterIP: corev1.ClusterIPNone, }, } diff --git a/internal/reconciler/upgrades.go b/internal/reconciler/upgrades.go index 95a6a6f..c7bd422 100755 --- a/internal/reconciler/upgrades.go +++ b/internal/reconciler/upgrades.go @@ -21,6 +21,7 @@ import ( "time" log "github.com/sirupsen/logrus" + corev1 "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" @@ -32,7 +33,7 @@ import ( "github.com/travelaudience/aerospike-operator/internal/versioning" ) -func (r *AerospikeClusterReconciler) maybeUpgradePodWithIndex(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, configMap *v1.ConfigMap, index int, upgrade *versioning.VersionUpgrade) (*v1.Pod, error) { +func (r *AerospikeClusterReconciler) maybeUpgradePodWithIndex(aerospikeCluster *aerospikev1alpha2.AerospikeCluster, configMap *corev1.ConfigMap, index int, upgrade *versioning.VersionUpgrade) (*corev1.Pod, error) { // check whether a pod with the specified index exists pod, err := r.getPodWithIndex(aerospikeCluster, index) if err != nil { @@ -56,7 +57,7 @@ func (r *AerospikeClusterReconciler) maybeUpgradePodWithIndex(aerospikeCluster * log.WithFields(log.Fields{ logfields.AerospikeCluster: meta.Key(aerospikeCluster), }).Debugf("upgrading pod %s to version %s", meta.Key(pod), aerospikeCluster.Spec.Version) - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonNodeUpgradeStarted, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonNodeUpgradeStarted, "upgrading pod %s to version %s", meta.Key(pod), aerospikeCluster.Spec.Version) @@ -71,7 +72,7 @@ func (r *AerospikeClusterReconciler) maybeUpgradePodWithIndex(aerospikeCluster * return nil, err } if version != aerospikeCluster.Spec.Version { - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonNodeUpgradeFailed, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonNodeUpgradeFailed, "failed to upgrade pod %s to version %s", meta.Key(pod), aerospikeCluster.Spec.Version) return nil, fmt.Errorf("failed to upgrade pod %s to version %s", meta.Key(newPod), aerospikeCluster.Spec.Version) @@ -80,7 +81,7 @@ func (r *AerospikeClusterReconciler) maybeUpgradePodWithIndex(aerospikeCluster * log.WithFields(log.Fields{ logfields.AerospikeCluster: meta.Key(aerospikeCluster), }).Debugf("upgraded pod %s to version %s", meta.Key(pod), aerospikeCluster.Spec.Version) - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonNodeUpgradeFinished, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonNodeUpgradeFinished, "upgraded pod %s to version %s", meta.Key(pod), aerospikeCluster.Spec.Version) @@ -105,7 +106,7 @@ func (r *AerospikeClusterReconciler) signalBackupStarted(aerospikeCluster *aeros return nil, err } - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonClusterAutoBackupStarted, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonClusterAutoBackupStarted, "cluster backup started") log.WithFields(log.Fields{ @@ -132,7 +133,7 @@ func (r *AerospikeClusterReconciler) signalBackupFinished(aerospikeCluster *aero return nil, err } - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonClusterAutoBackupFinished, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonClusterAutoBackupFinished, "cluster backup finished") log.WithFields(log.Fields{ @@ -159,7 +160,7 @@ func (r *AerospikeClusterReconciler) signalBackupFailed(aerospikeCluster *aerosp return nil, err } - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonClusterAutoBackupFailed, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonClusterAutoBackupFailed, "cluster backup failed") log.WithFields(log.Fields{ @@ -187,7 +188,7 @@ func (r *AerospikeClusterReconciler) signalUpgradeStarted(aerospikeCluster *aero return nil, err } - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonClusterUpgradeStarted, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonClusterUpgradeStarted, "upgrade from version %s to %s started", upgrade.Source, upgrade.Target) log.WithFields(log.Fields{ @@ -215,7 +216,7 @@ func (r *AerospikeClusterReconciler) signalUpgradeFailed(aerospikeCluster *aeros return nil, err } - r.recorder.Eventf(aerospikeCluster, v1.EventTypeWarning, events.ReasonClusterUpgradeFailed, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeWarning, events.ReasonClusterUpgradeFailed, "upgrade from version %s to %s failed", upgrade.Source, upgrade.Target) @@ -244,7 +245,7 @@ func (r *AerospikeClusterReconciler) signalUpgradeFinished(aerospikeCluster *aer return nil, err } - r.recorder.Eventf(aerospikeCluster, v1.EventTypeNormal, events.ReasonClusterUpgradeFinished, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeNormal, events.ReasonClusterUpgradeFinished, "finished upgrade from version %s to %s", upgrade.Source, upgrade.Target) log.WithFields(log.Fields{ diff --git a/internal/reconciler/validation.go b/internal/reconciler/validation.go index 41d71be..b8dc51e 100755 --- a/internal/reconciler/validation.go +++ b/internal/reconciler/validation.go @@ -17,6 +17,7 @@ limitations under the License. package reconciler import ( + corev1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" @@ -36,7 +37,7 @@ func (r *AerospikeClusterReconciler) validate(aerospikeCluster *aerospikev1alpha func (r *AerospikeClusterReconciler) validateReplicationFactor(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) bool { for _, ns := range aerospikeCluster.Spec.Namespaces { if ns.ReplicationFactor != nil && *ns.ReplicationFactor > aerospikeCluster.Spec.NodeCount { - r.recorder.Eventf(aerospikeCluster, v1.EventTypeWarning, events.ReasonValidationError, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeWarning, events.ReasonValidationError, "replication factor of %d requested for namespace %s but the cluster has only %d nodes", ns.ReplicationFactor, ns.Name, @@ -53,12 +54,12 @@ func (r *AerospikeClusterReconciler) validateStorageClass(aerospikeCluster *aero if ns.Storage.StorageClassName != nil && *ns.Storage.StorageClassName != "" { if _, err := r.scsLister.Get(*ns.Storage.StorageClassName); err != nil { if errors.IsNotFound(err) { - r.recorder.Eventf(aerospikeCluster, v1.EventTypeWarning, events.ReasonValidationError, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeWarning, events.ReasonValidationError, "storage class %q does not exist", ns.Storage.StorageClassName, ) } else { - r.recorder.Eventf(aerospikeCluster, v1.EventTypeWarning, events.ReasonValidationError, + r.recorder.Eventf(aerospikeCluster, corev1.EventTypeWarning, events.ReasonValidationError, "failed to get storage class %q: %v", ns.Storage.StorageClassName, err, diff --git a/test/e2e/backups/backups.go b/test/e2e/backups/backups.go index d1e6098..3a6612d 100755 --- a/test/e2e/backups/backups.go +++ b/test/e2e/backups/backups.go @@ -18,6 +18,7 @@ package backups import ( . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" diff --git a/test/e2e/backups/e2e.go b/test/e2e/backups/e2e.go index 3be67d2..a39d243 100644 --- a/test/e2e/backups/e2e.go +++ b/test/e2e/backups/e2e.go @@ -19,7 +19,7 @@ package backups import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/e2e.go b/test/e2e/cluster/e2e.go index 7e6a249..b52b00e 100644 --- a/test/e2e/cluster/e2e.go +++ b/test/e2e/cluster/e2e.go @@ -19,7 +19,7 @@ package cluster import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "github.com/travelaudience/aerospike-operator/test/e2e/framework" ) diff --git a/test/e2e/cluster/multicluster.go b/test/e2e/cluster/multicluster.go index 0c56f25..71bb236 100755 --- a/test/e2e/cluster/multicluster.go +++ b/test/e2e/cluster/multicluster.go @@ -20,6 +20,7 @@ import ( "fmt" . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/asutils" diff --git a/test/e2e/cluster/podrestart.go b/test/e2e/cluster/podrestart.go index c361689..09ee29b 100755 --- a/test/e2e/cluster/podrestart.go +++ b/test/e2e/cluster/podrestart.go @@ -20,6 +20,7 @@ import ( "fmt" . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/asutils" diff --git a/test/e2e/cluster/pvc.go b/test/e2e/cluster/pvc.go index 49dddaa..dbd887c 100755 --- a/test/e2e/cluster/pvc.go +++ b/test/e2e/cluster/pvc.go @@ -21,6 +21,7 @@ import ( "strings" . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" diff --git a/test/e2e/cluster/scaling.go b/test/e2e/cluster/scaling.go index 0f5f36a..3ccdaa8 100755 --- a/test/e2e/cluster/scaling.go +++ b/test/e2e/cluster/scaling.go @@ -21,6 +21,7 @@ import ( "math" . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" diff --git a/test/e2e/cluster/upgrades.go b/test/e2e/cluster/upgrades.go index 53fb2e2..0f3dbda 100755 --- a/test/e2e/cluster/upgrades.go +++ b/test/e2e/cluster/upgrades.go @@ -20,6 +20,7 @@ import ( "fmt" . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/test/e2e/e2e_test.go b/test/e2e/e2e_test.go index 814661c..0b469e4 100755 --- a/test/e2e/e2e_test.go +++ b/test/e2e/e2e_test.go @@ -20,6 +20,7 @@ import ( "flag" "testing" + v1 "k8s.io/api/core/v1" _ "k8s.io/client-go/plugin/pkg/client/auth/gcp" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" diff --git a/test/e2e/framework/namespace.go b/test/e2e/framework/namespace.go index 6e87428..a0b4902 100755 --- a/test/e2e/framework/namespace.go +++ b/test/e2e/framework/namespace.go @@ -17,6 +17,7 @@ limitations under the License. package framework import ( + v1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) diff --git a/test/e2e/garbagecollector/asbackups.go b/test/e2e/garbagecollector/asbackups.go index 56b6eb4..38d6467 100755 --- a/test/e2e/garbagecollector/asbackups.go +++ b/test/e2e/garbagecollector/asbackups.go @@ -21,6 +21,7 @@ import ( "time" . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" diff --git a/test/e2e/garbagecollector/e2e.go b/test/e2e/garbagecollector/e2e.go index 64491c0..bc66349 100644 --- a/test/e2e/garbagecollector/e2e.go +++ b/test/e2e/garbagecollector/e2e.go @@ -19,7 +19,7 @@ package garbagecollector import ( . "github.com/onsi/ginkgo" . "github.com/onsi/gomega" - "k8s.io/api/core/v1" + v1 "k8s.io/api/core/v1" "time" diff --git a/test/e2e/garbagecollector/pvcs.go b/test/e2e/garbagecollector/pvcs.go index 1406b25..7900280 100755 --- a/test/e2e/garbagecollector/pvcs.go +++ b/test/e2e/garbagecollector/pvcs.go @@ -21,6 +21,7 @@ import ( "time" . "github.com/onsi/gomega" + v1 "k8s.io/api/core/v1" "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" From 6d4985f40f9ba3d47b7a445c3e88de650da1831a Mon Sep 17 00:00:00 2001 From: Piotr Kowalczuk Date: Tue, 4 Jun 2019 10:22:51 +0200 Subject: [PATCH 3/5] pkg into internal - fmt --- Makefile | 2 +- go.sum | 4 ++++ internal/crd/converters/v1alpha2/cluster.go | 7 +++---- internal/crd/converters/v1alpha2/restore.go | 7 +++---- internal/reconciler/pod.go | 2 +- 5 files changed, 12 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index d52213e..bfe51eb 100755 --- a/Makefile +++ b/Makefile @@ -64,7 +64,7 @@ gen: .PHONY: test.unit test.unit: - go test -v ./cmd/... ./pkg/... + go test -v ./cmd/... ./internal/... .PHONY: test.e2e.build test.e2e.build: diff --git a/go.sum b/go.sum index ebaefd8..85707f1 100644 --- a/go.sum +++ b/go.sum @@ -208,10 +208,14 @@ gopkg.in/yaml.v2 v2.0.0-20170812160011-eb3733d160e7/go.mod h1:JAlM8MvJe8wmxCU4Bl gopkg.in/yaml.v2 v2.2.1 h1:mUhvW9EsL+naU5Q3cakzfE91YhliOondGd6ZrsDBHQE= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= +k8s.io/api v0.0.0-20190516230258-a675ac48af67 h1:BKg03K4me3EdM340RB08XB3MRlJ57KY+0f5PfI6wPZY= k8s.io/api v0.0.0-20190516230258-a675ac48af67/go.mod h1:iuAfoD4hCxJ8Onx9kaTIt30j7jUFS00AXQi6QMi99vA= +k8s.io/apiextensions-apiserver v0.0.0-20190516231611-bf6753f2aa24 h1:SwpU8lyfh7Orv1XmveHiN6AD2LxffLHLePQ2gcav4sk= k8s.io/apiextensions-apiserver v0.0.0-20190516231611-bf6753f2aa24/go.mod h1:IxkesAMoaCRoLrPJdZNZUQp9NfZnzqaVzLhb2VEQzXE= +k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d h1:Jmdtdt1ZnoGfWWIIik61Z7nKYgO3J+swQJtPYsP9wHA= k8s.io/apimachinery v0.0.0-20190404173353-6a84e37a896d/go.mod h1:ccL7Eh7zubPUSh9A3USN90/OzHNSVN6zxzde07TDCL0= k8s.io/apiserver v0.0.0-20190516230822-f89599b3f645/go.mod h1:6bqaTSOSJavUIXUtfaR9Os9JtTCm8ZqH2SUl2S60C4w= +k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible h1:bK03DJulJi9j05gwnXUufcs2j7h4M85YFvJ0dIlQ9k4= k8s.io/client-go v11.0.1-0.20190516230509-ae8359b20417+incompatible/go.mod h1:7vJpHMYJwNQCWgzmNV+VYUl1zCObLyodBc8nIyt8L5s= k8s.io/component-base v0.0.0-20190515024022-2354f2393ad4 h1:TOebDR8jh/AcqOEWnotJ+DYVUNcMA1GT86TR4Bg70KQ= k8s.io/component-base v0.0.0-20190515024022-2354f2393ad4/go.mod h1:pKRi1i5IQdJDpK1LItot8oy27Bc3zL/hQiy9T171rvE= diff --git a/internal/crd/converters/v1alpha2/cluster.go b/internal/crd/converters/v1alpha2/cluster.go index 7ebfeb6..6bae9cd 100755 --- a/internal/crd/converters/v1alpha2/cluster.go +++ b/internal/crd/converters/v1alpha2/cluster.go @@ -19,8 +19,7 @@ package v1alpha2 import ( log "github.com/sirupsen/logrus" extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/common" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" @@ -36,7 +35,7 @@ var ( func convertAerospikeClusters(extsClient *extsclientset.Clientset, aerospikeClient *aerospikeclientset.Clientset) error { // fetch the aerospikecluster crd so we can understand if v1alpha1 is still being used as a storage version - asccrd, err := extsClient.ApiextensionsV1beta1().CustomResourceDefinitions().Get(crd.AerospikeClusterCRDName, v1.GetOptions{}) + asccrd, err := extsClient.ApiextensionsV1beta1().CustomResourceDefinitions().Get(crd.AerospikeClusterCRDName, metav1.GetOptions{}) if err != nil { return nil } @@ -54,7 +53,7 @@ func convertAerospikeClusters(extsClient *extsclientset.Clientset, aerospikeClie } // list all existing v1alpha1 aerospikecluster resources across all namespaces - ascs, err := aerospikeClient.AerospikeV1alpha1().AerospikeClusters(v1.NamespaceAll).List(v1.ListOptions{}) + ascs, err := aerospikeClient.AerospikeV1alpha1().AerospikeClusters(metav1.NamespaceAll).List(metav1.ListOptions{}) if err != nil { return nil } diff --git a/internal/crd/converters/v1alpha2/restore.go b/internal/crd/converters/v1alpha2/restore.go index 6842f3f..5fa24a3 100755 --- a/internal/crd/converters/v1alpha2/restore.go +++ b/internal/crd/converters/v1alpha2/restore.go @@ -19,8 +19,7 @@ package v1alpha2 import ( log "github.com/sirupsen/logrus" extsclientset "k8s.io/apiextensions-apiserver/pkg/client/clientset/clientset" - "k8s.io/apimachinery/pkg/apis/meta/v1" - v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha1" aerospikeclientset "github.com/travelaudience/aerospike-operator/internal/client/clientset/versioned" @@ -30,7 +29,7 @@ import ( func convertAerospikeNamespaceRestores(extsClient *extsclientset.Clientset, aerospikeClient *aerospikeclientset.Clientset) error { // fetch the aerospikenamespacerestore crd so we can understand if v1alpha1 is still being used as a storage version - asnrcrd, err := extsClient.ApiextensionsV1beta1().CustomResourceDefinitions().Get(crd.AerospikeNamespaceRestoreCRDName, v1.GetOptions{}) + asnrcrd, err := extsClient.ApiextensionsV1beta1().CustomResourceDefinitions().Get(crd.AerospikeNamespaceRestoreCRDName, metav1.GetOptions{}) if err != nil { return nil } @@ -48,7 +47,7 @@ func convertAerospikeNamespaceRestores(extsClient *extsclientset.Clientset, aero } // list all existing v1alpha1 aerospikenamespacerestore resources across all namespaces - asnr, err := aerospikeClient.AerospikeV1alpha1().AerospikeNamespaceRestores(v1.NamespaceAll).List(v1.ListOptions{}) + asnr, err := aerospikeClient.AerospikeV1alpha1().AerospikeNamespaceRestores(metav1.NamespaceAll).List(metav1.ListOptions{}) if err != nil { return nil } diff --git a/internal/reconciler/pod.go b/internal/reconciler/pod.go index 312376a..e16e5bf 100755 --- a/internal/reconciler/pod.go +++ b/internal/reconciler/pod.go @@ -784,7 +784,7 @@ func computeMemoryRequest(aerospikeCluster *aerospikev1alpha2.AerospikeCluster) } else { log.WithFields(log.Fields{ logfields.AerospikeCluster: meta.Key(aerospikeCluster), - }).Warn("failed to parse memory size for namespace %s: %v", err) + }).Warnf("failed to parse memory size for namespace %s: %s", ns.Name, err) // ns.MemorySize has been validated before, so it is highly unlikely // than an error occurs at this point. however, if it does occur, we // must return something, and so we pick the default memory request. From 0bae6350db04eda549b419aa1591ae975455069b Mon Sep 17 00:00:00 2001 From: Piotr Kowalczuk Date: Tue, 4 Jun 2019 13:11:04 +0200 Subject: [PATCH 4/5] pkg into internal - review changes --- hack/update-openapi.go | 8 ++++---- hack/update-openapi.sh | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/hack/update-openapi.go b/hack/update-openapi.go index 9c87631..d66d438 100755 --- a/hack/update-openapi.go +++ b/hack/update-openapi.go @@ -23,10 +23,10 @@ import ( "github.com/go-openapi/spec" log "github.com/sirupsen/logrus" - "k8s.io/apimachinery/internal/runtime" - "k8s.io/apimachinery/internal/runtime/serializer" - utilruntime "k8s.io/apimachinery/internal/util/runtime" - "k8s.io/kube-openapi/internal/common" + "k8s.io/apimachinery/pkg/runtime" + "k8s.io/apimachinery/pkg/runtime/serializer" + utilruntime "k8s.io/apimachinery/pkg/util/runtime" + "k8s.io/kube-openapi/pkg/common" aerospikev1alpha2 "github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2" "github.com/travelaudience/aerospike-operator/internal/crd" diff --git a/hack/update-openapi.sh b/hack/update-openapi.sh index f45b68a..81c13ae 100755 --- a/hack/update-openapi.sh +++ b/hack/update-openapi.sh @@ -24,7 +24,7 @@ SCRIPT_ROOT="$(dirname $(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd))" # run openapi-gen ${GOPATH}/bin/openapi-gen \ --go-header-file "${SCRIPT_ROOT}/hack/custom-boilerplate.go.txt" \ - --input-dirs github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2,k8s.io/apimachinery/internal/apis/meta/v1,k8s.io/apimachinery/internal/runtime \ + --input-dirs github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2,k8s.io/apimachinery/pkg/apis/meta/v1,k8s.io/apimachinery/pkg/runtime \ --output-package github.com/travelaudience/aerospike-operator/internal/apis/aerospike/v1alpha2 # run hack/openapi.go From 9c8a9207505e42cbded4c0350f6f6dbb0f79a98a Mon Sep 17 00:00:00 2001 From: Piotr Kowalczuk Date: Tue, 4 Jun 2019 13:13:07 +0200 Subject: [PATCH 5/5] pkg into internal - missing import raname --- internal/meta/key_test.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/internal/meta/key_test.go b/internal/meta/key_test.go index 2e87ae7..8cb73f3 100755 --- a/internal/meta/key_test.go +++ b/internal/meta/key_test.go @@ -20,7 +20,7 @@ import ( "testing" "github.com/stretchr/testify/assert" - v1 "k8s.io/api/core/v1" + corev1 "k8s.io/api/core/v1" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" ) @@ -29,8 +29,8 @@ func TestKey(t *testing.T) { obj interface{} key string }{ - {&v1.Node{ObjectMeta: metav1.ObjectMeta{Namespace: "", Name: "foo"}}, "foo"}, - {&v1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: "foo", Name: "bar"}}, "foo/bar"}, + {&corev1.Node{ObjectMeta: metav1.ObjectMeta{Namespace: "", Name: "foo"}}, "foo"}, + {&corev1.Pod{ObjectMeta: metav1.ObjectMeta{Namespace: "foo", Name: "bar"}}, "foo/bar"}, {"foo", "(unknown)"}, {1, "(unknown)"}, }