Skip to content

Commit

Permalink
Add support for SPKS and implement sts resizing
Browse files Browse the repository at this point in the history
Signed-off-by: Nicolas Bigler <[email protected]>
  • Loading branch information
TheBigLee committed Sep 10, 2024
1 parent be06da9 commit 19df6b7
Show file tree
Hide file tree
Showing 19 changed files with 1,649 additions and 3 deletions.
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ generate: export PATH := $(go_bin):$(PATH)
generate: get-crds generate-stackgres-crds protobuf-gen ## Generate code with controller-gen and protobuf.
go version
rm -rf apis/generated
go run sigs.k8s.io/controller-tools/cmd/controller-gen paths="{./apis/v1/..., ./apis/vshn/..., ./apis/exoscale/..., ./apis/apiserver/...}" object crd:crdVersions=v1,allowDangerousTypes=true output:artifacts:config=./apis/generated
go run sigs.k8s.io/controller-tools/cmd/controller-gen paths="{./apis/v1/..., ./apis/vshn/..., ./apis/exoscale/..., ./apis/apiserver/..., ./apis/syntools/...}" object crd:crdVersions=v1,allowDangerousTypes=true output:artifacts:config=./apis/generated
go generate ./...
# Because yaml is such a fun and easy specification, we need to hack some things here.
# Depending on the yaml parser implementation the equal sign (=) has special meaning, or not...
Expand Down Expand Up @@ -196,7 +196,8 @@ clean:
get-crds:
./hack/get_crds.sh https://github.com/crossplane-contrib/provider-helm provider-helm apis/release apis/helm
./hack/get_crds.sh https://github.com/crossplane-contrib/provider-kubernetes provider-kubernetes apis/object/v1alpha2 apis/kubernetes

# There is currently a bug with the serialization if `inline` and `omitempty` are set: https://github.com/crossplane/function-sdk-go/issues/161
sed -i 's/inline,omitempty/inline/g' apis/helm/release/v1beta1/types.go
# provider-sql needs manual fixes... Running this every time would break them.
# The crossplane code generator only works if the code is valid, but the code is not valid until the code generator has run...
#./hack/get_crds.sh https://github.com/crossplane-contrib/provider-sql provider-sql apis/ apis/sql
Expand Down
2 changes: 1 addition & 1 deletion apis/helm/release/v1beta1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ type NamespacedName struct {

// DataKeySelector defines required spec to access a key of a configmap or secret
type DataKeySelector struct {
NamespacedName `json:",inline,omitempty"`
NamespacedName `json:",inline"`
Key string `json:"key,omitempty"`
Optional bool `json:"optional,omitempty"`
}
Expand Down
10 changes: 10 additions & 0 deletions apis/syntools/generate.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
//go:build generate

// Remove existing manifests

// Generate deepcopy methodsets and CRD manifests

// Generate crossplane-runtime methodsets (resource.Claim, etc)
//go:generate go run -tags generate github.com/crossplane/crossplane-tools/cmd/angryjet generate-methodsets --header-file=../../.github/boilerplate.go.txt ./...

package syntools
35 changes: 35 additions & 0 deletions apis/syntools/v1alpha1/compositeredisinstance.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package v1alpha1

import (
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:object:root=true

type CompositeRedisInstance struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CompositeRedisInstanceSpec `json:"spec"`
Status CompositeRedisInstanceStatus `json:"status,omitempty"`
}

type CompositeRedisInstanceStatus struct {
xpv1.ResourceStatus `json:",inline"`
}

type CompositeRedisInstanceSpec struct {
xpv1.ResourceSpec `json:",inline"`
}

// +kubebuilder:object:generate=true
// +kubebuilder:object:root=true

// CompositeRedisInstanceList represents a list of composites
type CompositeRedisInstanceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []CompositeRedisInstance `json:"items"`
}
35 changes: 35 additions & 0 deletions apis/syntools/v1alpha1/compositermariadb.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
package v1alpha1

import (
xpv1 "github.com/crossplane/crossplane-runtime/apis/common/v1"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:object:root=true

type CompositeMariaDBInstance struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec CompositeMariaDBInstanceSpec `json:"spec"`
Status CompositeMariaDBInstanceStatus `json:"status,omitempty"`
}

type CompositeMariaDBInstanceStatus struct {
xpv1.ResourceStatus `json:",inline"`
}

type CompositeMariaDBInstanceSpec struct {
xpv1.ResourceSpec `json:",inline"`
}

// +kubebuilder:object:generate=true
// +kubebuilder:object:root=true

// CompositeMariaDBInstanceList represents a list of composites
type CompositeMariaDBInstanceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []CompositeMariaDBInstance `json:"items"`
}
30 changes: 30 additions & 0 deletions apis/syntools/v1alpha1/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
// +kubebuilder:object:generate=true
// +groupName=vshn.appcat.vshn.io
// +versionName=v1

package v1alpha1

import (
"k8s.io/apimachinery/pkg/runtime/schema"
"sigs.k8s.io/controller-runtime/pkg/scheme"
)

var (
// GroupVersion is group version used to register these objects
GroupVersion = schema.GroupVersion{Group: "syn.tools", Version: "v1alpha1"}

// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = &scheme.Builder{GroupVersion: GroupVersion}

// AddToScheme adds the types in this group-version to the given scheme.
AddToScheme = SchemeBuilder.AddToScheme
)

func init() {
SchemeBuilder.Register(
&CompositeRedisInstance{},
&CompositeRedisInstanceList{},
&CompositeMariaDBInstance{},
&CompositeMariaDBInstanceList{},
)
}
191 changes: 191 additions & 0 deletions apis/syntools/v1alpha1/zz_generated.deepcopy.go

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

Loading

0 comments on commit 19df6b7

Please sign in to comment.