2023-01-18 21:02:41 +00:00
|
|
|
|
import Model, { attr } from '@ember-data/model';
|
|
|
|
|
import { withFormFields } from 'vault/decorators/model-form-fields';
|
2023-02-09 16:38:39 +00:00
|
|
|
|
import { withModelValidations } from 'vault/decorators/model-validations';
|
2023-01-18 21:02:41 +00:00
|
|
|
|
|
2023-02-09 16:38:39 +00:00
|
|
|
|
const validations = {
|
2023-02-10 17:33:26 +00:00
|
|
|
|
kubernetesHost: [
|
|
|
|
|
{
|
|
|
|
|
validator: (model) => (model.disableLocalCaJwt && !model.kubernetesHost ? false : true),
|
|
|
|
|
message: 'Kubernetes host is required',
|
|
|
|
|
},
|
|
|
|
|
],
|
2023-02-09 16:38:39 +00:00
|
|
|
|
};
|
|
|
|
|
@withModelValidations(validations)
|
2023-01-18 21:02:41 +00:00
|
|
|
|
@withFormFields(['kubernetesHost', 'serviceAccountJwt', 'kubernetesCaCert'])
|
|
|
|
|
export default class KubernetesConfigModel extends Model {
|
|
|
|
|
@attr('string') backend; // dynamic path of secret -- set on response from value passed to queryRecord
|
|
|
|
|
@attr('string', {
|
|
|
|
|
label: 'Kubernetes host',
|
2023-02-09 23:16:24 +00:00
|
|
|
|
subText: 'Kubernetes API URL to connect to.',
|
2023-01-18 21:02:41 +00:00
|
|
|
|
})
|
|
|
|
|
kubernetesHost;
|
|
|
|
|
@attr('string', {
|
|
|
|
|
label: 'Service account JWT',
|
|
|
|
|
subText:
|
|
|
|
|
'The JSON web token of the service account used by the secret engine to manage Kubernetes roles. Defaults to the local pod’s JWT if found.',
|
|
|
|
|
})
|
|
|
|
|
serviceAccountJwt;
|
|
|
|
|
@attr('string', {
|
|
|
|
|
label: 'Kubernetes CA Certificate',
|
|
|
|
|
subText:
|
|
|
|
|
'PEM-encoded CA certificate to use by the secret engine to verify the Kubernetes API server certificate. Defaults to the local pod’s CA if found.',
|
|
|
|
|
editType: 'textarea',
|
|
|
|
|
})
|
|
|
|
|
kubernetesCaCert;
|
|
|
|
|
@attr('boolean', { defaultValue: false }) disableLocalCaJwt;
|
|
|
|
|
}
|