Skip to content

Commit 79473df

Browse files
author
Joshua Reed
committed
Removed identityRef that was essentially unused.
1 parent 85f618b commit 79473df

6 files changed

+0
-85
lines changed

api/v1beta2/cloudstackcluster_types.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -27,18 +27,6 @@ const (
2727
CloudStackClusterLabelName = "cloudstackcluster.infrastructure.cluster.x-k8s.io/name"
2828
)
2929

30-
// CloudStackIdentityReference is a reference to an infrastructure
31-
// provider identity to be used to provision cluster resources.
32-
type CloudStackIdentityReference struct {
33-
// Kind of the identity. Must be supported by the infrastructure provider
34-
// and may be either cluster or namespace-scoped.
35-
// +kubebuilder:validation:MinLength=1
36-
Kind string `json:"kind"`
37-
38-
// Name of the infrastructure identity to be used.
39-
Name string `json:"name"`
40-
}
41-
4230
// CloudStackClusterSpec defines the desired state of CloudStackCluster.
4331
type CloudStackClusterSpec struct {
4432
FailureDomains []CloudStackFailureDomainSpec `json:"failureDomains"`
@@ -53,10 +41,6 @@ type CloudStackClusterSpec struct {
5341
// CloudStack domain.
5442
// +optional
5543
Domain string `json:"domain,omitempty"`
56-
57-
// +optional
58-
// +k8s:conversion-gen=false
59-
IdentityRef *CloudStackIdentityReference `json:"identityRef,omitempty"`
6044
}
6145

6246
// The status of the CloudStackCluster object.

api/v1beta2/cloudstackcluster_webhook.go

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,11 +56,6 @@ func (r *CloudStackCluster) ValidateCreate() error {
5656

5757
var errorList field.ErrorList
5858

59-
// IdentityRefs must be Secrets.
60-
if r.Spec.IdentityRef != nil && r.Spec.IdentityRef.Kind != defaultIdentityRefKind {
61-
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "identityRef", "kind"), "must be a Secret"))
62-
}
63-
6459
if (r.Spec.Account != "") && (r.Spec.Domain == "") {
6560
errorList = append(errorList, field.Required(
6661
field.NewPath("spec", "account"), "specifying account requires additionally specifying domain"))
@@ -112,17 +107,6 @@ func (r *CloudStackCluster) ValidateUpdate(old runtime.Object) error {
112107
string(spec.ControlPlaneEndpoint.Port), string(oldSpec.ControlPlaneEndpoint.Port),
113108
"controlplaneendpoint.port", errorList)
114109
}
115-
if spec.IdentityRef != nil && oldSpec.IdentityRef != nil {
116-
errorList = webhookutil.EnsureStringFieldsAreEqual(
117-
spec.IdentityRef.Kind, oldSpec.IdentityRef.Kind, "identityref.kind", errorList)
118-
errorList = webhookutil.EnsureStringFieldsAreEqual(spec.IdentityRef.Name, oldSpec.IdentityRef.Name,
119-
"identityref.name", errorList)
120-
}
121-
122-
// IdentityRefs must be Secrets.
123-
if spec.IdentityRef != nil && spec.IdentityRef.Kind != defaultIdentityRefKind {
124-
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "identityRef", "kind"), "must be a Secret"))
125-
}
126110

127111
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
128112
}

api/v1beta2/cloudstackmachine_types.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,6 @@ type CloudStackMachineSpec struct {
8282
// FailureDomainName -- the name of the FailureDomain the machine is placed in.
8383
// +optional
8484
FailureDomainName string `json:"failureDomainName,omitempty"`
85-
86-
// IdentityRef is a reference to a identity to be used when reconciling this cluster
87-
// +optional
88-
// +k8s:conversion-gen=false
89-
IdentityRef *CloudStackIdentityReference `json:"identityRef,omitempty"`
9085
}
9186

