Skip to content

Commit

Permalink
Add Kubernetes access section to the role editor (#47674)
Browse files Browse the repository at this point in the history
* Add Kubernetes access section to the role editor

* Review

* Update the k8s operator docs

This also removes the mention of valid values of the Kind field, as I don't
want the external documentation to point to Teleport source files.

* Update operator CRDs and Terraform resources
  • Loading branch information
bl-nero authored Oct 24, 2024
1 parent fbbcb5f commit ae2b549
Show file tree
Hide file tree
Showing 20 changed files with 769 additions and 82 deletions.
1 change: 0 additions & 1 deletion api/proto/teleport/legacy/types/types.proto
Original file line number Diff line number Diff line change
Expand Up @@ -3320,7 +3320,6 @@ message DatabasePermission {
// KubernetesResource is the Kubernetes resource identifier.
message KubernetesResource {
// Kind specifies the Kubernetes Resource type.
// At the moment only "pod" is supported.
string Kind = 1 [(gogoproto.jsontag) = "kind,omitempty"];
// Namespace is the resource namespace.
// It supports wildcards.
Expand Down
14 changes: 13 additions & 1 deletion api/types/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -1270,7 +1270,14 @@ var RequestableResourceKinds = []string{
KindSAMLIdPServiceProvider,
}

// KubernetesResourcesKinds lists the supported Kubernetes resource kinds.
// The list below needs to be kept in sync with `kubernetesResourceKindOptions`
// in `web/packages/teleport/src/Roles/RoleEditor/standardmodel.ts`. (Keeping
// this comment separate to prevent it from being included in the official
// package docs.)

// KubernetesResourcesKinds lists the supported Kubernetes resource kinds. This
// is for the latest version of Role resources; roles whose version is set to
// v6 or prior only support [KindKubePod].
var KubernetesResourcesKinds = []string{
KindKubePod,
KindKubeSecret,
Expand Down Expand Up @@ -1318,6 +1325,11 @@ const (
KubeVerbPortForward = "portforward"
)

// The list below needs to be kept in sync with `kubernetesResourceVerbOptions`
// in `web/packages/teleport/src/Roles/RoleEditor/standardmodel.ts`. (Keeping
// this comment separate to prevent it from being included in the official
// package docs.)

// KubernetesVerbs lists the supported Kubernetes verbs.
var KubernetesVerbs = []string{
Wildcard,
Expand Down
1 change: 0 additions & 1 deletion api/types/types.pb.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down Expand Up @@ -267,7 +267,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down Expand Up @@ -508,7 +508,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down Expand Up @@ -666,7 +666,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down Expand Up @@ -267,7 +267,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down Expand Up @@ -267,7 +267,7 @@ resource, which you can apply after installing the Teleport Kubernetes operator.

|Field|Type|Description|
|---|---|---|
|kind|string|Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.|
|kind|string|Kind specifies the Kubernetes Resource type.|
|name|string|Name is the resource name. It supports wildcards.|
|namespace|string|Namespace is the resource namespace. It supports wildcards.|
|verbs|[]string|Verbs are the allowed Kubernetes verbs for the following resource.|
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/reference/terraform-provider/data-sources/role.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ Optional:

Optional:

- `kind` (String) Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.
- `kind` (String) Kind specifies the Kubernetes Resource type.
- `name` (String) Name is the resource name. It supports wildcards.
- `namespace` (String) Namespace is the resource namespace. It supports wildcards.
- `verbs` (List of String) Verbs are the allowed Kubernetes verbs for the following resource.
Expand Down Expand Up @@ -299,7 +299,7 @@ Optional:

Optional:

- `kind` (String) Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.
- `kind` (String) Kind specifies the Kubernetes Resource type.
- `name` (String) Name is the resource name. It supports wildcards.
- `namespace` (String) Namespace is the resource namespace. It supports wildcards.
- `verbs` (List of String) Verbs are the allowed Kubernetes verbs for the following resource.
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/reference/terraform-provider/resources/role.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ Optional:

Optional:

- `kind` (String) Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.
- `kind` (String) Kind specifies the Kubernetes Resource type.
- `name` (String) Name is the resource name. It supports wildcards.
- `namespace` (String) Namespace is the resource namespace. It supports wildcards.
- `verbs` (List of String) Verbs are the allowed Kubernetes verbs for the following resource.
Expand Down Expand Up @@ -353,7 +353,7 @@ Optional:

Optional:

- `kind` (String) Kind specifies the Kubernetes Resource type. At the moment only "pod" is supported.
- `kind` (String) Kind specifies the Kubernetes Resource type.
- `name` (String) Name is the resource name. It supports wildcards.
- `namespace` (String) Namespace is the resource namespace. It supports wildcards.
- `verbs` (List of String) Verbs are the allowed Kubernetes verbs for the following resource.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -797,7 +796,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -1613,7 +1611,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -2150,7 +2147,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -800,7 +799,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -800,7 +799,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -797,7 +796,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -1613,7 +1611,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -2150,7 +2147,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -800,7 +799,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down Expand Up @@ -800,7 +799,6 @@ spec:
properties:
kind:
description: Kind specifies the Kubernetes Resource type.
At the moment only "pod" is supported.
type: string
name:
description: Name is the resource name. It supports wildcards.
Expand Down
4 changes: 2 additions & 2 deletions integrations/terraform/tfschema/types_terraform.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit ae2b549

Please sign in to comment.