diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 2d793af..c857e7e 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,7 +1,7 @@ ack_generate_info: - build_date: "2024-08-29T17:14:13Z" + build_date: "2024-09-19T16:42:31Z" build_hash: f8f98563404066ac3340db0a049d2e530e5c51cc - go_version: go1.22.5 + go_version: go1.23.0 version: v0.38.1 api_directory_checksum: 626700f8799840e0470b1ff7ef3dbb32665b9f9d api_version: v1alpha1 diff --git a/pkg/resource/cluster/sdk.go b/pkg/resource/cluster/sdk.go index 2e40997..cb396ef 100644 --- a/pkg/resource/cluster/sdk.go +++ b/pkg/resource/cluster/sdk.go @@ -367,6 +367,14 @@ func (rm *resourceManager) sdkFind( } rm.setStatusDefaults(ko) + if r.ko.Spec.ResourcesVPCConfig.SubnetRefs != nil { + ko.Spec.ResourcesVPCConfig.SubnetRefs = r.ko.Spec.ResourcesVPCConfig.SubnetRefs + } + + if r.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs != nil { + ko.Spec.ResourcesVPCConfig.SecurityGroupRefs = r.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs + } + if !clusterActive(&resource{ko}) { // Setting resource synced condition to false will trigger a requeue of // the resource. No need to return a requeue error here. @@ -374,7 +382,6 @@ func (rm *resourceManager) sdkFind( } else { ackcondition.SetSynced(&resource{ko}, corev1.ConditionTrue, nil, nil) } - return &resource{ko}, nil } @@ -707,6 +714,14 @@ func (rm *resourceManager) sdkCreate( } rm.setStatusDefaults(ko) + if desired.ko.Spec.ResourcesVPCConfig.SubnetRefs != nil { + ko.Spec.ResourcesVPCConfig.SubnetRefs = desired.ko.Spec.ResourcesVPCConfig.SubnetRefs + } + + if desired.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs != nil { + ko.Spec.ResourcesVPCConfig.SecurityGroupRefs = desired.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs + } + // We expect the cluster to be in 'CREATING' status since we just issued // the call to create it, but I suppose it doesn't hurt to check here. if clusterCreating(&resource{ko}) { diff --git a/templates/hooks/cluster/sdk_create_post_set_output.go.tpl b/templates/hooks/cluster/sdk_create_post_set_output.go.tpl index ec6f62e..f1f6e5d 100644 --- a/templates/hooks/cluster/sdk_create_post_set_output.go.tpl +++ b/templates/hooks/cluster/sdk_create_post_set_output.go.tpl @@ -1,3 +1,11 @@ + if desired.ko.Spec.ResourcesVPCConfig.SubnetRefs != nil { + ko.Spec.ResourcesVPCConfig.SubnetRefs = desired.ko.Spec.ResourcesVPCConfig.SubnetRefs + } + + if desired.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs != nil { + ko.Spec.ResourcesVPCConfig.SecurityGroupRefs = desired.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs + } + // We expect the cluster to be in 'CREATING' status since we just issued // the call to create it, but I suppose it doesn't hurt to check here. if clusterCreating(&resource{ko}) { @@ -6,3 +14,4 @@ ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, nil, nil) return &resource{ko}, nil } + diff --git a/templates/hooks/cluster/sdk_read_one_post_set_output.go.tpl b/templates/hooks/cluster/sdk_read_one_post_set_output.go.tpl index d7acce0..3feb07d 100644 --- a/templates/hooks/cluster/sdk_read_one_post_set_output.go.tpl +++ b/templates/hooks/cluster/sdk_read_one_post_set_output.go.tpl @@ -1,8 +1,15 @@ + if r.ko.Spec.ResourcesVPCConfig.SubnetRefs != nil { + ko.Spec.ResourcesVPCConfig.SubnetRefs = r.ko.Spec.ResourcesVPCConfig.SubnetRefs + } + + if r.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs != nil { + ko.Spec.ResourcesVPCConfig.SecurityGroupRefs = r.ko.Spec.ResourcesVPCConfig.SecurityGroupRefs + } + if !clusterActive(&resource{ko}) { // Setting resource synced condition to false will trigger a requeue of // the resource. No need to return a requeue error here. ackcondition.SetSynced(&resource{ko}, corev1.ConditionFalse, nil, nil) } else { ackcondition.SetSynced(&resource{ko}, corev1.ConditionTrue, nil, nil) - } - + } \ No newline at end of file