Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove API sub-module #244

Merged
merged 1 commit into from
Oct 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .ci/pipeline_definitions
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ etcd-druid:
nextversion: 'bump_minor'
git_tags:
- ref_template: 'refs/tags/{VERSION}'
- ref_template: 'refs/tags/api/{VERSION}'
slack:
default_channel: 'internal_scp_workspace'
channel_cfgs:
Expand Down
2 changes: 1 addition & 1 deletion .ci/test
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@ function test_with_coverage() {
fetch_envtest_tools "$kb_root_dir"
setup_envtest_env "$kb_root_dir"

TEST_PACKAGES="api api_tests controllers pkg"
TEST_PACKAGES="api controllers pkg"
GINKGO_COMMON_FLAGS="-r -timeout=1h0m0s --randomizeAllSpecs --randomizeSuites --failOnPending --progress"
if [ -z $COVER ] || [ "$COVER" = false ] ; then
echo "[INFO] Test coverage is disabled."
Expand Down
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ CRD_OPTIONS ?= "crd:trivialVersions=true"

.PHONY: revendor
revendor:
@cd "$(REPO_ROOT)/api" && go mod tidy
@env GO111MODULE=on go mod vendor
@env GO111MODULE=on go mod tidy
@chmod +x "$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/"*
Expand Down Expand Up @@ -65,7 +64,7 @@ deploy: manifests
# Generate manifests e.g. CRD, RBAC etc.
.PHONY: manifests
manifests:
@cd "$(REPO_ROOT)/api" && controller-gen $(CRD_OPTIONS) paths="./..." output:crd:artifacts:config=../config/crd/bases
@controller-gen $(CRD_OPTIONS) paths="./api/..." output:crd:artifacts:config="./config/crd/bases"
@controller-gen rbac:roleName=manager-role paths="./controllers/..."

# Run go fmt against code
Expand All @@ -80,8 +79,7 @@ clean:
# Check packages
.PHONY: check
check:
@cd "$(REPO_ROOT)/api" && "$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check.sh" --golangci-lint-config=../.golangci.yaml ./...
@"$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check.sh" --golangci-lint-config=./.golangci.yaml ./pkg/... ./controllers/...
@"$(REPO_ROOT)/vendor/github.com/gardener/gardener/hack/check.sh" --golangci-lint-config=./.golangci.yaml ./api/... ./pkg/... ./controllers/...

.PHONY: check-generate
check-generate:
Expand Down
9 changes: 0 additions & 9 deletions api/go.mod

This file was deleted.

173 changes: 0 additions & 173 deletions api/go.sum

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,20 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1alpha1_test

import (
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"

"context"
"time"

druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1"
. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
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"

"k8s.io/apimachinery/pkg/api/resource"

corev1 "k8s.io/api/core/v1"
. "github.com/gardener/etcd-druid/api/v1alpha1"
)

// These tests are written in BDD-style using Ginkgo framework. Refer to
Expand All @@ -38,7 +36,7 @@ import (
var _ = Describe("Etcd", func() {
var (
key types.NamespacedName
created, fetched *druidv1alpha1.Etcd
created, fetched *Etcd
)

BeforeEach(func() {
Expand Down Expand Up @@ -66,7 +64,7 @@ var _ = Describe("Etcd", func() {
By("creating an API obj")
Expect(k8sClient.Create(context.TODO(), created)).To(Succeed())

fetched = &druidv1alpha1.Etcd{}
fetched = &Etcd{}
Expect(k8sClient.Get(context.TODO(), key, fetched)).To(Succeed())
Expect(fetched).To(Equal(created))

Expand All @@ -79,12 +77,12 @@ var _ = Describe("Etcd", func() {

})

func getEtcd(name, namespace string) *druidv1alpha1.Etcd {
func getEtcd(name, namespace string) *Etcd {
var (
clientPort int32 = 2379
serverPort int32 = 2380
backupPort int32 = 8080
metricLevel druidv1alpha1.MetricsLevel = druidv1alpha1.Basic
clientPort int32 = 2379
serverPort int32 = 2380
backupPort int32 = 8080
metricLevel MetricsLevel = Basic
)

garbageCollectionPeriod := metav1.Duration{
Expand All @@ -102,11 +100,11 @@ func getEtcd(name, namespace string) *druidv1alpha1.Etcd {
deltaSnapShotMemLimit := resource.MustParse("100Mi")
quota := resource.MustParse("8Gi")
storageClass := "gardener.cloud-fast"
provider := druidv1alpha1.StorageProvider("aws")
provider := StorageProvider("aws")
prefix := "etcd-test"
garbageCollectionPolicy := druidv1alpha1.GarbageCollectionPolicy(druidv1alpha1.GarbageCollectionPolicyExponential)
garbageCollectionPolicy := GarbageCollectionPolicy(GarbageCollectionPolicyExponential)

tlsConfig := &druidv1alpha1.TLSConfig{
tlsConfig := &TLSConfig{
ClientTLSSecretRef: corev1.SecretReference{
Name: "etcd-client-tls",
},
Expand All @@ -118,12 +116,12 @@ func getEtcd(name, namespace string) *druidv1alpha1.Etcd {
},
}

instance := &druidv1alpha1.Etcd{
instance := &Etcd{
ObjectMeta: metav1.ObjectMeta{
Name: name,
Namespace: namespace,
},
Spec: druidv1alpha1.EtcdSpec{
Spec: EtcdSpec{
Annotations: map[string]string{
"app": "etcd-statefulset",
"role": "test",
Expand All @@ -143,7 +141,7 @@ func getEtcd(name, namespace string) *druidv1alpha1.Etcd {
StorageClass: &storageClass,
StorageCapacity: &storageCapacity,

Backup: druidv1alpha1.BackupSpec{
Backup: BackupSpec{
Image: &imageBR,
Port: &backupPort,
FullSnapshotSchedule: &snapshotSchedule,
Expand All @@ -162,7 +160,7 @@ func getEtcd(name, namespace string) *druidv1alpha1.Etcd {
"memory": parseQuantity("128Mi"),
},
},
Store: &druidv1alpha1.StoreSpec{
Store: &StoreSpec{
SecretRef: &corev1.SecretReference{
Name: "etcd-backup",
},
Expand All @@ -171,7 +169,7 @@ func getEtcd(name, namespace string) *druidv1alpha1.Etcd {
Prefix: prefix,
},
},
Etcd: druidv1alpha1.EtcdConfig{
Etcd: EtcdConfig{
Quota: &quota,
Metrics: &metricLevel,
Image: &imageEtcd,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,23 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1
package v1alpha1_test

import (
"path/filepath"
"testing"

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

druidv1alpha1 "github.com/gardener/etcd-druid/api/v1alpha1"

"k8s.io/client-go/kubernetes/scheme"
"k8s.io/client-go/rest"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/envtest"
"sigs.k8s.io/controller-runtime/pkg/envtest/printer"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sigs.k8s.io/controller-runtime/pkg/log/zap"

. "github.com/gardener/etcd-druid/api/v1alpha1"
)

// These tests use Ginkgo (BDD-style Go testing framework). Refer to
Expand Down Expand Up @@ -59,7 +58,7 @@ var _ = BeforeSuite(func(done Done) {
CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
}

err := druidv1alpha1.SchemeBuilder.AddToScheme(scheme.Scheme)
err := SchemeBuilder.AddToScheme(scheme.Scheme)
Expect(err).NotTo(HaveOccurred())

cfg, err = testEnv.Start()
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions config/crd/bases/druid.gardener.cloud_etcds.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ spec:
backupCompactionSchedule:
description: BackupCompactionSchedule defines the cron standard for compacting the snapstore
type: string
etcdSnapshotTimeout:
description: EtcdSnapshotTimeout defines the timeout duration for etcd FullSnapshot operation
type: string
compression:
description: SnapshotCompression defines the specification for compression of Snapshots.
properties:
Expand All @@ -78,6 +75,9 @@ spec:
enableProfiling:
description: EnableProfiling defines if profiling should be enabled for the etcd-backup-restore-sidecar
type: boolean
etcdSnapshotTimeout:
description: EtcdSnapshotTimeout defines the timeout duration for etcd FullSnapshot operation
type: string
fullSnapshotSchedule:
description: FullSnapshotSchedule defines the cron standard schedule for full snapshots.
type: string
Expand Down
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ module github.com/gardener/etcd-druid
go 1.16

require (
github.com/gardener/etcd-druid/api v0.0.0-00010101000000-000000000000
github.com/gardener/gardener v1.23.0
github.com/ghodss/yaml v1.0.0
github.com/go-logr/logr v0.3.0
Expand All @@ -20,7 +19,6 @@ require (
)

replace (
github.com/gardener/etcd-druid/api => ./api
k8s.io/api => k8s.io/api v0.19.6
k8s.io/apiextensions-apiserver => k8s.io/apiextensions-apiserver v0.19.6
k8s.io/apimachinery => k8s.io/apimachinery v0.19.6
Expand Down
Loading