Skip to content

Commit

Permalink
Add Cluster Deployment Template
Browse files Browse the repository at this point in the history
Co-authored-by: Marty Spiewak <mspiewak@vmware.com>
  • Loading branch information
emmjohnson and Marty Spiewak committed Oct 14, 2021
1 parent eabeb98 commit 20fb7d7
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 2 deletions.
1 change: 1 addition & 0 deletions config/crd/bases/carto.run_clusterdeliveries.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ spec:
kind:
enum:
- ClusterSourceTemplate
- ClusterDeploymentTemplate
- ClusterTemplate
type: string
name:
Expand Down
2 changes: 1 addition & 1 deletion pkg/apis/v1alpha1/cluster_delivery.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ type ClusterDeliveryResource struct {
}

type DeliveryClusterTemplateReference struct {
// +kubebuilder:validation:Enum=ClusterSourceTemplate;ClusterTemplate
// +kubebuilder:validation:Enum=ClusterSourceTemplate;ClusterDeploymentTemplate;ClusterTemplate
Kind string `json:"kind"`
// +kubebuilder:validation:MinLength=1
Name string `json:"name"`
Expand Down
49 changes: 49 additions & 0 deletions pkg/apis/v1alpha1/cluster_deployment_template.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Copyright 2021 VMware
//
// 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.

// +versionName=v1alpha1
// +groupName=carto.run
// +kubebuilder:object:generate=true

package v1alpha1

import (
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
)

// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:scope=Cluster

type ClusterDeploymentTemplate struct {
metav1.TypeMeta `json:",inline"`
metav1.ObjectMeta `json:"metadata"`
Spec TemplateSpec `json:"spec"`
Status TemplateStatus `json:"status,omitempty"`
}

// +kubebuilder:object:root=true

type ClusterDeploymentTemplateList struct {
metav1.TypeMeta `json:",inline"`
metav1.ListMeta `json:"metadata,omitempty"`
Items []ClusterTemplate `json:"items"`
}

func init() {
SchemeBuilder.Register(
&ClusterDeploymentTemplate{},
&ClusterDeploymentTemplateList{},
)
}
59 changes: 59 additions & 0 deletions pkg/apis/v1alpha1/zz_generated.deepcopy.go

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

3 changes: 2 additions & 1 deletion pkg/registrar/registrar_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ var _ = Describe("Registrar", func() {
Group: "carto.run",
Version: "v1alpha1",
}
Expect(len(scheme.KnownTypes(gv))).To(Equal(25))
Expect(len(scheme.KnownTypes(gv))).To(Equal(27))
// If this test fails, it may indicate that new types should be added to the test below
})

Expand All @@ -71,6 +71,7 @@ var _ = Describe("Registrar", func() {
kinds := []string{
"ClusterConfigTemplate",
"ClusterDelivery",
"ClusterDeploymentTemplate",
"ClusterImageTemplate",
"ClusterSourceTemplate",
"ClusterSupplyChain",
Expand Down

0 comments on commit 20fb7d7

Please sign in to comment.