Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ dist/

/kubeflex/

# Code generator tools (repo-local)
hack/tools/bin/

# Ignore generated CRDs for the chart
chart/crds/controlplanes.yaml
chart/crds/postcreatehooks.yaml
8 changes: 8 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust
generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

.PHONY: generate-clients
generate-clients: ## Generate typed clientset, informers, and listers using Kubernetes code-generator.
./hack/update-codegen.sh

.PHONY: verify-codegen
verify-codegen: ## Verify that generated code is up-to-date.
./hack/verify-codegen.sh

.PHONY: fmt
fmt: ## Run go fmt against code.
go fmt ./...
Expand Down
6 changes: 2 additions & 4 deletions api/v1alpha1/controlplane_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,8 @@ type ControlPlaneStatus struct {
}

// ControlPlane is the Schema for the controlplanes API
// +genclient
// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
Expand Down Expand Up @@ -159,7 +161,3 @@ type BootstrapSecretReference struct {
// Required
InClusterKey string `json:"inClusterKey"`
}

func init() {
SchemeBuilder.Register(&ControlPlane{}, &ControlPlaneList{})
}
19 changes: 2 additions & 17 deletions api/v1alpha1/groupversion_info.go → api/v1alpha1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,8 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the tenancy v1alpha1 API group
// +kubebuilder:object:generate=true
// +groupName=tenancy.kflex.kubestellar.org
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: "tenancy.kflex.kubestellar.org", 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
)
// Package v1alpha1 contains API Schema definitions for the tenancy v1alpha1 API group
package v1alpha1
8 changes: 3 additions & 5 deletions api/v1alpha1/postcreatehook_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,9 @@ type PostCreateHookStatus struct {
SecretRef *SecretReference `json:"secretRef,omitempty"`
}

// PostCreateHook is the Schema for the controlplanes API
// PostCreateHook is the Schema for the postcreatehooks API
// +genclient
// +genclient:nonNamespaced
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="SYNCED",type="string",JSONPath=".status.conditions[?(@.type=='Synced')].status"
Expand Down Expand Up @@ -72,7 +74,3 @@ type Manifest struct {
// +kubebuilder:pruning:PreserveUnknownFields
runtime.RawExtension `json:",inline"`
}

func init() {
SchemeBuilder.Register(&PostCreateHook{}, &PostCreateHookList{})
}
51 changes: 51 additions & 0 deletions api/v1alpha1/register.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
/*
Copyright 2023 The KubeStellar Authors.

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"
"k8s.io/apimachinery/pkg/runtime"
"k8s.io/apimachinery/pkg/runtime/schema"
)

// SchemeGroupVersion is group version used to register these objects
var SchemeGroupVersion = schema.GroupVersion{Group: "tenancy.kflex.kubestellar.org", Version: "v1alpha1"}

// Resource takes an unqualified resource and returns a Group qualified GroupResource
func Resource(resource string) schema.GroupResource {
return SchemeGroupVersion.WithResource(resource).GroupResource()
}

var (
// SchemeBuilder is used to add go types to the GroupVersionKind scheme
SchemeBuilder = runtime.NewSchemeBuilder(addKnownTypes)

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

// Adds the list of known types to the given scheme.
func addKnownTypes(scheme *runtime.Scheme) error {
scheme.AddKnownTypes(SchemeGroupVersion,
&ControlPlane{},
&ControlPlaneList{},
&PostCreateHook{},
&PostCreateHookList{},
)
metav1.AddToGroupVersion(scheme, SchemeGroupVersion)
return nil
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.17.3
name: controlplanes.tenancy.kflex.kubestellar.org
spec:
group: tenancy.kflex.kubestellar.org
Expand Down Expand Up @@ -142,6 +142,8 @@ spec:
WaitForPostCreateHooks determines if the control plane should wait for all
post create hook resources to be ready before marking the control plane as ready
type: boolean
required:
- type
type: object
status:
description: ControlPlaneStatus defines the observed state of ControlPlane
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ apiVersion: apiextensions.k8s.io/v1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.15.0
controller-gen.kubebuilder.io/version: v0.17.3
name: postcreatehooks.tenancy.kflex.kubestellar.org
spec:
group: tenancy.kflex.kubestellar.org
Expand Down Expand Up @@ -33,7 +33,7 @@ spec:
name: v1alpha1
schema:
openAPIV3Schema:
description: PostCreateHook is the Schema for the controlplanes API
description: PostCreateHook is the Schema for the postcreatehooks API
properties:
apiVersion:
description: |-
Expand Down
Loading