Skip to content

Fix AdoptedResource functionality for FlowLogs #161

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 12, 2023

Conversation

nnbu
Copy link
Contributor

@nnbu nnbu commented Dec 6, 2023

Issue # : aws-controllers-k8s/community#1946

RCA:
Following CR currently fails to adopt the existing FlowLog resource.

apiVersion: services.k8s.aws/v1alpha1
kind: AdoptedResource
metadata:
  name: flowlog1
spec:
  aws:
    nameOrID: fl-xxxxxx
  kubernetes:
    group: ec2.services.k8s.aws
    kind: FlowLog
    metadata:
      name: flowlog-adopted
      namespace: default

The error

"error": "FlowLog.ec2.services.k8s.aws "my-resource" is invalid: [spec.resourceID: Required value, spec.resourceType: Required value]"}

comes from https://github.com/aws-controllers-k8s/runtime/blob/main/pkg/runtime/adoption_reconciler.go#L157

SetIdentifiers function needs to have code to fill up required values of the CR so as to solve this issue.

Solution:
2 new fields are defined as resourceID and resourceType and they are initialized in SetIdentifiers function. These fields need to part of additionalKeys field of AdoptedResource CR for FlowLog.

The new CR looks like,

apiVersion: services.k8s.aws/v1alpha1
kind: AdoptedResource
metadata:
  name: flowlog1
spec:
  aws:
    nameOrID: fl-xxxxx
    additionalKeys:
      resourceID: vpc-xxxxxx
      resourceType: VPC
  kubernetes:
    group: ec2.services.k8s.aws
    kind: FlowLog
    metadata:
      name: flowlog-adopted
      namespace: default

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-prow ack-prow bot added the needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. label Dec 6, 2023
Copy link

ack-prow bot commented Dec 6, 2023

Hi @nnbu. Thanks for your PR.

I'm waiting for a aws-controllers-k8s member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

Instructions 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.

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/ok-to-test

@ack-prow ack-prow bot added ok-to-test Indicates a non-member PR verified by an org member that is safe to test. and removed needs-ok-to-test Indicates a PR that requires an org member to verify it is safe to test. labels Dec 6, 2023
@nnbu nnbu force-pushed the adoptResourceFlowLog branch 2 times, most recently from a95bccd to f66c263 Compare December 6, 2023 22:50
@nnbu nnbu force-pushed the adoptResourceFlowLog branch from f66c263 to 53ec617 Compare December 7, 2023 16:55
@nnbu nnbu force-pushed the adoptResourceFlowLog branch from 53ec617 to 487fd4e Compare December 7, 2023 16:56
@nnbu
Copy link
Contributor Author

nnbu commented Dec 8, 2023

@a-hilaly Could you please review this? I have addressed the comments

Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you, @nnbu !
/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Dec 12, 2023
@a-hilaly
Copy link
Member

/hold

@ack-prow ack-prow bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2023
@a-hilaly a-hilaly changed the title Add AdoptedResource functionality to FlowLogs Fix AdoptedResource functionality for FlowLogs Dec 12, 2023
@a-hilaly
Copy link
Member

/unhold

@ack-prow ack-prow bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Dec 12, 2023
Copy link

ack-prow bot commented Dec 12, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: a-hilaly, nnbu

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ack-prow ack-prow bot added the approved label Dec 12, 2023
@ack-prow ack-prow bot merged commit 0271c52 into aws-controllers-k8s:main Dec 12, 2023
ack-prow bot pushed a commit that referenced this pull request Dec 13, 2023
Description of changes:
This PR creates a release v1.1.1 for ec2-controller, following the merge of PRs:
- #161 
- #163 

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
nnbu pushed a commit to nnbu/ack-ec2-controller that referenced this pull request Sep 18, 2024
Description of changes:
This PR creates a release v1.1.1 for ec2-controller, following the merge of PRs:
- aws-controllers-k8s#161 
- aws-controllers-k8s#163 

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged. ok-to-test Indicates a non-member PR verified by an org member that is safe to test.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants