eformat / sno-for-100

Single Node OpenShift on AWS Spot
https://developers.redhat.com/blog/2023/02/08/sno-spot
25 stars 12 forks source link

AWS CLI v2 Issue with Router ELB #6

Closed cuppett closed 2 years ago

cuppett commented 2 years ago

This step didn't work (maybe with CLI v2 only?):

🌴 RouterLoadBalancer set to aa2a9ddd000e94b718487e804e0e3d24    a9b27c28add644da48d5e14113aedf24
Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: a9b27c28add644da48d5e14113aedf24
🕱Failed - could not associate router lb  aa2a9ddd000e94b718487e804e0e3d24   a9b27c28add644da48d5e14113aedf24 with instance i-0244d5a182f015f11 ?
cuppett commented 2 years ago

Do we need this step? If we have the "patch up the AWS instance" and then the operator takes care of it, maybe we lean in on that to prove it's all working and delete this bit of code?

cuppett commented 2 years ago

oic, looks like we use oc and get after the node a little bit and need the router attached for a minute.

However, we don't fix the KUBECONFIG= environment variable in the README instructions. (mine wasn't set right)

eformat commented 2 years ago

i think this is now fixed i did start with v1 aws client .. then upgraded to v2 aws client ... keep it open for now will retest ...

cuppett commented 2 years ago

I'm actually using v1:

aws-cli/1.25.83 Python/3.11.0 Linux/6.0.8-300.fc37.x86_64 botocore/1.27.82

Still getting same error:

🌴 RouterLoadBalancer set to aa2a9ddd000e94b718487e804e0e3d24    af38b0b2a90b64b72b16b0d9a840481e
Note: AWS CLI version 2, the latest major version of the AWS CLI, is now stable and recommended for general use. For more information, see the AWS CLI version 2 installation instructions at: https://docs.aws.amazon.com/cli/latest/userguide/install-cliv2.html

usage: aws [options] <command> <subcommand> [<subcommand> ...] [parameters]
To see help text, you can run:

  aws help
  aws <command> help
  aws <command> <subcommand> help

Unknown options: af38b0b2a90b64b72b16b0d9a840481e
🕱Failed - could not associate router lb  aa2a9ddd000e94b718487e804e0e3d24   af38b0b2a90b64b72b16b0d9a840481e with instance i-0f320acc37ac8ddb8 ?
eformat commented 2 years ago

ah interesting .. wonder why its picking up 2 ELB's (should only be one ?) ...

RouterLoadBalancer set to aa2a9ddd000e94b718487e804e0e3d24 af38b0b2a90b64b72b16b0d9a840481e

eformat commented 2 years ago

i retested this one again on fresh install, worked for me .. but i only have one ELB as expected

 -> restart_instance starting [ i-08e03a91da3aca453 ] OK
🌴 RouterLoadBalancer set to a01e7e357cf4a47969ab3586632749c5
{
    "Instances": [
        {
            "InstanceId": "i-08e03a91da3aca453"
        }
    ]
}
cuppett commented 2 years ago

There's no filter in the query. In my account I have another SNO running (or user could have any number of them). These lines in the script have no tag filter:

https://github.com/eformat/sno-for-100/blob/main/adjust-single-node.sh#L484-L486

We're going to need a tag key filter for something like this:

kubernetes.io/cluster/sno-1-6jxkf = owned

Or, we could filter by VPC ID as well; however, that would make shared VPC setups challenging (but I bet the other assumptions in the scripts about NATGW and stuff would start to hurt too).

cuppett commented 2 years ago

The previous comment will actually delete all load balancers from any number of clusters/applications (with no filter). Here's the router lines which also don't have a filter:

https://github.com/eformat/sno-for-100/blob/main/adjust-single-node.sh#L515-L518

eformat commented 2 years ago

dont ask me why this is .. but there are NO --filters on those commands in aws cli

aws elbv2 describe-load-balancers help

this has always been the way i think ... grrr .. i will need to figure out a different filtering mechanism ...

eformat commented 2 years ago

OK .. so i have added into the query the VpcId for both elb types ... https://github.com/eformat/sno-for-100/commit/76004217dfcdb741c94cb1f84743662bf58cf557 that should narrow down selection at least. @cuppett - It wont cover the use case where you are sharing vpc's and have multiple elb's for different apps, does that work better for you ?

cuppett commented 2 years ago

Yeah, it's wicked better. With no NAT gateways many of the "reasons" for wanting to share a VPC mostly go away anyway, especially in the target type of person account (personal dev).

eformat commented 2 years ago

LGTM !!