Skip to content
This repository has been archived by the owner on Jun 26, 2023. It is now read-only.

[VC]: Update Controller Runtime to 2.9 #738

Merged
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
20 changes: 15 additions & 5 deletions incubator/virtualcluster/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@ COVERAGE_PACKAGES=$(shell go list ./... | \
grep -v github.com/multi-tenancy/incubator/virtualcluster/pkg/apis | \
grep -v github.com/multi-tenancy/incubator/virtualcluster/cmd)

# CRD_OPTIONS ?= "crd:trivialVersions=true"
CRD_OPTIONS ?= "crd:trivialVersions=true,maxDescLen=0"

# Build code.
#
# Args:
Expand Down Expand Up @@ -74,7 +77,7 @@ deploy: manifests

# Generate manifests e.g. CRD, RBAC etc.
manifests: controller-gen
$(CONTROLLER_GEN) all
$(CONTROLLER_GEN) $(CRD_OPTIONS) rbac:roleName=manager-role paths="./..." output:crd:artifacts:config=config/crds
hack/make-rules/replace-null.sh

# Run go fmt against code
Expand All @@ -86,11 +89,11 @@ vet:
go vet ./pkg/... ./cmd/...

# Generate code
generate:
generate: controller-gen
ifndef GOPATH
$(error GOPATH not defined, please define GOPATH. Run "go help gopath" to learn more about GOPATH)
endif
go generate ./pkg/... ./cmd/...
$(CONTROLLER_GEN) object:headerFile="hack/boilerplate.go.txt" paths="./..."

# Build release image.
#
Expand All @@ -114,8 +117,15 @@ docker-push:
# download controller-gen if necessary
controller-gen:
ifeq (, $(shell which controller-gen))
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.1.1
CONTROLLER_GEN=$(GOPATH)/bin/controller-gen
@{ \
set -e ;\
CONTROLLER_GEN_TMP_DIR=$$(mktemp -d) ;\
cd $$CONTROLLER_GEN_TMP_DIR ;\
go mod init tmp ;\
go get sigs.k8s.io/controller-tools/cmd/controller-gen@v0.3.0 ;\
rm -rf $$CONTROLLER_GEN_TMP_DIR ;\
}
CONTROLLER_GEN=$(GOBIN)/controller-gen
else
CONTROLLER_GEN=$(shell which controller-gen)
endif
Expand Down
9,063 changes: 9,063 additions & 0 deletions incubator/virtualcluster/config/crds/tenancy.x-k8s.io_clusterversions.yaml

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,17 +1,21 @@

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
annotations:
controller-gen.kubebuilder.io/version: v0.3.0
creationTimestamp: null
labels:
controller-tools.k8s.io: "1.0"
name: virtualclusters.tenancy.x-k8s.io
spec:
group: tenancy.x-k8s.io
names:
kind: VirtualCluster
listKind: VirtualClusterList
plural: virtualclusters
shortNames:
- vc
singular: virtualcluster
scope: Namespaced
validation:
openAPIV3Schema:
Expand Down Expand Up @@ -70,11 +74,13 @@ spec:
type: string
required:
- phase
- message
- reason
type: object
type: object
version: v1alpha1
versions:
- name: v1alpha1
served: true
storage: true
status:
acceptedNames:
kind: ""
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions incubator/virtualcluster/doc/demo.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ The binary can be found in `_output/bin/vcctl`.
## Install CRDs and all components
Running following cmds will install all CRDs and create all virtualcluster components.
```bash
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/multi-tenancy/master/incubator/virtualcluster/config/crds/tenancy_v1alpha1_clusterversion.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/multi-tenancy/master/incubator/virtualcluster/config/crds/tenancy_v1alpha1_virtualcluster.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/multi-tenancy/master/incubator/virtualcluster/config/crds/tenancy.x-k8s.io_clusterversions.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/multi-tenancy/master/incubator/virtualcluster/config/crds/tenancy.x-k8s.io_virtualclusters.yaml
kubectl apply -f https://raw.githubusercontent.com/kubernetes-sigs/multi-tenancy/master/incubator/virtualcluster/config/setup/all_in_one.yaml
```

Expand Down
3 changes: 0 additions & 3 deletions incubator/virtualcluster/pkg/apis/apis.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,6 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

// Generate deepcopy for apis
//go:generate go run k8s.io/code-generator/cmd/deepcopy-gen -O zz_generated.deepcopy -i ./... -h ../../hack/boilerplate.go.txt

// Package apis contains Kubernetes API groups.
package apis

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,23 @@ type StatefulSetSvcBundle struct {
metav1.ObjectMeta `json:"metadata,omitempty"`

// StatefulSet that manages the specified component
// +kubebuilder:validation:XEmbeddedResource
StatefulSet *appsv1.StatefulSet `json:"statefulset,omitempty"`

// Service that exposes the StatefulSet
// +kubebuilder:validation:XEmbeddedResource
Service *corev1.Service `json:"service,omitempty"`
}

// ClusterVersionStatus defines the observed state of ClusterVersion
type ClusterVersionStatus struct {
}

// +kubebuilder:object:root=true
// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +genclient:nonNamespaced
// +kubebuilder:resource:scope=Cluster,shortName=cv

// ClusterVersion is the Schema for the clusterversions API
// +k8s:openapi-gen=true
Expand All @@ -64,6 +68,7 @@ type ClusterVersion struct {
Status ClusterVersionStatus `json:"status,omitempty"`
}

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

Expand Down
1 change: 1 addition & 0 deletions incubator/virtualcluster/pkg/apis/tenancy/v1alpha1/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ limitations under the License.
*/

// Package v1alpha1 contains API Schema definitions for the tenancy v1alpha1 API group
// +kubebuilder:object:generate=true
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen=package,register
// +k8s:conversion-gen=sigs.k8s.io/multi-tenancy/incubator/virtualcluster/pkg/apis/tenancy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ type ClusterCondition struct {

// +genclient
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:resource:shortName=vc
// +k8s:openapi-gen=true

// VirtualCluster is the Schema for the virtualclusters API
// +k8s:openapi-gen=true
Expand All @@ -121,6 +124,7 @@ type VirtualCluster struct {
Status VirtualClusterStatus `json:"status,omitempty"`
}

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

// VirtualClusterList contains a list of VirtualCluster
Expand Down

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