feat(payment): rollout on hashMapAnnotations change#386
Conversation
|
Caution Review failedThe pull request is closed. WalkthroughFunction signatures for Changes
Sequence Diagram(s)sequenceDiagram
participant Controller
participant v3EnvVars
participant temporalEnvVars
participant Secrets
participant K8sDeployment
Controller->>v3EnvVars: request envs and hashes (stack, payments, database)
v3EnvVars->>temporalEnvVars: request temporal envs and resource hashes
temporalEnvVars->>Secrets: fetch Temporal TLS / encryption key / secrets
Secrets-->>temporalEnvVars: secret data (or not found)
temporalEnvVars-->>v3EnvVars: return (hashMap, envVars, err)
v3EnvVars-->>Controller: return (hashMap, envVars, err)
Controller->>K8sDeployment: create/update Deployment with envVars and annotations=hashMap
K8sDeployment-->>Controller: Deployment applied
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~22 minutes Poem
🚥 Pre-merge checks | ✅ 1 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (1 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing touches
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Fix all issues with AI agents
In `@internal/resources/payments/deployments.go`:
- Around line 54-62: The code dereferences ref (accessing ref.Name and
ref.Status.Hash) before checking err; change the flow in the temporalURI
handling to check the error returned from resourcereferences.Create immediately
and only access ref when err == nil and ref != nil (e.g., call
resourcereferences.Create into ref, err, then if err != nil return the error,
else set hash[ref.Name] = ref.Status.Hash); apply the same immediate-error-check
pattern to the second Create call later in this block and ensure that after
calling resourcereferences.Delete you also handle its error before proceeding.
| if secret := temporalURI.Query().Get("secret"); secret != "" { | ||
| _, err = resourcereferences.Create(ctx, payments, "payments-temporal", secret, &corev1.Secret{}) | ||
| ref, err = resourcereferences.Create(ctx, payments, "payments-temporal", secret, &corev1.Secret{}) | ||
| hash[ref.Name] = ref.Status.Hash | ||
| } else { | ||
| err = resourcereferences.Delete(ctx, payments, "payments-temporal") | ||
| } | ||
| if err != nil { | ||
| return nil, err | ||
| return | ||
| } | ||
|
|
||
| if secret := temporalURI.Query().Get("encryptionKeySecret"); secret != "" { | ||
| _, err = resourcereferences.Create(ctx, payments, "payments-temporal-encryption-key", secret, &corev1.Secret{}) | ||
| ref, err = resourcereferences.Create(ctx, payments, "payments-temporal-encryption-key", secret, &corev1.Secret{}) | ||
| hash[ref.Name] = ref.Status.Hash | ||
| } else { |
There was a problem hiding this comment.
Add the resource Ref to the hashMap.
resourceRef.Create does a CreateOrUpdate and keep the actual resource ref.
| }, | ||
| Spec: appsv1.DeploymentSpec{ | ||
| Template: corev1.PodTemplateSpec{ | ||
| ObjectMeta: metav1.ObjectMeta{ | ||
| Annotations: hashMap, | ||
| }, | ||
| Spec: corev1.PodSpec{ |
There was a problem hiding this comment.
THen adding it to the podspec
7ab664d to
db38aff
Compare
No description provided.