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
76 changes: 76 additions & 0 deletions api/v1alpha1/export_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
package v1alpha1

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

const (
// ConditionReconciled is a status condition type that indicates whether the
// CR has been successfully reconciled
ConditionReconciled ConditionType = "Reconciled"
// ReconciledReasonComplete indicates the CR was successfully reconciled
ReconciledReasonComplete = "ReconcileComplete"
// ReconciledReasonError indicates an error was encountered while
// reconciling the CR
ReconciledReasonError = "ReconcileError"
)

type ExportSpec struct {
// Method download or git. This defines which process
// to use for exporting objects from a cluster
Method string `json:"method"`
// Branch within the git repository
Branch string `json:"branch,omitempty"`
// Git repository which will be cloned and updated
Repo string `json:"repo,omitempty"`
// Email used to specify the user who performed the git commit
Email string `json:"email,omitempty"`
// Predefined secret that contains an SSH key that will
// be used for git cloning and pushing
Secret string `json:"secret,omitempty"`
// Set automatically by the webhook to dictate who will
// run the export process
User string `json:"user,omitempty"`
// Set automatically by the webhook to dictate the
// group
Group []string `json:"group,omitempty"`
// Filter Export by labels
LabelSelector string `json:"labelSelector,omitempty"`
}

// ExportStatus defines the observed state of Export
type ExportStatus struct {
// Condition set by controller to signify the export completed
// successfully and the route is available
Completed bool `json:"completed,omitempty"`
Extracted bool `json:"extracted,omitempty"`
Conditions []Condition `json:"conditions,omitempty"`
// Route that is defined by the controller to specify the
// location of the zip file
Route string `json:"route,omitempty"`
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status

// Export is the Schema for the exports API
type Export struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ExportSpec `json:"spec,omitempty"`
Status ExportStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

// ExportList contains a list of Export
type ExportList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []Export `json:"items"`
}

func init() {
SchemeBuilder.Register(&Export{}, &ExportList{})
}
101 changes: 101 additions & 0 deletions api/v1alpha1/zz_generated.deepcopy.go

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

2 changes: 1 addition & 1 deletion make/generate.mk
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ API_VERSION:=v1alpha1
# how to dispatch the CRD files per repository (space-separated lists)
# !!! IMPORTANT !!! - when there is a new CRD added or an existing one removed or renamed, don't forget to change it also here: https://github.com/codeready-toolchain/toolchain-cicd/blob/master/scripts/add-cluster.sh#L52-L73
HOST_CLUSTER_CRDS:=masteruserrecords nstemplatetiers usersignups bannedusers notifications spaces spacebindings socialevents tiertemplates toolchainstatuses toolchainclusters toolchainconfigs usertiers proxyplugins spacerequests
MEMBER_CLUSTER_CRDS:=useraccounts nstemplatesets memberstatuses idlers toolchainclusters memberoperatorconfigs spacerequests workspaces
MEMBER_CLUSTER_CRDS:=useraccounts nstemplatesets memberstatuses idlers toolchainclusters memberoperatorconfigs spacerequests workspaces exports

PATH_TO_CRD_BASES=config/crd/bases

Expand Down