Skip to content

Commit

Permalink
add all resources valudate
Browse files Browse the repository at this point in the history
Signed-off-by: runzexia <runzexia@yunify.com>
  • Loading branch information
runzexia committed Jan 9, 2019
1 parent c2d0e13 commit 289562d
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/addtoscheme.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func (a *AddToScheme) GetInput() (input.Input, error) {
return a.Input, nil
}

// Validate validates the values
func (a *AddToScheme) Validate() error {
return a.Resource.Validate()
}

var addResourceTemplate = `{{ .Boilerplate }}
package apis
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/authproxyrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func (r *AuthProxyRole) GetInput() (input.Input, error) {
return r.Input, nil
}

// Validate validates the values
func (r *AuthProxyRole) Validate() error {
return r.Resource.Validate()
}

var proxyRoleTemplate = `apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/authproxyrolebinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func (r *AuthProxyRoleBinding) GetInput() (input.Input, error) {
return r.Input, nil
}

// Validate validates the values
func (r *AuthProxyRoleBinding) Validate() error {
return r.Resource.Validate()
}

var proxyRoleBindinggTemplate = `apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/authproxyservice.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func (r *AuthProxyService) GetInput() (input.Input, error) {
return r.Input, nil
}

// Validate validates the values
func (r *AuthProxyService) Validate() error {
return r.Resource.Validate()
}

var AuthProxyServiceTemplate = `apiVersion: v1
kind: Service
metadata:
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/crd.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ func (c *CRD) GetInput() (input.Input, error) {
return c.Input, nil
}

// Validate validates the values
func (c *CRD) Validate() error {
return c.Resource.Validate()
}

var crdTemplate = `apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/crd_sample.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ func (c *CRDSample) GetInput() (input.Input, error) {
return c.Input, nil
}

// Validate validates the values
func (c *CRDSample) Validate() error {
return c.Resource.Validate()
}

var crdSampleTemplate = `apiVersion: {{ .Resource.Group }}.{{ .Domain }}/{{ .Resource.Version }}
kind: {{ .Resource.Kind }}
metadata:
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/doc.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,11 @@ func (a *Doc) GetInput() (input.Input, error) {
return a.Input, nil
}

// Validate validates the values
func (a *Doc) Validate() error {
return a.Resource.Validate()
}

var docGoTemplate = `{{ .Boilerplate }}
// Package {{.Resource.Version}} contains API Schema definitions for the {{ .Resource.Group }} {{.Resource.Version}} API group
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/group.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func (g *Group) GetInput() (input.Input, error) {
return g.Input, nil
}

// Validate validates the values
func (g *Group) Validate() error {
return g.Resource.Validate()
}

var groupTemplate = `{{ .Boilerplate }}
// Package {{ .Resource.Group }} contains {{ .Resource.Group }} API versions
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ func (r *Register) GetInput() (input.Input, error) {
return r.Input, nil
}

// Validate validates the values
func (r *Register) Validate() error {
return r.Resource.Validate()
}

var registerTemplate = `{{ .Boilerplate }}
// NOTE: Boilerplate only. Ignore this file.
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/role.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func (r *Role) GetInput() (input.Input, error) {
return r.Input, nil
}

// Validate validates the values
func (r *Role) Validate() error {
return r.Resource.Validate()
}

var roleTemplate = `apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/rolebinding.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func (r *RoleBinding) GetInput() (input.Input, error) {
return r.Input, nil
}

// Validate validates the values
func (r *RoleBinding) Validate() error {
return r.Resource.Validate()
}

var roleBindingTemplate = `apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
Expand Down
5 changes: 5 additions & 0 deletions pkg/scaffold/resource/version_suitetest.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ func (v *VersionSuiteTest) GetInput() (input.Input, error) {
return v.Input, nil
}

// Validate validates the values
func (v *VersionSuiteTest) Validate() error {
return v.Resource.Validate()
}

var versionSuiteTestTemplate = `{{ .Boilerplate }}
package {{ .Resource.Version }}
Expand Down

0 comments on commit 289562d

Please sign in to comment.