Skip to content
Draft
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
154 changes: 154 additions & 0 deletions apis/ops/v1alpha1/openapi_generated.go

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

2 changes: 2 additions & 0 deletions apis/ops/v1alpha1/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ func addKnownTypes(scheme *runtime.Scheme) error {
&SolrOpsRequestList{},
&ZooKeeperOpsRequest{},
&ZooKeeperOpsRequestList{},
&WeaviateOpsRequest{},
&WeaviateOpsRequestList{},
)

scheme.AddKnownTypes(SchemeGroupVersion,
Expand Down
41 changes: 41 additions & 0 deletions apis/ops/v1alpha1/weaviate_ops_helpers.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

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"

var _ Accessor = &WeaviateOpsRequest{}

func (w *WeaviateOpsRequest) GetObjectMeta() metav1.ObjectMeta {
return w.ObjectMeta
}

func (w *WeaviateOpsRequest) GetDBRefName() string {
return w.Spec.DatabaseRef.Name
}

func (w *WeaviateOpsRequest) GetRequestType() string {
return string(w.Spec.Type)
}

func (w *WeaviateOpsRequest) GetStatus() OpsRequestStatus {
return w.Status
}

func (w *WeaviateOpsRequest) SetStatus(s OpsRequestStatus) {
w.Status = s
}
86 changes: 86 additions & 0 deletions apis/ops/v1alpha1/weaviate_ops_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
/*
Copyright AppsCode Inc. and Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

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.
*/

//go:generate go-enum --mustparse --names --values
package v1alpha1

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

const (
ResourceCodeWeaviateOpsRequest = "wvops"
ResourceKindWeaviateOpsRequest = "WeaviateOpsRequest"
ResourceSingularWeaviateOpsRequest = "weaviateopsrequest"
ResourcePluralWeaviateOpsRequest = "weaviateopsrequests"
)

// WeaviateDBOpsRequest defines a Weaviate DBA operation.

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

// +kubebuilder:object:root=true
// +kubebuilder:resource:path=weaviateopsrequests,singular=weaviateopsrequest,shortName=wvops,categories={ops,kubedb,appscode}
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="Type",type="string",JSONPath=".spec.type"
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type WeaviateOpsRequest struct {
metav1.TypeMeta `json:",inline,omitempty"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec WeaviateOpsRequestSpec `json:"spec,omitempty"`
Status OpsRequestStatus `json:"status,omitempty"`
}

// WeaviateOpsRequestSpec is the spec for WeaviateOpsRequest
type WeaviateOpsRequestSpec struct {
// Specifies the Weaviate reference
DatabaseRef core.LocalObjectReference `json:"databaseRef"`

// Specifies the ops request type: UpdateVersion, HorizontalScaling, VerticalScaling etc.
Type WeaviateOpsRequestType `json:"type"`

// Specifies information necessary for restarting database
Restart *RestartSpec `json:"restart,omitempty"`

// Timeout for each step of the ops request in second. If a step doesn't finish within the specified timeout, the ops request will result in failure.
Timeout *metav1.Duration `json:"timeout,omitempty"`

// ApplyOption is to control the execution of OpsRequest depending on the database state.
// +kubebuilder:default="IfReady"
Apply ApplyOption `json:"apply,omitempty"`

// +kubebuilder:default=1
MaxRetries int32 `json:"maxRetries,omitempty"`
}

// +kubebuilder:validation:Enum=Restart
// ENUM(Restart)
type WeaviateOpsRequestType string

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

// WeaviateOpsRequestList is a list of WeaviateOpsRequests
type WeaviateOpsRequestList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
// Items is a list of WeaviateOpsRequest CRD objects
Items []WeaviateOpsRequest `json:"items,omitempty"`
}
69 changes: 69 additions & 0 deletions apis/ops/v1alpha1/weaviate_ops_types_enum.go

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

Loading
Loading