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

Super deletion protection #307

Open
wants to merge 31 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
d0c29e0
improving bootstrap
wejdross Jan 15, 2025
5b17356
adding FQDN separator and connection secret field
wejdross Jan 27, 2025
13c4f96
webhook, setting correct plural
wejdross Jan 27, 2025
90fbf9e
cleanup
wejdross Jan 27, 2025
45d6055
updating plural in webhook
wejdross Jan 27, 2025
077b3e0
Delete forgejo.yaml
wejdross Jan 27, 2025
a217a92
adding Codey base crd,xrd
wejdross Jan 28, 2025
ade4ab3
testing new kubebuilder approach
wejdross Jan 28, 2025
5b40ef7
switching codey to vshncodey
wejdross Jan 29, 2025
31657af
adding FQDN field to Codey
wejdross Jan 29, 2025
738abdb
improving codey crd
wejdross Jan 29, 2025
14d3175
improving codey crd
wejdross Jan 29, 2025
15e2be1
improving codey crd
wejdross Jan 29, 2025
1311be1
VSHNCodey -> Codey
wejdross Jan 29, 2025
74e2ec6
VSHNCodey -> Codey.io
wejdross Jan 29, 2025
24401f9
improving Codey annotations
wejdross Jan 30, 2025
c2f9ece
fixing v1.Conditions generation and population
wejdross Jan 30, 2025
e6b0fc1
rename initial admin user
wejdross Jan 30, 2025
9dda59b
reworking codey API
wejdross Jan 30, 2025
4ecbcf3
renaming Codey to Instance
wejdross Jan 30, 2025
4677b05
renaming Codey to Instance
wejdross Jan 30, 2025
dfd5d46
Codey/FQDN and Forgejo/version api cleanup
wejdross Jan 30, 2025
0a4733d
fixing leftover after api migration
wejdross Jan 30, 2025
5b2978e
changing gitea_admin default login to Forgejo
wejdross Feb 3, 2025
76f4b06
removing Repo indexing
wejdross Feb 3, 2025
43bfa0e
restoring Repo indexing
wejdross Feb 3, 2025
a534e48
refactoring slightly deploy.go, using func for nested objects
wejdross Feb 4, 2025
5e311d9
refactoring ingress annotations
wejdross Feb 5, 2025
e7de2a8
refactoring Codey name again
wejdross Feb 5, 2025
347537c
updating function call updated in other branch
wejdross Feb 6, 2025
4107e59
SUper deletion protection
Feb 7, 2025
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
2 changes: 1 addition & 1 deletion 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/..., ./apis/syntools/...}" 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/..., ./apis/codey/...}" 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
115 changes: 115 additions & 0 deletions apis/codey/dbaas_vshn_codey.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
package codey

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

//go:generate yq -i e ../generated/codey.io_codeyinstances.yaml --expression "with(.spec.versions[]; .schema.openAPIV3Schema.properties.spec.properties.parameters.properties.size.default={})"

// +groupName=codey.io
// +versionName=v1
// +kubebuilder:object:root=true

// CodeyInstance is the API for creating CodeyInstance instances.
type CodeyInstance struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

// Spec defines the desired state of a CodeyCodeyInstance.
Spec CodeyInstanceSpec `json:"spec"`

// Status reflects the observed state of a CodeyInstance.
Status CodeyInstanceStatus `json:"status,omitempty"`
}

// +kubebuilder:object:generate=true
// +kubebuilder:object:root=true
type CodeyInstanceList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`

Items []CodeyInstance `json:"items,omitempty"`
}

// CodeyInstanceSpec defines the desired state of a CodeyInstance.
type CodeyInstanceSpec struct {
// Parameters are the configurable fields of a CodeyInstance.
// +kubebuilder:default={}
Parameters CodeyInstanceParameters `json:"parameters,omitempty"`

// WriteConnectionSecretToRef references a secret to which the connection details will be written.
WriteConnectionSecretToRef xpv1.LocalSecretReference `json:"writeConnectionSecretToRef,omitempty"`
}

// CodeyInstanceParameters are the configurable fields of a CodeyInstance.
type CodeyInstanceParameters struct {
// Service contains CodeyInstance DBaaS specific properties
Service CodeyInstanceServiceSpec `json:"service,omitempty"`

// Size contains settings to control the sizing of a service.
Size VSHNCodeyInstanceSizeSpec `json:"size,omitempty"`
}

// CodeyInstanceServiceSpec contains CodeyInstance DBaaS specific properties
type CodeyInstanceServiceSpec struct {

// Version contains supported version of CodeyInstance.
// Multiple versions are supported.
MajorVersion string `json:"majorVersion,omitempty"`

// AdminEmail for email notifications.
// +kubebuilder:validation:Required
AdminEmail string `json:"adminEmail"`
}

// CodeyInstanceStatus reflects the observed state of a CodeyInstance.
type CodeyInstanceStatus struct {
// CodeyInstanceNamespace contains the name of the namespace where the instance resides
CodeyInstanceNamespace string `json:"instanceNamespace,omitempty"`
}

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

// XCodeyInstance represents the internal composite of this claim
type XCodeyInstance struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec XCodeyInstanceSpec `json:"spec"`
Status XCodeyInstanceStatus `json:"status,omitempty"`
}

// XCodeyInstanceSpec defines the desired state of a CodeyInstance.
type XCodeyInstanceSpec struct {
// Parameters are the configurable fields of a CodeyInstance.
Parameters CodeyInstanceParameters `json:"parameters,omitempty"`

xpv1.ResourceSpec `json:",inline"`
}

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

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

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

Items []XCodeyInstance `json:"items"`
}

// VSHNCodeyInstanceSizeSpec contains settings to control the sizing of a service.
type VSHNCodeyInstanceSizeSpec struct {
// Size contains settings to control the sizing of a service.
// +kubebuilder:validation:Enum=mini;small
// +kubebuilder:default=mini
// Plan is the name of the resource plan that defines the compute resources.
Plan string `json:"plan,omitempty"`
}
10 changes: 10 additions & 0 deletions apis/codey/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 codey
23 changes: 23 additions & 0 deletions apis/codey/groupversion_info.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// +kubebuilder:object:generate=true

package codey

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: "codey.io", Version: "v1"}

// 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(&CodeyInstance{}, &XCodeyInstance{})
}
Loading
Loading