knife-ionoscloud 5.1.1 → 6.0.0.beta.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/docs/README.md +1 -1
- data/docs/subcommands/composite_server_create.md +9 -3
- data/docs/subcommands/cube_server_create.md +91 -0
- data/docs/subcommands/firewall_create.md +5 -2
- data/docs/subcommands/flowlog_create.md +63 -0
- data/docs/subcommands/flowlog_delete.md +51 -0
- data/docs/subcommands/flowlog_list.md +51 -0
- data/docs/subcommands/group_create.md +10 -1
- data/docs/subcommands/natgateway_create.md +41 -0
- data/docs/subcommands/natgateway_delete.md +35 -0
- data/docs/subcommands/natgateway_lan_add.md +46 -0
- data/docs/subcommands/natgateway_lan_remove.md +39 -0
- data/docs/subcommands/natgateway_list.md +35 -0
- data/docs/subcommands/natgateway_rule_add.md +66 -0
- data/docs/subcommands/natgateway_rule_list.md +38 -0
- data/docs/subcommands/natgateway_rule_remove.md +39 -0
- data/docs/subcommands/networkloadbalancer_create.md +54 -0
- data/docs/subcommands/networkloadbalancer_delete.md +35 -0
- data/docs/subcommands/networkloadbalancer_list.md +35 -0
- data/docs/subcommands/networkloadbalancer_rule_add.md +72 -0
- data/docs/subcommands/networkloadbalancer_rule_list.md +39 -0
- data/docs/subcommands/networkloadbalancer_rule_remove.md +39 -0
- data/docs/subcommands/networkloadbalancer_rule_target_add.md +64 -0
- data/docs/subcommands/networkloadbalancer_rule_target_list.md +43 -0
- data/docs/subcommands/networkloadbalancer_rule_target_remove.md +51 -0
- data/docs/subcommands/nic_create.md +3 -3
- data/docs/subcommands/nodepool_lan_add.md +49 -0
- data/docs/subcommands/nodepool_lan_remove.md +39 -0
- data/docs/subcommands/server_console.md +39 -0
- data/docs/subcommands/server_list.md +4 -1
- data/docs/subcommands/server_resume.md +35 -0
- data/docs/subcommands/server_suspend.md +35 -0
- data/docs/subcommands/server_token.md +39 -0
- data/docs/subcommands/server_upgrade.md +39 -0
- data/docs/subcommands/template_list.md +31 -0
- data/docs/subcommands/volume_create.md +2 -5
- data/docs/summary.md +29 -0
- data/knife-ionoscloud.gemspec +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_create.rb +12 -16
- data/lib/chef/knife/ionoscloud_backupunit_delete.rb +2 -5
- data/lib/chef/knife/ionoscloud_backupunit_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_backupunit_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_backupunit_update.rb +62 -0
- data/lib/chef/knife/ionoscloud_base.rb +309 -1
- data/lib/chef/knife/ionoscloud_composite_server_create.rb +23 -5
- data/lib/chef/knife/ionoscloud_contract_list.rb +32 -23
- data/lib/chef/knife/ionoscloud_cube_server_create.rb +212 -0
- data/lib/chef/knife/ionoscloud_datacenter_create.rb +11 -14
- data/lib/chef/knife/ionoscloud_datacenter_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_datacenter_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_datacenter_list.rb +4 -2
- data/lib/chef/knife/ionoscloud_datacenter_update.rb +67 -0
- data/lib/chef/knife/ionoscloud_firewall_create.rb +16 -21
- data/lib/chef/knife/ionoscloud_firewall_delete.rb +5 -13
- data/lib/chef/knife/ionoscloud_firewall_get.rb +52 -0
- data/lib/chef/knife/ionoscloud_firewall_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_firewall_update.rb +133 -0
- data/lib/chef/knife/ionoscloud_flowlog_create.rb +116 -0
- data/lib/chef/knife/ionoscloud_flowlog_delete.rb +103 -0
- data/lib/chef/knife/ionoscloud_flowlog_get.rb +84 -0
- data/lib/chef/knife/ionoscloud_flowlog_list.rb +101 -0
- data/lib/chef/knife/ionoscloud_flowlog_update.rb +127 -0
- data/lib/chef/knife/ionoscloud_group_create.rb +33 -27
- data/lib/chef/knife/ionoscloud_group_delete.rb +1 -11
- data/lib/chef/knife/ionoscloud_group_get.rb +1 -13
- data/lib/chef/knife/ionoscloud_group_list.rb +19 -7
- data/lib/chef/knife/ionoscloud_group_update.rb +131 -0
- data/lib/chef/knife/ionoscloud_group_user_add.rb +1 -18
- data/lib/chef/knife/ionoscloud_group_user_remove.rb +1 -18
- data/lib/chef/knife/ionoscloud_image_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipblock_create.rb +10 -13
- data/lib/chef/knife/ionoscloud_ipblock_delete.rb +1 -4
- data/lib/chef/knife/ionoscloud_ipblock_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_ipblock_update.rb +57 -0
- data/lib/chef/knife/ionoscloud_ipfailover_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_ipfailover_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_k8s_create.rb +27 -35
- data/lib/chef/knife/ionoscloud_k8s_delete.rb +1 -9
- data/lib/chef/knife/ionoscloud_k8s_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_k8s_update.rb +99 -0
- data/lib/chef/knife/ionoscloud_label_add.rb +1 -1
- data/lib/chef/knife/ionoscloud_label_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_label_remove.rb +1 -1
- data/lib/chef/knife/ionoscloud_lan_create.rb +6 -14
- data/lib/chef/knife/ionoscloud_lan_delete.rb +3 -4
- data/lib/chef/knife/ionoscloud_lan_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_lan_list.rb +2 -1
- data/lib/chef/knife/ionoscloud_lan_update.rb +76 -0
- data/lib/chef/knife/ionoscloud_loadbalancer_create.rb +4 -14
- data/lib/chef/knife/ionoscloud_loadbalancer_delete.rb +2 -9
- data/lib/chef/knife/ionoscloud_loadbalancer_get.rb +3 -13
- data/lib/chef/knife/ionoscloud_loadbalancer_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_add.rb +3 -15
- data/lib/chef/knife/ionoscloud_loadbalancer_nic_remove.rb +3 -16
- data/lib/chef/knife/ionoscloud_loadbalancer_update.rb +73 -0
- data/lib/chef/knife/ionoscloud_location_list.rb +5 -3
- data/lib/chef/knife/ionoscloud_natgateway_create.rb +60 -0
- data/lib/chef/knife/ionoscloud_natgateway_delete.rb +54 -0
- data/lib/chef/knife/ionoscloud_natgateway_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_add.rb +74 -0
- data/lib/chef/knife/ionoscloud_natgateway_lan_remove.rb +52 -0
- data/lib/chef/knife/ionoscloud_natgateway_list.rb +51 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_add.rb +107 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_list.rb +65 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_remove.rb +55 -0
- data/lib/chef/knife/ionoscloud_natgateway_rule_update.rb +116 -0
- data/lib/chef/knife/ionoscloud_natgateway_update.rb +84 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_create.rb +89 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_delete.rb +62 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_get.rb +42 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_list.rb +57 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_add.rb +141 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_list.rb +65 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_remove.rb +68 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_add.rb +124 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_list.rb +70 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove.rb +88 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_rule_update.rb +148 -0
- data/lib/chef/knife/ionoscloud_networkloadbalancer_update.rb +98 -0
- data/lib/chef/knife/ionoscloud_nic_create.rb +17 -22
- data/lib/chef/knife/ionoscloud_nic_delete.rb +3 -7
- data/lib/chef/knife/ionoscloud_nic_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_nic_list.rb +9 -5
- data/lib/chef/knife/ionoscloud_nic_update.rb +96 -0
- data/lib/chef/knife/ionoscloud_node_get.rb +49 -0
- data/lib/chef/knife/ionoscloud_node_list.rb +0 -1
- data/lib/chef/knife/ionoscloud_nodepool_create.rb +35 -48
- data/lib/chef/knife/ionoscloud_nodepool_delete.rb +1 -7
- data/lib/chef/knife/ionoscloud_nodepool_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_add.rb +104 -0
- data/lib/chef/knife/ionoscloud_nodepool_lan_remove.rb +72 -0
- data/lib/chef/knife/ionoscloud_nodepool_list.rb +3 -1
- data/lib/chef/knife/ionoscloud_nodepool_update.rb +124 -0
- data/lib/chef/knife/ionoscloud_pcc_create.rb +12 -18
- data/lib/chef/knife/ionoscloud_pcc_delete.rb +2 -10
- data/lib/chef/knife/ionoscloud_pcc_get.rb +33 -0
- data/lib/chef/knife/ionoscloud_pcc_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_pcc_update.rb +63 -0
- data/lib/chef/knife/ionoscloud_request_get.rb +40 -0
- data/lib/chef/knife/ionoscloud_request_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_request_status.rb +1 -1
- data/lib/chef/knife/ionoscloud_s3key_create.rb +3 -7
- data/lib/chef/knife/ionoscloud_s3key_delete.rb +4 -7
- data/lib/chef/knife/ionoscloud_s3key_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_s3key_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_server_console.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_create.rb +14 -26
- data/lib/chef/knife/ionoscloud_server_delete.rb +3 -9
- data/lib/chef/knife/ionoscloud_server_get.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_list.rb +16 -5
- data/lib/chef/knife/ionoscloud_server_reboot.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_resume.rb +44 -0
- data/lib/chef/knife/ionoscloud_server_start.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_stop.rb +1 -1
- data/lib/chef/knife/ionoscloud_server_suspend.rb +45 -0
- data/lib/chef/knife/ionoscloud_server_token.rb +43 -0
- data/lib/chef/knife/ionoscloud_server_update.rb +97 -0
- data/lib/chef/knife/ionoscloud_server_upgrade.rb +45 -0
- data/lib/chef/knife/ionoscloud_share_create.rb +7 -11
- data/lib/chef/knife/ionoscloud_share_delete.rb +2 -3
- data/lib/chef/knife/ionoscloud_share_get.rb +38 -0
- data/lib/chef/knife/ionoscloud_share_update.rb +70 -0
- data/lib/chef/knife/ionoscloud_snapshot_create.rb +2 -10
- data/lib/chef/knife/ionoscloud_snapshot_delete.rb +2 -7
- data/lib/chef/knife/ionoscloud_snapshot_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_snapshot_list.rb +1 -1
- data/lib/chef/knife/ionoscloud_snapshot_restore.rb +3 -14
- data/lib/chef/knife/ionoscloud_snapshot_update.rb +126 -0
- data/lib/chef/knife/ionoscloud_template_list.rb +47 -0
- data/lib/chef/knife/ionoscloud_user_create.rb +1 -8
- data/lib/chef/knife/ionoscloud_user_delete.rb +1 -6
- data/lib/chef/knife/ionoscloud_user_get.rb +32 -0
- data/lib/chef/knife/ionoscloud_user_ssourl.rb +1 -1
- data/lib/chef/knife/ionoscloud_user_update.rb +92 -0
- data/lib/chef/knife/ionoscloud_volume_attach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_create.rb +18 -34
- data/lib/chef/knife/ionoscloud_volume_delete.rb +3 -9
- data/lib/chef/knife/ionoscloud_volume_detach.rb +1 -1
- data/lib/chef/knife/ionoscloud_volume_get.rb +36 -0
- data/lib/chef/knife/ionoscloud_volume_list.rb +2 -2
- data/lib/chef/knife/ionoscloud_volume_update.rb +106 -0
- data/lib/knife-ionoscloud/version.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_create_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_backupunit_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_backupunit_get_spec.rb +65 -0
- data/spec/chef/knife/ionoscloud_backupunit_list_spec.rb +1 -1
- data/spec/chef/knife/ionoscloud_backupunit_ssourl_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_backupunit_update_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_base_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_composite_server_create_spec.rb +11 -8
- data/spec/chef/knife/ionoscloud_contract_list_spec.rb +32 -27
- data/spec/chef/knife/ionoscloud_cube_server_create_spec.rb +249 -0
- data/spec/chef/knife/ionoscloud_datacenter_create_spec.rb +6 -2
- data/spec/chef/knife/ionoscloud_datacenter_delete_spec.rb +8 -5
- data/spec/chef/knife/ionoscloud_datacenter_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_datacenter_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_datacenter_update_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_firewall_create_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_firewall_delete_spec.rb +6 -5
- data/spec/chef/knife/ionoscloud_firewall_get_spec.rb +77 -0
- data/spec/chef/knife/ionoscloud_firewall_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_firewall_update_spec.rb +117 -0
- data/spec/chef/knife/ionoscloud_flowlog_create_spec.rb +254 -0
- data/spec/chef/knife/ionoscloud_flowlog_delete_spec.rb +360 -0
- data/spec/chef/knife/ionoscloud_flowlog_get_spec.rb +171 -0
- data/spec/chef/knife/ionoscloud_flowlog_list_spec.rb +264 -0
- data/spec/chef/knife/ionoscloud_flowlog_update_spec.rb +244 -0
- data/spec/chef/knife/ionoscloud_group_create_spec.rb +9 -0
- data/spec/chef/knife/ionoscloud_group_delete_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_get_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_list_spec.rb +26 -8
- data/spec/chef/knife/ionoscloud_group_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_group_user_add_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_group_user_remove_spec.rb +6 -0
- data/spec/chef/knife/ionoscloud_image_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_ipblock_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_ipblock_update_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_ipfailover_add_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_ipfailover_remove_spec.rb +7 -7
- data/spec/chef/knife/ionoscloud_k8s_create_spec.rb +7 -0
- data/spec/chef/knife/ionoscloud_k8s_delete_spec.rb +16 -11
- data/spec/chef/knife/ionoscloud_k8s_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_k8s_update_spec.rb +114 -0
- data/spec/chef/knife/ionoscloud_kubeconfig_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_label_add_spec.rb +10 -10
- data/spec/chef/knife/ionoscloud_label_list_spec.rb +14 -14
- data/spec/chef/knife/ionoscloud_label_remove_spec.rb +20 -20
- data/spec/chef/knife/ionoscloud_lan_create_spec.rb +4 -3
- data/spec/chef/knife/ionoscloud_lan_delete_spec.rb +7 -5
- data/spec/chef/knife/ionoscloud_lan_get_spec.rb +68 -0
- data/spec/chef/knife/ionoscloud_lan_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_lan_update_spec.rb +87 -0
- data/spec/chef/knife/ionoscloud_loadbalancer_create_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_loadbalancer_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_loadbalancer_get_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_loadbalancer_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_add_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_loadbalancer_nic_remove_spec.rb +6 -6
- data/spec/chef/knife/ionoscloud_loadbalancer_update_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_location_list_spec.rb +5 -3
- data/spec/chef/knife/ionoscloud_natgateway_create_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_natgateway_delete_spec.rb +118 -0
- data/spec/chef/knife/ionoscloud_natgateway_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_add_spec.rb +158 -0
- data/spec/chef/knife/ionoscloud_natgateway_lan_remove_spec.rb +209 -0
- data/spec/chef/knife/ionoscloud_natgateway_list_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_add_spec.rb +99 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_list_spec.rb +92 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_remove_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_natgateway_rule_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_natgateway_update_spec.rb +121 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_create_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_delete_spec.rb +120 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_get_spec.rb +82 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_list_spec.rb +88 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_add_spec.rb +105 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_list_spec.rb +89 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_remove_spec.rb +150 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_add_spec.rb +113 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_list_spec.rb +85 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_target_remove_spec.rb +281 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_rule_update_spec.rb +163 -0
- data/spec/chef/knife/ionoscloud_networkloadbalancer_update_spec.rb +107 -0
- data/spec/chef/knife/ionoscloud_nic_create_spec.rb +9 -5
- data/spec/chef/knife/ionoscloud_nic_delete_spec.rb +8 -6
- data/spec/chef/knife/ionoscloud_nic_get_spec.rb +72 -0
- data/spec/chef/knife/ionoscloud_nic_list_spec.rb +12 -6
- data/spec/chef/knife/ionoscloud_nic_update_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_node_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_nodepool_create_spec.rb +10 -5
- data/spec/chef/knife/ionoscloud_nodepool_delete_spec.rb +14 -0
- data/spec/chef/knife/ionoscloud_nodepool_get_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_add_spec.rb +222 -0
- data/spec/chef/knife/ionoscloud_nodepool_lan_remove.rb +196 -0
- data/spec/chef/knife/ionoscloud_nodepool_list_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_nodepool_update_spec.rb +134 -0
- data/spec/chef/knife/ionoscloud_pcc_create_spec.rb +11 -8
- data/spec/chef/knife/ionoscloud_pcc_delete_spec.rb +7 -7
- data/spec/chef/knife/ionoscloud_pcc_get_spec.rb +71 -0
- data/spec/chef/knife/ionoscloud_pcc_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_pcc_update_spec.rb +83 -0
- data/spec/chef/knife/ionoscloud_request_get_spec.rb +69 -0
- data/spec/chef/knife/ionoscloud_request_list_spec.rb +16 -16
- data/spec/chef/knife/ionoscloud_request_status_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_s3key_create_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_s3key_delete_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_s3key_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_s3key_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_server_console_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_server_create_spec.rb +6 -3
- data/spec/chef/knife/ionoscloud_server_delete_spec.rb +8 -5
- data/spec/chef/knife/ionoscloud_server_get_spec.rb +74 -0
- data/spec/chef/knife/ionoscloud_server_list_spec.rb +63 -5
- data/spec/chef/knife/ionoscloud_server_reboot_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_resume_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_server_start_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_stop_spec.rb +3 -5
- data/spec/chef/knife/ionoscloud_server_suspend_spec.rb +93 -0
- data/spec/chef/knife/ionoscloud_server_token_spec.rb +97 -0
- data/spec/chef/knife/ionoscloud_server_update_spec.rb +105 -0
- data/spec/chef/knife/ionoscloud_server_upgrade_spec.rb +96 -0
- data/spec/chef/knife/ionoscloud_share_get_spec.rb +66 -0
- data/spec/chef/knife/ionoscloud_share_update_spec.rb +91 -0
- data/spec/chef/knife/ionoscloud_snapshot_create_spec.rb +15 -3
- data/spec/chef/knife/ionoscloud_snapshot_delete_spec.rb +17 -5
- data/spec/chef/knife/ionoscloud_snapshot_get_spec.rb +79 -0
- data/spec/chef/knife/ionoscloud_snapshot_list_spec.rb +2 -2
- data/spec/chef/knife/ionoscloud_snapshot_restore_spec.rb +12 -3
- data/spec/chef/knife/ionoscloud_snapshot_update_spec.rb +113 -0
- data/spec/chef/knife/ionoscloud_template_list_spec.rb +78 -0
- data/spec/chef/knife/ionoscloud_user_create_spec.rb +3 -1
- data/spec/chef/knife/ionoscloud_user_delete_spec.rb +4 -2
- data/spec/chef/knife/ionoscloud_user_get_spec.rb +70 -0
- data/spec/chef/knife/ionoscloud_user_ssourl_spec.rb +3 -3
- data/spec/chef/knife/ionoscloud_user_update_spec.rb +110 -0
- data/spec/chef/knife/ionoscloud_volume_attach_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_create_spec.rb +21 -11
- data/spec/chef/knife/ionoscloud_volume_delete_spec.rb +15 -5
- data/spec/chef/knife/ionoscloud_volume_detach_spec.rb +5 -5
- data/spec/chef/knife/ionoscloud_volume_get_spec.rb +81 -0
- data/spec/chef/knife/ionoscloud_volume_list_spec.rb +4 -4
- data/spec/chef/knife/ionoscloud_volume_update_spec.rb +116 -0
- data/spec/spec_helper.rb +251 -39
- metadata +245 -6
@@ -36,22 +36,26 @@ class Chef
|
|
36
36
|
ui.color('Name', :bold),
|
37
37
|
ui.color('IPs', :bold),
|
38
38
|
ui.color('DHCP', :bold),
|
39
|
-
ui.color('
|
40
|
-
ui.color('
|
39
|
+
ui.color('LAN', :bold),
|
40
|
+
ui.color('Firewall Type', :bold),
|
41
|
+
ui.color('Device Number', :bold),
|
42
|
+
ui.color('PCI Slot', :bold),
|
41
43
|
]
|
42
44
|
|
43
|
-
nic_api = Ionoscloud::
|
45
|
+
nic_api = Ionoscloud::NetworkInterfacesApi.new(api_client)
|
44
46
|
|
45
47
|
nic_api.datacenters_servers_nics_get(config[:datacenter_id], config[:server_id], { depth: 1 }).items.each do |nic|
|
46
48
|
nic_list << nic.id
|
47
49
|
nic_list << nic.properties.name
|
48
50
|
nic_list << nic.properties.ips.to_s
|
49
51
|
nic_list << nic.properties.dhcp.to_s
|
50
|
-
nic_list << nic.properties.nat.to_s
|
51
52
|
nic_list << nic.properties.lan.to_s
|
53
|
+
nic_list << nic.properties.firewall_type.to_s
|
54
|
+
nic_list << nic.properties.device_number.to_s
|
55
|
+
nic_list << nic.properties.pci_slot.to_s
|
52
56
|
end
|
53
57
|
|
54
|
-
puts ui.list(nic_list, :uneven_columns_across,
|
58
|
+
puts ui.list(nic_list, :uneven_columns_across, 8)
|
55
59
|
end
|
56
60
|
end
|
57
61
|
end
|
@@ -0,0 +1,96 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudNicUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud nic update (options)'
|
9
|
+
|
10
|
+
option :datacenter_id,
|
11
|
+
short: '-D DATACENTER_ID',
|
12
|
+
long: '--datacenter-id DATACENTER_ID',
|
13
|
+
description: 'ID of the data center'
|
14
|
+
|
15
|
+
option :server_id,
|
16
|
+
short: '-S SERVER_ID',
|
17
|
+
long: '--server-id SERVER_ID',
|
18
|
+
description: 'The ID of the server to which the NIC is assigned'
|
19
|
+
|
20
|
+
option :nic_id,
|
21
|
+
short: '-N NIC_ID',
|
22
|
+
long: '--nic-id NIC_ID',
|
23
|
+
description: 'ID of the load balancer'
|
24
|
+
|
25
|
+
option :name,
|
26
|
+
short: '-n NAME',
|
27
|
+
long: '--name NAME',
|
28
|
+
description: 'Name of the NIC'
|
29
|
+
|
30
|
+
option :ips,
|
31
|
+
short: '-i IP[,IP,...]',
|
32
|
+
long: '--ips IP[,IP,...]',
|
33
|
+
description: 'IPs assigned to the NIC'
|
34
|
+
|
35
|
+
option :dhcp,
|
36
|
+
long: '--dhcp DHCP',
|
37
|
+
description: 'Set to false if you wish to disable DHCP'
|
38
|
+
|
39
|
+
option :lan,
|
40
|
+
short: '-l ID',
|
41
|
+
long: '--lan ID',
|
42
|
+
description: 'The LAN ID the NIC will reside on; if the LAN ID does not exist it will be created'
|
43
|
+
|
44
|
+
|
45
|
+
option :firewall_type,
|
46
|
+
short: '-t FIREWALL_TYPE',
|
47
|
+
long: '--firewall-type FIREWALL_TYPE',
|
48
|
+
description: 'The type of firewall rules that will be allowed on the NIC. If it is not specified it will take the '\
|
49
|
+
'default value INGRESS'
|
50
|
+
|
51
|
+
attr_reader :description, :required_options
|
52
|
+
|
53
|
+
def initialize(args = [])
|
54
|
+
super(args)
|
55
|
+
@description =
|
56
|
+
'Updates information about a Ionoscloud NIC.'
|
57
|
+
@required_options = [:datacenter_id, :server_id, :nic_id, :ionoscloud_username, :ionoscloud_password]
|
58
|
+
@updatable_fields = [:name, :ips, :dhcp, :lan, :nat]
|
59
|
+
end
|
60
|
+
|
61
|
+
def run
|
62
|
+
$stdout.sync = true
|
63
|
+
handle_extra_config
|
64
|
+
validate_required_params(@required_options, config)
|
65
|
+
|
66
|
+
config[:ips] = config[:ips].split(',') if config[:ips] && config[:ips].instance_of?(String)
|
67
|
+
|
68
|
+
nic_api = Ionoscloud::NetworkInterfacesApi.new(api_client)
|
69
|
+
|
70
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
71
|
+
print "#{ui.color('Updating NIC...', :magenta)}"
|
72
|
+
|
73
|
+
_, _, headers = nic_api.datacenters_servers_nics_patch_with_http_info(
|
74
|
+
config[:datacenter_id],
|
75
|
+
config[:server_id],
|
76
|
+
config[:nic_id],
|
77
|
+
Ionoscloud::NicProperties.new(
|
78
|
+
name: config[:name],
|
79
|
+
ips: config[:ips],
|
80
|
+
dhcp: (config.key?(:dhcp) ? config[:dhcp].to_s.downcase == 'true' : nil),
|
81
|
+
lan: config[:lan],
|
82
|
+
firewall_type: config[:firewall_type],
|
83
|
+
),
|
84
|
+
)
|
85
|
+
|
86
|
+
dot = ui.color('.', :magenta)
|
87
|
+
api_client.wait_for { print dot; is_done? get_request_id headers }
|
88
|
+
else
|
89
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
90
|
+
end
|
91
|
+
|
92
|
+
print_nic(nic_api.datacenters_servers_nics_find_by_id(config[:datacenter_id], config[:server_id], config[:nic_id]))
|
93
|
+
end
|
94
|
+
end
|
95
|
+
end
|
96
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudNodeGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud node get (options)'
|
9
|
+
|
10
|
+
option :cluster_id,
|
11
|
+
short: '-C CLUSTER_ID',
|
12
|
+
long: '--cluster-id CLUSTER_ID',
|
13
|
+
description: 'The ID of the K8s Cluster'
|
14
|
+
|
15
|
+
option :nodepool_id,
|
16
|
+
short: '-P NODEPOOL_ID',
|
17
|
+
long: '--nodepool-id NODEPOOL_ID',
|
18
|
+
description: 'The ID of the K8s Nodepool'
|
19
|
+
|
20
|
+
option :node_id,
|
21
|
+
short: '-N NODE_ID',
|
22
|
+
long: '--node-id NODE_ID',
|
23
|
+
description: 'ID of the load balancer'
|
24
|
+
|
25
|
+
attr_reader :description, :required_options
|
26
|
+
|
27
|
+
def initialize(args = [])
|
28
|
+
super(args)
|
29
|
+
@description =
|
30
|
+
'Retrieves the attributes of a given K8S Node.'
|
31
|
+
@required_options = [:cluster_id, :nodepool_id, :node_id, :ionoscloud_username, :ionoscloud_password]
|
32
|
+
end
|
33
|
+
|
34
|
+
def run
|
35
|
+
$stdout.sync = true
|
36
|
+
handle_extra_config
|
37
|
+
validate_required_params(@required_options, config)
|
38
|
+
|
39
|
+
print_k8s_node(
|
40
|
+
Ionoscloud::KubernetesApi.new(api_client).k8s_nodepools_nodes_find_by_id(
|
41
|
+
config[:cluster_id],
|
42
|
+
config[:nodepool_id],
|
43
|
+
config[:node_id],
|
44
|
+
),
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -91,6 +91,14 @@ class Chef
|
|
91
91
|
'must contain one extra IP than maximum number of nodes could be. (nodeCount+1 if fixed '\
|
92
92
|
'node amount or maxNodeCount+1 if auto scaling is used) The extra provided IP Will be used during rebuilding of nodes.'
|
93
93
|
|
94
|
+
option :labels,
|
95
|
+
long: '--labels LABEL [LABEL]',
|
96
|
+
description: 'map of labels attached to node pool'
|
97
|
+
|
98
|
+
option :annotations,
|
99
|
+
long: '--annotations ANNOTATION [ANNOTATION]',
|
100
|
+
description: 'map of annotations attached to node pool'
|
101
|
+
|
94
102
|
attr_reader :description, :required_options
|
95
103
|
|
96
104
|
def initialize(args = [])
|
@@ -115,59 +123,38 @@ class Chef
|
|
115
123
|
kubernetes_api = Ionoscloud::KubernetesApi.new(api_client)
|
116
124
|
|
117
125
|
config[:public_ips] = config[:public_ips].split(',') if config[:public_ips] && config[:public_ips].instance_of?(String)
|
126
|
+
config[:lans] = config[:lans].split(',') if config[:lans] && config[:lans].instance_of?(String)
|
127
|
+
config[:labels] = JSON[config[:labels]] if config[:labels] && config[:labels].instance_of?(String)
|
128
|
+
config[:annotations] = JSON[config[:annotations]] if config[:annotations] && config[:annotations].instance_of?(String)
|
118
129
|
|
119
130
|
nodepool_properties = {
|
120
131
|
name: config[:name],
|
121
|
-
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
132
|
+
k8s_version: config[:version],
|
133
|
+
datacenter_id: config[:datacenter_id],
|
134
|
+
node_count: config[:node_count],
|
135
|
+
cpu_family: config[:cpu_family],
|
136
|
+
cores_count: config[:cores],
|
137
|
+
ram_size: config[:ram],
|
138
|
+
availability_zone: config[:availability_zone],
|
139
|
+
storage_type: config[:storage_type],
|
140
|
+
storage_size: config[:storage_size],
|
141
|
+
public_ips: config[:public_ips],
|
142
|
+
labels: config[:labels],
|
143
|
+
annotations: config[:annotations],
|
144
|
+
lans: config.key?(:lans) ? config[:lans].map { |lan| { id: Integer(lan) } } : nil,
|
145
|
+
auto_scaling: Ionoscloud::KubernetesAutoScaling.new(
|
146
|
+
min_node_count: config[:min_node_count],
|
147
|
+
max_node_count: config[:max_node_count],
|
148
|
+
),
|
149
|
+
maintenance_window: (config.key?(:maintenance_day) || config.key?(:maintenance_time)) ? Ionoscloud::KubernetesMaintenanceWindow.new(
|
150
|
+
day_of_the_week: config[:maintenance_day],
|
151
|
+
time: config[:maintenance_time],
|
152
|
+
) : nil,
|
131
153
|
}
|
132
154
|
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
time: config[:maintenance_time],
|
137
|
-
}
|
138
|
-
end
|
139
|
-
|
140
|
-
if config[:min_node_count] || config[:max_node_count]
|
141
|
-
nodepool_properties[:autoScaling] = {}
|
142
|
-
nodepool_properties[:autoScaling][:minNodeCount] = config[:min_node_count] unless config[:min_node_count].nil?
|
143
|
-
nodepool_properties[:autoScaling][:maxNodeCount] = config[:max_node_count] unless config[:max_node_count].nil?
|
144
|
-
end
|
145
|
-
|
146
|
-
if config[:lans]
|
147
|
-
nodepool_properties[:lans] = config[:lans].split(',').map! { |lan| { id: Integer(lan) } }
|
148
|
-
end
|
149
|
-
|
150
|
-
nodepool = kubernetes_api.k8s_nodepools_post(config[:cluster_id], { properties: nodepool_properties })
|
151
|
-
|
152
|
-
auto_scaling = "Min node count: #{nodepool.properties.auto_scaling.min_node_count}, Max node count:#{nodepool.properties.auto_scaling.max_node_count}"
|
153
|
-
maintenance_window = "#{nodepool.properties.maintenance_window.day_of_the_week}, #{nodepool.properties.maintenance_window.time}"
|
154
|
-
|
155
|
-
puts "\n"
|
156
|
-
puts "#{ui.color('ID', :cyan)}: #{nodepool.id}"
|
157
|
-
puts "#{ui.color('Name', :cyan)}: #{nodepool.properties.name}"
|
158
|
-
puts "#{ui.color('K8s Version', :cyan)}: #{nodepool.properties.k8s_version}"
|
159
|
-
puts "#{ui.color('Datacenter ID', :cyan)}: #{nodepool.properties.datacenter_id}"
|
160
|
-
puts "#{ui.color('Node Count', :cyan)}: #{nodepool.properties.node_count}"
|
161
|
-
puts "#{ui.color('CPU Family', :cyan)}: #{nodepool.properties.cpu_family}"
|
162
|
-
puts "#{ui.color('Cores Count', :cyan)}: #{nodepool.properties.cores_count}"
|
163
|
-
puts "#{ui.color('RAM', :cyan)}: #{nodepool.properties.ram_size}"
|
164
|
-
puts "#{ui.color('Storage Type', :cyan)}: #{nodepool.properties.storage_type}"
|
165
|
-
puts "#{ui.color('Storage Size', :cyan)}: #{nodepool.properties.storage_size}"
|
166
|
-
puts "#{ui.color('Availability Zone', :cyan)}: #{nodepool.properties.availability_zone}"
|
167
|
-
puts "#{ui.color('Auto Scaling', :cyan)}: #{auto_scaling}"
|
168
|
-
puts "#{ui.color('Maintenance Window', :cyan)}: #{maintenance_window}"
|
169
|
-
puts "#{ui.color('State', :cyan)}: #{nodepool.metadata.state}"
|
170
|
-
puts 'done'
|
155
|
+
nodepool = Ionoscloud::KubernetesNodePool.new(properties: Ionoscloud::KubernetesNodePoolPropertiesForPost.new(nodepool_properties))
|
156
|
+
|
157
|
+
print_k8s_nodepool(kubernetes_api.k8s_nodepools_post(config[:cluster_id], nodepool))
|
171
158
|
end
|
172
159
|
end
|
173
160
|
end
|
@@ -37,13 +37,7 @@ class Chef
|
|
37
37
|
next
|
38
38
|
end
|
39
39
|
|
40
|
-
|
41
|
-
msg_pair('Name', nodepool.properties.name)
|
42
|
-
msg_pair('K8s Version', nodepool.properties.k8s_version)
|
43
|
-
msg_pair('Datacenter ID', nodepool.properties.datacenter_id)
|
44
|
-
msg_pair('Node Count', nodepool.properties.node_count)
|
45
|
-
msg_pair('State', nodepool.metadata.state)
|
46
|
-
|
40
|
+
print_k8s_nodepool(nodepool)
|
47
41
|
puts "\n"
|
48
42
|
|
49
43
|
begin
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudNodepoolGet < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud nodepool get (options)'
|
9
|
+
|
10
|
+
option :cluster_id,
|
11
|
+
short: '-C CLUSTER_ID',
|
12
|
+
long: '--cluster-id CLUSTER_ID',
|
13
|
+
description: 'The ID of the K8s Cluster'
|
14
|
+
|
15
|
+
option :nodepool_id,
|
16
|
+
short: '-P NODEPOOL_ID',
|
17
|
+
long: '--nodepool-id NODEPOOL_ID',
|
18
|
+
description: 'The ID of the K8s Nodepool'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
'Retrieves the attributes of a given K8S Nodepool.'
|
26
|
+
@required_options = [:cluster_id, :nodepool_id, :ionoscloud_username, :ionoscloud_password]
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
$stdout.sync = true
|
31
|
+
handle_extra_config
|
32
|
+
validate_required_params(@required_options, config)
|
33
|
+
|
34
|
+
print_k8s_nodepool(
|
35
|
+
Ionoscloud::KubernetesApi.new(api_client).k8s_nodepools_find_by_id(
|
36
|
+
config[:cluster_id],
|
37
|
+
config[:nodepool_id],
|
38
|
+
),
|
39
|
+
)
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,104 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudNodepoolLanAdd < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud nodepool lan add (options)'
|
9
|
+
|
10
|
+
option :cluster_id,
|
11
|
+
short: '-C CLUSTER_ID',
|
12
|
+
long: '--cluster-id CLUSTER_ID',
|
13
|
+
description: 'ID of the Kubernetes cluster'
|
14
|
+
|
15
|
+
option :nodepool_id,
|
16
|
+
short: '-N NODEPOOL_ID',
|
17
|
+
long: '--nodepool NODEPOOL_ID',
|
18
|
+
description: 'The ID of the K8s Nodepool'
|
19
|
+
|
20
|
+
option :lan_id,
|
21
|
+
short: '-L LAN_ID',
|
22
|
+
long: '--lan LAN_ID',
|
23
|
+
description: 'The ID of the LAN'
|
24
|
+
|
25
|
+
option :no_dhcp,
|
26
|
+
long: '--nodhcp',
|
27
|
+
boolean: true,
|
28
|
+
default: false,
|
29
|
+
description: 'Indicates if the Kubernetes Node Pool LAN will reserve an IP using DHCP'
|
30
|
+
|
31
|
+
option :routes,
|
32
|
+
long: '--routes NETWORK,GATEWAY_IP [NETWORK,GATEWAY_IP]',
|
33
|
+
description: 'An array of additional LANs attached to worker nodes'
|
34
|
+
|
35
|
+
attr_reader :description, :required_options
|
36
|
+
|
37
|
+
def initialize(args = [])
|
38
|
+
super(args)
|
39
|
+
@description =
|
40
|
+
'Adds or updates a LAN within a Nodepool.'
|
41
|
+
@required_options = [:cluster_id, :nodepool_id, :lan_id, :ionoscloud_username, :ionoscloud_password]
|
42
|
+
end
|
43
|
+
|
44
|
+
def run
|
45
|
+
$stdout.sync = true
|
46
|
+
handle_extra_config
|
47
|
+
validate_required_params(@required_options, config)
|
48
|
+
|
49
|
+
kubernetes_api = Ionoscloud::KubernetesApi.new(api_client)
|
50
|
+
|
51
|
+
begin
|
52
|
+
nodepool = kubernetes_api.k8s_nodepools_find_by_id(config[:cluster_id], config[:nodepool_id])
|
53
|
+
rescue Ionoscloud::ApiError => err
|
54
|
+
raise err unless err.code == 404
|
55
|
+
ui.error("Nodepool ID #{config[:nodepool_id]} not found.")
|
56
|
+
exit(1)
|
57
|
+
end
|
58
|
+
|
59
|
+
routes = []
|
60
|
+
config[:routes] = config[:routes].split(',') if config[:routes] && config[:routes].instance_of?(String)
|
61
|
+
config[:routes].each_slice(2) do |network, gateway_ip|
|
62
|
+
routes << Ionoscloud::KubernetesNodePoolLanRoutes.new(
|
63
|
+
network: network,
|
64
|
+
gateway_ip: gateway_ip,
|
65
|
+
)
|
66
|
+
end
|
67
|
+
|
68
|
+
new_lan = Ionoscloud::KubernetesNodePoolLan.new(
|
69
|
+
id: Integer(config[:lan_id]),
|
70
|
+
dhcp: !config[:no_dhcp],
|
71
|
+
routes: routes,
|
72
|
+
)
|
73
|
+
|
74
|
+
existing = nodepool.properties.lans.select { |lan| lan.id == new_lan.id }
|
75
|
+
|
76
|
+
new_nodepool = Ionoscloud::KubernetesNodePool.new(
|
77
|
+
properties: Ionoscloud::KubernetesNodePoolPropertiesForPut.new(
|
78
|
+
node_count: nodepool.properties.node_count,
|
79
|
+
k8s_version: nodepool.properties.k8s_version,
|
80
|
+
maintenance_window: nodepool.properties.maintenance_window,
|
81
|
+
auto_scaling: nodepool.properties.auto_scaling,
|
82
|
+
public_ips: nodepool.properties.public_ips,
|
83
|
+
lans: nodepool.properties.lans,
|
84
|
+
),
|
85
|
+
)
|
86
|
+
|
87
|
+
new_nodepool.properties.lans = new_nodepool.properties.lans.delete_if { |lan| lan.id == new_lan.id }
|
88
|
+
new_nodepool.properties.lans << new_lan
|
89
|
+
|
90
|
+
nodepool = kubernetes_api.k8s_nodepools_put(
|
91
|
+
config[:cluster_id], config[:nodepool_id], new_nodepool,
|
92
|
+
)
|
93
|
+
|
94
|
+
if existing.length > 0
|
95
|
+
ui.info("Updating Lan #{config[:lan_id]} in the Nodepoool.")
|
96
|
+
else
|
97
|
+
ui.info("Adding Lan #{config[:lan_id]} to the Nodepoool.")
|
98
|
+
end
|
99
|
+
|
100
|
+
print_k8s_nodepool(nodepool)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudNodepoolLanRemove < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud nodepool lan remove LAN_ID [LAN_ID] (options)'
|
9
|
+
|
10
|
+
option :cluster_id,
|
11
|
+
short: '-C CLUSTER_ID',
|
12
|
+
long: '--cluster-id CLUSTER_ID',
|
13
|
+
description: 'ID of the Kubernetes cluster'
|
14
|
+
|
15
|
+
option :nodepool_id,
|
16
|
+
short: '-N NODEPOOL_ID',
|
17
|
+
long: '--nodepool NODEPOOL_ID',
|
18
|
+
description: 'The ID of the K8s Nodepool'
|
19
|
+
|
20
|
+
attr_reader :description, :required_options
|
21
|
+
|
22
|
+
def initialize(args = [])
|
23
|
+
super(args)
|
24
|
+
@description =
|
25
|
+
'Adds or updates a LAN within a Nodepool.'
|
26
|
+
@required_options = [:cluster_id, :nodepool_id, :ionoscloud_username, :ionoscloud_password]
|
27
|
+
end
|
28
|
+
|
29
|
+
def run
|
30
|
+
$stdout.sync = true
|
31
|
+
handle_extra_config
|
32
|
+
validate_required_params(@required_options, config)
|
33
|
+
|
34
|
+
kubernetes_api = Ionoscloud::KubernetesApi.new(api_client)
|
35
|
+
|
36
|
+
begin
|
37
|
+
nodepool = kubernetes_api.k8s_nodepools_find_by_id(config[:cluster_id], config[:nodepool_id])
|
38
|
+
rescue Ionoscloud::ApiError => err
|
39
|
+
raise err unless err.code == 404
|
40
|
+
ui.error("Nodepool ID #{config[:nodepool_id]} not found.")
|
41
|
+
exit(1)
|
42
|
+
end
|
43
|
+
|
44
|
+
existing = nodepool.properties.lans.select { |lan| @name_args.map { |id| Integer(id) }.include? lan.id }
|
45
|
+
|
46
|
+
if existing.length > 0
|
47
|
+
new_nodepool = Ionoscloud::KubernetesNodePool.new(
|
48
|
+
properties: Ionoscloud::KubernetesNodePoolPropertiesForPut.new(
|
49
|
+
node_count: nodepool.properties.node_count,
|
50
|
+
k8s_version: nodepool.properties.k8s_version,
|
51
|
+
maintenance_window: nodepool.properties.maintenance_window,
|
52
|
+
auto_scaling: nodepool.properties.auto_scaling,
|
53
|
+
public_ips: nodepool.properties.public_ips,
|
54
|
+
lans: nodepool.properties.lans,
|
55
|
+
),
|
56
|
+
)
|
57
|
+
new_nodepool.properties.lans.delete_if { |lan| @name_args.map { |id| Integer(id) }.include? lan.id }
|
58
|
+
|
59
|
+
nodepool = kubernetes_api.k8s_nodepools_put(
|
60
|
+
config[:cluster_id], config[:nodepool_id], new_nodepool,
|
61
|
+
)
|
62
|
+
|
63
|
+
ui.info("Removing Lans #{@name_args} from the Nodepoool.")
|
64
|
+
else
|
65
|
+
ui.info("None of the specified Lan IDs (#{@name_args}) are present on the Nodepoool.")
|
66
|
+
end
|
67
|
+
|
68
|
+
print_k8s_nodepool(nodepool)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -32,6 +32,7 @@ class Chef
|
|
32
32
|
ui.color('K8s Version', :bold),
|
33
33
|
ui.color('Datacenter ID', :bold),
|
34
34
|
ui.color('Node Count', :bold),
|
35
|
+
ui.color('Lan Count', :bold),
|
35
36
|
ui.color('State', :bold),
|
36
37
|
]
|
37
38
|
|
@@ -43,9 +44,10 @@ class Chef
|
|
43
44
|
nodepool_list << nodepool.properties.k8s_version
|
44
45
|
nodepool_list << nodepool.properties.datacenter_id
|
45
46
|
nodepool_list << nodepool.properties.node_count.to_s
|
47
|
+
nodepool_list << nodepool.properties.lans.length
|
46
48
|
nodepool_list << nodepool.metadata.state
|
47
49
|
end
|
48
|
-
puts ui.list(nodepool_list, :uneven_columns_across,
|
50
|
+
puts ui.list(nodepool_list, :uneven_columns_across, 7)
|
49
51
|
end
|
50
52
|
end
|
51
53
|
end
|
@@ -0,0 +1,124 @@
|
|
1
|
+
require_relative 'ionoscloud_base'
|
2
|
+
|
3
|
+
class Chef
|
4
|
+
class Knife
|
5
|
+
class IonoscloudNodepoolUpdate < Knife
|
6
|
+
include Knife::IonoscloudBase
|
7
|
+
|
8
|
+
banner 'knife ionoscloud nodepool update (options)'
|
9
|
+
|
10
|
+
option :cluster_id,
|
11
|
+
short: '-C CLUSTER_ID',
|
12
|
+
long: '--cluster-id CLUSTER_ID',
|
13
|
+
description: 'ID of the Kubernetes cluster'
|
14
|
+
|
15
|
+
option :nodepool_id,
|
16
|
+
short: '-P NODEPOOL_ID',
|
17
|
+
long: '--nodepool-id NODEPOOL_ID',
|
18
|
+
description: 'ID of the Kubernetes nodepool'
|
19
|
+
|
20
|
+
option :k8s_version,
|
21
|
+
short: '-v VERSION',
|
22
|
+
long: '--version VERSION',
|
23
|
+
description: 'The version for the Kubernetes cluster.'
|
24
|
+
|
25
|
+
option :maintenance_day,
|
26
|
+
long: '--maintenance-day MAINTENANCE_DAY',
|
27
|
+
description: 'Day Of the week when to perform the maintenance.'
|
28
|
+
|
29
|
+
option :maintenance_time,
|
30
|
+
short: '-t MAINTENANCE_TIME',
|
31
|
+
long: '--maintenance-time MAINTENANCE_TIME',
|
32
|
+
description: 'Time Of the day when to perform the maintenance.'
|
33
|
+
|
34
|
+
option :node_count,
|
35
|
+
short: '-c NODE_COUNT',
|
36
|
+
long: '--node-count NODE_COUNT',
|
37
|
+
description: 'The number of worker nodes that the node pool should contain. Min 2, Max: Determined by the resource availability.'
|
38
|
+
|
39
|
+
option :min_node_count,
|
40
|
+
long: '--min-node-count MIN_NODE_COUNT',
|
41
|
+
description: 'The minimum number of worker nodes that the managed node group can scale in'
|
42
|
+
|
43
|
+
option :max_node_count,
|
44
|
+
long: '--max-node-count MAX_NODE_COUNT',
|
45
|
+
description: 'The maximum number of worker nodes that the managed node pool can scale-out.'
|
46
|
+
|
47
|
+
option :lans,
|
48
|
+
long: '--lans LAN_ID [LAN_ID]',
|
49
|
+
description: 'An array of additional private LANs attached to worker nodes'
|
50
|
+
|
51
|
+
option :public_ips,
|
52
|
+
long: '--ips PUBLIC_IP [PUBLIC_IP]',
|
53
|
+
description: 'Optional array of reserved public IP addresses to be used by the nodes. '\
|
54
|
+
'IPs must be from same location as the data center used for the node pool. The array '\
|
55
|
+
'must contain one extra IP than maximum number of nodes could be. (nodeCount+1 if fixed '\
|
56
|
+
'node amount or maxNodeCount+1 if auto scaling is used) The extra provided IP Will be used during rebuilding of nodes.'
|
57
|
+
|
58
|
+
option :labels,
|
59
|
+
long: '--labels LABEL [LABEL]',
|
60
|
+
description: 'map of labels attached to node pool'
|
61
|
+
|
62
|
+
option :annotations,
|
63
|
+
long: '--annotations ANNOTATION [ANNOTATION]',
|
64
|
+
description: 'map of annotations attached to node pool'
|
65
|
+
|
66
|
+
attr_reader :description, :required_options
|
67
|
+
|
68
|
+
def initialize(args = [])
|
69
|
+
super(args)
|
70
|
+
@description =
|
71
|
+
'Updates information about a Ionoscloud K8s Nodepool.'
|
72
|
+
@required_options = [:cluster_id, :nodepool_id, :ionoscloud_username, :ionoscloud_password]
|
73
|
+
@updatable_fields = [
|
74
|
+
:k8s_version, :node_count, :public_ips, :lans, :maintenance_day, :maintenance_time,
|
75
|
+
:min_node_count, :max_node_count, :labels, :annotations,
|
76
|
+
]
|
77
|
+
end
|
78
|
+
|
79
|
+
def run
|
80
|
+
$stdout.sync = true
|
81
|
+
handle_extra_config
|
82
|
+
validate_required_params(@required_options, config)
|
83
|
+
|
84
|
+
config[:public_ips] = config[:public_ips].split(',') if config[:public_ips] && config[:public_ips].instance_of?(String)
|
85
|
+
config[:lans] = config[:lans].split(',') if config[:lans] && config[:lans].instance_of?(String)
|
86
|
+
config[:labels] = JSON[config[:labels]] if config[:labels] && config[:labels].instance_of?(String)
|
87
|
+
config[:annotations] = JSON[config[:annotations]] if config[:annotations] && config[:annotations].instance_of?(String)
|
88
|
+
|
89
|
+
kubernetes_api = Ionoscloud::KubernetesApi.new(api_client)
|
90
|
+
|
91
|
+
if @updatable_fields.map { |el| config[el] }.any?
|
92
|
+
print "#{ui.color('Updating K8s Nodepool...', :magenta)}"
|
93
|
+
|
94
|
+
nodepool = kubernetes_api.k8s_nodepools_find_by_id(config[:cluster_id], config[:nodepool_id])
|
95
|
+
|
96
|
+
new_nodepool = Ionoscloud::KubernetesNodePoolForPut.new(
|
97
|
+
properties: Ionoscloud::KubernetesNodePoolPropertiesForPut.new(
|
98
|
+
k8s_version: config.key?(:k8s_version) ? config[:k8s_version] : nodepool.properties.k8s_version,
|
99
|
+
node_count: config.key?(:node_count) ? config[:node_count] : nodepool.properties.node_count,
|
100
|
+
public_ips: config.key?(:public_ips) ? config[:public_ips] : nodepool.properties.public_ips,
|
101
|
+
labels: config.key?(:labels) ? config[:labels] : nodepool.properties.labels,
|
102
|
+
annotations: config.key?(:annotations) ? config[:annotations] : nodepool.properties.annotations,
|
103
|
+
lans: config.key?(:lans) ? config[:lans].map! { |lan| { id: Integer(lan) } } : nodepool.properties.lans,
|
104
|
+
maintenance_window: Ionoscloud::KubernetesMaintenanceWindow.new(
|
105
|
+
day_of_the_week: config.key?(:maintenance_day) ? config[:maintenance_day] : nodepool.properties.maintenance_window.day_of_the_week,
|
106
|
+
time: config.key?(:maintenance_time) ? config[:maintenance_time] : nodepool.properties.maintenance_window.time,
|
107
|
+
),
|
108
|
+
auto_scaling: Ionoscloud::KubernetesAutoScaling.new(
|
109
|
+
min_node_count: config.key?(:min_node_count) ? config[:min_node_count] : nodepool.properties.auto_scaling.min_node_count,
|
110
|
+
max_node_count: config.key?(:max_node_count) ? config[:max_node_count] : nodepool.properties.auto_scaling.max_node_count,
|
111
|
+
),
|
112
|
+
),
|
113
|
+
)
|
114
|
+
|
115
|
+
kubernetes_api.k8s_nodepools_put(config[:cluster_id], config[:nodepool_id], new_nodepool)
|
116
|
+
else
|
117
|
+
ui.warn("Nothing to update, please set one of the attributes #{@updatable_fields}.")
|
118
|
+
end
|
119
|
+
|
120
|
+
print_k8s_nodepool(kubernetes_api.k8s_nodepools_find_by_id(config[:cluster_id], config[:nodepool_id]))
|
121
|
+
end
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|