Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,18 @@ spec:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate
delivery.
Expand All @@ -3101,6 +3113,7 @@ spec:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3082,6 +3082,18 @@ spec:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate
delivery.
Expand All @@ -3101,6 +3113,7 @@ spec:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3102,6 +3102,18 @@ spec:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate
delivery.
Expand All @@ -3121,6 +3133,7 @@ spec:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
13 changes: 13 additions & 0 deletions app/kumactl/cmd/install/testdata/install-crds.all.golden.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5195,6 +5195,18 @@ spec:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate
delivery.
Expand All @@ -5214,6 +5226,7 @@ spec:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
13 changes: 13 additions & 0 deletions deployments/charts/kuma/crds/kuma.io_meshidentities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ spec:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate
delivery.
Expand All @@ -198,6 +210,7 @@ spec:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
13 changes: 13 additions & 0 deletions docs/generated/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18032,6 +18032,18 @@ components:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate delivery.
properties:
Expand All @@ -18052,6 +18064,7 @@ components:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
13 changes: 13 additions & 0 deletions docs/generated/raw/crds/kuma.io_meshidentities.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,18 @@ spec:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate
delivery.
Expand All @@ -198,6 +210,7 @@ spec:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
package v1alpha1

import (
apiextensionsv1 "k8s.io/apiextensions-apiserver/pkg/apis/apiextensions/v1"
k8s "k8s.io/apimachinery/pkg/apis/meta/v1"

common_api "github.com/kumahq/kuma/v2/api/common/v1alpha1"
Expand Down Expand Up @@ -30,12 +31,13 @@ type SpiffeID struct {
Path *string `json:"path,omitempty"`
}

// +kubebuilder:validation:Enum=Bundled;Spire
// +kubebuilder:validation:Enum=Bundled;Spire;Extension
type ProviderType string

const (
BundledType ProviderType = "Bundled"
SpireType ProviderType = "Spire"
BundledType ProviderType = "Bundled"
ExtensionType ProviderType = "Extension"
SpireType ProviderType = "Spire"
)

type Provider struct {
Expand All @@ -48,6 +50,8 @@ type Provider struct {
Bundled *Bundled `json:"bundled,omitempty"`
// Spire indicates that SPIRE is used for certificate delivery.
Spire *Spire `json:"spire,omitempty"`
// Extension indicates that custom provider is used.
Extension *Extension `json:"extension,omitempty"`
}

type CertificateParameters struct {
Expand Down Expand Up @@ -98,6 +102,13 @@ type Spire struct {
Agent *SpireAgent `json:"agent,omitempty"`
}

type Extension struct {
// Type of the extension.
Type string `json:"type"`
// Config freeform configuration for the extension.
Config *apiextensionsv1.JSON `json:"config,omitempty"`
}

const (
ReadyConditionType string = "Ready"
ProviderConditionType string = "Provider"
Expand Down
13 changes: 13 additions & 0 deletions pkg/core/resources/apis/meshidentity/api/v1alpha1/rest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -281,6 +281,18 @@ components:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate delivery.
properties:
Expand All @@ -299,6 +311,7 @@ components:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
violations:
- field: spec.provider.extension.type
message: extension type needs to be defined
- field: spec.provider.extension.config
message: configuration needs to be defined
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
spiffeID:
trustDomain: "{{ .Mesh }}.{{ .Zone }}.mesh.local"
path: "/ns/.Namespace/sa/{{ .ServiceAccount }}"
provider:
type: Extension
extension:
type: ""
config:
17 changes: 17 additions & 0 deletions pkg/core/resources/apis/meshidentity/api/v1alpha1/validator.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ func validateProvider(provider Provider) validators.ValidationError {
verr.Add(validateBundled(validators.RootedAt("bundled"), provider.Bundled))
case SpireType:
verr.Add(validateSpire(validators.RootedAt("spire"), provider.Spire))
case ExtensionType:
verr.Add(validateExtension(validators.RootedAt("extension"), provider.Extension))
default:
verr.AddError("type", validators.MakeFieldMustBeOneOfErr(string(provider.Type), string(BundledType), string(SpireType)))
}
Expand Down Expand Up @@ -110,6 +112,21 @@ func validateSpire(path validators.PathBuilder, b *Spire) validators.ValidationE
return verr
}

func validateExtension(path validators.PathBuilder, b *Extension) validators.ValidationError {
var verr validators.ValidationError
if b == nil {
verr.AddViolationAt(path, "configuration needs to be defined")
return verr
}
if b.Type == "" {
verr.AddViolationAt(path.Field("type"), "extension type needs to be defined")
}
if b.Config == nil {
verr.AddViolationAt(path.Field("config"), "configuration needs to be defined")
}
return verr
}

func validateSpireAgent(path validators.PathBuilder, b *SpireAgent) validators.ValidationError {
return validators.ValidateDurationNotNegativeOrNil(path.Field("timeout"), b.Timeout)
}

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 @@ -179,6 +179,18 @@ spec:
- Disabled
type: string
type: object
extension:
description: Extension indicates that custom provider is used.
properties:
config:
description: Config freeform configuration for the extension.
x-kubernetes-preserve-unknown-fields: true
type:
description: Type of the extension.
type: string
required:
- type
type: object
spire:
description: Spire indicates that SPIRE is used for certificate
delivery.
Expand All @@ -198,6 +210,7 @@ spec:
enum:
- Bundled
- Spire
- Extension
type: string
required:
- type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ func (b *bundledIdentityProvider) GetRootCA(ctx context.Context, identity *meshi
return cert, err
}

func (s *bundledIdentityProvider) ShouldCreateMeshTrust(mid *meshidentity_api.MeshIdentityResource) (bool, error) {
return pointer.DerefOr(mid.Spec.Provider.Bundled.MeshTrustCreation, meshidentity_api.MeshTrustCreationEnabled) == meshidentity_api.MeshTrustCreationEnabled, nil
}

// Instead of loading the CA pair on each dataplane workload identity generation,
// we can cache it and refresh the cache periodically (e.g., every few seconds).
// This reduces the load on the underlying store (e.g., OS, DB), as the CA pair doesn't change frequently.
Expand Down
Loading
Loading