Skip to content
17 changes: 15 additions & 2 deletions api/hypershift/v1beta1/azure.go
Original file line number Diff line number Diff line change
Expand Up @@ -810,6 +810,9 @@ const (
// AzureKMSSpec defines metadata about the configuration of the Azure KMS Secret Encryption provider using Azure key vault
//
// +kubebuilder:validation:XValidation:rule="!has(self.backupKey) || self.backupKey.keyVaultName == self.activeKey.keyVaultName",message="backupKey.keyVaultName must match activeKey.keyVaultName; both keys must reside in the same Key Vault"
// +kubebuilder:validation:XValidation:rule="!(has(self.kms) && has(self.workloadIdentity))",message="kms and workloadIdentity are mutually exclusive"
// +kubebuilder:validation:XValidation:rule="has(self.kms) || has(self.workloadIdentity)",message="one of kms or workloadIdentity must be set"
// +kubebuilder:validation:XValidation:rule="has(self.kms) == has(oldSelf.kms)",message="the KMS authentication mode is immutable once set"
type AzureKMSSpec struct {
// activeKey defines the active key used to encrypt new secrets
//
Expand All @@ -821,9 +824,19 @@ type AzureKMSSpec struct {
BackupKey *AzureKMSKey `json:"backupKey,omitempty"`

// kms is a pre-existing managed identity used to authenticate with Azure KMS.
// This is used for managed Azure (ARO HCP) clusters.
// kms and workloadIdentity are mutually exclusive.
//
// +required
KMS ManagedIdentity `json:"kms"`
// +optional
KMS ManagedIdentity `json:"kms,omitzero"`

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know this field was added before, but why is it called kms? with the new field, it should be called managedIdentity or smth

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.spec.secretEncryption.kms.azure.kms doesn't sound correct.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure how we can change this now since ARO HCP is in flight other than introducing a new field and trying to deprecated this.


// workloadIdentity contains the workload identity used to authenticate
// with Azure Key Vault for KMS encryption via a token-minter sidecar.
// This identity must have "Key Vault Crypto User" role on the Key Vault.
// kms and workloadIdentity are mutually exclusive.
//
// +optional

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd rather don't introduce this naming pattern until we decide if we want to introduce a semantic for product and have a detailed plan for it.
Can we name this after the targeted auth mechanism e.g. kmsFederatedTokenIdentity

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Renamed to kmsFederatedTokenIdentity / AzureKMSFederatedTokenIdentity across the board — API types, CEL rules, envtests, CLI, controllers, and docs.

WorkloadIdentity WorkloadIdentity `json:"workloadIdentity,omitzero"`

// keyVaultAccess specifies how the Key Vault should be accessed.
// When set to "Private", the control plane routes Key Vault traffic through
Expand Down
1 change: 1 addition & 0 deletions api/hypershift/v1beta1/zz_generated.deepcopy.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 @@ -6046,8 +6046,10 @@ spec:
- ""
type: string
kms:
description: kms is a pre-existing managed identity used
to authenticate with Azure KMS.
description: |-
kms is a pre-existing managed identity used to authenticate with Azure KMS.
This is used for managed Azure (ARO HCP) clusters.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: |-
Expand Down Expand Up @@ -6096,15 +6098,42 @@ spec:
- credentialsSecretName
- objectEncoding
type: object
workloadIdentity:
description: |-
workloadIdentity contains the workload identity used to authenticate
with Azure Key Vault for KMS encryption via a token-minter sidecar.
This identity must have "Key Vault Crypto User" role on the Key Vault.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: clientID is client ID of a federated
managed identity used in workload identity authentication
maxLength: 36
minLength: 36
pattern: ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$
type: string
x-kubernetes-validations:
- message: the client ID of a managed identity must
be a valid UUID. It should be 5 groups of hyphen
separated hexadecimal characters in the form 8-4-4-4-12.
rule: self.matches('^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$')
required:
- clientID
type: object
required:
- activeKey
- kms
type: object
x-kubernetes-validations:
- message: backupKey.keyVaultName must match activeKey.keyVaultName;
both keys must reside in the same Key Vault
rule: '!has(self.backupKey) || self.backupKey.keyVaultName
== self.activeKey.keyVaultName'
- message: kms and workloadIdentity are mutually exclusive
rule: '!(has(self.kms) && has(self.workloadIdentity))'
- message: one of kms or workloadIdentity must be set
rule: has(self.kms) || has(self.workloadIdentity)
- message: the KMS authentication mode is immutable once set
rule: has(self.kms) == has(oldSelf.kms)
ibmcloud:
description: ibmcloud defines metadata for the IBM Cloud KMS
encryption strategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6029,8 +6029,10 @@ spec:
- ""
type: string
kms:
description: kms is a pre-existing managed identity used
to authenticate with Azure KMS.
description: |-
kms is a pre-existing managed identity used to authenticate with Azure KMS.
This is used for managed Azure (ARO HCP) clusters.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: |-
Expand Down Expand Up @@ -6079,15 +6081,42 @@ spec:
- credentialsSecretName
- objectEncoding
type: object
workloadIdentity:
description: |-
workloadIdentity contains the workload identity used to authenticate
with Azure Key Vault for KMS encryption via a token-minter sidecar.
This identity must have "Key Vault Crypto User" role on the Key Vault.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: clientID is client ID of a federated
managed identity used in workload identity authentication
maxLength: 36
minLength: 36
pattern: ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$
type: string
x-kubernetes-validations:
- message: the client ID of a managed identity must
be a valid UUID. It should be 5 groups of hyphen
separated hexadecimal characters in the form 8-4-4-4-12.
rule: self.matches('^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$')
required:
- clientID
type: object
required:
- activeKey
- kms
type: object
x-kubernetes-validations:
- message: backupKey.keyVaultName must match activeKey.keyVaultName;
both keys must reside in the same Key Vault
rule: '!has(self.backupKey) || self.backupKey.keyVaultName
== self.activeKey.keyVaultName'
- message: kms and workloadIdentity are mutually exclusive
rule: '!(has(self.kms) && has(self.workloadIdentity))'
- message: one of kms or workloadIdentity must be set
rule: has(self.kms) || has(self.workloadIdentity)
- message: the KMS authentication mode is immutable once set
rule: has(self.kms) == has(oldSelf.kms)
ibmcloud:
description: ibmcloud defines metadata for the IBM Cloud KMS
encryption strategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6049,8 +6049,10 @@ spec:
- ""
type: string
kms:
description: kms is a pre-existing managed identity used
to authenticate with Azure KMS.
description: |-
kms is a pre-existing managed identity used to authenticate with Azure KMS.
This is used for managed Azure (ARO HCP) clusters.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: |-
Expand Down Expand Up @@ -6099,15 +6101,42 @@ spec:
- credentialsSecretName
- objectEncoding
type: object
workloadIdentity:
description: |-
workloadIdentity contains the workload identity used to authenticate
with Azure Key Vault for KMS encryption via a token-minter sidecar.
This identity must have "Key Vault Crypto User" role on the Key Vault.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: clientID is client ID of a federated
managed identity used in workload identity authentication
maxLength: 36
minLength: 36
pattern: ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$
type: string
x-kubernetes-validations:
- message: the client ID of a managed identity must
be a valid UUID. It should be 5 groups of hyphen
separated hexadecimal characters in the form 8-4-4-4-12.
rule: self.matches('^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$')
required:
- clientID
type: object
required:
- activeKey
- kms
type: object
x-kubernetes-validations:
- message: backupKey.keyVaultName must match activeKey.keyVaultName;
both keys must reside in the same Key Vault
rule: '!has(self.backupKey) || self.backupKey.keyVaultName
== self.activeKey.keyVaultName'
- message: kms and workloadIdentity are mutually exclusive
rule: '!(has(self.kms) && has(self.workloadIdentity))'
- message: one of kms or workloadIdentity must be set
rule: has(self.kms) || has(self.workloadIdentity)
- message: the KMS authentication mode is immutable once set
rule: has(self.kms) == has(oldSelf.kms)
ibmcloud:
description: ibmcloud defines metadata for the IBM Cloud KMS
encryption strategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6361,8 +6361,10 @@ spec:
- ""
type: string
kms:
description: kms is a pre-existing managed identity used
to authenticate with Azure KMS.
description: |-
kms is a pre-existing managed identity used to authenticate with Azure KMS.
This is used for managed Azure (ARO HCP) clusters.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: |-
Expand Down Expand Up @@ -6411,15 +6413,42 @@ spec:
- credentialsSecretName
- objectEncoding
type: object
workloadIdentity:
description: |-
workloadIdentity contains the workload identity used to authenticate
with Azure Key Vault for KMS encryption via a token-minter sidecar.
This identity must have "Key Vault Crypto User" role on the Key Vault.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: clientID is client ID of a federated
managed identity used in workload identity authentication
maxLength: 36
minLength: 36
pattern: ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$
type: string
x-kubernetes-validations:
- message: the client ID of a managed identity must
be a valid UUID. It should be 5 groups of hyphen
separated hexadecimal characters in the form 8-4-4-4-12.
rule: self.matches('^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$')
required:
- clientID
type: object
required:
- activeKey
- kms
type: object
x-kubernetes-validations:
- message: backupKey.keyVaultName must match activeKey.keyVaultName;
both keys must reside in the same Key Vault
rule: '!has(self.backupKey) || self.backupKey.keyVaultName
== self.activeKey.keyVaultName'
- message: kms and workloadIdentity are mutually exclusive
rule: '!(has(self.kms) && has(self.workloadIdentity))'
- message: one of kms or workloadIdentity must be set
rule: has(self.kms) || has(self.workloadIdentity)
- message: the KMS authentication mode is immutable once set
rule: has(self.kms) == has(oldSelf.kms)
ibmcloud:
description: ibmcloud defines metadata for the IBM Cloud KMS
encryption strategy
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6501,8 +6501,10 @@ spec:
- ""
type: string
kms:
description: kms is a pre-existing managed identity used
to authenticate with Azure KMS.
description: |-
kms is a pre-existing managed identity used to authenticate with Azure KMS.
This is used for managed Azure (ARO HCP) clusters.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: |-
Expand Down Expand Up @@ -6551,15 +6553,42 @@ spec:
- credentialsSecretName
- objectEncoding
type: object
workloadIdentity:
description: |-
workloadIdentity contains the workload identity used to authenticate
with Azure Key Vault for KMS encryption via a token-minter sidecar.
This identity must have "Key Vault Crypto User" role on the Key Vault.
kms and workloadIdentity are mutually exclusive.
properties:
clientID:
description: clientID is client ID of a federated
managed identity used in workload identity authentication
maxLength: 36
minLength: 36
pattern: ^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$
type: string
x-kubernetes-validations:
- message: the client ID of a managed identity must
be a valid UUID. It should be 5 groups of hyphen
separated hexadecimal characters in the form 8-4-4-4-12.
rule: self.matches('^[0-9a-fA-F]{8}-([0-9a-fA-F]{4}-){3}[0-9a-fA-F]{12}$')
required:
- clientID
type: object
required:
- activeKey
- kms
type: object
x-kubernetes-validations:
- message: backupKey.keyVaultName must match activeKey.keyVaultName;
both keys must reside in the same Key Vault
rule: '!has(self.backupKey) || self.backupKey.keyVaultName
== self.activeKey.keyVaultName'
- message: kms and workloadIdentity are mutually exclusive
rule: '!(has(self.kms) && has(self.workloadIdentity))'
- message: one of kms or workloadIdentity must be set
rule: has(self.kms) || has(self.workloadIdentity)
- message: the KMS authentication mode is immutable once set
rule: has(self.kms) == has(oldSelf.kms)
ibmcloud:
description: ibmcloud defines metadata for the IBM Cloud KMS
encryption strategy
Expand Down
Loading
Loading