Commit Graph

63 Commits

Author SHA1 Message Date
Fernando 1e3214539c
Add a mutex lock to 'awsCloudInstances' map (#15415)
* Add a mutex lock to 'awsCloudInstances' map

We're using terraform kops provider to manage our AWS kops clusters.
Time to time we hit a race condition with the stack trace points to
`awsup.NewAWSCloud` function, when writing to a concurrent map, that
maintains a map between regions and `AWSCloud` objects.

This PR changes this to variable so it belongs to a new type, that wraps
the map into its own struct where access is controlled by a mutex lock.

Let me know if that makes sense to you all.

Thanks for building this awesome project!

* lock on reads as well

* cosmetic change, removing empty line
2023-05-19 07:48:31 -07:00
John Gardiner Myers 87925bf0ca Remove CloudFormation support 2022-11-22 21:02:50 -08:00
John Gardiner Myers d39ba74bd7 Change the control-plane IG role to "ControlPlane" in v1alpha3 API 2022-11-22 17:05:29 -08:00
Ciprian Hacman 211c82d8ad aws: Fix SIGSEGV when using instance selector 2022-11-17 12:22:22 +02:00
Justin SB c6e9a75490 Clearer error messages around instance types not found
Issue #14481

Co-authored-by: John Gardiner Myers <jgmyers@proofpoint.com>
2022-11-14 11:37:58 -05:00
Ciprian Hacman edb44610f7 aws: Create cluster without DNS or Gossip 2022-11-02 12:54:27 +02:00
Bronson Mirafuentes b87fbc3853 add option to query AMIs IDs from SSM 2022-10-19 11:39:39 -07:00
Ole Markus With 8c12d5b035 When using kops create, set the provided machinetype in the written IG spec 2022-09-28 12:16:03 +02:00
Ole Markus With fdb72f2c34 Add create cluster test that includes apiserver 2022-08-19 18:57:43 +02:00
Jesse Haka b88d110f58 Drain OpenStack loadbalancers 2021-12-31 13:16:02 +02:00
Ole Markus With b852a804d9 Don't allow IGs with both GPU and non-GPU types 2021-09-05 20:09:04 +02:00
John Gardiner Myers dd605fdbc3 Subsume StatusStore into fi.Cloud 2021-05-15 17:39:32 -07:00
John Gardiner Myers 1dab19f499 Require fi.Cloud to implement kops.StatusStore 2021-05-15 15:54:38 -07:00
John Gardiner Myers 4090c07e01 Move ELB/NLB query functions into AWSCloud 2021-05-15 15:22:01 -07:00
Ciprian Hacman bdd63c917f Allow AWS instance types with multiple architectures
Older AWS instance types support both "i386" and "x86_64" architectures:
```
$ aws ec2 describe-instance-types --instance-types t2.micro
{
    "InstanceTypes": [
            "InstanceType": "t2.micro",
            "ProcessorInfo": {
                "SupportedArchitectures": [
                    "i386",
                    "x86_64"
                ],
```
2021-05-12 14:05:12 +03:00
Jason Haugen c8bb48ba81 fix existing tests 2021-04-19 15:43:05 -05:00
Jason Haugen d07b067249 Add NTH queue-processor mode 2021-04-19 15:43:05 -05:00
Bharath Vedartham 059c7ef33a Create an environment file for kops-configuration systemd process 2021-03-13 22:20:49 +05:30
Ciprian Hacman dee13cecca Improve machine type and image validation 2021-02-19 18:28:57 +02:00
Bharath Vedartham 1912db0f11 Add mocks 2021-02-19 01:20:15 +05:30
Ciprian Hacman 057ab28d4c Update LaunchTemplate tags on changes 2020-11-09 21:40:36 +02:00
Christian Joun e91ed11449
Implement API load balancer class with NLB and ELB support on AWS (#9011)
* refactor TargetLoadBalancer to use DNSTarget interface instead of LoadBalancer

* add LoadBalancerClass fields into api

* make api machinery

* WIP: Implemented API loadbalancer class, allowing NLB and ELB support on AWS for new clusters.

* perform vendoring related tasks and apply fixes identified from hack/

dissallow spotinst + nlb
remove reflection in status_discovery.go
Add precreated additional security groups to the Master nodes in case of NLB
Remove support for attaching individual instances to NLB; only rely on ASG attachments
Don't specify Classic loadbalancer in GCE integration test

* add utility function to the kops model context to make LoadBalancer comparisons simpler

* use DNSTarget interface when locating DNSName of API ELB

* wip: create target group task

* Consolidate TargetGroup tasks

* Use context helper for determining api load balancer type to avoid nil pointers

* Update NLB creation to use target group ARN from separate task rather than creating a TG in-line

* Address staticcheck and bazel failures

* Removing NLB Attachment tasks because they're not used since we switched to defining them as a part of the ASGs

* Address PR review feedback

* Only set LB Class field for AWS clusters, fix nil pointer

* Move target group attributes from NLB task to TG task, removing unused attributes

* Add terraform and cloudformation support for NLBs, listeners, and target groups

* Update integration test for NLB support

* Fix NLB name format to pass terraform validation

* Preserve security group rule names when switching ELB to NLB to reduce destructive terraform changes

* Use elbv2 enums and address some TODOs

* Set healthcheck values in target group

* Find TG tags, fix NLB name detection

* Fix more spurious changes reported by lifecycle integration test

* Fix spotinst validation, more code cleanup

* Address more PR feedback

* ReconcileTargetGroups unit test + more code simplification

* Addressing PR feedback Renaming task 1. awstasks.LoadBalancer -> awstasks.ClassicLoadBalancer

* Addressing PR feedback Renaming task: ELBName() -> CLBName() / LinkToELB() -> LinkToCLB()

* Addressing PR feedback: Various text changes

* fix export of kubecfg

* address TargetGroup should have the same name as the NLB

* should address error when fetching tags due to missing ARN

* Update expected and crds

* Add feature table to NLB docs

* Address more feedback and remove some TODOs that arent applicable anymore

* Update spotinst validation error message

Co-authored-by: Peter Rifel <pgrifel@gmail.com>
2020-11-02 05:28:52 -08:00
Peter Rifel d4d4545345
Add AWS partition support to iam service account roles 2020-09-17 10:01:27 -05:00
Justin SB 8498ac9dbb Create PublicJWKS feature flag
This should be much easier to start and to get under testing; it only
works with a load balancer, it sets the apiserver into anonymous-auth
allowed, it grants the anonymous auth user permission to read our jwks
tokens.  But it shouldn't need a second bucket or anything of that
nature.

Co-authored-by: John Gardiner Myers <jgmyers@proofpoint.com>
2020-09-09 09:57:06 -04:00
Ole Markus With 0ec71686b9 Refactor cloudinstancegroupmember in a more independent cloud instance representation
Apply suggestions from code review

Co-authored-by: John Gardiner Myers <jgmyers@proofpoint.com>
2020-08-30 21:37:03 +02:00
Peter Rifel 4d9f0128a3
Upgrade to klog2
This splits up the kubernetes 1.19 PR to make it easier to keep up to date until we get it sorted out.
2020-08-16 20:56:48 -05:00
Peter Rifel 64ef8c2d42
Add DescribeInstanceTypes to AWSCloud 2020-06-09 10:13:00 -05:00
John Gardiner Myers cc5b6f4b8f Add fi.Cloud.DetachInstance() 2020-01-27 20:15:11 -08:00
mikesplain 9e55b8230a Update copyright notices
Also cleans some white spaces
2019-09-09 14:47:51 -04:00
liranp 80020052d3
feat(spotinst): new instance group type: ocean 2019-06-03 12:38:46 +03:00
Justin SB 3e33ac7682
Change code from glog to klog
We don't call klog.InitFlags yet, because that will cause a flag
redefinition error until we get everyone to stop using glog.  That
will happen when we update to k8s 1.13.
2019-05-06 12:54:51 -04:00
mikesplain 14cbad9bc0 Fix tagging and remove tagging elbs 2019-03-29 13:29:11 -04:00
Derek Lemon -T (delemon - AEROTEK INC at Cisco) 4f0169bb79 codegen 2019-01-16 09:30:40 -07:00
Liran Polak 7654a923f1 feature: new integration: spotinst 2018-10-14 11:37:31 +03:00
Naresh Kumar Amrutham 504414dd1c include tests 2018-08-17 13:04:28 -07:00
Naresh Kumar Amrutham 76a0018d53 add delete support for NLBs, ALBs and Target groups 2018-08-14 16:15:22 -07:00
Justin Santa Barbara ab7439b360 More mocks - sufficient for privatecalico to roundtrip 2018-03-11 23:12:22 -04:00
Justin Santa Barbara c121e7f14e Create lifecycle test against AWS mocks
We create a cluster, run kops update, then run kops update again.  We
expect no changes on the second update.
2018-03-11 17:04:30 -04:00
Kubernetes Submit Queue e88496a248
Merge pull request #4061 from meringu/create-subnets
Automatic merge from submit-queue.

Add --subnets and --utility-subnets to kops create cluster

This change adds two new options to `kops create cluster`

When specifying `--vpc`, `--subnets` can be specified as an unordered array of subnet ids. Kops will then look up the zones of the subnets to find which zone to add the subnet id to.

If `--topology private` is also specified, `--utility-subnets` can similarly be specified.

~If a zone was specified but a subnet wasn't given that matches the zone, then the subnet will be allocated a CIDR with the current behaviour.~ This case fails validation here 7bd0a6a703/pkg/apis/kops/validation/validation.go (L151)

I can add unit tests and docs changes if required, but I am keen to get feedback before I proceed much further.

I have only added support for AWS.

I have tested this by running a command similar to this:

```bash
kops create cluster \
  --zones=us-east-1a,us-east-1b,us-east-1c \
  --topology private \
  --master-zones=us-east-1a,us-east-1b,us-east-1c  \
  --vpc $vpc_id \
  --subnets subnet-111111,subnet-222222,subnet-333333 \
  --utility-subnets subnet-444444,subnet-555555,subnet-666666 \
  $cluster_hosted_zone_name
```

And the cluster spec was as expected.
2017-12-18 21:12:59 -08:00
Henry Muru Paenga afc1b58722 Tests for create cluster in shared vpc 2017-12-15 18:29:20 +13:00
Justin Santa Barbara f03cc5dbd9 Update dnsprovider imports to use our version 2017-12-13 20:43:01 -05:00
Arto Jantunen 53669b8217 Make ELB somewhat mockable 2017-11-28 11:48:57 +02:00
georgebuckerfield eab351c913 Add tests for ListRouteTables function 2017-11-18 12:34:39 +00:00
Justin Santa Barbara 737f2fcd80 rolling-update - initial GCE support 2017-10-02 23:07:35 -04:00
Justin Santa Barbara 3478031533 API types changed package 2017-10-01 14:03:56 -04:00
Justin Santa Barbara 44e67c4f93 DRY mock-aws cloudinstances functions 2017-09-30 17:39:53 -04:00
chrislovecnm a431eb3e43 refactoring to use cloud based GetGroups 2017-09-29 12:29:07 -06:00
chrislovecnm 93f3600f36 adding aws_cloud instancegroups delete and get methods 2017-09-28 15:52:50 -06:00
chrislovecnm db5b931579 Adding three new funcs for cloud providers, for refactoring delete and
get
2017-09-28 15:52:49 -06:00
Justin Santa Barbara bde0c46b10 AWS mock provider should use the AWS cloudprovider id
Otherwise our tests get a little confused; for example they weren't
outputing the Terraform provider block.
2017-09-23 20:52:54 -04:00