Skip to content
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

feat(k8s): add ACLs #4006

Merged
merged 1 commit into from
Jul 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions cmd/scw/testdata/test-all-usage-k8s-acl-usage.golden
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
🎲🎲🎲 EXIT CODE: 0 🎲🎲🎲
🟥🟥🟥 STDERR️️ 🟥🟥🟥️
Network Access Control Lists (ACLs) allow you to manage inbound network traffic by setting up ACL rules.

USAGE:
scw k8s acl

FLAGS:
-h, --help help for acl

GLOBAL FLAGS:
-c, --config string The path to the config file
-D, --debug Enable debug mode
-o, --output string Output format: json or human, see 'scw help output' for more info (default "human")
-p, --profile string The config profile to use
1 change: 1 addition & 0 deletions cmd/scw/testdata/test-all-usage-k8s-usage.golden
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ USAGE:
scw k8s <command>

AVAILABLE COMMANDS:
acl Access Control List (ACL) management commands
cluster Kapsule cluster management commands
cluster-type Cluster type management commands
kubeconfig Manage your Kubernetes Kapsule cluster's kubeconfig files
Expand Down
15 changes: 15 additions & 0 deletions docs/commands/k8s.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Documentation for `scw k8s`
This API allows you to manage Kubernetes Kapsule and Kosmos clusters.

