Skip to content

Commit 5d1870e

Browse files
authored
Add CRD versioning (#581)
1 parent 6cb7eb3 commit 5d1870e

13 files changed

+44
-23
lines changed

api/v1alpha2/agentpool_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ type AgentPoolStatus struct {
192192

193193
//+kubebuilder:object:root=true
194194
//+kubebuilder:subresource:status
195+
//+kubebuilder:metadata:labels="app.terraform.io/crd-schema-version=v25.4.0"
195196

196197
// AgentPool manages HCP Terraform Agent Pools, HCP Terraform Agent Tokens and can perform HCP Terraform Agent scaling.
197198
// More infromation:

api/v1alpha2/module_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -178,6 +178,7 @@ type ModuleStatus struct {
178178
//+kubebuilder:subresource:status
179179
//+kubebuilder:printcolumn:name="CV Status",type=string,JSONPath=`.status.configurationVersion.status`
180180
//+kubebuilder:printcolumn:name="Run Status",type=string,JSONPath=`.status.run.status`
181+
//+kubebuilder:metadata:labels="app.terraform.io/crd-schema-version=v25.4.0"
181182

182183
// Module implements API-driven Run Workflows.
183184
// More information:

api/v1alpha2/project_types.go

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,7 @@ type ProjectStatus struct {
189189
//+kubebuilder:subresource:status
190190
//+kubebuilder:printcolumn:name="Project Name",type=string,JSONPath=`.status.name`
191191
//+kubebuilder:printcolumn:name="Project ID",type=string,JSONPath=`.status.id`
192+
//+kubebuilder:metadata:labels="app.terraform.io/crd-schema-version=v25.4.0"
192193

193194
// Project manages HCP Terraform Projects.
194195
// More information:

api/v1alpha2/workspace_types.go

Lines changed: 24 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,24 @@ type WorkspaceProject struct {
447447
Name string `json:"name,omitempty"`
448448
}
449449

450+
type WorkspaceVariableSet struct {
451+
// ID of the variable set.
452+
// Must match pattern: `varset-[a-zA-Z0-9]+$`
453+
// More information:
454+
// - https://developer.hashicorp.com/terraform/tutorials/cloud/cloud-multiple-variable-sets
455+
//
456+
//+kubebuilder:validation:Pattern:="varset-[a-zA-Z0-9]+$"
457+
//+optional
458+
ID string `json:"id,omitempty"`
459+
// Name of the variable set.
460+
// More information:
461+
// - https://developer.hashicorp.com/terraform/tutorials/cloud/cloud-multiple-variable-sets
462+
//
463+
//+kubebuilder:validation:MinLength:=1
464+
//+optional
465+
Name string `json:"name,omitempty"`
466+
}
467+
450468
// WorkspaceSpec defines the desired state of Workspace.
451469
type WorkspaceSpec struct {
452470
// Workspace name.
@@ -726,9 +744,15 @@ type WorkspaceStatus struct {
726744
VariableSets []VariableSetStatus `json:"variableSet,omitempty"`
727745
}
728746

747+
type VariableSetStatus struct {
748+
ID string `json:"id,omitempty"`
749+
Name string `json:"name,omitempty"`
750+
}
751+
729752
//+kubebuilder:object:root=true
730753
//+kubebuilder:subresource:status
731754
//+kubebuilder:printcolumn:name="Workspace ID",type=string,JSONPath=`.status.workspaceID`
755+
//+kubebuilder:metadata:labels="app.terraform.io/crd-schema-version=v25.4.0"
732756

733757
// Workspace manages HCP Terraform Workspaces.
734758
// More information:
@@ -750,29 +774,6 @@ type WorkspaceList struct {
750774
Items []Workspace `json:"items"`
751775
}
752776

753-
type WorkspaceVariableSet struct {
754-
// ID of the variable set.
755-
// Must match pattern: `varset-[a-zA-Z0-9]+$`
756-
// More information:
757-
// - https://developer.hashicorp.com/terraform/tutorials/cloud/cloud-multiple-variable-sets
758-
//
759-
//+kubebuilder:validation:Pattern:="varset-[a-zA-Z0-9]+$"
760-
//+optional
761-
ID string `json:"id,omitempty"`
762-
// Name of the variable set.
763-
// More information:
764-
// - https://developer.hashicorp.com/terraform/tutorials/cloud/cloud-multiple-variable-sets
765-
//
766-
//+kubebuilder:validation:MinLength:=1
767-
//+optional
768-
Name string `json:"name,omitempty"`
769-
}
770-
771-
type VariableSetStatus struct {
772-
ID string `json:"id,omitempty"`
773-
Name string `json:"name,omitempty"`
774-
}
775-
776777
func init() {
777778
SchemeBuilder.Register(&Workspace{}, &WorkspaceList{})
778779
}

charts/hcp-terraform-operator/crds/app.terraform.io_agentpools.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ kind: CustomResourceDefinition
77
metadata:
88
annotations:
99
controller-gen.kubebuilder.io/version: v0.16.5
10+
labels:
11+
app.terraform.io/crd-schema-version: v25.4.0
1012
name: agentpools.app.terraform.io
1113
spec:
1214
group: app.terraform.io

charts/hcp-terraform-operator/crds/app.terraform.io_modules.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ kind: CustomResourceDefinition
77
metadata:
88
annotations:
99
controller-gen.kubebuilder.io/version: v0.16.5
10+
labels:
11+
app.terraform.io/crd-schema-version: v25.4.0
1012
name: modules.app.terraform.io
1113
spec:
1214
group: app.terraform.io

charts/hcp-terraform-operator/crds/app.terraform.io_projects.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ kind: CustomResourceDefinition
77
metadata:
88
annotations:
99
controller-gen.kubebuilder.io/version: v0.16.5
10+
labels:
11+
app.terraform.io/crd-schema-version: v25.4.0
1012
name: projects.app.terraform.io
1113
spec:
1214
group: app.terraform.io

charts/hcp-terraform-operator/crds/app.terraform.io_workspaces.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@ kind: CustomResourceDefinition
77
metadata:
88
annotations:
99
controller-gen.kubebuilder.io/version: v0.16.5
10+
labels:
11+
app.terraform.io/crd-schema-version: v25.4.0
1012
name: workspaces.app.terraform.io
1113
spec:
1214
group: app.terraform.io

config/crd/bases/app.terraform.io_agentpools.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.16.5
7+
labels:
8+
app.terraform.io/crd-schema-version: v25.4.0
79
name: agentpools.app.terraform.io
810
spec:
911
group: app.terraform.io

config/crd/bases/app.terraform.io_modules.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ kind: CustomResourceDefinition
44
metadata:
55
annotations:
66
controller-gen.kubebuilder.io/version: v0.16.5
7+
labels:
8+
app.terraform.io/crd-schema-version: v25.4.0
79
name: modules.app.terraform.io
810
spec:
911
group: app.terraform.io

0 commit comments

Comments
 (0)