diff --git a/apis/v1alpha1/ack-generate-metadata.yaml b/apis/v1alpha1/ack-generate-metadata.yaml index 50ece39b..d30ceced 100755 --- a/apis/v1alpha1/ack-generate-metadata.yaml +++ b/apis/v1alpha1/ack-generate-metadata.yaml @@ -1,13 +1,13 @@ ack_generate_info: - build_date: "2023-09-20T11:19:38Z" - build_hash: e9b68590da73ce9143ba1e4361cebdc1d876c81e + build_date: "2023-09-24T06:21:32Z" + build_hash: 892f29d00a4c4ad21a2fa32919921de18190979d go_version: go1.20.3 - version: v0.26.1-7-ge9b6859 -api_directory_checksum: 5fba18fb7f9bccf860caf2da80e33859d4f93020 + version: v0.27.1 +api_directory_checksum: 62d52ec595b37efec3f76b5863d14477e41b4987 api_version: v1alpha1 aws_sdk_go_version: v1.44.93 generator_config_info: - file_checksum: ae8176be538fe3f653bc1bad979f59bba34b1cbc + file_checksum: 4a938ee6da37ee5c79556fdbdafce4b1376b1da3 original_file_name: generator.yaml last_modification: reason: API generation diff --git a/apis/v1alpha1/generator.yaml b/apis/v1alpha1/generator.yaml index 0779f9b0..b730057e 100644 --- a/apis/v1alpha1/generator.yaml +++ b/apis/v1alpha1/generator.yaml @@ -53,6 +53,9 @@ ignore: - SecurityGroupRule.GroupOwnerId - SecurityGroupRule.ReferencedGroupInfo - TerminateInstancesInput.DryRun + - CreateLaunchTemplateInput.ClientToken + - CreateLaunchTemplateInput.DryRun + - CreateLaunchTemplateInput.Tags resource_names: - AccountAttribute - CapacityReservation @@ -210,6 +213,12 @@ resources: print: path: Status.latestVersionNumber name: LatestVersion + Tags: + from: + operation: CreateTags + path: Tags + compare: + is_ignored: True tags: ignore: true renames: @@ -226,8 +235,6 @@ resources: DescribeLaunchTemplate: input_fields: LaunchTemplateName: Name - reconcile: - requeue_on_success_seconds: 60 hooks: sdk_update_post_build_request: template_path: hooks/launch_template/sdk_update_post_build_request.go.tpl diff --git a/apis/v1alpha1/launch_template.go b/apis/v1alpha1/launch_template.go index 8ad6bd88..0009b746 100644 --- a/apis/v1alpha1/launch_template.go +++ b/apis/v1alpha1/launch_template.go @@ -24,18 +24,7 @@ import ( // // Describes a launch template. type LaunchTemplateSpec struct { - - // Unique, case-sensitive identifier you provide to ensure the idempotency of - // the request. For more information, see Ensuring idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). - // - // Constraint: Maximum 128 ASCII characters. - ClientToken *string `json:"clientToken,omitempty"` - DefaultVersionNumber *int64 `json:"defaultVersionNumber,omitempty"` - // Checks whether you have the required permissions for the action, without - // actually making the request, and provides an error response. If you have - // the required permissions, the error response is DryRunOperation. Otherwise, - // it is UnauthorizedOperation. - DryRun *bool `json:"dryRun,omitempty"` + DefaultVersionNumber *int64 `json:"defaultVersionNumber,omitempty"` // The information for the launch template. // +kubebuilder:validation:Required LaunchTemplateData *RequestLaunchTemplateData `json:"launchTemplateData"` @@ -50,6 +39,10 @@ type LaunchTemplateSpec struct { // data (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_RequestLaunchTemplateData.html) // structure. TagSpecifications []*TagSpecification `json:"tagSpecifications,omitempty"` + // The tags. The value parameter is required, but if you don't want the tag + // to have a value, specify the parameter with no value, and we set the value + // to an empty string. + Tags []*Tag `json:"tags,omitempty"` // A description for the first version of the launch template. VersionDescription *string `json:"versionDescription,omitempty"` } @@ -79,9 +72,6 @@ type LaunchTemplateStatus struct { // The ID of the launch template. // +kubebuilder:validation:Optional LaunchTemplateID *string `json:"launchTemplateID,omitempty"` - // The tags for the launch template. - // +kubebuilder:validation:Optional - Tags []*Tag `json:"tags,omitempty"` } // LaunchTemplate is the Schema for the LaunchTemplates API diff --git a/apis/v1alpha1/zz_generated.deepcopy.go b/apis/v1alpha1/zz_generated.deepcopy.go index 2f9a4eee..07db45e8 100644 --- a/apis/v1alpha1/zz_generated.deepcopy.go +++ b/apis/v1alpha1/zz_generated.deepcopy.go @@ -11497,21 +11497,11 @@ func (in *LaunchTemplatePrivateDNSNameOptionsRequest) DeepCopy() *LaunchTemplate // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LaunchTemplateSpec) DeepCopyInto(out *LaunchTemplateSpec) { *out = *in - if in.ClientToken != nil { - in, out := &in.ClientToken, &out.ClientToken - *out = new(string) - **out = **in - } if in.DefaultVersionNumber != nil { in, out := &in.DefaultVersionNumber, &out.DefaultVersionNumber *out = new(int64) **out = **in } - if in.DryRun != nil { - in, out := &in.DryRun, &out.DryRun - *out = new(bool) - **out = **in - } if in.LaunchTemplateData != nil { in, out := &in.LaunchTemplateData, &out.LaunchTemplateData *out = new(RequestLaunchTemplateData) @@ -11533,6 +11523,17 @@ func (in *LaunchTemplateSpec) DeepCopyInto(out *LaunchTemplateSpec) { } } } + if in.Tags != nil { + in, out := &in.Tags, &out.Tags + *out = make([]*Tag, len(*in)) + for i := range *in { + if (*in)[i] != nil { + in, out := &(*in)[i], &(*out)[i] + *out = new(Tag) + (*in).DeepCopyInto(*out) + } + } + } if in.VersionDescription != nil { in, out := &in.VersionDescription, &out.VersionDescription *out = new(string) @@ -11696,17 +11697,6 @@ func (in *LaunchTemplateStatus) DeepCopyInto(out *LaunchTemplateStatus) { *out = new(string) **out = **in } - if in.Tags != nil { - in, out := &in.Tags, &out.Tags - *out = make([]*Tag, len(*in)) - for i := range *in { - if (*in)[i] != nil { - in, out := &(*in)[i], &(*out)[i] - *out = new(Tag) - (*in).DeepCopyInto(*out) - } - } - } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new LaunchTemplateStatus. diff --git a/cmd/controller/controller b/cmd/controller/controller deleted file mode 100755 index 5563fded..00000000 Binary files a/cmd/controller/controller and /dev/null differ diff --git a/cmd/controller/main.go b/cmd/controller/main.go index 0236e5fa..c5f470d2 100644 --- a/cmd/controller/main.go +++ b/cmd/controller/main.go @@ -98,13 +98,14 @@ func main() { } mgr, err := ctrlrt.NewManager(ctrlrt.GetConfigOrDie(), ctrlrt.Options{ - Scheme: scheme, - Port: port, - Host: host, - MetricsBindAddress: ackCfg.MetricsAddr, - LeaderElection: ackCfg.EnableLeaderElection, - LeaderElectionID: awsServiceAPIGroup, - Namespace: ackCfg.WatchNamespace, + Scheme: scheme, + Port: port, + Host: host, + MetricsBindAddress: ackCfg.MetricsAddr, + LeaderElection: ackCfg.EnableLeaderElection, + LeaderElectionID: "ack-" + awsServiceAPIGroup, + Namespace: ackCfg.WatchNamespace, + LeaderElectionNamespace: ackCfg.LeaderElectionNamespace, }) if err != nil { setupLog.Error( diff --git a/config/controller/deployment.yaml b/config/controller/deployment.yaml index 76b8883b..e3bd281b 100644 --- a/config/controller/deployment.yaml +++ b/config/controller/deployment.yaml @@ -29,14 +29,16 @@ spec: - "$(AWS_REGION)" - --aws-endpoint-url - "$(AWS_ENDPOINT_URL)" - - --enable-development-logging - - "$(ACK_ENABLE_DEVELOPMENT_LOGGING)" + - --enable-development-logging=$(ACK_ENABLE_DEVELOPMENT_LOGGING) - --log-level - "$(ACK_LOG_LEVEL)" - --resource-tags - "$(ACK_RESOURCE_TAGS)" - --watch-namespace - "$(ACK_WATCH_NAMESPACE)" + - --enable-leader-election=$(ENABLE_LEADER_ELECTION) + - --leader-election-namespace + - "$(LEADER_ELECTION_NAMESPACE)" image: controller:latest name: controller ports: @@ -66,6 +68,10 @@ spec: value: "info" - name: ACK_RESOURCE_TAGS value: "services.k8s.aws/controller-version=%CONTROLLER_SERVICE%-%CONTROLLER_VERSION%,services.k8s.aws/namespace=%K8S_NAMESPACE%" + - name: ENABLE_LEADER_ELECTION + value: "false" + - name: LEADER_ELECTION_NAMESPACE + value: "ack-system" securityContext: allowPrivilegeEscalation: false privileged: false @@ -79,5 +85,6 @@ spec: terminationGracePeriodSeconds: 10 serviceAccountName: ack-ec2-controller hostIPC: false - hostNetwork: false hostPID: false + hostNetwork: false + dnsPolicy: ClusterFirst diff --git a/config/crd/bases/ec2.services.k8s.aws_launchtemplates.yaml b/config/crd/bases/ec2.services.k8s.aws_launchtemplates.yaml index 71c414af..a5183f3c 100644 --- a/config/crd/bases/ec2.services.k8s.aws_launchtemplates.yaml +++ b/config/crd/bases/ec2.services.k8s.aws_launchtemplates.yaml @@ -46,21 +46,9 @@ spec: description: "LaunchTemplateSpec defines the desired state of LaunchTemplate. \n Describes a launch template." properties: - clientToken: - description: "Unique, case-sensitive identifier you provide to ensure - the idempotency of the request. For more information, see Ensuring - idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). - \n Constraint: Maximum 128 ASCII characters." - type: string defaultVersionNumber: format: int64 type: integer - dryRun: - description: Checks whether you have the required permissions for - the action, without actually making the request, and provides an - error response. If you have the required permissions, the error - response is DryRunOperation. Otherwise, it is UnauthorizedOperation. - type: boolean launchTemplateData: description: The information for the launch template. properties: @@ -577,6 +565,19 @@ spec: type: array type: object type: array + tags: + description: The tags. The value parameter is required, but if you + don't want the tag to have a value, specify the parameter with no + value, and we set the value to an empty string. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array versionDescription: description: A description for the first version of the launch template. type: string @@ -663,17 +664,6 @@ spec: launchTemplateID: description: The ID of the launch template. type: string - tags: - description: The tags for the launch template. - items: - description: Describes a tag. - properties: - key: - type: string - value: - type: string - type: object - type: array type: object type: object served: true diff --git a/config/rbac/kustomization.yaml b/config/rbac/kustomization.yaml index eb7df60a..d9acdeeb 100644 --- a/config/rbac/kustomization.yaml +++ b/config/rbac/kustomization.yaml @@ -4,4 +4,5 @@ resources: - role-reader.yaml - role-writer.yaml - service-account.yaml - +- leader-election-role.yaml +- leader-election-role-binding.yaml diff --git a/generator.yaml b/generator.yaml index 0779f9b0..b730057e 100644 --- a/generator.yaml +++ b/generator.yaml @@ -53,6 +53,9 @@ ignore: - SecurityGroupRule.GroupOwnerId - SecurityGroupRule.ReferencedGroupInfo - TerminateInstancesInput.DryRun + - CreateLaunchTemplateInput.ClientToken + - CreateLaunchTemplateInput.DryRun + - CreateLaunchTemplateInput.Tags resource_names: - AccountAttribute - CapacityReservation @@ -210,6 +213,12 @@ resources: print: path: Status.latestVersionNumber name: LatestVersion + Tags: + from: + operation: CreateTags + path: Tags + compare: + is_ignored: True tags: ignore: true renames: @@ -226,8 +235,6 @@ resources: DescribeLaunchTemplate: input_fields: LaunchTemplateName: Name - reconcile: - requeue_on_success_seconds: 60 hooks: sdk_update_post_build_request: template_path: hooks/launch_template/sdk_update_post_build_request.go.tpl diff --git a/helm/crds/ec2.services.k8s.aws_launchtemplates.yaml b/helm/crds/ec2.services.k8s.aws_launchtemplates.yaml index 71c414af..a5183f3c 100644 --- a/helm/crds/ec2.services.k8s.aws_launchtemplates.yaml +++ b/helm/crds/ec2.services.k8s.aws_launchtemplates.yaml @@ -46,21 +46,9 @@ spec: description: "LaunchTemplateSpec defines the desired state of LaunchTemplate. \n Describes a launch template." properties: - clientToken: - description: "Unique, case-sensitive identifier you provide to ensure - the idempotency of the request. For more information, see Ensuring - idempotency (https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html). - \n Constraint: Maximum 128 ASCII characters." - type: string defaultVersionNumber: format: int64 type: integer - dryRun: - description: Checks whether you have the required permissions for - the action, without actually making the request, and provides an - error response. If you have the required permissions, the error - response is DryRunOperation. Otherwise, it is UnauthorizedOperation. - type: boolean launchTemplateData: description: The information for the launch template. properties: @@ -577,6 +565,19 @@ spec: type: array type: object type: array + tags: + description: The tags. The value parameter is required, but if you + don't want the tag to have a value, specify the parameter with no + value, and we set the value to an empty string. + items: + description: Describes a tag. + properties: + key: + type: string + value: + type: string + type: object + type: array versionDescription: description: A description for the first version of the launch template. type: string @@ -663,17 +664,6 @@ spec: launchTemplateID: description: The ID of the launch template. type: string - tags: - description: The tags for the launch template. - items: - description: Describes a tag. - properties: - key: - type: string - value: - type: string - type: object - type: array type: object type: object served: true diff --git a/helm/templates/deployment.yaml b/helm/templates/deployment.yaml index 4d087a52..f40b5f22 100644 --- a/helm/templates/deployment.yaml +++ b/helm/templates/deployment.yaml @@ -11,7 +11,7 @@ metadata: k8s-app: {{ include "app.name" . }} helm.sh/chart: {{ include "chart.name-version" . }} spec: - replicas: 1 + replicas: {{ .Values.deployment.replicas }} selector: matchLabels: app.kubernetes.io/name: {{ include "app.name" . }} @@ -48,8 +48,9 @@ spec: - "$(AWS_REGION)" - --aws-endpoint-url - "$(AWS_ENDPOINT_URL)" +{{- if .Values.log.enable_development_logging }} - --enable-development-logging - - "$(ACK_ENABLE_DEVELOPMENT_LOGGING)" +{{- end }} - --log-level - "$(ACK_LOG_LEVEL)" - --resource-tags @@ -58,6 +59,11 @@ spec: - "$(ACK_WATCH_NAMESPACE)" - --deletion-policy - "$(DELETION_POLICY)" +{{- if .Values.leaderElection.enabled }} + - --enable-leader-election + - --leader-election-namespace + - "$(LEADER_ELECTION_NAMESPACE)" +{{- end }} {{- if gt .Values.reconcile.defaultResyncPeriod 0.0 }} - --reconcile-default-resync-seconds - "$(RECONCILE_DEFAULT_RESYNC_SECONDS)" @@ -87,8 +93,8 @@ spec: value: {{ include "watch-namespace" . }} - name: DELETION_POLICY value: {{ .Values.deletionPolicy }} - - name: ACK_ENABLE_DEVELOPMENT_LOGGING - value: {{ .Values.log.enable_development_logging | quote }} + - name: LEADER_ELECTION_NAMESPACE + value: {{ .Values.leaderElection.namespace | quote }} - name: ACK_LOG_LEVEL value: {{ .Values.log.level | quote }} - name: ACK_RESOURCE_TAGS @@ -141,8 +147,9 @@ spec: priorityClassName: {{ .Values.deployment.priorityClassName }} {{ end -}} hostIPC: false - hostNetwork: false hostPID: false + hostNetwork: {{ .Values.deployment.hostNetwork }} + dnsPolicy: {{ .Values.deployment.dnsPolicy }} volumes: {{- if .Values.aws.credentials.secretName -}} - name: {{ .Values.aws.credentials.secretName }} diff --git a/helm/values.schema.json b/helm/values.schema.json index fb4437b7..ac28b680 100644 --- a/helm/values.schema.json +++ b/helm/values.schema.json @@ -47,6 +47,9 @@ "minimum": 1, "maximum": 65535 }, + "replicas": { + "type": "integer" + }, "nodeSelector": { "type": "object" }, @@ -231,6 +234,18 @@ }, "type": "object" }, + "leaderElection": { + "description": "Parameter to configure the controller's leader election system.", + "properties": { + "enabled": { + "type": "boolean" + }, + "namespace": { + "type": "string" + } + }, + "type": "object" + }, "serviceAccount": { "description": "ServiceAccount settings", "properties": { diff --git a/helm/values.yaml b/helm/values.yaml index 765c47e0..59cf0cc4 100644 --- a/helm/values.yaml +++ b/helm/values.yaml @@ -15,6 +15,10 @@ deployment: annotations: {} labels: {} containerPort: 8080 + # Number of Deployment replicas + # This determines how many instances of the controller will be running. It's recommended + # to enable leader election if you need to increase the number of replicas > 1 + replicas: 1 # Which nodeSelector to set? # See: https://kubernetes.io/docs/concepts/scheduling-eviction/assign-pod-node/#nodeselector nodeSelector: @@ -28,6 +32,15 @@ deployment: # Which priorityClassName to set? # See: https://kubernetes.io/docs/concepts/scheduling-eviction/pod-priority-preemption/#pod-priority priorityClassName: "" + # Specifies the hostname of the Pod. + # If not specified, the pod's hostname will be set to a system-defined value. + hostNetwork: false + # Set DNS policy for the pod. + # Defaults to "ClusterFirst". + # Valid values are 'ClusterFirstWithHostNet', 'ClusterFirst', 'Default' or 'None'. + # To have DNS options set along with hostNetwork, you have to specify DNS policy + # explicitly to 'ClusterFirstWithHostNet'. + dnsPolicy: ClusterFirst extraVolumes: [] extraVolumeMounts: [] @@ -52,7 +65,7 @@ deployment: # If "installScope: cluster" then these labels will be applied to ClusterRole role: labels: {} - + metrics: service: # Set to true to automatically create a Kubernetes Service resource for the @@ -80,7 +93,7 @@ aws: # Secret stringData key that contains the credentials secretKey: "credentials" # Profile used for AWS credentials - profile: "default" + profile: "default" # log level for the controller log: @@ -121,3 +134,15 @@ serviceAccount: name: ack-ec2-controller annotations: {} # eks.amazonaws.com/role-arn: arn:aws:iam::AWS_ACCOUNT_ID:role/IAM_ROLE_NAME + +# Configuration of the leader election. Required for running multiple instances of the +# controller within the same cluster. +# See https://kubernetes.io/docs/concepts/architecture/leases/#leader-election +leaderElection: + # Enable Controller Leader Election. Set this to true to enable leader election + # for this controller. + enabled: false + # Leader election can be scoped to a specific namespace. By default, the controller + # will attempt to use the namespace of the service account mounted to the Controller + # pod. + namespace: "" diff --git a/pkg/resource/launch_template/delta.go b/pkg/resource/launch_template/delta.go index 7140e500..14922df9 100644 --- a/pkg/resource/launch_template/delta.go +++ b/pkg/resource/launch_template/delta.go @@ -43,13 +43,6 @@ func newResourceDelta( return delta } - if ackcompare.HasNilDifference(a.ko.Spec.ClientToken, b.ko.Spec.ClientToken) { - delta.Add("Spec.ClientToken", a.ko.Spec.ClientToken, b.ko.Spec.ClientToken) - } else if a.ko.Spec.ClientToken != nil && b.ko.Spec.ClientToken != nil { - if *a.ko.Spec.ClientToken != *b.ko.Spec.ClientToken { - delta.Add("Spec.ClientToken", a.ko.Spec.ClientToken, b.ko.Spec.ClientToken) - } - } if ackcompare.HasNilDifference(a.ko.Spec.DefaultVersionNumber, b.ko.Spec.DefaultVersionNumber) { delta.Add("Spec.DefaultVersionNumber", a.ko.Spec.DefaultVersionNumber, b.ko.Spec.DefaultVersionNumber) } else if a.ko.Spec.DefaultVersionNumber != nil && b.ko.Spec.DefaultVersionNumber != nil { @@ -57,13 +50,6 @@ func newResourceDelta( delta.Add("Spec.DefaultVersionNumber", a.ko.Spec.DefaultVersionNumber, b.ko.Spec.DefaultVersionNumber) } } - if ackcompare.HasNilDifference(a.ko.Spec.DryRun, b.ko.Spec.DryRun) { - delta.Add("Spec.DryRun", a.ko.Spec.DryRun, b.ko.Spec.DryRun) - } else if a.ko.Spec.DryRun != nil && b.ko.Spec.DryRun != nil { - if *a.ko.Spec.DryRun != *b.ko.Spec.DryRun { - delta.Add("Spec.DryRun", a.ko.Spec.DryRun, b.ko.Spec.DryRun) - } - } if ackcompare.HasNilDifference(a.ko.Spec.LaunchTemplateData, b.ko.Spec.LaunchTemplateData) { delta.Add("Spec.LaunchTemplateData", a.ko.Spec.LaunchTemplateData, b.ko.Spec.LaunchTemplateData) } else if a.ko.Spec.LaunchTemplateData != nil && b.ko.Spec.LaunchTemplateData != nil { diff --git a/pkg/resource/launch_template/manager_factory.go b/pkg/resource/launch_template/manager_factory.go index 64b98700..55daa974 100644 --- a/pkg/resource/launch_template/manager_factory.go +++ b/pkg/resource/launch_template/manager_factory.go @@ -82,7 +82,7 @@ func (f *resourceManagerFactory) IsAdoptable() bool { // RequeueOnSuccessSeconds returns true if the resource should be requeued after specified seconds // Default is false which means resource will not be requeued after success. func (f *resourceManagerFactory) RequeueOnSuccessSeconds() int { - return 60 + return 0 } func newResourceManagerFactory() *resourceManagerFactory { diff --git a/pkg/resource/launch_template/sdk.go b/pkg/resource/launch_template/sdk.go index 8ad26e3e..c4fd1d30 100644 --- a/pkg/resource/launch_template/sdk.go +++ b/pkg/resource/launch_template/sdk.go @@ -125,9 +125,9 @@ func (rm *resourceManager) sdkFind( } f6 = append(f6, f6elem) } - ko.Status.Tags = f6 + ko.Spec.Tags = f6 } else { - ko.Status.Tags = nil + ko.Spec.Tags = nil } found = true break @@ -157,9 +157,6 @@ func (rm *resourceManager) newListRequestPayload( ) (*svcsdk.DescribeLaunchTemplatesInput, error) { res := &svcsdk.DescribeLaunchTemplatesInput{} - if r.ko.Spec.DryRun != nil { - res.SetDryRun(*r.ko.Spec.DryRun) - } if r.ko.Status.LaunchTemplateID != nil { f2 := []*string{} f2 = append(f2, r.ko.Status.LaunchTemplateID) @@ -239,9 +236,9 @@ func (rm *resourceManager) sdkCreate( } f6 = append(f6, f6elem) } - ko.Status.Tags = f6 + ko.Spec.Tags = f6 } else { - ko.Status.Tags = nil + ko.Spec.Tags = nil } rm.setStatusDefaults(ko) @@ -256,626 +253,620 @@ func (rm *resourceManager) newCreateRequestPayload( ) (*svcsdk.CreateLaunchTemplateInput, error) { res := &svcsdk.CreateLaunchTemplateInput{} - if r.ko.Spec.ClientToken != nil { - res.SetClientToken(*r.ko.Spec.ClientToken) - } - if r.ko.Spec.DryRun != nil { - res.SetDryRun(*r.ko.Spec.DryRun) - } if r.ko.Spec.LaunchTemplateData != nil { - f2 := &svcsdk.RequestLaunchTemplateData{} + f0 := &svcsdk.RequestLaunchTemplateData{} if r.ko.Spec.LaunchTemplateData.BlockDeviceMappings != nil { - f2f0 := []*svcsdk.LaunchTemplateBlockDeviceMappingRequest{} - for _, f2f0iter := range r.ko.Spec.LaunchTemplateData.BlockDeviceMappings { - f2f0elem := &svcsdk.LaunchTemplateBlockDeviceMappingRequest{} - if f2f0iter.DeviceName != nil { - f2f0elem.SetDeviceName(*f2f0iter.DeviceName) + f0f0 := []*svcsdk.LaunchTemplateBlockDeviceMappingRequest{} + for _, f0f0iter := range r.ko.Spec.LaunchTemplateData.BlockDeviceMappings { + f0f0elem := &svcsdk.LaunchTemplateBlockDeviceMappingRequest{} + if f0f0iter.DeviceName != nil { + f0f0elem.SetDeviceName(*f0f0iter.DeviceName) } - if f2f0iter.EBS != nil { - f2f0elemf1 := &svcsdk.LaunchTemplateEbsBlockDeviceRequest{} - if f2f0iter.EBS.DeleteOnTermination != nil { - f2f0elemf1.SetDeleteOnTermination(*f2f0iter.EBS.DeleteOnTermination) + if f0f0iter.EBS != nil { + f0f0elemf1 := &svcsdk.LaunchTemplateEbsBlockDeviceRequest{} + if f0f0iter.EBS.DeleteOnTermination != nil { + f0f0elemf1.SetDeleteOnTermination(*f0f0iter.EBS.DeleteOnTermination) } - if f2f0iter.EBS.Encrypted != nil { - f2f0elemf1.SetEncrypted(*f2f0iter.EBS.Encrypted) + if f0f0iter.EBS.Encrypted != nil { + f0f0elemf1.SetEncrypted(*f0f0iter.EBS.Encrypted) } - if f2f0iter.EBS.IOPS != nil { - f2f0elemf1.SetIops(*f2f0iter.EBS.IOPS) + if f0f0iter.EBS.IOPS != nil { + f0f0elemf1.SetIops(*f0f0iter.EBS.IOPS) } - if f2f0iter.EBS.KMSKeyID != nil { - f2f0elemf1.SetKmsKeyId(*f2f0iter.EBS.KMSKeyID) + if f0f0iter.EBS.KMSKeyID != nil { + f0f0elemf1.SetKmsKeyId(*f0f0iter.EBS.KMSKeyID) } - if f2f0iter.EBS.SnapshotID != nil { - f2f0elemf1.SetSnapshotId(*f2f0iter.EBS.SnapshotID) + if f0f0iter.EBS.SnapshotID != nil { + f0f0elemf1.SetSnapshotId(*f0f0iter.EBS.SnapshotID) } - if f2f0iter.EBS.Throughput != nil { - f2f0elemf1.SetThroughput(*f2f0iter.EBS.Throughput) + if f0f0iter.EBS.Throughput != nil { + f0f0elemf1.SetThroughput(*f0f0iter.EBS.Throughput) } - if f2f0iter.EBS.VolumeSize != nil { - f2f0elemf1.SetVolumeSize(*f2f0iter.EBS.VolumeSize) + if f0f0iter.EBS.VolumeSize != nil { + f0f0elemf1.SetVolumeSize(*f0f0iter.EBS.VolumeSize) } - if f2f0iter.EBS.VolumeType != nil { - f2f0elemf1.SetVolumeType(*f2f0iter.EBS.VolumeType) + if f0f0iter.EBS.VolumeType != nil { + f0f0elemf1.SetVolumeType(*f0f0iter.EBS.VolumeType) } - f2f0elem.SetEbs(f2f0elemf1) + f0f0elem.SetEbs(f0f0elemf1) } - if f2f0iter.NoDevice != nil { - f2f0elem.SetNoDevice(*f2f0iter.NoDevice) + if f0f0iter.NoDevice != nil { + f0f0elem.SetNoDevice(*f0f0iter.NoDevice) } - if f2f0iter.VirtualName != nil { - f2f0elem.SetVirtualName(*f2f0iter.VirtualName) + if f0f0iter.VirtualName != nil { + f0f0elem.SetVirtualName(*f0f0iter.VirtualName) } - f2f0 = append(f2f0, f2f0elem) + f0f0 = append(f0f0, f0f0elem) } - f2.SetBlockDeviceMappings(f2f0) + f0.SetBlockDeviceMappings(f0f0) } if r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification != nil { - f2f1 := &svcsdk.LaunchTemplateCapacityReservationSpecificationRequest{} + f0f1 := &svcsdk.LaunchTemplateCapacityReservationSpecificationRequest{} if r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference != nil { - f2f1.SetCapacityReservationPreference(*r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference) + f0f1.SetCapacityReservationPreference(*r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationPreference) } if r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget != nil { - f2f1f1 := &svcsdk.CapacityReservationTarget{} + f0f1f1 := &svcsdk.CapacityReservationTarget{} if r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID != nil { - f2f1f1.SetCapacityReservationId(*r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) + f0f1f1.SetCapacityReservationId(*r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationID) } if r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN != nil { - f2f1f1.SetCapacityReservationResourceGroupArn(*r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) + f0f1f1.SetCapacityReservationResourceGroupArn(*r.ko.Spec.LaunchTemplateData.CapacityReservationSpecification.CapacityReservationTarget.CapacityReservationResourceGroupARN) } - f2f1.SetCapacityReservationTarget(f2f1f1) + f0f1.SetCapacityReservationTarget(f0f1f1) } - f2.SetCapacityReservationSpecification(f2f1) + f0.SetCapacityReservationSpecification(f0f1) } if r.ko.Spec.LaunchTemplateData.CPUOptions != nil { - f2f2 := &svcsdk.LaunchTemplateCpuOptionsRequest{} + f0f2 := &svcsdk.LaunchTemplateCpuOptionsRequest{} if r.ko.Spec.LaunchTemplateData.CPUOptions.CoreCount != nil { - f2f2.SetCoreCount(*r.ko.Spec.LaunchTemplateData.CPUOptions.CoreCount) + f0f2.SetCoreCount(*r.ko.Spec.LaunchTemplateData.CPUOptions.CoreCount) } if r.ko.Spec.LaunchTemplateData.CPUOptions.ThreadsPerCore != nil { - f2f2.SetThreadsPerCore(*r.ko.Spec.LaunchTemplateData.CPUOptions.ThreadsPerCore) + f0f2.SetThreadsPerCore(*r.ko.Spec.LaunchTemplateData.CPUOptions.ThreadsPerCore) } - f2.SetCpuOptions(f2f2) + f0.SetCpuOptions(f0f2) } if r.ko.Spec.LaunchTemplateData.CreditSpecification != nil { - f2f3 := &svcsdk.CreditSpecificationRequest{} + f0f3 := &svcsdk.CreditSpecificationRequest{} if r.ko.Spec.LaunchTemplateData.CreditSpecification.CPUCredits != nil { - f2f3.SetCpuCredits(*r.ko.Spec.LaunchTemplateData.CreditSpecification.CPUCredits) + f0f3.SetCpuCredits(*r.ko.Spec.LaunchTemplateData.CreditSpecification.CPUCredits) } - f2.SetCreditSpecification(f2f3) + f0.SetCreditSpecification(f0f3) } if r.ko.Spec.LaunchTemplateData.DisableAPIStop != nil { - f2.SetDisableApiStop(*r.ko.Spec.LaunchTemplateData.DisableAPIStop) + f0.SetDisableApiStop(*r.ko.Spec.LaunchTemplateData.DisableAPIStop) } if r.ko.Spec.LaunchTemplateData.DisableAPITermination != nil { - f2.SetDisableApiTermination(*r.ko.Spec.LaunchTemplateData.DisableAPITermination) + f0.SetDisableApiTermination(*r.ko.Spec.LaunchTemplateData.DisableAPITermination) } if r.ko.Spec.LaunchTemplateData.EBSOptimized != nil { - f2.SetEbsOptimized(*r.ko.Spec.LaunchTemplateData.EBSOptimized) + f0.SetEbsOptimized(*r.ko.Spec.LaunchTemplateData.EBSOptimized) } if r.ko.Spec.LaunchTemplateData.ElasticGPUSpecifications != nil { - f2f7 := []*svcsdk.ElasticGpuSpecification{} - for _, f2f7iter := range r.ko.Spec.LaunchTemplateData.ElasticGPUSpecifications { - f2f7elem := &svcsdk.ElasticGpuSpecification{} - if f2f7iter.Type != nil { - f2f7elem.SetType(*f2f7iter.Type) + f0f7 := []*svcsdk.ElasticGpuSpecification{} + for _, f0f7iter := range r.ko.Spec.LaunchTemplateData.ElasticGPUSpecifications { + f0f7elem := &svcsdk.ElasticGpuSpecification{} + if f0f7iter.Type != nil { + f0f7elem.SetType(*f0f7iter.Type) } - f2f7 = append(f2f7, f2f7elem) + f0f7 = append(f0f7, f0f7elem) } - f2.SetElasticGpuSpecifications(f2f7) + f0.SetElasticGpuSpecifications(f0f7) } if r.ko.Spec.LaunchTemplateData.ElasticInferenceAccelerators != nil { - f2f8 := []*svcsdk.LaunchTemplateElasticInferenceAccelerator{} - for _, f2f8iter := range r.ko.Spec.LaunchTemplateData.ElasticInferenceAccelerators { - f2f8elem := &svcsdk.LaunchTemplateElasticInferenceAccelerator{} - if f2f8iter.Count != nil { - f2f8elem.SetCount(*f2f8iter.Count) + f0f8 := []*svcsdk.LaunchTemplateElasticInferenceAccelerator{} + for _, f0f8iter := range r.ko.Spec.LaunchTemplateData.ElasticInferenceAccelerators { + f0f8elem := &svcsdk.LaunchTemplateElasticInferenceAccelerator{} + if f0f8iter.Count != nil { + f0f8elem.SetCount(*f0f8iter.Count) } - if f2f8iter.Type != nil { - f2f8elem.SetType(*f2f8iter.Type) + if f0f8iter.Type != nil { + f0f8elem.SetType(*f0f8iter.Type) } - f2f8 = append(f2f8, f2f8elem) + f0f8 = append(f0f8, f0f8elem) } - f2.SetElasticInferenceAccelerators(f2f8) + f0.SetElasticInferenceAccelerators(f0f8) } if r.ko.Spec.LaunchTemplateData.EnclaveOptions != nil { - f2f9 := &svcsdk.LaunchTemplateEnclaveOptionsRequest{} + f0f9 := &svcsdk.LaunchTemplateEnclaveOptionsRequest{} if r.ko.Spec.LaunchTemplateData.EnclaveOptions.Enabled != nil { - f2f9.SetEnabled(*r.ko.Spec.LaunchTemplateData.EnclaveOptions.Enabled) + f0f9.SetEnabled(*r.ko.Spec.LaunchTemplateData.EnclaveOptions.Enabled) } - f2.SetEnclaveOptions(f2f9) + f0.SetEnclaveOptions(f0f9) } if r.ko.Spec.LaunchTemplateData.HibernationOptions != nil { - f2f10 := &svcsdk.LaunchTemplateHibernationOptionsRequest{} + f0f10 := &svcsdk.LaunchTemplateHibernationOptionsRequest{} if r.ko.Spec.LaunchTemplateData.HibernationOptions.Configured != nil { - f2f10.SetConfigured(*r.ko.Spec.LaunchTemplateData.HibernationOptions.Configured) + f0f10.SetConfigured(*r.ko.Spec.LaunchTemplateData.HibernationOptions.Configured) } - f2.SetHibernationOptions(f2f10) + f0.SetHibernationOptions(f0f10) } if r.ko.Spec.LaunchTemplateData.IAMInstanceProfile != nil { - f2f11 := &svcsdk.LaunchTemplateIamInstanceProfileSpecificationRequest{} + f0f11 := &svcsdk.LaunchTemplateIamInstanceProfileSpecificationRequest{} if r.ko.Spec.LaunchTemplateData.IAMInstanceProfile.ARN != nil { - f2f11.SetArn(*r.ko.Spec.LaunchTemplateData.IAMInstanceProfile.ARN) + f0f11.SetArn(*r.ko.Spec.LaunchTemplateData.IAMInstanceProfile.ARN) } if r.ko.Spec.LaunchTemplateData.IAMInstanceProfile.Name != nil { - f2f11.SetName(*r.ko.Spec.LaunchTemplateData.IAMInstanceProfile.Name) + f0f11.SetName(*r.ko.Spec.LaunchTemplateData.IAMInstanceProfile.Name) } - f2.SetIamInstanceProfile(f2f11) + f0.SetIamInstanceProfile(f0f11) } if r.ko.Spec.LaunchTemplateData.ImageID != nil { - f2.SetImageId(*r.ko.Spec.LaunchTemplateData.ImageID) + f0.SetImageId(*r.ko.Spec.LaunchTemplateData.ImageID) } if r.ko.Spec.LaunchTemplateData.InstanceInitiatedShutdownBehavior != nil { - f2.SetInstanceInitiatedShutdownBehavior(*r.ko.Spec.LaunchTemplateData.InstanceInitiatedShutdownBehavior) + f0.SetInstanceInitiatedShutdownBehavior(*r.ko.Spec.LaunchTemplateData.InstanceInitiatedShutdownBehavior) } if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions != nil { - f2f14 := &svcsdk.LaunchTemplateInstanceMarketOptionsRequest{} + f0f14 := &svcsdk.LaunchTemplateInstanceMarketOptionsRequest{} if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.MarketType != nil { - f2f14.SetMarketType(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.MarketType) + f0f14.SetMarketType(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.MarketType) } if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions != nil { - f2f14f1 := &svcsdk.LaunchTemplateSpotMarketOptionsRequest{} + f0f14f1 := &svcsdk.LaunchTemplateSpotMarketOptionsRequest{} if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes != nil { - f2f14f1.SetBlockDurationMinutes(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) + f0f14f1.SetBlockDurationMinutes(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.BlockDurationMinutes) } if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior != nil { - f2f14f1.SetInstanceInterruptionBehavior(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) + f0f14f1.SetInstanceInterruptionBehavior(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.InstanceInterruptionBehavior) } if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice != nil { - f2f14f1.SetMaxPrice(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice) + f0f14f1.SetMaxPrice(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.MaxPrice) } if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType != nil { - f2f14f1.SetSpotInstanceType(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType) + f0f14f1.SetSpotInstanceType(*r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.SpotInstanceType) } if r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil != nil { - f2f14f1.SetValidUntil(r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil.Time) + f0f14f1.SetValidUntil(r.ko.Spec.LaunchTemplateData.InstanceMarketOptions.SpotOptions.ValidUntil.Time) } - f2f14.SetSpotOptions(f2f14f1) + f0f14.SetSpotOptions(f0f14f1) } - f2.SetInstanceMarketOptions(f2f14) + f0.SetInstanceMarketOptions(f0f14) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements != nil { - f2f15 := &svcsdk.InstanceRequirementsRequest{} + f0f15 := &svcsdk.InstanceRequirementsRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorCount != nil { - f2f15f0 := &svcsdk.AcceleratorCountRequest{} + f0f15f0 := &svcsdk.AcceleratorCountRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorCount.Max != nil { - f2f15f0.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorCount.Max) + f0f15f0.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorCount.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorCount.Min != nil { - f2f15f0.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorCount.Min) + f0f15f0.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorCount.Min) } - f2f15.SetAcceleratorCount(f2f15f0) + f0f15.SetAcceleratorCount(f0f15f0) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorManufacturers != nil { - f2f15f1 := []*string{} - for _, f2f15f1iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorManufacturers { - var f2f15f1elem string - f2f15f1elem = *f2f15f1iter - f2f15f1 = append(f2f15f1, &f2f15f1elem) + f0f15f1 := []*string{} + for _, f0f15f1iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorManufacturers { + var f0f15f1elem string + f0f15f1elem = *f0f15f1iter + f0f15f1 = append(f0f15f1, &f0f15f1elem) } - f2f15.SetAcceleratorManufacturers(f2f15f1) + f0f15.SetAcceleratorManufacturers(f0f15f1) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorNames != nil { - f2f15f2 := []*string{} - for _, f2f15f2iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorNames { - var f2f15f2elem string - f2f15f2elem = *f2f15f2iter - f2f15f2 = append(f2f15f2, &f2f15f2elem) + f0f15f2 := []*string{} + for _, f0f15f2iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorNames { + var f0f15f2elem string + f0f15f2elem = *f0f15f2iter + f0f15f2 = append(f0f15f2, &f0f15f2elem) } - f2f15.SetAcceleratorNames(f2f15f2) + f0f15.SetAcceleratorNames(f0f15f2) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTotalMemoryMiB != nil { - f2f15f3 := &svcsdk.AcceleratorTotalMemoryMiBRequest{} + f0f15f3 := &svcsdk.AcceleratorTotalMemoryMiBRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTotalMemoryMiB.Max != nil { - f2f15f3.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTotalMemoryMiB.Max) + f0f15f3.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTotalMemoryMiB.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTotalMemoryMiB.Min != nil { - f2f15f3.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTotalMemoryMiB.Min) + f0f15f3.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTotalMemoryMiB.Min) } - f2f15.SetAcceleratorTotalMemoryMiB(f2f15f3) + f0f15.SetAcceleratorTotalMemoryMiB(f0f15f3) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTypes != nil { - f2f15f4 := []*string{} - for _, f2f15f4iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTypes { - var f2f15f4elem string - f2f15f4elem = *f2f15f4iter - f2f15f4 = append(f2f15f4, &f2f15f4elem) + f0f15f4 := []*string{} + for _, f0f15f4iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.AcceleratorTypes { + var f0f15f4elem string + f0f15f4elem = *f0f15f4iter + f0f15f4 = append(f0f15f4, &f0f15f4elem) } - f2f15.SetAcceleratorTypes(f2f15f4) + f0f15.SetAcceleratorTypes(f0f15f4) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.BareMetal != nil { - f2f15.SetBareMetal(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BareMetal) + f0f15.SetBareMetal(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BareMetal) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.BaselineEBSBandwidthMbps != nil { - f2f15f6 := &svcsdk.BaselineEbsBandwidthMbpsRequest{} + f0f15f6 := &svcsdk.BaselineEbsBandwidthMbpsRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.BaselineEBSBandwidthMbps.Max != nil { - f2f15f6.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BaselineEBSBandwidthMbps.Max) + f0f15f6.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BaselineEBSBandwidthMbps.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.BaselineEBSBandwidthMbps.Min != nil { - f2f15f6.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BaselineEBSBandwidthMbps.Min) + f0f15f6.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BaselineEBSBandwidthMbps.Min) } - f2f15.SetBaselineEbsBandwidthMbps(f2f15f6) + f0f15.SetBaselineEbsBandwidthMbps(f0f15f6) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.BurstablePerformance != nil { - f2f15.SetBurstablePerformance(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BurstablePerformance) + f0f15.SetBurstablePerformance(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.BurstablePerformance) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.CPUManufacturers != nil { - f2f15f8 := []*string{} - for _, f2f15f8iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.CPUManufacturers { - var f2f15f8elem string - f2f15f8elem = *f2f15f8iter - f2f15f8 = append(f2f15f8, &f2f15f8elem) + f0f15f8 := []*string{} + for _, f0f15f8iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.CPUManufacturers { + var f0f15f8elem string + f0f15f8elem = *f0f15f8iter + f0f15f8 = append(f0f15f8, &f0f15f8elem) } - f2f15.SetCpuManufacturers(f2f15f8) + f0f15.SetCpuManufacturers(f0f15f8) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.ExcludedInstanceTypes != nil { - f2f15f9 := []*string{} - for _, f2f15f9iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.ExcludedInstanceTypes { - var f2f15f9elem string - f2f15f9elem = *f2f15f9iter - f2f15f9 = append(f2f15f9, &f2f15f9elem) + f0f15f9 := []*string{} + for _, f0f15f9iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.ExcludedInstanceTypes { + var f0f15f9elem string + f0f15f9elem = *f0f15f9iter + f0f15f9 = append(f0f15f9, &f0f15f9elem) } - f2f15.SetExcludedInstanceTypes(f2f15f9) + f0f15.SetExcludedInstanceTypes(f0f15f9) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.InstanceGenerations != nil { - f2f15f10 := []*string{} - for _, f2f15f10iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.InstanceGenerations { - var f2f15f10elem string - f2f15f10elem = *f2f15f10iter - f2f15f10 = append(f2f15f10, &f2f15f10elem) + f0f15f10 := []*string{} + for _, f0f15f10iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.InstanceGenerations { + var f0f15f10elem string + f0f15f10elem = *f0f15f10iter + f0f15f10 = append(f0f15f10, &f0f15f10elem) } - f2f15.SetInstanceGenerations(f2f15f10) + f0f15.SetInstanceGenerations(f0f15f10) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.LocalStorage != nil { - f2f15.SetLocalStorage(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.LocalStorage) + f0f15.SetLocalStorage(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.LocalStorage) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.LocalStorageTypes != nil { - f2f15f12 := []*string{} - for _, f2f15f12iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.LocalStorageTypes { - var f2f15f12elem string - f2f15f12elem = *f2f15f12iter - f2f15f12 = append(f2f15f12, &f2f15f12elem) + f0f15f12 := []*string{} + for _, f0f15f12iter := range r.ko.Spec.LaunchTemplateData.InstanceRequirements.LocalStorageTypes { + var f0f15f12elem string + f0f15f12elem = *f0f15f12iter + f0f15f12 = append(f0f15f12, &f0f15f12elem) } - f2f15.SetLocalStorageTypes(f2f15f12) + f0f15.SetLocalStorageTypes(f0f15f12) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryGiBPerVCPU != nil { - f2f15f13 := &svcsdk.MemoryGiBPerVCpuRequest{} + f0f15f13 := &svcsdk.MemoryGiBPerVCpuRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryGiBPerVCPU.Max != nil { - f2f15f13.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryGiBPerVCPU.Max) + f0f15f13.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryGiBPerVCPU.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryGiBPerVCPU.Min != nil { - f2f15f13.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryGiBPerVCPU.Min) + f0f15f13.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryGiBPerVCPU.Min) } - f2f15.SetMemoryGiBPerVCpu(f2f15f13) + f0f15.SetMemoryGiBPerVCpu(f0f15f13) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryMiB != nil { - f2f15f14 := &svcsdk.MemoryMiBRequest{} + f0f15f14 := &svcsdk.MemoryMiBRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryMiB.Max != nil { - f2f15f14.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryMiB.Max) + f0f15f14.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryMiB.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryMiB.Min != nil { - f2f15f14.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryMiB.Min) + f0f15f14.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.MemoryMiB.Min) } - f2f15.SetMemoryMiB(f2f15f14) + f0f15.SetMemoryMiB(f0f15f14) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.NetworkInterfaceCount != nil { - f2f15f15 := &svcsdk.NetworkInterfaceCountRequest{} + f0f15f15 := &svcsdk.NetworkInterfaceCountRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.NetworkInterfaceCount.Max != nil { - f2f15f15.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.NetworkInterfaceCount.Max) + f0f15f15.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.NetworkInterfaceCount.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.NetworkInterfaceCount.Min != nil { - f2f15f15.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.NetworkInterfaceCount.Min) + f0f15f15.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.NetworkInterfaceCount.Min) } - f2f15.SetNetworkInterfaceCount(f2f15f15) + f0f15.SetNetworkInterfaceCount(f0f15f15) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.OnDemandMaxPricePercentageOverLowestPrice != nil { - f2f15.SetOnDemandMaxPricePercentageOverLowestPrice(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.OnDemandMaxPricePercentageOverLowestPrice) + f0f15.SetOnDemandMaxPricePercentageOverLowestPrice(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.OnDemandMaxPricePercentageOverLowestPrice) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.RequireHibernateSupport != nil { - f2f15.SetRequireHibernateSupport(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.RequireHibernateSupport) + f0f15.SetRequireHibernateSupport(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.RequireHibernateSupport) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.SpotMaxPricePercentageOverLowestPrice != nil { - f2f15.SetSpotMaxPricePercentageOverLowestPrice(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.SpotMaxPricePercentageOverLowestPrice) + f0f15.SetSpotMaxPricePercentageOverLowestPrice(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.SpotMaxPricePercentageOverLowestPrice) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.TotalLocalStorageGB != nil { - f2f15f19 := &svcsdk.TotalLocalStorageGBRequest{} + f0f15f19 := &svcsdk.TotalLocalStorageGBRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.TotalLocalStorageGB.Max != nil { - f2f15f19.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.TotalLocalStorageGB.Max) + f0f15f19.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.TotalLocalStorageGB.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.TotalLocalStorageGB.Min != nil { - f2f15f19.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.TotalLocalStorageGB.Min) + f0f15f19.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.TotalLocalStorageGB.Min) } - f2f15.SetTotalLocalStorageGB(f2f15f19) + f0f15.SetTotalLocalStorageGB(f0f15f19) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.VCPUCount != nil { - f2f15f20 := &svcsdk.VCpuCountRangeRequest{} + f0f15f20 := &svcsdk.VCpuCountRangeRequest{} if r.ko.Spec.LaunchTemplateData.InstanceRequirements.VCPUCount.Max != nil { - f2f15f20.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.VCPUCount.Max) + f0f15f20.SetMax(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.VCPUCount.Max) } if r.ko.Spec.LaunchTemplateData.InstanceRequirements.VCPUCount.Min != nil { - f2f15f20.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.VCPUCount.Min) + f0f15f20.SetMin(*r.ko.Spec.LaunchTemplateData.InstanceRequirements.VCPUCount.Min) } - f2f15.SetVCpuCount(f2f15f20) + f0f15.SetVCpuCount(f0f15f20) } - f2.SetInstanceRequirements(f2f15) + f0.SetInstanceRequirements(f0f15) } if r.ko.Spec.LaunchTemplateData.InstanceType != nil { - f2.SetInstanceType(*r.ko.Spec.LaunchTemplateData.InstanceType) + f0.SetInstanceType(*r.ko.Spec.LaunchTemplateData.InstanceType) } if r.ko.Spec.LaunchTemplateData.KernelID != nil { - f2.SetKernelId(*r.ko.Spec.LaunchTemplateData.KernelID) + f0.SetKernelId(*r.ko.Spec.LaunchTemplateData.KernelID) } if r.ko.Spec.LaunchTemplateData.KeyName != nil { - f2.SetKeyName(*r.ko.Spec.LaunchTemplateData.KeyName) + f0.SetKeyName(*r.ko.Spec.LaunchTemplateData.KeyName) } if r.ko.Spec.LaunchTemplateData.LicenseSpecifications != nil { - f2f19 := []*svcsdk.LaunchTemplateLicenseConfigurationRequest{} - for _, f2f19iter := range r.ko.Spec.LaunchTemplateData.LicenseSpecifications { - f2f19elem := &svcsdk.LaunchTemplateLicenseConfigurationRequest{} - if f2f19iter.LicenseConfigurationARN != nil { - f2f19elem.SetLicenseConfigurationArn(*f2f19iter.LicenseConfigurationARN) + f0f19 := []*svcsdk.LaunchTemplateLicenseConfigurationRequest{} + for _, f0f19iter := range r.ko.Spec.LaunchTemplateData.LicenseSpecifications { + f0f19elem := &svcsdk.LaunchTemplateLicenseConfigurationRequest{} + if f0f19iter.LicenseConfigurationARN != nil { + f0f19elem.SetLicenseConfigurationArn(*f0f19iter.LicenseConfigurationARN) } - f2f19 = append(f2f19, f2f19elem) + f0f19 = append(f0f19, f0f19elem) } - f2.SetLicenseSpecifications(f2f19) + f0.SetLicenseSpecifications(f0f19) } if r.ko.Spec.LaunchTemplateData.MaintenanceOptions != nil { - f2f20 := &svcsdk.LaunchTemplateInstanceMaintenanceOptionsRequest{} + f0f20 := &svcsdk.LaunchTemplateInstanceMaintenanceOptionsRequest{} if r.ko.Spec.LaunchTemplateData.MaintenanceOptions.AutoRecovery != nil { - f2f20.SetAutoRecovery(*r.ko.Spec.LaunchTemplateData.MaintenanceOptions.AutoRecovery) + f0f20.SetAutoRecovery(*r.ko.Spec.LaunchTemplateData.MaintenanceOptions.AutoRecovery) } - f2.SetMaintenanceOptions(f2f20) + f0.SetMaintenanceOptions(f0f20) } if r.ko.Spec.LaunchTemplateData.MetadataOptions != nil { - f2f21 := &svcsdk.LaunchTemplateInstanceMetadataOptionsRequest{} + f0f21 := &svcsdk.LaunchTemplateInstanceMetadataOptionsRequest{} if r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPEndpoint != nil { - f2f21.SetHttpEndpoint(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPEndpoint) + f0f21.SetHttpEndpoint(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPEndpoint) } if r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPProtocolIPv6 != nil { - f2f21.SetHttpProtocolIpv6(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPProtocolIPv6) + f0f21.SetHttpProtocolIpv6(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPProtocolIPv6) } if r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPPutResponseHopLimit != nil { - f2f21.SetHttpPutResponseHopLimit(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPPutResponseHopLimit) + f0f21.SetHttpPutResponseHopLimit(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPPutResponseHopLimit) } if r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPTokens != nil { - f2f21.SetHttpTokens(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPTokens) + f0f21.SetHttpTokens(*r.ko.Spec.LaunchTemplateData.MetadataOptions.HTTPTokens) } if r.ko.Spec.LaunchTemplateData.MetadataOptions.InstanceMetadataTags != nil { - f2f21.SetInstanceMetadataTags(*r.ko.Spec.LaunchTemplateData.MetadataOptions.InstanceMetadataTags) + f0f21.SetInstanceMetadataTags(*r.ko.Spec.LaunchTemplateData.MetadataOptions.InstanceMetadataTags) } - f2.SetMetadataOptions(f2f21) + f0.SetMetadataOptions(f0f21) } if r.ko.Spec.LaunchTemplateData.Monitoring != nil { - f2f22 := &svcsdk.LaunchTemplatesMonitoringRequest{} + f0f22 := &svcsdk.LaunchTemplatesMonitoringRequest{} if r.ko.Spec.LaunchTemplateData.Monitoring.Enabled != nil { - f2f22.SetEnabled(*r.ko.Spec.LaunchTemplateData.Monitoring.Enabled) + f0f22.SetEnabled(*r.ko.Spec.LaunchTemplateData.Monitoring.Enabled) } - f2.SetMonitoring(f2f22) + f0.SetMonitoring(f0f22) } if r.ko.Spec.LaunchTemplateData.NetworkInterfaces != nil { - f2f23 := []*svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} - for _, f2f23iter := range r.ko.Spec.LaunchTemplateData.NetworkInterfaces { - f2f23elem := &svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} - if f2f23iter.AssociateCarrierIPAddress != nil { - f2f23elem.SetAssociateCarrierIpAddress(*f2f23iter.AssociateCarrierIPAddress) + f0f23 := []*svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + for _, f0f23iter := range r.ko.Spec.LaunchTemplateData.NetworkInterfaces { + f0f23elem := &svcsdk.LaunchTemplateInstanceNetworkInterfaceSpecificationRequest{} + if f0f23iter.AssociateCarrierIPAddress != nil { + f0f23elem.SetAssociateCarrierIpAddress(*f0f23iter.AssociateCarrierIPAddress) } - if f2f23iter.AssociatePublicIPAddress != nil { - f2f23elem.SetAssociatePublicIpAddress(*f2f23iter.AssociatePublicIPAddress) + if f0f23iter.AssociatePublicIPAddress != nil { + f0f23elem.SetAssociatePublicIpAddress(*f0f23iter.AssociatePublicIPAddress) } - if f2f23iter.DeleteOnTermination != nil { - f2f23elem.SetDeleteOnTermination(*f2f23iter.DeleteOnTermination) + if f0f23iter.DeleteOnTermination != nil { + f0f23elem.SetDeleteOnTermination(*f0f23iter.DeleteOnTermination) } - if f2f23iter.Description != nil { - f2f23elem.SetDescription(*f2f23iter.Description) + if f0f23iter.Description != nil { + f0f23elem.SetDescription(*f0f23iter.Description) } - if f2f23iter.DeviceIndex != nil { - f2f23elem.SetDeviceIndex(*f2f23iter.DeviceIndex) + if f0f23iter.DeviceIndex != nil { + f0f23elem.SetDeviceIndex(*f0f23iter.DeviceIndex) } - if f2f23iter.Groups != nil { - f2f23elemf5 := []*string{} - for _, f2f23elemf5iter := range f2f23iter.Groups { - var f2f23elemf5elem string - f2f23elemf5elem = *f2f23elemf5iter - f2f23elemf5 = append(f2f23elemf5, &f2f23elemf5elem) + if f0f23iter.Groups != nil { + f0f23elemf5 := []*string{} + for _, f0f23elemf5iter := range f0f23iter.Groups { + var f0f23elemf5elem string + f0f23elemf5elem = *f0f23elemf5iter + f0f23elemf5 = append(f0f23elemf5, &f0f23elemf5elem) } - f2f23elem.SetGroups(f2f23elemf5) + f0f23elem.SetGroups(f0f23elemf5) } - if f2f23iter.InterfaceType != nil { - f2f23elem.SetInterfaceType(*f2f23iter.InterfaceType) + if f0f23iter.InterfaceType != nil { + f0f23elem.SetInterfaceType(*f0f23iter.InterfaceType) } - if f2f23iter.IPv4PrefixCount != nil { - f2f23elem.SetIpv4PrefixCount(*f2f23iter.IPv4PrefixCount) + if f0f23iter.IPv4PrefixCount != nil { + f0f23elem.SetIpv4PrefixCount(*f0f23iter.IPv4PrefixCount) } - if f2f23iter.IPv4Prefixes != nil { - f2f23elemf8 := []*svcsdk.Ipv4PrefixSpecificationRequest{} - for _, f2f23elemf8iter := range f2f23iter.IPv4Prefixes { - f2f23elemf8elem := &svcsdk.Ipv4PrefixSpecificationRequest{} - if f2f23elemf8iter.IPv4Prefix != nil { - f2f23elemf8elem.SetIpv4Prefix(*f2f23elemf8iter.IPv4Prefix) + if f0f23iter.IPv4Prefixes != nil { + f0f23elemf8 := []*svcsdk.Ipv4PrefixSpecificationRequest{} + for _, f0f23elemf8iter := range f0f23iter.IPv4Prefixes { + f0f23elemf8elem := &svcsdk.Ipv4PrefixSpecificationRequest{} + if f0f23elemf8iter.IPv4Prefix != nil { + f0f23elemf8elem.SetIpv4Prefix(*f0f23elemf8iter.IPv4Prefix) } - f2f23elemf8 = append(f2f23elemf8, f2f23elemf8elem) + f0f23elemf8 = append(f0f23elemf8, f0f23elemf8elem) } - f2f23elem.SetIpv4Prefixes(f2f23elemf8) + f0f23elem.SetIpv4Prefixes(f0f23elemf8) } - if f2f23iter.IPv6AddressCount != nil { - f2f23elem.SetIpv6AddressCount(*f2f23iter.IPv6AddressCount) + if f0f23iter.IPv6AddressCount != nil { + f0f23elem.SetIpv6AddressCount(*f0f23iter.IPv6AddressCount) } - if f2f23iter.IPv6Addresses != nil { - f2f23elemf10 := []*svcsdk.InstanceIpv6AddressRequest{} - for _, f2f23elemf10iter := range f2f23iter.IPv6Addresses { - f2f23elemf10elem := &svcsdk.InstanceIpv6AddressRequest{} - if f2f23elemf10iter.IPv6Address != nil { - f2f23elemf10elem.SetIpv6Address(*f2f23elemf10iter.IPv6Address) + if f0f23iter.IPv6Addresses != nil { + f0f23elemf10 := []*svcsdk.InstanceIpv6AddressRequest{} + for _, f0f23elemf10iter := range f0f23iter.IPv6Addresses { + f0f23elemf10elem := &svcsdk.InstanceIpv6AddressRequest{} + if f0f23elemf10iter.IPv6Address != nil { + f0f23elemf10elem.SetIpv6Address(*f0f23elemf10iter.IPv6Address) } - f2f23elemf10 = append(f2f23elemf10, f2f23elemf10elem) + f0f23elemf10 = append(f0f23elemf10, f0f23elemf10elem) } - f2f23elem.SetIpv6Addresses(f2f23elemf10) + f0f23elem.SetIpv6Addresses(f0f23elemf10) } - if f2f23iter.IPv6PrefixCount != nil { - f2f23elem.SetIpv6PrefixCount(*f2f23iter.IPv6PrefixCount) + if f0f23iter.IPv6PrefixCount != nil { + f0f23elem.SetIpv6PrefixCount(*f0f23iter.IPv6PrefixCount) } - if f2f23iter.IPv6Prefixes != nil { - f2f23elemf12 := []*svcsdk.Ipv6PrefixSpecificationRequest{} - for _, f2f23elemf12iter := range f2f23iter.IPv6Prefixes { - f2f23elemf12elem := &svcsdk.Ipv6PrefixSpecificationRequest{} - if f2f23elemf12iter.IPv6Prefix != nil { - f2f23elemf12elem.SetIpv6Prefix(*f2f23elemf12iter.IPv6Prefix) + if f0f23iter.IPv6Prefixes != nil { + f0f23elemf12 := []*svcsdk.Ipv6PrefixSpecificationRequest{} + for _, f0f23elemf12iter := range f0f23iter.IPv6Prefixes { + f0f23elemf12elem := &svcsdk.Ipv6PrefixSpecificationRequest{} + if f0f23elemf12iter.IPv6Prefix != nil { + f0f23elemf12elem.SetIpv6Prefix(*f0f23elemf12iter.IPv6Prefix) } - f2f23elemf12 = append(f2f23elemf12, f2f23elemf12elem) + f0f23elemf12 = append(f0f23elemf12, f0f23elemf12elem) } - f2f23elem.SetIpv6Prefixes(f2f23elemf12) + f0f23elem.SetIpv6Prefixes(f0f23elemf12) } - if f2f23iter.NetworkCardIndex != nil { - f2f23elem.SetNetworkCardIndex(*f2f23iter.NetworkCardIndex) + if f0f23iter.NetworkCardIndex != nil { + f0f23elem.SetNetworkCardIndex(*f0f23iter.NetworkCardIndex) } - if f2f23iter.NetworkInterfaceID != nil { - f2f23elem.SetNetworkInterfaceId(*f2f23iter.NetworkInterfaceID) + if f0f23iter.NetworkInterfaceID != nil { + f0f23elem.SetNetworkInterfaceId(*f0f23iter.NetworkInterfaceID) } - if f2f23iter.PrivateIPAddress != nil { - f2f23elem.SetPrivateIpAddress(*f2f23iter.PrivateIPAddress) + if f0f23iter.PrivateIPAddress != nil { + f0f23elem.SetPrivateIpAddress(*f0f23iter.PrivateIPAddress) } - if f2f23iter.PrivateIPAddresses != nil { - f2f23elemf16 := []*svcsdk.PrivateIpAddressSpecification{} - for _, f2f23elemf16iter := range f2f23iter.PrivateIPAddresses { - f2f23elemf16elem := &svcsdk.PrivateIpAddressSpecification{} - if f2f23elemf16iter.Primary != nil { - f2f23elemf16elem.SetPrimary(*f2f23elemf16iter.Primary) + if f0f23iter.PrivateIPAddresses != nil { + f0f23elemf16 := []*svcsdk.PrivateIpAddressSpecification{} + for _, f0f23elemf16iter := range f0f23iter.PrivateIPAddresses { + f0f23elemf16elem := &svcsdk.PrivateIpAddressSpecification{} + if f0f23elemf16iter.Primary != nil { + f0f23elemf16elem.SetPrimary(*f0f23elemf16iter.Primary) } - if f2f23elemf16iter.PrivateIPAddress != nil { - f2f23elemf16elem.SetPrivateIpAddress(*f2f23elemf16iter.PrivateIPAddress) + if f0f23elemf16iter.PrivateIPAddress != nil { + f0f23elemf16elem.SetPrivateIpAddress(*f0f23elemf16iter.PrivateIPAddress) } - f2f23elemf16 = append(f2f23elemf16, f2f23elemf16elem) + f0f23elemf16 = append(f0f23elemf16, f0f23elemf16elem) } - f2f23elem.SetPrivateIpAddresses(f2f23elemf16) + f0f23elem.SetPrivateIpAddresses(f0f23elemf16) } - if f2f23iter.SecondaryPrivateIPAddressCount != nil { - f2f23elem.SetSecondaryPrivateIpAddressCount(*f2f23iter.SecondaryPrivateIPAddressCount) + if f0f23iter.SecondaryPrivateIPAddressCount != nil { + f0f23elem.SetSecondaryPrivateIpAddressCount(*f0f23iter.SecondaryPrivateIPAddressCount) } - if f2f23iter.SubnetID != nil { - f2f23elem.SetSubnetId(*f2f23iter.SubnetID) + if f0f23iter.SubnetID != nil { + f0f23elem.SetSubnetId(*f0f23iter.SubnetID) } - f2f23 = append(f2f23, f2f23elem) + f0f23 = append(f0f23, f0f23elem) } - f2.SetNetworkInterfaces(f2f23) + f0.SetNetworkInterfaces(f0f23) } if r.ko.Spec.LaunchTemplateData.Placement != nil { - f2f24 := &svcsdk.LaunchTemplatePlacementRequest{} + f0f24 := &svcsdk.LaunchTemplatePlacementRequest{} if r.ko.Spec.LaunchTemplateData.Placement.Affinity != nil { - f2f24.SetAffinity(*r.ko.Spec.LaunchTemplateData.Placement.Affinity) + f0f24.SetAffinity(*r.ko.Spec.LaunchTemplateData.Placement.Affinity) } if r.ko.Spec.LaunchTemplateData.Placement.AvailabilityZone != nil { - f2f24.SetAvailabilityZone(*r.ko.Spec.LaunchTemplateData.Placement.AvailabilityZone) + f0f24.SetAvailabilityZone(*r.ko.Spec.LaunchTemplateData.Placement.AvailabilityZone) } if r.ko.Spec.LaunchTemplateData.Placement.GroupName != nil { - f2f24.SetGroupName(*r.ko.Spec.LaunchTemplateData.Placement.GroupName) + f0f24.SetGroupName(*r.ko.Spec.LaunchTemplateData.Placement.GroupName) } if r.ko.Spec.LaunchTemplateData.Placement.HostID != nil { - f2f24.SetHostId(*r.ko.Spec.LaunchTemplateData.Placement.HostID) + f0f24.SetHostId(*r.ko.Spec.LaunchTemplateData.Placement.HostID) } if r.ko.Spec.LaunchTemplateData.Placement.HostResourceGroupARN != nil { - f2f24.SetHostResourceGroupArn(*r.ko.Spec.LaunchTemplateData.Placement.HostResourceGroupARN) + f0f24.SetHostResourceGroupArn(*r.ko.Spec.LaunchTemplateData.Placement.HostResourceGroupARN) } if r.ko.Spec.LaunchTemplateData.Placement.PartitionNumber != nil { - f2f24.SetPartitionNumber(*r.ko.Spec.LaunchTemplateData.Placement.PartitionNumber) + f0f24.SetPartitionNumber(*r.ko.Spec.LaunchTemplateData.Placement.PartitionNumber) } if r.ko.Spec.LaunchTemplateData.Placement.SpreadDomain != nil { - f2f24.SetSpreadDomain(*r.ko.Spec.LaunchTemplateData.Placement.SpreadDomain) + f0f24.SetSpreadDomain(*r.ko.Spec.LaunchTemplateData.Placement.SpreadDomain) } if r.ko.Spec.LaunchTemplateData.Placement.Tenancy != nil { - f2f24.SetTenancy(*r.ko.Spec.LaunchTemplateData.Placement.Tenancy) + f0f24.SetTenancy(*r.ko.Spec.LaunchTemplateData.Placement.Tenancy) } - f2.SetPlacement(f2f24) + f0.SetPlacement(f0f24) } if r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions != nil { - f2f25 := &svcsdk.LaunchTemplatePrivateDnsNameOptionsRequest{} + f0f25 := &svcsdk.LaunchTemplatePrivateDnsNameOptionsRequest{} if r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.EnableResourceNameDNSAAAARecord != nil { - f2f25.SetEnableResourceNameDnsAAAARecord(*r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.EnableResourceNameDNSAAAARecord) + f0f25.SetEnableResourceNameDnsAAAARecord(*r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.EnableResourceNameDNSAAAARecord) } if r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.EnableResourceNameDNSARecord != nil { - f2f25.SetEnableResourceNameDnsARecord(*r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.EnableResourceNameDNSARecord) + f0f25.SetEnableResourceNameDnsARecord(*r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.EnableResourceNameDNSARecord) } if r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.HostnameType != nil { - f2f25.SetHostnameType(*r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.HostnameType) + f0f25.SetHostnameType(*r.ko.Spec.LaunchTemplateData.PrivateDNSNameOptions.HostnameType) } - f2.SetPrivateDnsNameOptions(f2f25) + f0.SetPrivateDnsNameOptions(f0f25) } if r.ko.Spec.LaunchTemplateData.RAMDiskID != nil { - f2.SetRamDiskId(*r.ko.Spec.LaunchTemplateData.RAMDiskID) + f0.SetRamDiskId(*r.ko.Spec.LaunchTemplateData.RAMDiskID) } if r.ko.Spec.LaunchTemplateData.SecurityGroupIDs != nil { - f2f27 := []*string{} - for _, f2f27iter := range r.ko.Spec.LaunchTemplateData.SecurityGroupIDs { - var f2f27elem string - f2f27elem = *f2f27iter - f2f27 = append(f2f27, &f2f27elem) + f0f27 := []*string{} + for _, f0f27iter := range r.ko.Spec.LaunchTemplateData.SecurityGroupIDs { + var f0f27elem string + f0f27elem = *f0f27iter + f0f27 = append(f0f27, &f0f27elem) } - f2.SetSecurityGroupIds(f2f27) + f0.SetSecurityGroupIds(f0f27) } if r.ko.Spec.LaunchTemplateData.SecurityGroups != nil { - f2f28 := []*string{} - for _, f2f28iter := range r.ko.Spec.LaunchTemplateData.SecurityGroups { - var f2f28elem string - f2f28elem = *f2f28iter - f2f28 = append(f2f28, &f2f28elem) + f0f28 := []*string{} + for _, f0f28iter := range r.ko.Spec.LaunchTemplateData.SecurityGroups { + var f0f28elem string + f0f28elem = *f0f28iter + f0f28 = append(f0f28, &f0f28elem) } - f2.SetSecurityGroups(f2f28) + f0.SetSecurityGroups(f0f28) } if r.ko.Spec.LaunchTemplateData.TagSpecifications != nil { - f2f29 := []*svcsdk.LaunchTemplateTagSpecificationRequest{} - for _, f2f29iter := range r.ko.Spec.LaunchTemplateData.TagSpecifications { - f2f29elem := &svcsdk.LaunchTemplateTagSpecificationRequest{} - if f2f29iter.ResourceType != nil { - f2f29elem.SetResourceType(*f2f29iter.ResourceType) + f0f29 := []*svcsdk.LaunchTemplateTagSpecificationRequest{} + for _, f0f29iter := range r.ko.Spec.LaunchTemplateData.TagSpecifications { + f0f29elem := &svcsdk.LaunchTemplateTagSpecificationRequest{} + if f0f29iter.ResourceType != nil { + f0f29elem.SetResourceType(*f0f29iter.ResourceType) } - if f2f29iter.Tags != nil { - f2f29elemf1 := []*svcsdk.Tag{} - for _, f2f29elemf1iter := range f2f29iter.Tags { - f2f29elemf1elem := &svcsdk.Tag{} - if f2f29elemf1iter.Key != nil { - f2f29elemf1elem.SetKey(*f2f29elemf1iter.Key) + if f0f29iter.Tags != nil { + f0f29elemf1 := []*svcsdk.Tag{} + for _, f0f29elemf1iter := range f0f29iter.Tags { + f0f29elemf1elem := &svcsdk.Tag{} + if f0f29elemf1iter.Key != nil { + f0f29elemf1elem.SetKey(*f0f29elemf1iter.Key) } - if f2f29elemf1iter.Value != nil { - f2f29elemf1elem.SetValue(*f2f29elemf1iter.Value) + if f0f29elemf1iter.Value != nil { + f0f29elemf1elem.SetValue(*f0f29elemf1iter.Value) } - f2f29elemf1 = append(f2f29elemf1, f2f29elemf1elem) + f0f29elemf1 = append(f0f29elemf1, f0f29elemf1elem) } - f2f29elem.SetTags(f2f29elemf1) + f0f29elem.SetTags(f0f29elemf1) } - f2f29 = append(f2f29, f2f29elem) + f0f29 = append(f0f29, f0f29elem) } - f2.SetTagSpecifications(f2f29) + f0.SetTagSpecifications(f0f29) } if r.ko.Spec.LaunchTemplateData.UserData != nil { - f2.SetUserData(*r.ko.Spec.LaunchTemplateData.UserData) + f0.SetUserData(*r.ko.Spec.LaunchTemplateData.UserData) } - res.SetLaunchTemplateData(f2) + res.SetLaunchTemplateData(f0) } if r.ko.Spec.Name != nil { res.SetLaunchTemplateName(*r.ko.Spec.Name) } if r.ko.Spec.TagSpecifications != nil { - f4 := []*svcsdk.TagSpecification{} - for _, f4iter := range r.ko.Spec.TagSpecifications { - f4elem := &svcsdk.TagSpecification{} - if f4iter.ResourceType != nil { - f4elem.SetResourceType(*f4iter.ResourceType) - } - if f4iter.Tags != nil { - f4elemf1 := []*svcsdk.Tag{} - for _, f4elemf1iter := range f4iter.Tags { - f4elemf1elem := &svcsdk.Tag{} - if f4elemf1iter.Key != nil { - f4elemf1elem.SetKey(*f4elemf1iter.Key) + f2 := []*svcsdk.TagSpecification{} + for _, f2iter := range r.ko.Spec.TagSpecifications { + f2elem := &svcsdk.TagSpecification{} + if f2iter.ResourceType != nil { + f2elem.SetResourceType(*f2iter.ResourceType) + } + if f2iter.Tags != nil { + f2elemf1 := []*svcsdk.Tag{} + for _, f2elemf1iter := range f2iter.Tags { + f2elemf1elem := &svcsdk.Tag{} + if f2elemf1iter.Key != nil { + f2elemf1elem.SetKey(*f2elemf1iter.Key) } - if f4elemf1iter.Value != nil { - f4elemf1elem.SetValue(*f4elemf1iter.Value) + if f2elemf1iter.Value != nil { + f2elemf1elem.SetValue(*f2elemf1iter.Value) } - f4elemf1 = append(f4elemf1, f4elemf1elem) + f2elemf1 = append(f2elemf1, f2elemf1elem) } - f4elem.SetTags(f4elemf1) + f2elem.SetTags(f2elemf1) } - f4 = append(f4, f4elem) + f2 = append(f2, f2elem) } - res.SetTagSpecifications(f4) + res.SetTagSpecifications(f2) } if r.ko.Spec.VersionDescription != nil { res.SetVersionDescription(*r.ko.Spec.VersionDescription) @@ -953,9 +944,9 @@ func (rm *resourceManager) sdkUpdate( } f6 = append(f6, f6elem) } - ko.Status.Tags = f6 + ko.Spec.Tags = f6 } else { - ko.Status.Tags = nil + ko.Spec.Tags = nil } rm.setStatusDefaults(ko) @@ -971,12 +962,6 @@ func (rm *resourceManager) newUpdateRequestPayload( ) (*svcsdk.ModifyLaunchTemplateInput, error) { res := &svcsdk.ModifyLaunchTemplateInput{} - if r.ko.Spec.ClientToken != nil { - res.SetClientToken(*r.ko.Spec.ClientToken) - } - if r.ko.Spec.DryRun != nil { - res.SetDryRun(*r.ko.Spec.DryRun) - } if r.ko.Status.LaunchTemplateID != nil { res.SetLaunchTemplateId(*r.ko.Status.LaunchTemplateID) } @@ -1013,9 +998,6 @@ func (rm *resourceManager) newDeleteRequestPayload( ) (*svcsdk.DeleteLaunchTemplateInput, error) { res := &svcsdk.DeleteLaunchTemplateInput{} - if r.ko.Spec.DryRun != nil { - res.SetDryRun(*r.ko.Spec.DryRun) - } if r.ko.Status.LaunchTemplateID != nil { res.SetLaunchTemplateId(*r.ko.Status.LaunchTemplateID) } @@ -1113,13 +1095,8 @@ func (rm *resourceManager) updateConditions( recoverableCondition.Message = nil } } - if syncCondition == nil && onSuccess { - syncCondition = &ackv1alpha1.Condition{ - Type: ackv1alpha1.ConditionTypeResourceSynced, - Status: corev1.ConditionTrue, - } - ko.Status.Conditions = append(ko.Status.Conditions, syncCondition) - } + // Required to avoid the "declared but not used" error in the default case + _ = syncCondition if terminalCondition != nil || recoverableCondition != nil || syncCondition != nil { return &resource{ko}, true // updated } diff --git a/pkg/resource/launch_template/tags.go b/pkg/resource/launch_template/tags.go new file mode 100644 index 00000000..95314d83 --- /dev/null +++ b/pkg/resource/launch_template/tags.go @@ -0,0 +1,63 @@ +// Copyright Amazon.com Inc. or its affiliates. All Rights Reserved. +// +// Licensed under the Apache License, Version 2.0 (the "License"). You may +// not use this file except in compliance with the License. A copy of the +// License is located at +// +// http://aws.amazon.com/apache2.0/ +// +// or in the "license" file accompanying this file. This file 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. + +// Code generated by ack-generate. DO NOT EDIT. + +package launch_template + +import ( + acktags "github.com/aws-controllers-k8s/runtime/pkg/tags" + + svcapitypes "github.com/aws-controllers-k8s/ec2-controller/apis/v1alpha1" +) + +var ( + _ = svcapitypes.LaunchTemplate{} + _ = acktags.NewTags() +) + +// ToACKTags converts the tags parameter into 'acktags.Tags' shape. +// This method helps in creating the hub(acktags.Tags) for merging +// default controller tags with existing resource tags. +func ToACKTags(tags []*svcapitypes.Tag) acktags.Tags { + result := acktags.NewTags() + if tags == nil || len(tags) == 0 { + return result + } + + for _, t := range tags { + if t.Key != nil { + if t.Value == nil { + result[*t.Key] = "" + } else { + result[*t.Key] = *t.Value + } + } + } + + return result +} + +// FromACKTags converts the tags parameter into []*svcapitypes.Tag shape. +// This method helps in setting the tags back inside AWSResource after merging +// default controller tags with existing resource tags. +func FromACKTags(tags acktags.Tags) []*svcapitypes.Tag { + result := []*svcapitypes.Tag{} + for k, v := range tags { + kCopy := k + vCopy := v + tag := svcapitypes.Tag{Key: &kCopy, Value: &vCopy} + result = append(result, &tag) + } + return result +} diff --git a/test/e2e/resources/launch_template.yaml b/test/e2e/resources/launch_template.yaml index e74f5990..577f93dd 100644 --- a/test/e2e/resources/launch_template.yaml +++ b/test/e2e/resources/launch_template.yaml @@ -6,4 +6,9 @@ spec: name: $LAUNCH_TEMPLATE_NAME versionDescription: $VERSION_DESCRIPTION launchTemplateData: - instanceType: t2.micro \ No newline at end of file + instanceType: t2.micro + tagSpecifications: + - resourceType: $RESOURCE_TYPE + tags: + - key: name + value: ack-launch-template diff --git a/test/e2e/resources/launchtemplate_invalid.yaml b/test/e2e/resources/launchtemplate_invalid.yaml deleted file mode 100644 index 6c506902..00000000 --- a/test/e2e/resources/launchtemplate_invalid.yaml +++ /dev/null @@ -1,14 +0,0 @@ -apiVersion: ec2.services.k8s.aws/v1alpha1 -kind: LaunchTemplate -metadata: - name: $LAUNCH_TEMPLATE_NAME -spec: - name: $LAUNCH_TEMPLATE_NAME - versionDescription: $VERSION_DESCRIPTION - launchTemplateData: - instanceType: t2.micro - tagSpecifications: - - resourceType: volume - tags: - - key: Name - value: ABC diff --git a/test/e2e/tests/test_launch_template.py b/test/e2e/tests/test_launch_template.py index 06b1d3fb..902e0a45 100644 --- a/test/e2e/tests/test_launch_template.py +++ b/test/e2e/tests/test_launch_template.py @@ -33,19 +33,13 @@ @pytest.fixture def simple_launch_template(request): - #resource_name = random_suffix_name("launch-template-ack-test", 24) - resource_name = "launchtemplateacktest" + resource_name = random_suffix_name("lt-ack-test", 24) resource_file = "launch_template" replacements = REPLACEMENT_VALUES.copy() replacements["LAUNCH_TEMPLATE_NAME"] = resource_name replacements["VERSION_DESCRIPTION"] = "THIS IS TEST LAUNCH TEMPLATE" - - marker = request.node.get_closest_marker("resource_data") - - if marker is not None: - data = marker.args[0] - + replacements["RESOURCE_TYPE"] = "launch-template" # Load LaunchTemplate CR resource_data = load_ec2_resource( @@ -104,14 +98,15 @@ def test_crud(self, ec2_client, simple_launch_template): ec2_validator.assert_launch_template(resource_id, exists=False) def test_terminal_condition_invalid_parameter_value(self): - #resource_name = random_suffix_name("launch-template-ack-fail", 24) - resource_name = "launchtemplateackfail" + resource_name = random_suffix_name("lt-ack-fail", 24) replacements = REPLACEMENT_VALUES.copy() replacements["LAUNCH_TEMPLATE_NAME"] = resource_name - + replacements["RESOURCE_TYPE"] = "volume" + + # Load LaunchTemplate CR resource_data = load_ec2_resource( - "launchtemplate_invalid", + "launch_template", additional_replacements=replacements, ) logging.debug(resource_data) @@ -135,6 +130,8 @@ def test_terminal_condition_invalid_parameter_value(self): # This is not a valid CIDR block. assert expected_msg in terminal_condition['message'] + time.sleep(CREATE_WAIT_AFTER_SECONDS) + # Delete k8s resource _, deleted = k8s.delete_custom_resource(ref, 2, 5) assert deleted is True