Skip to content

Commit

Permalink
1
Browse files Browse the repository at this point in the history
Signed-off-by: Xiaodong Ye <yeahdongcn@gmail.com>
  • Loading branch information
yeahdongcn committed Nov 27, 2023
1 parent f27b71b commit f7477b1
Show file tree
Hide file tree
Showing 20 changed files with 1,694 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Makefile
Expand Up @@ -100,7 +100,7 @@ help: ## Display this help.
manifests: SED_SEARCH_STRING := scope: Namespaced
manifests: SED_REPLACE_STRING := scope: Cluster
manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and CustomResourceDefinition objects.
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/;./controllers/..." output:crd:artifacts:config=config/crd/bases
$(CONTROLLER_GEN) rbac:roleName=manager-role crd webhook paths="./vendor/github.com/loft-sh/api/v3/pkg/apis/storage/v1/;./api/v1/;./controllers/..." output:crd:artifacts:config=config/crd/bases
grep -l -RE "$(SED_SEARCH_STRING)" config/crd/bases \
| xargs $(SED) -i -E 's#$(SED_SEARCH_STRING)$$#$(SED_REPLACE_STRING)#g'

Expand Down
8 changes: 8 additions & 0 deletions PROJECT
Expand Up @@ -21,4 +21,12 @@ resources:
group: storage
kind: VirtualClusterTemplate
version: v1
- api:
crdVersion: v1
controller: true
domain: openloft.cn
group: storage
kind: ClusterDomain
path: github.com/openloft/openloft/api/v1
version: v1
version: "3"
56 changes: 56 additions & 0 deletions api/v1/clusterdomain_types.go
@@ -0,0 +1,56 @@
/*
Copyright 2023.
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 v1

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

// ClusterDomainSpec defines the desired state of ClusterDomain
type ClusterDomainSpec struct {
Domain string `json:"domain,omitempty"`
}

// ClusterDomainStatus defines the observed state of ClusterDomain
type ClusterDomainStatus struct {
}

//+kubebuilder:object:root=true
//+kubebuilder:subresource:status
//+kubebuilder:resource:scope=Cluster

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

Spec ClusterDomainSpec `json:"spec,omitempty"`
Status ClusterDomainStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true

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

func init() {
SchemeBuilder.Register(&ClusterDomain{}, &ClusterDomainList{})
}
89 changes: 89 additions & 0 deletions api/v1/zz_generated.deepcopy.go

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

48 changes: 48 additions & 0 deletions config/crd/bases/storage.openloft.cn_clusterdomains.yaml
@@ -0,0 +1,48 @@
---
apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.11.1
creationTimestamp: null
name: clusterdomains.storage.openloft.cn
spec:
group: storage.openloft.cn
names:
kind: ClusterDomain
listKind: ClusterDomainList
plural: clusterdomains
singular: clusterdomain
scope: Cluster
versions:
- name: v1
schema:
openAPIV3Schema:
description: ClusterDomain is the Schema for the clusterdomains API
properties:
apiVersion:
description: 'APIVersion defines the versioned schema of this representation
of an object. Servers should convert recognized schemas to the latest
internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources'
type: string
kind:
description: 'Kind is a string value representing the REST resource this
object represents. Servers may infer this from the endpoint the client
submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds'
type: string
metadata:
type: object
spec:
description: ClusterDomainSpec defines the desired state of ClusterDomain
properties:
domain:
type: string
type: object
status:
description: ClusterDomainStatus defines the observed state of ClusterDomain
type: object
type: object
served: true
storage: true
subresources:
status: {}

0 comments on commit f7477b1

Please sign in to comment.