9287
type CloudStackResourceIdentifier struct {

api/v1beta2/cloudstackmachine_webhook.go

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,11 +58,6 @@ func (r *CloudStackMachine) ValidateCreate() error {
5858

5959
var errorList field.ErrorList
6060

61-
// IdentityRefs must be Secrets.
62-
if r.Spec.IdentityRef != nil && r.Spec.IdentityRef.Kind != defaultIdentityRefKind {
63-
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "identityRef", "kind"), "must be a Secret"))
64-
}
65-
6661
errorList = webhookutil.EnsureAtLeastOneFieldExists(r.Spec.Offering.ID, r.Spec.Offering.Name, "Offering", errorList)
6762
errorList = webhookutil.EnsureAtLeastOneFieldExists(r.Spec.Template.ID, r.Spec.Template.Name, "Template", errorList)
6863
if len(r.Spec.DiskOffering.ID) > 0 || len(r.Spec.DiskOffering.Name) > 0 {
@@ -94,12 +89,6 @@ func (r *CloudStackMachine) ValidateUpdate(old runtime.Object) error {
9489
errorList = webhookutil.EnsureStringFieldsAreEqual(r.Spec.SSHKey, oldSpec.SSHKey, "sshkey", errorList)
9590
errorList = webhookutil.EnsureBothFieldsAreEqual(r.Spec.Template.ID, r.Spec.Template.Name, oldSpec.Template.ID, oldSpec.Template.Name, "template", errorList)
9691
errorList = webhookutil.EnsureStringStringMapFieldsAreEqual(&r.Spec.Details, &oldSpec.Details, "details", errorList)
97-
if r.Spec.IdentityRef != nil && oldSpec.IdentityRef != nil {
98-
errorList = webhookutil.EnsureStringFieldsAreEqual(
99-
r.Spec.IdentityRef.Kind, oldSpec.IdentityRef.Kind, "identityRef.Kind", errorList)
100-
errorList = webhookutil.EnsureStringFieldsAreEqual(
101-
r.Spec.IdentityRef.Name, oldSpec.IdentityRef.Name, "identityRef.Name", errorList)
102-
}
10392
errorList = webhookutil.EnsureStringFieldsAreEqual(r.Spec.Affinity, oldSpec.Affinity, "affinity", errorList)
10493

10594
if !reflect.DeepEqual(r.Spec.AffinityGroupIDs, oldSpec.AffinityGroupIDs) { // Equivalent to other Ensure funcs.

api/v1beta2/cloudstackmachinetemplate_webhook.go

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,6 @@ func (r *CloudStackMachineTemplate) ValidateCreate() error {
6161
spec = r.Spec.Spec.Spec // CloudStackMachineTemplateSpec.CloudStackMachineTemplateResource.CloudStackMachineSpec
6262
)
6363

64-
// IdentityRefs must be Secrets.
65-
if spec.IdentityRef != nil && spec.IdentityRef.Kind != defaultIdentityRefKind {
66-
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "identityRef", "kind"), "must be a Secret"))
67-
}
68-
6964
affinity := strings.ToLower(spec.Affinity)
7065
if !(affinity == "" || affinity == "no" || affinity == "pro" || affinity == "anti") {
7166
errorList = append(errorList, field.Invalid(field.NewPath("spec", "Affinity"), spec.Affinity,
@@ -107,13 +102,6 @@ func (r *CloudStackMachineTemplate) ValidateUpdate(old runtime.Object) error {
107102
errorList = append(errorList, field.Forbidden(field.NewPath("spec", "AffinityGroupIDs"), "AffinityGroupIDs"))
108103
}
109104

110-
if spec.IdentityRef != nil && oldSpec.IdentityRef != nil { // Allow setting once.
111-
errorList = webhookutil.EnsureStringFieldsAreEqual(
112-
spec.IdentityRef.Kind, oldSpec.IdentityRef.Kind, "identityRef.Kind", errorList)
113-
errorList = webhookutil.EnsureStringFieldsAreEqual(
114-
spec.IdentityRef.Name, oldSpec.IdentityRef.Name, "identityRef.Name", errorList)
115-
}
116-
117105
return webhookutil.AggregateObjErrors(r.GroupVersionKind().GroupKind(), r.Name, errorList)
118106
}
119107

api/v1beta2/zz_generated.deepcopy.go

Lines changed: 0 additions & 25 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)