Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
danil-smirnov committed Feb 18, 2023
1 parent 33f5f9f commit 4b733b4
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 49 deletions.
9 changes: 9 additions & 0 deletions manifests/crds/rollout-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3249,29 +3249,38 @@ spec:
type: string
name:
type: string
fullName:
type: string
required:
- arn
- name
- fullName
type: object
loadBalancer:
properties:
arn:
type: string
name:
type: string
fullName:
type: string
required:
- arn
- name
- fullName
type: object
stableTargetGroup:
properties:
arn:
type: string
name:
type: string
fullName:
type: string
required:
- arn
- name
- fullName
type: object
type: object
availableReplicas:
Expand Down
9 changes: 9 additions & 0 deletions manifests/install.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14295,29 +14295,38 @@ spec:
type: string
name:
type: string
fullName:
type: string
required:
- arn
- name
- fullName
type: object
loadBalancer:
properties:
arn:
type: string
name:
type: string
fullName:
type: string
required:
- arn
- name
- fullName
type: object
stableTargetGroup:
properties:
arn:
type: string
name:
type: string
fullName:
type: string
required:
- arn
- name
- fullName
type: object
type: object
availableReplicas:
Expand Down
3 changes: 3 additions & 0 deletions pkg/apiclient/rollout/rollout.swagger.json
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,9 @@
},
"arn": {
"type": "string"
},
"fullName": {
"type": "string"
}
}
},
Expand Down
120 changes: 71 additions & 49 deletions rollout/trafficrouting/alb/alb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -455,16 +455,19 @@ func (f *fakeAWSClient) GetTargetGroupHealth(ctx context.Context, targetGroupARN
func (f *fakeAWSClient) getAlbStatus() *v1alpha1.ALBStatus {
return &v1alpha1.ALBStatus{
LoadBalancer: v1alpha1.AwsResourceRef{
Name: *f.loadBalancer.LoadBalancerName,
ARN: *f.loadBalancer.LoadBalancerArn,
Name: *f.loadBalancer.LoadBalancerName,
ARN: *f.loadBalancer.LoadBalancerArn,
FullName: *f.loadBalancer.LoadBalancerFullName,
},
CanaryTargetGroup: v1alpha1.AwsResourceRef{
Name: *f.targetGroups[0].TargetGroupName,
ARN: *f.targetGroups[0].TargetGroupArn,
Name: *f.targetGroups[0].TargetGroupName,
ARN: *f.targetGroups[0].TargetGroupArn,
FullName: *f.targetGroups[0].TargetGroupFullName,
},
StableTargetGroup: v1alpha1.AwsResourceRef{
Name: *f.targetGroups[len(f.targetGroups)-1].TargetGroupName,
ARN: *f.targetGroups[len(f.targetGroups)-1].TargetGroupArn,
Name: *f.targetGroups[len(f.targetGroups)-1].TargetGroupName,
ARN: *f.targetGroups[len(f.targetGroups)-1].TargetGroupArn,
FullName: *f.targetGroups[len(f.targetGroups)-1].TargetGroupFullName,
},
}
}
Expand Down Expand Up @@ -544,15 +547,17 @@ func TestVerifyWeight(t *testing.T) {
var status v1alpha1.RolloutStatus
r, fakeClient := newFakeReconciler(&status)
fakeClient.loadBalancer = &elbv2types.LoadBalancer{
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
LoadBalancerFullName: pointer.StringPtr("lb-abc123-fullname"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
}
fakeClient.targetGroups = []aws.TargetGroupMeta{
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("canary-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(11),
Tags: map[string]string{
Expand All @@ -561,8 +566,9 @@ func TestVerifyWeight(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("stable-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(89),
Tags: map[string]string{
Expand All @@ -582,15 +588,17 @@ func TestVerifyWeight(t *testing.T) {
var status v1alpha1.RolloutStatus
r, fakeClient := newFakeReconciler(&status)
fakeClient.loadBalancer = &elbv2types.LoadBalancer{
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
LoadBalancerFullName: pointer.StringPtr("lb-abc123-fullname"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
}
fakeClient.targetGroups = []aws.TargetGroupMeta{
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("canary-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(10),
Tags: map[string]string{
Expand All @@ -599,8 +607,9 @@ func TestVerifyWeight(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("stable-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(11),
Tags: map[string]string{
Expand Down Expand Up @@ -720,15 +729,17 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
var status v1alpha1.RolloutStatus
r, fakeClient := newFakeReconciler(&status)
fakeClient.loadBalancer = &elbv2types.LoadBalancer{
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
LoadBalancerFullName: pointer.StringPtr("lb-abc123-fullname"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
}
fakeClient.targetGroups = []aws.TargetGroupMeta{
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("canary-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(10),
Tags: map[string]string{
Expand All @@ -737,8 +748,9 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("stable-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(90),
Tags: map[string]string{
Expand All @@ -758,15 +770,17 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
var status v1alpha1.RolloutStatus
r, fakeClient := newFakeReconciler(&status)
fakeClient.loadBalancer = &elbv2types.LoadBalancer{
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
LoadBalancerFullName: pointer.StringPtr("lb-abc123-fullname"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
}
fakeClient.targetGroups = []aws.TargetGroupMeta{
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("canary-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(10),
Tags: map[string]string{
Expand All @@ -775,8 +789,9 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("ex-svc-1-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-1-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("ex-svc-1-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-1-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("ex-svc-1-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(100),
Tags: map[string]string{
Expand All @@ -785,8 +800,9 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("ex-svc-2-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-2-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("ex-svc-2-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-2-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("ex-svc-2-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(100),
Tags: map[string]string{
Expand All @@ -795,8 +811,9 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("stable-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(85),
Tags: map[string]string{
Expand All @@ -816,15 +833,17 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
var status v1alpha1.RolloutStatus
r, fakeClient := newFakeReconciler(&status)
fakeClient.loadBalancer = &elbv2types.LoadBalancer{
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
LoadBalancerName: pointer.StringPtr("lb-abc123-name"),
LoadBalancerArn: pointer.StringPtr("lb-abc123-arn"),
LoadBalancerFullName: pointer.StringPtr("lb-abc123-fullname"),
DNSName: pointer.StringPtr("verify-weight-test-abc-123.us-west-2.elb.amazonaws.com"),
}
fakeClient.targetGroups = []aws.TargetGroupMeta{
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("canary-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("canary-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("canary-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(10),
Tags: map[string]string{
Expand All @@ -833,8 +852,9 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("ex-svc-1-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-1-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("ex-svc-1-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-1-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("ex-svc-1-tg-abc123-fullname"),
},
Weight: &weightDestinations[0].Weight,
Tags: map[string]string{
Expand All @@ -843,8 +863,9 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("ex-svc-2-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-2-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("ex-svc-2-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("ex-svc-2-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("ex-svc-2-tg-abc123-fullname"),
},
Weight: &weightDestinations[1].Weight,
Tags: map[string]string{
Expand All @@ -853,8 +874,9 @@ func TestVerifyWeightWithAdditionalDestinations(t *testing.T) {
},
{
TargetGroup: elbv2types.TargetGroup{
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupName: pointer.StringPtr("stable-tg-abc123-name"),
TargetGroupArn: pointer.StringPtr("stable-tg-abc123-arn"),
TargetGroupFullName: pointer.StringPtr("stable-tg-abc123-fullname"),
},
Weight: pointer.Int32Ptr(85),
Tags: map[string]string{
Expand Down

0 comments on commit 4b733b4

Please sign in to comment.