- [Access Control List (ACL) management commands](#access-control-list-(acl)-management-commands)
- [Kapsule cluster management commands](#kapsule-cluster-management-commands)
- [Create a new Cluster](#create-a-new-cluster)
- [Delete a Cluster](#delete-a-cluster)
Expand Down Expand Up @@ -40,6 +41,20 @@ This API allows you to manage Kubernetes Kapsule and Kosmos clusters.
- [List all available Versions](#list-all-available-versions)


## Access Control List (ACL) management commands

Network Access Control Lists (ACLs) allow you to manage inbound network traffic by setting up ACL rules.

Network Access Control Lists (ACLs) allow you to manage inbound network traffic by setting up ACL rules.

**Usage:**

```
scw k8s acl
```



## Kapsule cluster management commands

A cluster is a fully managed Kubernetes cluster
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ require (
github.com/mattn/go-isatty v0.0.20
github.com/moby/buildkit v0.13.2
github.com/opencontainers/go-digest v1.0.0
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29.0.20240725041911-1cd5fcfaf214
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29.0.20240725100043-c4e7d505fef5
github.com/skratchdot/open-golang v0.0.0-20200116055534-eef842397966
github.com/spf13/cobra v1.8.1
github.com/spf13/pflag v1.0.5
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -463,8 +463,8 @@ github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUz
github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06 h1:OkMGxebDjyw0ULyrTYWeN0UNCCkmCWfjPnIA2W6oviI=
github.com/sabhiram/go-gitignore v0.0.0-20210923224102-525f6e181f06/go.mod h1:+ePHsJ1keEjQtpvf9HHw0f4ZeJ0TLRsxhunSI2hYJSs=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29.0.20240725041911-1cd5fcfaf214 h1:OvbLG2G2BmPcxjarPKe/6dC17INl7SSr6q8f11tT0ho=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29.0.20240725041911-1cd5fcfaf214/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29.0.20240725100043-c4e7d505fef5 h1:4QeufrUuqSmaDRLyEUAk6bLrARCruhfxWL5kVr0VVg8=
github.com/scaleway/scaleway-sdk-go v1.0.0-beta.29.0.20240725100043-c4e7d505fef5/go.mod h1:fCa7OJZ/9DRTnOKmxvT6pn+LPWUptQAmHF/SBJUGEcg=
github.com/sclevine/spec v1.4.0 h1:z/Q9idDcay5m5irkZ28M7PtQM4aOISzOpj4bUPkDee8=
github.com/sclevine/spec v1.4.0/go.mod h1:LvpgJaFyvQzRvc1kaDs0bulYwzC70PbiYjC4QnFHkOM=
github.com/secure-systems-lab/go-securesystemslib v0.8.0 h1:mr5An6X45Kb2nddcFlbmfHkLguCE9laoZCUzEEpIZXA=
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Bootscript x86_64 mainline 4.4.230 rev1
BootType local
Volumes.0.ID 08424d6f-cf09-4498-94b5-042ef6eb38f1
Volumes.0.Name Ubuntu Jammy GPU OS 12 passthrough
Volumes.0.ExportURI -
Volumes.0.Organization ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b
Volumes.0.Server.ID 475ad734-23b2-4f8d-b5be-6d08cc547079
Volumes.0.Server.Name cli-srv-dazzling-einstein
Expand All @@ -65,7 +64,6 @@ Volumes.0.Boot false
Volumes.0.Zone fr-par-2
Volumes.1.ID 318bd18f-ef0c-4595-825b-097757fdf331
Volumes.1.Name default-cli-scratch-volume
Volumes.1.ExportURI -
Volumes.1.Organization ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b
Volumes.1.Server.ID 475ad734-23b2-4f8d-b5be-6d08cc547079
Volumes.1.Server.Name cli-srv-dazzling-einstein
Expand Down Expand Up @@ -173,7 +171,7 @@ Zone fr-par-2
"0": {
"id": "08424d6f-cf09-4498-94b5-042ef6eb38f1",
"name": "Ubuntu Jammy GPU OS 12 passthrough",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "475ad734-23b2-4f8d-b5be-6d08cc547079",
Expand All @@ -191,7 +189,7 @@ Zone fr-par-2
"1": {
"id": "318bd18f-ef0c-4595-825b-097757fdf331",
"name": "default-cli-scratch-volume",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "475ad734-23b2-4f8d-b5be-6d08cc547079",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Bootscript x86_64 mainline 4.4.230 rev1
BootType local
Volumes.0.ID b2a541e6-cd3a-418d-9cb2-c3e10ae4b3f3
Volumes.0.Name Ubuntu 22.04 Jammy Jellyfish
Volumes.0.ExportURI -
Volumes.0.Organization ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b
Volumes.0.Server.ID 3aafe9b5-d477-4eb3-b7b0-9c8777302878
Volumes.0.Server.Name cli-srv-dreamy-haslett
Expand Down Expand Up @@ -159,7 +158,7 @@ Zone fr-par-1
"0": {
"id": "b2a541e6-cd3a-418d-9cb2-c3e10ae4b3f3",
"name": "Ubuntu 22.04 Jammy Jellyfish",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "3aafe9b5-d477-4eb3-b7b0-9c8777302878",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ ID MAC ADDRESS PRIVATE NETWORK NAME PRIVATE NETWORK ID
"0": {
"id": "a6abb479-db47-4429-900f-b0ce63e3c6f3",
"name": "Ubuntu 18.04 Bionic Beaver",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "75b0d534-42c9-4d62-862f-27aa7efebc6b",
Expand Down Expand Up @@ -184,7 +184,7 @@ ID MAC ADDRESS PRIVATE NETWORK NAME PRIVATE NETWORK ID
{
"id": "a6abb479-db47-4429-900f-b0ce63e3c6f3",
"name": "Ubuntu 18.04 Bionic Beaver",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "75b0d534-42c9-4d62-862f-27aa7efebc6b",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Bootscript x86_64 mainline 4.4.230 rev1
BootType local
Volumes.0.ID 2c0392b4-a294-46d8-a393-39f4bfacf77f
Volumes.0.Name Ubuntu 22.04 Jammy Jellyfish
Volumes.0.ExportURI -
Volumes.0.Organization ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b
Volumes.0.Server.ID 41687115-b01c-4ebd-a78e-695a01433a77
Volumes.0.Server.Name cli-srv-youthful-lederberg
Expand Down Expand Up @@ -172,7 +171,7 @@ Zone fr-par-1
"0": {
"id": "2c0392b4-a294-46d8-a393-39f4bfacf77f",
"name": "Ubuntu 22.04 Jammy Jellyfish",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "41687115-b01c-4ebd-a78e-695a01433a77",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ Bootscript x86_64 mainline 4.4.230 rev1
BootType local
Volumes.0.ID 8c935774-18e4-4747-8765-820399eaaab8
Volumes.0.Name Ubuntu 22.04 Jammy Jellyfish
Volumes.0.ExportURI -
Volumes.0.Organization ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b
Volumes.0.Server.ID 1ffc7827-8cdc-48b9-a203-860a05499050
Volumes.0.Server.Name cli-srv-condescending-faraday
Expand Down Expand Up @@ -172,7 +171,7 @@ Zone fr-par-3
"0": {
"id": "8c935774-18e4-4747-8765-820399eaaab8",
"name": "Ubuntu 22.04 Jammy Jellyfish",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "1ffc7827-8cdc-48b9-a203-860a05499050",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ Server.Bootscript x86_64 mainline 4.4.230 rev1
Server.BootType local
Server.Volumes.0.ID 5af49971-524e-4cc5-9919-55824de6a87b
Server.Volumes.0.Name Ubuntu 18.04 Bionic Beaver
Server.Volumes.0.ExportURI -
Server.Volumes.0.Organization ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b
Server.Volumes.0.Server.ID a3be4ab5-651a-4136-9a41-ec47da2ca7d2
Server.Volumes.0.Server.Name cli-srv-epic-cohen
Expand Down Expand Up @@ -160,7 +159,7 @@ Server.Zone fr-par-1
"0": {
"id": "5af49971-524e-4cc5-9919-55824de6a87b",
"name": "Ubuntu 18.04 Bionic Beaver",
"export_uri": "",
"export_uri": null,
"organization": "ee7bd9e1-9cbd-4724-b2f4-19e50f3cf38b",
"server": {
"id": "a3be4ab5-651a-4136-9a41-ec47da2ca7d2",
Expand Down
10 changes: 10 additions & 0 deletions internal/namespaces/k8s/v1/k8s_cli.go
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ func GetGeneratedCommands() *core.Commands {
k8sNode(),
k8sVersion(),
k8sClusterType(),
k8sACL(),
k8sClusterList(),
k8sClusterCreate(),
k8sClusterGet(),
Expand Down Expand Up @@ -109,6 +110,15 @@ A cluster type represents the different commercial types of clusters offered by
}
}

func k8sACL() *core.Command {
return &core.Command{
Short: `Access Control List (ACL) management commands`,
Long: `Network Access Control Lists (ACLs) allow you to manage inbound network traffic by setting up ACL rules.`,
Namespace: "k8s",
Resource: "acl",
}
}

func k8sClusterList() *core.Command {
return &core.Command{
Short: `List Clusters`,
Expand Down
Loading