Skip to content

Commit

Permalink
Add project api
Browse files Browse the repository at this point in the history
Signed-off-by: Tamal Saha <[email protected]>
  • Loading branch information
tamalsaha committed Sep 20, 2023
1 parent 273eefd commit 0e39e1f
Show file tree
Hide file tree
Showing 17 changed files with 730 additions and 42 deletions.
3 changes: 3 additions & 0 deletions apis/core/fuzzer/fuzzer.go
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ var Funcs = func(codecs runtimeserializer.CodecFactory) []interface{} {
func(s *v1alpha1.PodView, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
func(s *v1alpha1.Project, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
func(s *v1alpha1.ResourceSummary, c fuzz.Continue) {
c.FuzzNoCustom(s) // fuzz self without calling this function again
},
Expand Down
151 changes: 151 additions & 0 deletions apis/core/v1alpha1/openapi_generated.go

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

77 changes: 77 additions & 0 deletions apis/core/v1alpha1/project_types.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
/*
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 (
ResourceKindProject = "Project"
ResourceProject = "project"
ResourceProjects = "projects"
)

// ProjectSpec defines the desired state of Project
type ProjectSpec struct {
// +kubebuilder:default=User
Type ProjectType `json:"type,omitempty"`
Namespaces []string `json:"namespaces,omitempty"`
NamespaceSelector *metav1.LabelSelector `json:"namespaceSelector,omitempty"`
}

// +kubebuilder:validation:Enum=Default;System;User
type ProjectType string

const (
ProjectDefault ProjectType = "Default"
ProjectSystem ProjectType = "System"
ProjectUser ProjectType = "User"
)

// ProjectStatus defines the observed state of Project
type ProjectStatus struct{}

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

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

Spec ProjectSpec `json:"spec,omitempty"`
Status ProjectStatus `json:"status,omitempty"`
}

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

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

func init() {
SchemeBuilder.Register(&Project{}, &ProjectList{})
}
104 changes: 104 additions & 0 deletions apis/core/v1alpha1/zz_generated.deepcopy.go

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

5 changes: 5 additions & 0 deletions client/clientset/versioned/typed/core/v1alpha1/core_client.go

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

Loading

0 comments on commit 0e39e1f

Please sign in to comment.