Skip to content
Merged
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,13 @@

# Output of the go coverage tool, specifically when used with LiteIDE
*.out
bin/

# Dependency directories (remove the comment below to include it)
vendor/

# Go workspace file
go.work
go.work.sum

__output
63 changes: 63 additions & 0 deletions .idea/workspace.xml

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

4 changes: 2 additions & 2 deletions .licenserc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,5 +60,5 @@ header:
- '**/PROJECT'
- '**/Dockerfile'
- '**/.dockerignore'
comment: never
license-location-threshold: 100
comment: on-failure
license-location-threshold: 200
31 changes: 31 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
LOCALBIN ?= $(shell pwd)/bin
$(LOCALBIN):
mkdir -p $(LOCALBIN)
CONTROLLER_TOOLS_VERSION ?= v0.15.0
CONTROLLER_GEN ?= $(LOCALBIN)/controller-gen
CODEGEN = $(LOCALBIN)/kube-codegen

controller-gen: $(CONTROLLER_GEN) ## Download controller-gen locally if necessary. If wrong version is installed, it will be overwritten.
$(CONTROLLER_GEN): $(LOCALBIN)
test -s $(LOCALBIN)/controller-gen && $(LOCALBIN)/controller-gen --version | grep -q $(CONTROLLER_TOOLS_VERSION) || \
GOBIN=$(LOCALBIN) go install sigs.k8s.io/controller-tools/cmd/controller-gen@$(CONTROLLER_TOOLS_VERSION)

manifests: controller-gen
@for dir in apps cluster; do \
mkdir -p "config/crd/$$dir"; \
$(CONTROLLER_GEN) rbac:roleName=manager-role crd:generateEmbeddedObjectMeta=true webhook paths="./$$dir/..." output:crd:artifacts:config="config/crd/$$dir"; \
done

generate: codegen controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations.
#@scripts/generate_client.sh
# $(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."
$(CODEGEN) code-gen --go-header-file=./hack/boilerplate.go.txt --code-generator-version=v0.27.16 --apis-path=./ --generators=deepcopy,register

codegen: $(CODEGEN) # Download kube-codegen locally if necessary. If wrong version is installed, it will be overwritten.
$(CODEGEN):
ifeq (, $(shell command -v $(CODEGEN)))
@cd $(shell mktemp -d) && \
git clone https://github.com/zoumo/kube-codegen.git && \
cd kube-codegen && \
GOBIN=$(LOCALBIN) go install ./cmd/kube-codegen
endif
18 changes: 7 additions & 11 deletions apps/v1alpha1/collaset_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -168,8 +168,7 @@ type ByPartition struct {
Partition *int32 `json:"partition,omitempty"`
}

type ByLabel struct {
}
type ByLabel struct{}

// RollingUpdateCollaSetStrategy is used to communicate parameter for rolling update.
type RollingUpdateCollaSetStrategy struct {
Expand Down Expand Up @@ -272,12 +271,10 @@ type CollaSetCondition struct {
Message string `json:"message,omitempty"`
}

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

// CollaSet is the Schema for the collasets API
// +k8s:openapi-gen=true
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=cls
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="DESIRED",type="integer",JSONPath=".spec.replicas",description="The desired number of pods."
Expand All @@ -290,6 +287,8 @@ type CollaSetCondition struct {
// +kubebuilder:printcolumn:name="UPDATED_REVISION",type="string",JSONPath=".status.updatedRevision",description="The updated revision."
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +resource:path=collasets

// CollaSet is the Schema for the collasets API
type CollaSet struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -298,15 +297,12 @@ type CollaSet struct {
Status CollaSetStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

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

func init() {
SchemeBuilder.Register(&CollaSet{}, &CollaSetList{})
}
22 changes: 6 additions & 16 deletions cluster/v1beta1/zz_generated.defaults.go → apps/v1alpha1/doc.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
//go:build !ignore_autogenerated
// +build !ignore_autogenerated

/*
Copyright The Karbour Authors.

Expand All @@ -17,17 +14,10 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Code generated by defaulter-gen. DO NOT EDIT.

package v1beta1

import (
runtime "k8s.io/apimachinery/pkg/runtime"
)
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package
// +k8s:defaulter-gen=TypeMeta
// +groupName=apps.kusionstack.io

// RegisterDefaults adds defaulters functions to the given scheme.
// Public to allow building arbitrary schemes.
// All generated defaulters are covering - they call all nested defaulters.
func RegisterDefaults(scheme *runtime.Scheme) error {
return nil
}
// Package v1alpha1 Package v1alpha1 is the v1alpha1 version of the API.
package v1alpha1
36 changes: 0 additions & 36 deletions apps/v1alpha1/groupversion_info.go

This file was deleted.

12 changes: 4 additions & 8 deletions apps/v1alpha1/operationjob_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,11 +135,10 @@ type OpsStatus struct {
Message string `json:"message,omitempty"`
}

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

// +k8s:openapi-gen=true
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=oj
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="PROGRESS",type="string",JSONPath=".status.progress"
Expand All @@ -154,15 +153,12 @@ type OperationJob struct {
Status OperationJobStatus `json:"status,omitempty"`
}

//+kubebuilder:object:root=true
// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

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

func init() {
SchemeBuilder.Register(&OperationJob{}, &OperationJobList{})
}
17 changes: 6 additions & 11 deletions apps/v1alpha1/poddecoration_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ type PodDecorationPodTemplate struct {
}

type PodDecorationPodTemplateMeta struct {

// patch pod metadata policy, Default is "Retain"
PatchPolicy MetadataPatchPolicy `json:"patchPolicy"`

Expand Down Expand Up @@ -257,15 +256,12 @@ type PodDecorationCondition struct {
Message string `json:"message,omitempty"`
}

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

// PodDecoration is the Schema for the poddecorations API
// +k8s:openapi-gen=true
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:resource:shortName=pd
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:printcolumn:name="EFFECTIVE",type="boolean",JSONPath=".status.isEffective",description="The number of pods updated."
// +kubebuilder:resource:shortName=pd
// +kubebuilder:printcolumn:name="MATCHED",type="integer",JSONPath=".status.matchedPods",description="The number of selected pods."
// +kubebuilder:printcolumn:name="INJECTED",type="integer",JSONPath=".status.injectedPods",description="The number of injected pods."
// +kubebuilder:printcolumn:name="UPDATED",type="integer",JSONPath=".status.updatedPods",description="The number of updated pods."
Expand All @@ -274,6 +270,8 @@ type PodDecorationCondition struct {
// +kubebuilder:printcolumn:name="UPDATED_REVISION",type="string",JSONPath=".status.updatedRevision",description="The updated revision."
// +kubebuilder:printcolumn:name="AGE",type="date",JSONPath=".metadata.creationTimestamp"
// +resource:path=poddecorations

// PodDecoration is the Schema for the poddecorations API
type PodDecoration struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`
Expand All @@ -282,6 +280,7 @@ type PodDecoration struct {
Status PodDecorationStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object

// PodDecorationList contains a list of PodDecoration
Expand All @@ -290,7 +289,3 @@ type PodDecorationList struct {
metav1.ListMeta `json:"metadata,omitempty"`
Items []PodDecoration `json:"items"`
}

func init() {
SchemeBuilder.Register(&PodDecoration{}, &PodDecorationList{})
}
Loading