Update service-topology mock data with new attributes: TransparentProxy, DefaultAllow, WildcardIntention, and Source

This commit is contained in:
kenia 2021-04-08 14:08:57 -04:00
parent 7e9bcb06ca
commit bcad886efd
2 changed files with 19 additions and 2 deletions

View File

@ -11,6 +11,9 @@ export default class Topology extends Model {
@attr('string') Namespace; @attr('string') Namespace;
@attr('string') Protocol; @attr('string') Protocol;
@attr('boolean') FilteredByACLs; @attr('boolean') FilteredByACLs;
@attr('boolean') TransparentProxy;
@attr('boolean') DefaultAllow;
@attr('boolean') WildcardIntention;
@attr() Upstreams; // Service[] @attr() Upstreams; // Service[]
@attr() Downstreams; // Service[], @attr() Downstreams; // Service[],
@attr() meta; // {} @attr() meta; // {}

View File

@ -52,10 +52,18 @@ ${
} }
fake.seed(index); fake.seed(index);
// Randomly make permissive intentions
const defaultAllow = fake.random.boolean();
const wildcardIntention = defaultAllow ? false : fake.random.boolean();
return ` return `
{ {
"Protocol": "${serviceProto}", "Protocol": "${serviceProto}",
"FilteredByACLs": ${fake.random.boolean()}, "FilteredByACLs": ${fake.random.boolean()},
"TransparentProxy": ${fake.random.boolean()},
"DefaultAllow": ${defaultAllow},
"WildcardIntention": ${wildcardIntention},
"Upstreams": [ "Upstreams": [
${ ${
upstreams.map((item, i) => { upstreams.map((item, i) => {
@ -70,11 +78,14 @@ ${
"ChecksPassing":${fake.random.number({min: 1, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksPassing":${fake.random.number({min: 1, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})},
"ChecksWarning":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksWarning":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})},
"ChecksCritical":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksCritical":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})},
"Source": "${fake.helpers.randomize(['proxy-registration', 'default-allow', 'wildcard-intention'])}",
"TransparentProxy": ${fake.random.boolean()},
"Intention": { "Intention": {
"Allowed": ${allowed}, "Allowed": ${allowed},
"HasPermissions": ${hasPerms}, "HasPermissions": ${hasPerms},
"ExternalSource": "${fake.helpers.randomize(['nomad', 'kubernetes', ''])}", "ExternalSource": "${fake.helpers.randomize(['nomad', 'kubernetes', ''])}",
"HasExact": ${fake.random.boolean()} "HasExact": ${fake.random.boolean()},
"DefaultAllow": ${fake.random.boolean()}
} }
} }
`})} `})}
@ -93,11 +104,14 @@ ${
"ChecksPassing":${fake.random.number({min: 1, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksPassing":${fake.random.number({min: 1, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})},
"ChecksWarning":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksWarning":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})},
"ChecksCritical":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})}, "ChecksCritical":${fake.random.number({min: 0, max: env('CONSUL_CHECK_COUNT', fake.random.number(10))})},
"Source": "${fake.helpers.randomize(['proxy-registration', 'specific-intention', 'default-allow', 'wildcard-intention'])}",
"TransparentProxy": ${fake.random.boolean()},
"Intention": { "Intention": {
"Allowed": ${allowed}, "Allowed": ${allowed},
"HasPermissions": ${hasPerms}, "HasPermissions": ${hasPerms},
"ExternalSource": "${fake.helpers.randomize(['nomad', 'kubernetes', ''])}", "ExternalSource": "${fake.helpers.randomize(['nomad', 'kubernetes', ''])}",
"HasExact": ${fake.random.boolean()} "HasExact": ${fake.random.boolean()},
"DefaultAllow": ${fake.random.boolean()}
} }
} }
`})} `})}