Skip to content

Commit

Permalink
Convert ClusterProfile into a crd
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Oct 16, 2024
1 parent c0bce29 commit c2f6c87
Show file tree
Hide file tree
Showing 54 changed files with 1,202 additions and 404 deletions.
5 changes: 2 additions & 3 deletions apis/core/v1alpha1/openapi_generated.go

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

5 changes: 2 additions & 3 deletions apis/identity/v1alpha1/openapi_generated.go

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

5 changes: 2 additions & 3 deletions apis/management/v1alpha1/openapi_generated.go

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

27 changes: 6 additions & 21 deletions apis/meta/v1alpha1/clusterprofile_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,25 +17,11 @@ limitations under the License.
package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)
uiapi "kmodules.xyz/resource-metadata/apis/ui/v1alpha1"

const (
ResourceKindClusterProfile = "ClusterProfile"
ResourceClusterProfile = "clusterprofile"
ResourceClusterProfiles = "clusterprofiles"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// ClusterProfileSpec defines the desired state of ClusterProfile
type ClusterProfileSpec struct {
Title string `json:"title"`
Description string `json:"description"`
Provider string `json:"provider,omitempty"`
RequiredFeatureSets map[string]FeatureList `json:"requiredFeatureSets,omitempty"`
}

// ClusterProfile is the Schema for the clusterprofiles API

// +genclient
// +genclient:nonNamespaced
// +genclient:skipVerbs=updateStatus
Expand All @@ -47,18 +33,17 @@ type ClusterProfileSpec struct {
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type ClusterProfile struct {
metav1.TypeMeta `json:",inline"`
metav1.TypeMeta `json:",inline"`
// +optional
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ClusterProfileSpec `json:"spec,omitempty"`
Spec uiapi.ClusterProfileSpec `json:"spec,omitempty"`
}

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

// ClusterProfileList contains a list of ClusterProfile
type ClusterProfileList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterProfile `json:"items"`
Items []ClusterProfile `json:"items,omitempty"`
}
70 changes: 5 additions & 65 deletions apis/meta/v1alpha1/openapi_generated.go

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

31 changes: 0 additions & 31 deletions apis/meta/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 2 additions & 3 deletions apis/node/v1alpha1/openapi_generated.go

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

66 changes: 66 additions & 0 deletions apis/ui/v1alpha1/clusterprofile_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
/*
Copyright AppsCode Inc. and Contributors
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"
)

const (
ResourceKindClusterProfile = "ClusterProfile"
ResourceClusterProfile = "clusterprofile"
ResourceClusterProfiles = "clusterprofiles"
)

// ClusterProfileSpec defines the desired state of ClusterProfile
type ClusterProfileSpec struct {
Title string `json:"title"`
Description string `json:"description"`
Provider string `json:"provider,omitempty"`
RequiredFeatureSets map[string]Features `json:"requiredFeatureSets,omitempty"`
}

type Features []string

// ClusterProfile is the Schema for the clusterprofiles API

// +genclient
// +genclient:nonNamespaced
// +genclient:skipVerbs=updateStatus
// +k8s:openapi-gen=true
// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.phase"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
type ClusterProfile struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata,omitempty"`

Spec ClusterProfileSpec `json:"spec,omitempty"`
}

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

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

0 comments on commit c2f6c87

Please sign in to comment.