Skip to content

Commit

Permalink
Add kubedb-kubestash-catalog (#708)
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha authored Nov 23, 2023
1 parent 74fe306 commit 0b52c9c
Show file tree
Hide file tree
Showing 279 changed files with 8,492 additions and 17 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ jobs:
name: Build
runs-on: ubuntu-20.04
steps:
- name: Set up Go 1.20
- name: Set up Go 1.21
uses: actions/setup-go@v1
with:
go-version: '1.20'
go-version: '1.21'
id: go

- name: Check out code into the Go module directory
Expand Down
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ endif
###

SRC_PKGS := apis # directories which hold app source (not vendored)
SRC_DIRS := $(SRC_PKGS) hack/fmt
SRC_DIRS := $(SRC_PKGS) catalog

DOCKER_PLATFORMS := linux/amd64 linux/arm linux/arm64
BIN_PLATFORMS := $(DOCKER_PLATFORMS)
Expand All @@ -60,7 +60,7 @@ ARCH := $(if $(GOARCH),$(GOARCH),$(shell go env GOARCH))
BASEIMAGE_PROD ?= gcr.io/distroless/static-debian11
BASEIMAGE_DBG ?= debian:bullseye

GO_VERSION ?= 1.20
GO_VERSION ?= 1.21
BUILD_IMAGE ?= ghcr.io/appscode/golang-dev:$(GO_VERSION)
CHART_TEST_IMAGE ?= quay.io/helmpack/chart-testing:v3.8.0

Expand Down Expand Up @@ -278,7 +278,8 @@ fmt: $(BUILD_DIRS)
$(BUILD_IMAGE) \
/bin/bash -c " \
set -eou pipefail; \
go run ./hack/fmt/main.go; \
go run ./catalog/kubedb/fmt/main.go; \
go run ./catalog/kubestash/fmt/main.go; \
REPO_PKG=$(GO_PKG) \
./hack/fmt.sh $(SRC_DIRS) \
"
Expand Down
3 changes: 3 additions & 0 deletions apis/installer/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
func(s *v1alpha1.KubedbCatalog, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
func(s *v1alpha1.KubedbKubestashCatalog, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
func(s *v1alpha1.KubedbDashboard, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
Expand Down
182 changes: 182 additions & 0 deletions apis/installer/v1alpha1/kubedb_kubestash_catalog_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,182 @@
/*
Copyright AppsCode Inc. and Contributors
Licensed under the AppsCode Community License 1.0.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
https://github.com/appscode/licenses/raw/1.0.0/AppsCode-Community-1.0.0.md
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

const (
ResourceKindKubedbKubestashCatalog = "KubedbKubestashCatalog"
ResourceKubedbKubestashCatalog = "kubedbkubestashcatalog"
ResourceKubedbKubestashCatalogs = "kubedbkubestashcatalogs"
)

// KubedbKubestashCatalog defines the schema for Stash Catalog chart.

// +genclient
// +genclient:skipVerbs=updateStatus
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=kubedbkubestashcatalogs,singular=kubedbkubestashcatalog,categories={stash,appscode}
type KubedbKubestashCatalog struct {
metav1.TypeMeta `json:",inline,omitempty"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Spec KubedbKubestashCatalogSpec `json:"spec,omitempty"`
}

// KubedbKubestashCatalogSpec is the schema for Stash Postgres values file
type KubedbKubestashCatalogSpec struct {
//+optional
Proxies RegistryProxies `json:"proxies"`
WaitTimeout int64 `json:"waitTimeout"`
Elasticsearch StashElasticsearchSpec `json:"elasticsearch"`
Opensearch StashOpensearchSpec `json:"opensearch"`
Kubedbmanifest StashKubedbmanifestSpec `json:"kubedbmanifest"`
KubeDump KubeDumpSpec `json:"kubedump"`
Mongodb StashMongodbSpec `json:"mongodb"`
Mysql StashMysqlSpec `json:"mysql"`
Pvc StashPvcSpec `json:"pvc"`
Redis StashRedisSpec `json:"redis"`
Volumesnapshot StashVolumesnapshotSpec `json:"volumesnapshot"`
Workload StashWorkloadSpec `json:"workload"`
}

// StashElasticsearchSpec is the schema for Stash Elasticsearch values file
type StashElasticsearchSpec struct {
Enabled bool `json:"enabled"`
Backup ElasticsearchBackup `json:"backup"`
Restore ElasticsearchRestore `json:"restore"`
}

type ElasticsearchBackup struct {
//+optional
Args string `json:"args"`
}

type ElasticsearchRestore struct {
//+optional
Args string `json:"args"`
}

// StashOpensearchSpec is the schema for Stash Opensearch values file
type StashOpensearchSpec struct {
Enabled bool `json:"enabled"`
Backup OpensearchBackup `json:"backup"`
Restore OpensearchRestore `json:"restore"`
}

type OpensearchBackup struct {
//+optional
Args string `json:"args"`
}

type OpensearchRestore struct {
//+optional
Args string `json:"args"`
}

type StashKubedbmanifestSpec struct {
Enabled bool `json:"enabled"`
}

type KubeDumpSpec struct {
Enabled bool `json:"enabled"`
Backup KubeDumpBackup `json:"backup"`
}

type KubeDumpBackup struct {
Sanitize bool `json:"sanitize"`
LabelSelector string `json:"labelSelector"`
IncludeDependants bool `json:"includeDependants"`
}

// StashMongodbSpec is the schema for Stash MongoDB values file
type StashMongodbSpec struct {
Enabled bool `json:"enabled"`
MaxConcurrency int32 `json:"maxConcurrency"`
Backup MongoDBBackup `json:"backup"`
Restore MongoDBRestore `json:"restore"`
}

type MongoDBBackup struct {
// +optional
Args string `json:"args"`
}

type MongoDBRestore struct {
// +optional
Args string `json:"args"`
}

// StashMysqlSpec is the schema for Stash MySQL values file
type StashMysqlSpec struct {
Enabled bool `json:"enabled"`
Backup MySQLBackup `json:"backup"`
Restore MySQLRestore `json:"restore"`
}

type MySQLBackup struct {
// +optional
Args string `json:"args"`
}

type MySQLRestore struct {
// +optional
Args string `json:"args"`
}

type StashPvcSpec struct {
Enabled bool `json:"enabled"`
}

// StashRedisSpec is the schema for Stash Redis values file
type StashRedisSpec struct {
Enabled bool `json:"enabled"`
Backup RedisBackup `json:"backup"`
Restore RedisRestore `json:"restore"`
}

type RedisBackup struct {
// +optional
Args string `json:"args"`
}

type RedisRestore struct {
// +optional
Args string `json:"args"`
}

type StashVolumesnapshotSpec struct {
Enabled bool `json:"enabled"`
}

type StashWorkloadSpec struct {
Enabled bool `json:"enabled"`
}

// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// KubedbKubestashCatalogList is a list of KubedbKubestashCatalogs
type KubedbKubestashCatalogList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// Items is a list of StashPostgres CRD objects
Items []KubedbKubestashCatalog `json:"items,omitempty"`
}
2 changes: 2 additions & 0 deletions apis/installer/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&KubedbDashboardList{},
&Kubedb{},
&KubedbList{},
&KubedbKubestashCatalog{},
&KubedbKubestashCatalogList{},
&KubedbOpsManager{},
&KubedbOpsManagerList{},
&KubedbProvisioner{},
Expand Down
7 changes: 4 additions & 3 deletions apis/installer/v1alpha1/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@ import (

func TestDefaultValues(t *testing.T) {
checker := schemachecker.New(os.DirFS("../../.."),
schemachecker.TestCase{Obj: v1alpha1.KubedbProviderAwsSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbProviderAzureSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbProviderGcpSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbAutoscalerSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbCatalogSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbDashboardSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbKubestashCatalogSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbOpsManagerSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbProviderAwsSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbProviderAzureSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbProviderGcpSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbProvisionerSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbSchemaManagerSpec{}},
schemachecker.TestCase{Obj: v1alpha1.KubedbSpec{}},
Expand Down
Loading

0 comments on commit 0b52c9c

Please sign in to comment.