Skip to content

Commit c0c7637

Browse files
author
Maurice Faber
authored
fix: kms validation (#212)
1 parent 38bc9c6 commit c0c7637

File tree

4 files changed

+210
-109
lines changed

4 files changed

+210
-109
lines changed

src/fixtures/values.ts

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -415,6 +415,16 @@ export default {
415415
channelCrit: 'mon-otomi-crit',
416416
},
417417
},
418+
kms: {
419+
sops: {
420+
provider: 'google',
421+
google: {
422+
keys: 'some/key',
423+
accountJson: '{"some":"json"}',
424+
project: 'some-project',
425+
},
426+
},
427+
},
418428
oidc: {
419429
adminGroupID: 'someAdminGroupID',
420430
clientID: 'someClientID',

src/openapi/api.yaml

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -645,12 +645,26 @@ components:
645645
$ref: cluster.yaml#/apiName
646646
apiServer:
647647
$ref: cluster.yaml#/apiServer
648-
awsCreds:
649-
$ref: definitions.yaml#/awsCreds
650-
azureCreds:
651-
$ref: definitions.yaml#/azureCreds
648+
awsAccessKey:
649+
$ref: definitions.yaml#/awsAccessKey
650+
awsSecretKey:
651+
$ref: definitions.yaml#/awsSecretKey
652+
awsRegion:
653+
$ref: definitions.yaml#/awsRegion
654+
awsRole:
655+
$ref: definitions.yaml#/awsRole
656+
azureClientId:
657+
$ref: definitions.yaml#/azureClientId
658+
azureClientSecret:
659+
$ref: definitions.yaml#/azureClientSecret
660+
azureEnvironment:
661+
$ref: definitions.yaml#/azureEnvironment
652662
azureMonitor:
653663
$ref: definitions.yaml#/azureMonitor
664+
azureSubscriptionId:
665+
$ref: definitions.yaml#/azureSubscriptionId
666+
azureTenantId:
667+
$ref: definitions.yaml#/azureTenantId
654668
containerSpec:
655669
$ref: definitions.yaml#/containerSpec
656670
containerSpecNoSec:
@@ -669,8 +683,10 @@ components:
669683
$ref: cluster.yaml#/entrypoint
670684
env:
671685
$ref: definitions.yaml#/env
672-
googleCreds:
673-
$ref: definitions.yaml#/googleCreds
686+
googleAccountJson:
687+
$ref: definitions.yaml#/googleAccountJson
688+
googleProject:
689+
$ref: definitions.yaml#/googleProject
674690
idName:
675691
$ref: definitions.yaml#/idName
676692
image:
@@ -721,7 +737,5 @@ components:
721737
$ref: definitions.yaml#/svcPredeployed
722738
url:
723739
$ref: definitions.yaml#/url
724-
vaultCreds:
725-
$ref: definitions.yaml#/vaultCreds
726740
vpcID:
727741
$ref: cluster.yaml#/vpcID

src/openapi/definitions.yaml

Lines changed: 178 additions & 100 deletions
Original file line numberDiff line numberDiff line change
@@ -91,105 +91,98 @@ annotations:
9191
value:
9292
type: string
9393
maxLength: 32767
94-
awsCreds:
95-
title: AWS credentials
96-
description: Amazon Web Services credentials.
97-
properties:
98-
accessKey:
99-
title: Access Key
100-
type: string
101-
secretKey:
102-
title: Secret Key
103-
type: string
104-
region:
105-
title: Region
106-
type: string
107-
type: object
108-
required:
109-
- accessKey
110-
- secretKey
111-
- region
112-
azureCreds:
113-
title: Azure credentials
114-
description: Microsoft's Azure credentials.
115-
properties:
116-
clientId:
117-
description: Enter client ID.
118-
title: Client ID
119-
type: string
120-
clientSecret:
121-
description: Enter client secret.
122-
title: Client Secret
123-
type: string
124-
environment:
125-
description: Enter Azure environment.
126-
title: Environment
127-
type: string
128-
tenantId:
129-
description: Enter tenant ID.
130-
title: Tenant ID
131-
type: string
132-
type: object
133-
required:
134-
- clientId
135-
- clientSecret
136-
- tenantId
94+
awsAccessKey:
95+
title: AWS access key
96+
description: An AWS access key ID.
97+
type: string
98+
x-secret: ''
99+
awsSecretKey:
100+
title: AWS secret key
101+
description: An AWS secret key.
102+
type: string
103+
x-secret: ''
104+
awsRegion:
105+
title: AWS region
106+
description: An AWS region.
107+
type: string
108+
awsRole:
109+
description: Role may be set explicitly if no metadata can be accessed.
110+
example: arn:aws:iam::YYYYYYYYYYYY:role/dns-manager
111+
type: string
112+
azureClientId:
113+
title: Azure client id
114+
description: An Azure client id.
115+
type: string
116+
x-secret: ''
117+
azureClientSecret:
118+
title: Azure client secret
119+
description: An Azure client secret.
120+
type: string
121+
x-secret: ''
122+
azureEnvironment:
123+
title: Azure environment
124+
description: An Azure environment. Don't specify this if you don't know what you are doing!
125+
type: string
126+
default: AzureCloud
127+
enum:
128+
- AzureCloud
129+
- AzureChinaCloud
130+
- AzureUSGovernment
131+
- AzureGermanCloud
137132
azureMonitor:
138133
description: Azure Monitor data can be made available in Grafana.
139134
title: Azure Monitor
140135
nullable: true
141136
oneOf:
142137
- $ref: '#/offChoice'
143138
- properties:
144-
clientId:
145-
title: Azure client id
146-
description: An Azure client id.
147-
type: string
148-
clientSecret:
149-
title: Azure client secret
150-
description: An Azure client secret.
151-
type: string
152-
tenantId:
153-
title: LogAnalytics tenant id
154-
description: An Azure monitor log analytics workspace.
155-
type: string
156-
subscriptionId:
157-
title: Azure subscription id
158-
description: An Azure subscription id.
159-
type: string
139+
appInsightsApiKey:
140+
$ref: '#/azureClientSecret'
141+
title: AppInsights api key
142+
description: An Azure AppInsights client secret.
143+
appInsightsAppId:
144+
$ref: '#/azureClientId'
145+
title: AppInsights app id
160146
azureLogAnalyticsSameAs:
161147
title: LogAnalytics using same creds?
162148
type: boolean
163149
default: true
150+
clientId:
151+
$ref: '#/azureClientId'
152+
clientSecret:
153+
$ref: '#/azureClientSecret'
164154
logAnalyticsClientId:
155+
$ref: '#/azureClientId'
165156
title: LogAnalytics client id
166157
description: An Azure client secret.
167-
type: string
168158
logAnalyticsClientSecret:
159+
$ref: '#/azureClientSecret'
169160
title: LogAnalytics client secret
170161
description: An Azure client secret.
171-
type: string
172162
logAnalyticsTenantId:
163+
$ref: '#/azureTenantId'
173164
title: LogAnalytics tenant id
174165
description: An Azure tenant id.
175-
type: string
176166
logAnalyticsDefaultWorkspace:
177-
title: LogAnalytics workspace
167+
title: LogAnalytics default workspace to show
178168
description: An Azure LogAnalytics workspace.
179169
type: string
180-
appInsightsApiKey:
181-
title: AppInsights api key
182-
description: An Azure AppInsights client secret.
183-
type: string
184-
appInsightsAppId:
185-
title: AppInsights app id
186-
description: An Azure AppInsights client id.
187-
type: string
188-
required:
189-
- clientId
190-
- clientSecret
170+
subscriptionId:
171+
$ref: '#/azureSubscriptionId'
172+
tenantId:
173+
$ref: '#/azureTenantId'
191174
title: 'On'
192-
type: object
175+
required:
176+
- clientId
177+
- clientSecret
178+
azureSubscriptionId:
179+
title: Azure subscription id
180+
description: An Azure subscription id.
181+
type: string
182+
azureTenantId:
183+
title: Azure tenant id
184+
description: An Azure tenant id.
185+
type: string
193186
containerSpecNoSec:
194187
properties:
195188
image:
@@ -358,18 +351,14 @@ files:
358351
- path
359352
- content
360353
type: object
361-
googleCreds:
362-
title: Google credentials
363-
description: Google's GCP credentials.
364-
properties:
365-
accountJson:
366-
description: Enter GCP account JSON for authentication.
367-
title: Account JSON
368-
type: string
369-
project:
370-
description: Enter GCP project.
371-
title: GCP Project
372-
type: string
354+
googleAccountJson:
355+
description: Enter GCP account JSON for authentication.
356+
title: Account JSON
357+
type: string
358+
googleProject:
359+
description: Enter GCP project.
360+
title: GCP Project
361+
type: string
373362
hostPort:
374363
pattern: ^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\-]*[a-zA-Z0-9])\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\-]*[A-Za-z0-9]):()([1-9]|[1-5]?[0-9]{2,4}|6[1-4][0-9]{3}|65[1-4][0-9]{2}|655[1-2][0-9]|6553[1-5])$
375364
type: string
@@ -467,10 +456,105 @@ kms:
467456
description: Encryption credentials for SOPS to encrypt the platform secrets.
468457
title: SOPS credentials
469458
oneOf:
470-
- $ref: definitions.yaml#/awsCreds
471-
- $ref: definitions.yaml#/azureCreds
472-
- $ref: definitions.yaml#/googleCreds
473-
- $ref: definitions.yaml#/vaultCreds
459+
- properties:
460+
provider:
461+
type: string
462+
enum:
463+
- aws
464+
default: aws
465+
aws:
466+
properties:
467+
keys:
468+
description: Comma separated list of one or two ARNs to keys as defined in AWS KMS. One if used for both enc+dec. Two if one for enc, other for dec.
469+
title: AWS KMS keys
470+
type: string
471+
accessKey:
472+
$ref: '#/awsAccessKey'
473+
secretKey:
474+
$ref: '#/awsSecretKey'
475+
region:
476+
$ref: '#/awsRegion'
477+
required:
478+
- accessKey
479+
- keys
480+
- region
481+
- secretKey
482+
title: ''
483+
required:
484+
- aws
485+
title: AWS
486+
- properties:
487+
provider:
488+
type: string
489+
default: azure
490+
enum:
491+
- azure
492+
azure:
493+
properties:
494+
keys:
495+
description: Comma separated list of one or two paths to keys as defined in Azure Keyvault. One if used for both enc+dec. Two if one for enc, other for dec.
496+
title: Azure Keyvault keys
497+
type: string
498+
clientId:
499+
$ref: '#/azureClientId'
500+
clientSecret:
501+
$ref: '#/azureClientSecret'
502+
tenantId:
503+
$ref: '#/azureTenantId'
504+
required:
505+
- clientId
506+
- clientSecret
507+
- keys
508+
- tenantId
509+
title: ''
510+
required:
511+
- azure
512+
title: Azure
513+
- properties:
514+
provider:
515+
type: string
516+
default: google
517+
enum:
518+
- google
519+
google:
520+
properties:
521+
keys:
522+
description: Comma separated list of one or two paths to keys as defined in GCP KMS. One if used for both enc+dec. Two if one for enc, other for dec.
523+
title: GCP KMS keys
524+
type: string
525+
accountJson:
526+
$ref: '#/googleAccountJson'
527+
project:
528+
$ref: '#/googleProject'
529+
required:
530+
- keys
531+
- accountJson
532+
- project
533+
title: ''
534+
required:
535+
- google
536+
title: Google
537+
- properties:
538+
provider:
539+
type: string
540+
default: vault
541+
enum:
542+
- vault
543+
vault:
544+
properties:
545+
keys:
546+
description: Comma separated list of one or two paths to keys as defined in Vault. One if used for both enc+dec. Two if one for enc, other for dec.
547+
title: Vault keys
548+
type: string
549+
token:
550+
$ref: '#/vaultToken'
551+
required:
552+
- keys
553+
- token
554+
title: ''
555+
required:
556+
- vault
557+
title: Vault
474558
ksvcNew:
475559
description: Will create a new knative service from the input gathered here.
476560
title: New knative service
@@ -762,15 +846,9 @@ svcPredeployed:
762846
url:
763847
pattern: ^(https:\/\/)([\w\-])+\.{1}([a-zA-Z]{2,63})([\/\w-]*)*\/?\??([^#\n\r]*)?#?([^\n\r]*)$
764848
type: string
765-
vaultCreds:
766-
title: Vault credentials
767-
description: Hashicorp's Vault credentials.
768-
properties:
769-
token:
770-
title: Token
771-
type: string
772-
required:
773-
- token
849+
vaultToken:
850+
title: Token
851+
type: string
774852
volumes:
775853
items:
776854
additionalProperties: false

0 commit comments

Comments
 (0)