Skip to content

Conversation

@embano1
Copy link
Member

@embano1 embano1 commented Feb 27, 2023

Description of changes: Add Pipes Resource

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

@embano1 embano1 changed the title Pipes Add Pipes Resource Feb 27, 2023
@ack-prow ack-prow bot added the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Feb 27, 2023
@embano1 embano1 force-pushed the pipes branch 2 times, most recently from 6475e0a to 86df0fa Compare March 2, 2023 14:37
@ack-prow ack-prow bot removed the do-not-merge/invalid-owners-file Indicates that a PR should not merge because it has an invalid OWNERS file in it. label Mar 3, 2023
@embano1
Copy link
Member Author

embano1 commented Mar 3, 2023

I'll split the two commits into two PRs as discussed with @a-hilaly

Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com>
@embano1 embano1 force-pushed the pipes branch 2 times, most recently from c9f710e to 9c34d77 Compare March 10, 2023 16:02

// hasNilDifference returns true if the supplied subjects' nilness is
// different
func hasNilDifference(a, b interface{}) bool {
Copy link
Member Author

@embano1 embano1 Mar 10, 2023

Choose a reason for hiding this comment

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

99% copy and paste from runtime and code-gen because we need to treat empty struct responses as nil :/
Changing this in the runtime would very likely lead to breaking changes.

client_interface: PipesAPI
resources:
Pipe:
fields:
Copy link
Member Author

Choose a reason for hiding this comment

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

Let me know if we need custom compare for tags as per API def they're a map type (which I guess you'd consider non-deterministic) -> Tags.

Copy link
Member

Choose a reason for hiding this comment

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

Just added one :)

Signed-off-by: Michael Gasch <15986659+embano1@users.noreply.github.com>
@a-hilaly a-hilaly force-pushed the pipes branch 4 times, most recently from d4f4f81 to ca538b3 Compare March 14, 2023 02:47
@a-hilaly a-hilaly force-pushed the pipes branch 5 times, most recently from 980a59a to 2fa02eb Compare March 14, 2023 13:52
Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

I'm almost there on this one. I do, however, think it would be best to rename Spec.DesiredState to just Spec.State and ignore the Status.CurrentState field path (see note inline...

go.mod Outdated
require (
github.com/aws-controllers-k8s/runtime v0.24.1
github.com/aws/aws-sdk-go v1.44.218
github.com/aws/aws-sdk-go v1.44.209
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any reason we're going back 9 releases?

Copy link
Member

Choose a reason for hiding this comment

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

Fixed

- name: ACK Admins
url: https://github.com/orgs/aws-controllers-k8s/teams/ack-admin
- name: Admins
- name: Pipes Admins
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can just use my full name here. ;)

Copy link
Member Author

Choose a reason for hiding this comment

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

Sure you can handle that :-p ?

Comment on lines +102 to +119
// hack (by the great @a-hilaly): forces a requeue in update if currentState != desiredState to reconcile
// and update status fields in Kubernetes resource e.g., in case of UPDATE_FAILED
if *bDesiredState != *b.ko.Status.CurrentState {
// setting Spec. because Status. is not considered in delta logic
delta.Add("Spec.CurrentState", *bDesiredState, *b.ko.Status.CurrentState)
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

Instead of doing this, you could rename the DesiredState field to just State, then ignore the CreatePipeOutput.CurrentState field path and in the sdk_read_one_post_set_output code hook, simply do:

if resp.CurrentState != nil {
    ko.Spec.State = resp.CurrentState
}

then the standard comparison logic would be just fine.

Copy link
Member

@a-hilaly a-hilaly Mar 14, 2023

Choose a reason for hiding this comment

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

A better hack by the great EventBridge "Jay" Pipes

Copy link
Member Author

@embano1 embano1 Mar 14, 2023

Choose a reason for hiding this comment

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

The only concern I have here is from a debugging pov since an operator could be confused a) by the field name and b) why this field name has a value which is not allowed as per API:

DesiredState
The state the pipe should be in.

Type: String

Valid Values: RUNNING | STOPPED

Required: No

Copy link
Collaborator

Choose a reason for hiding this comment

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

@embano1 @a-hilaly OK, I didn't realize the value set of these fields was different. I see now that this is more of a way for EventBridge to avoid having a StopPipe API call that only changes the desired state of the pipe. Alright, then, good to go with this :)

@a-hilaly
Copy link
Member

@jaypipes took me some time to think about this but I'm a little bit confused about why would we remove the CurrentState field. it's very similar to what rds, dyamodb, ec2... etc have. It makes sense to keep the field so it's viewable via kubectl describe and we could also inject it in the kubectl get response. Thoughts?

@a-hilaly a-hilaly force-pushed the pipes branch 2 times, most recently from 88163f5 to b27016b Compare March 15, 2023 15:32
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.

Alright lads let's ship this one!
Dankeshoen @embano1 and @jaypipes!
/lgtm

@ack-prow ack-prow bot added lgtm Indicates that a PR is ready to be merged. approved labels Mar 15, 2023
@embano1
Copy link
Member Author

embano1 commented Mar 15, 2023

Awesome, thx a ton for your help throughout these EDA controllers :)

Comment on lines +28 to +39
// _____ _ _____ _ _____ ____ ____ _ ____ _____ _____
// / __// \ |\/ __// \ /|/__ __\/ _ \/ __\/ \/ _ \/ __// __/
// | \ | | //| \ | |\ || / \ | | //| \/|| || | \|| | _| \
// | /_ | \// | /_ | | \|| | | | |_\\| /| || |_/|| |_//| /_
// \____\\__/ \____\\_/ \| \_/ \____/\_/\_\\_/\____/\____\\____\
//
// _ _ _ ____ ___ __ _ ____ _ ____ _____ ____
// \||/ / |/ _ \\ \//\||/ / __\/ \/ __\/ __// ___\
// | || / \| \ / | \/|| || \/|| \ | \
// /\_| || |-|| / / | __/| || __/| /_ \___ |
// \____/\_/ \|/_/ \_/ \_/\_/ \____\\____/

Copy link
Member Author

Choose a reason for hiding this comment

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

🤣 Your friendly 24/7 support

Copy link
Collaborator

Choose a reason for hiding this comment

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

LOL :)

Signed-off-by: Amine Hilaly <hilalyamine@gmail.com>
@ack-prow ack-prow bot removed the lgtm Indicates that a PR is ready to be merged. label Mar 15, 2023
@a-hilaly
Copy link
Member

/lgtm

@ack-prow ack-prow bot added the lgtm Indicates that a PR is ready to be merged. label Mar 15, 2023
@ack-prow
Copy link

ack-prow bot commented Mar 15, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: A-Hilaly, embano1, jaypipes

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 merged commit 299f342 into aws-controllers-k8s:main Mar 15, 2023
@embano1 embano1 deleted the pipes branch March 22, 2023 15:55
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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants