Add update operations for VolumeSize, InstanceType, and BrokerCount#55
Conversation
26aab76 to
c670340
Compare
Also added reconcile before deletion attempt if cluster is not active. Before, if we tried deleting a cluster that was not active, the controller would set it to terminal, and does not reconcile.
5ce92f5 to
be660de
Compare
be660de to
f8009f8
Compare
f8009f8 to
3857374
Compare
|
@michaelhtm: The following test failed, say
Full PR test history. Your PR dashboard. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. I understand the commands that are listed here. |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: michaelhtm, rushmash91 The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/hold |
|
/unhold |
| BootstrapBrokerStringVpcConnectivityTls: | ||
| type: string | ||
| is_read_only: true | ||
| CurrentVersion: |
There was a problem hiding this comment.
Why do you need both spec.KafkaVersion and `CurrentVersion? do they serve the same purpose?
There was a problem hiding this comment.
CurrentVersion is just the version of the cluster..it's different values from KafkaVersion...also ClusterVersion comes from the Describe output smh
| input := &svcsdk.UpdateSecurityInput{} | ||
| if desired.ko.Status.CurrentVersion != nil { | ||
| input.CurrentVersion = desired.ko.Status.CurrentVersion | ||
| } | ||
| if desired.ko.Status.ACKResourceMetadata.ARN != nil { | ||
| input.ClusterArn = (*string)(desired.ko.Status.ACKResourceMetadata.ARN) | ||
| } | ||
| if desired.ko.Spec.ClientAuthentication != nil { | ||
| f0 := &svcsdktypes.ClientAuthentication{} | ||
| if desired.ko.Spec.ClientAuthentication.SASL != nil { | ||
| f0f0 := &svcsdktypes.Sasl{} | ||
| if desired.ko.Spec.ClientAuthentication.SASL.IAM != nil && | ||
| desired.ko.Spec.ClientAuthentication.SASL.IAM.Enabled != nil { | ||
| f0f0f0 := &svcsdktypes.Iam{ | ||
| Enabled: desired.ko.Spec.ClientAuthentication.SASL.IAM.Enabled, | ||
| } | ||
| f0f0.Iam = f0f0f0 | ||
| } | ||
| if desired.ko.Spec.ClientAuthentication.SASL.SCRAM != nil && | ||
| desired.ko.Spec.ClientAuthentication.SASL.SCRAM.Enabled != nil { | ||
| f0f0f1 := &svcsdktypes.Scram{ | ||
| Enabled: desired.ko.Spec.ClientAuthentication.SASL.SCRAM.Enabled, | ||
| } | ||
| f0f0.Scram = f0f0f1 | ||
| } | ||
| f0.Sasl = f0f0 | ||
| } | ||
| if desired.ko.Spec.ClientAuthentication.TLS != nil { | ||
| f0f1 := &svcsdktypes.Tls{} | ||
| if desired.ko.Spec.ClientAuthentication.TLS.CertificateAuthorityARNList != nil { | ||
| f0f1.CertificateAuthorityArnList = aws.ToStringSlice(desired.ko.Spec.ClientAuthentication.TLS.CertificateAuthorityARNList) | ||
| } | ||
| if desired.ko.Spec.ClientAuthentication.TLS.Enabled != nil { | ||
| f0f1.Enabled = desired.ko.Spec.ClientAuthentication.TLS.Enabled | ||
| } | ||
| f0.Tls = f0f1 | ||
| } | ||
| if desired.ko.Spec.ClientAuthentication.Unauthenticated != nil && | ||
| desired.ko.Spec.ClientAuthentication.Unauthenticated.Enabled != nil { | ||
| f0.Unauthenticated = &svcsdktypes.Unauthenticated{ | ||
| Enabled: desired.ko.Spec.ClientAuthentication.Unauthenticated.Enabled, | ||
| } | ||
| } | ||
| input.ClientAuthentication = f0 | ||
| } | ||
|
|
||
| _, err = rm.sdkapi.UpdateSecurity(ctx, input) | ||
| rm.metrics.RecordAPICall("UPDATE", "UpdateSecurity", err) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| ackcondition.SetSynced(updatedRes, corev1.ConditionFalse, nil, nil) | ||
| err = requeueAfterAsyncUpdate() | ||
|
|
There was a problem hiding this comment.
Can we use a function to hide this logic?
| _, err := rm.sdkapi.UpdateBrokerStorage(ctx, &svcsdk.UpdateBrokerStorageInput{ | ||
| ClusterArn: (*string)(latest.ko.Status.ACKResourceMetadata.ARN), | ||
| CurrentVersion: latest.ko.Status.CurrentVersion, | ||
| TargetBrokerEBSVolumeInfo: []svcsdktypes.BrokerEBSVolumeInfo{ | ||
| { | ||
| KafkaBrokerNodeId: aws.String("ALL"), | ||
| VolumeSizeGB: aws.Int32(int32(*desired.ko.Spec.BrokerNodeGroupInfo.StorageInfo.EBSStorageInfo.VolumeSize)), | ||
| }, | ||
| }, | ||
| }) | ||
| rm.metrics.RecordAPICall("UPDATE", "UpdateBrokerStorage", err) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| message := fmt.Sprintf("kafka is updating broker storage") | ||
| ackcondition.SetSynced(updatedRes, corev1.ConditionFalse, &message, nil) | ||
| err = requeueAfterAsyncUpdate() |
| _, err := rm.sdkapi.UpdateBrokerType(ctx, &svcsdk.UpdateBrokerTypeInput{ | ||
| ClusterArn: (*string)(latest.ko.Status.ACKResourceMetadata.ARN), | ||
| CurrentVersion: latest.ko.Status.CurrentVersion, | ||
| TargetInstanceType: desired.ko.Spec.BrokerNodeGroupInfo.InstanceType, | ||
| }) | ||
| rm.metrics.RecordAPICall("UPDATE", "UpdateBrokerType", err) | ||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| message := fmt.Sprintf("kafka is updating broker instanceType") | ||
| ackcondition.SetSynced(updatedRes, corev1.ConditionFalse, &message, nil) |
| type unprocessedSecret struct { | ||
| errorCode string | ||
| errorMessage string | ||
| secretArn string | ||
| } | ||
|
|
||
| func (us unprocessedSecret) String() string { | ||
| return fmt.Sprintf("ErrorCode: %s, ErrorMessage %s, SecretArn: %s", us.errorCode, us.errorMessage, us.secretArn) | ||
| } |
There was a problem hiding this comment.
how about making an error type, encapsulating all the unprocessed secrets. And implement an Error method that formats it all for you. I guess that's what you're trying to do in L388+
There was a problem hiding this comment.
mmm, not sure how we can achieve that since each secret may have its own reason why it can't be attached...i don't think i can return a slice of errors..
There was a problem hiding this comment.
unless maybe if i make all three fields a list of strings..after i would just need to fix how I represent it as a string
Issue #55 Description of changes: * wrapped update operations in functions * made `unprocessedSecrets` implement error By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Issue #2249
Description of changes:
Also added reconcile before deletion attempt if cluster is
not active. Before, if we tried deleting a cluster that was
not active, the controller would set it to terminal, and does
not reconcile.
Another change being added is a field in the Cluster status
called ClusterVersion. This field is returned by the sdkFind
operation, and is crutial to make updates to VolumeSize,
InstanceType, and BrokerCount.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.