cdk8s-redis
Advanced tools
Comparing version 0.1.86 to 0.1.87
@@ -38,3 +38,3 @@ # API Reference | ||
* **labels** (<code>Map<string, string></code>) Extra labels to associate with resources. __*Default*__: none | ||
* **slaveReplicas** (<code>number</code>) Number of slave replicas. __*Default*__: 2 | ||
* **replicas** (<code>number</code>) Number of replicas. __*Default*__: 2 | ||
@@ -48,4 +48,4 @@ | ||
-----|------|------------- | ||
**masterHost**🔹 | <code>string</code> | The DNS host for the master server. | ||
**slaveHost**🔹 | <code>string</code> | The DNS host for the slave service. | ||
**primaryHost**🔹 | <code>string</code> | The DNS host for the primary service. | ||
**replicaHost**🔹 | <code>string</code> | The DNS host for the replica service. | ||
@@ -64,5 +64,5 @@ | ||
**labels**?🔹 | <code>Map<string, string></code> | Extra labels to associate with resources.<br/>__*Default*__: none | ||
**slaveReplicas**?🔹 | <code>number</code> | Number of slave replicas.<br/>__*Default*__: 2 | ||
**replicas**?🔹 | <code>number</code> | Number of replicas.<br/>__*Default*__: 2 | ||
@@ -7,3 +7,3 @@ import { Construct } from 'constructs'; | ||
/** | ||
* (experimental) Number of slave replicas. | ||
* (experimental) Number of replicas. | ||
* | ||
@@ -13,3 +13,3 @@ * @default 2 | ||
*/ | ||
readonly slaveReplicas?: number; | ||
readonly replicas?: number; | ||
/** | ||
@@ -30,13 +30,13 @@ * (experimental) Extra labels to associate with resources. | ||
/** | ||
* (experimental) The DNS host for the master server. | ||
* (experimental) The DNS host for the primary service. | ||
* | ||
* @experimental | ||
*/ | ||
readonly masterHost: string; | ||
readonly primaryHost: string; | ||
/** | ||
* (experimental) The DNS host for the slave service. | ||
* (experimental) The DNS host for the replica service. | ||
* | ||
* @experimental | ||
*/ | ||
readonly slaveHost: string; | ||
readonly replicaHost: string; | ||
/** | ||
@@ -43,0 +43,0 @@ * @experimental |
@@ -18,35 +18,35 @@ "use strict"; | ||
super(scope, id); | ||
const master = new service_deployment_1.ServiceDeployment(this, 'master', { | ||
const primary = new service_deployment_1.ServiceDeployment(this, 'primary', { | ||
image: 'k8s.gcr.io/redis:e2e', | ||
containerPort: 6379, | ||
externalPort: 6379, | ||
containerName: 'master', | ||
containerName: 'primary', | ||
env: { GET_HOSTS_FROM: 'dns' }, | ||
labels: { | ||
app: 'redis', | ||
role: 'master', | ||
role: 'primary', | ||
...options.labels, | ||
}, | ||
}); | ||
this.masterHost = master.host; | ||
const slaveReplicas = (_b = options.slaveReplicas) !== null && _b !== void 0 ? _b : 2; | ||
if (slaveReplicas > 0) { | ||
const slave = new service_deployment_1.ServiceDeployment(this, 'slave', { | ||
this.primaryHost = primary.host; | ||
const replicas = (_b = options.replicas) !== null && _b !== void 0 ? _b : 2; | ||
if (replicas > 0) { | ||
const replica = new service_deployment_1.ServiceDeployment(this, 'replica', { | ||
image: 'gcr.io/google_samples/gb-redisslave:v1', | ||
containerName: 'slave', | ||
containerName: 'replica', | ||
containerPort: 6379, | ||
externalPort: 6379, | ||
env: { GET_HOSTS_FROM: 'env', REDIS_MASTER_SERVICE_HOST: this.masterHost }, | ||
replicas: slaveReplicas, | ||
env: { GET_HOSTS_FROM: 'env', REDIS_MASTER_SERVICE_HOST: this.primaryHost }, | ||
replicas: replicas, | ||
labels: { | ||
app: 'redis', | ||
role: 'slave', | ||
role: 'replica', | ||
...options.labels, | ||
}, | ||
}); | ||
this.slaveHost = slave.host; | ||
this.replicaHost = replica.host; | ||
} | ||
else { | ||
// if we have no slave, then use the same host as the master | ||
this.slaveHost = master.host; | ||
// if we have no slave, then use the same host as the primary | ||
this.replicaHost = primary.host; | ||
} | ||
@@ -57,3 +57,3 @@ } | ||
_a = JSII_RTTI_SYMBOL_1; | ||
Redis[_a] = { fqn: "cdk8s-redis.Redis", version: "0.1.86" }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVkaXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcmVkaXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5nc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FxuICAgICAgICBlbnY6IHsgR0VUX0hPU1RTX0ZST006ICdlbnYnLCBSRURJU19NQVNURVJfU0VSVklDRV9IT1NUOiB0aGlzLm1hc3Rlckhvc3QgfSxcbiAgICAgICAgcmVwbGljYXM6IHNsYXZlUmVwbGljYXMsXG4gICAgICAgIGxhYmVsczoge1xuICAgICAgICAgIGFwcDogJ3JlZGlzJyxcbiAgICAgICAgICByb2xlOiAnc2xhdmUnLFxuICAgICAgICAgIC4uLm9wdGlvbnMubGFiZWxzLFxuICAgICAgICB9LFxuICAgICAgfSk7XG5cbiAgICAgIHRoaXMuc2xhdmVIb3N0ID0gc2xhdmUuaG9zdDtcbiAgICB9IGVsc2Uge1xuICAgICAgLy8gaWYgd2UgaGF2ZSBubyBzbGF2ZSwgdGhlbiB1c2UgdGhlIHNhbWUgaG9zdCBhcyB0aGUgbWFzdGVyXG4gICAgICB0aGlzLnNsYXZlSG9zdCA9IG1hc3Rlci5ob3N0O1xuICAgIH1cbiAgfVxufVxuIl19 | ||
Redis[_a] = { fqn: "cdk8s-redis.Redis", version: "0.1.87" }; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicmVkaXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi9zcmMvcmVkaXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7QUFBQSwyQ0FBdUM7QUFDdkMsNkRBQXlEOzs7O0FBVXpELE1BQWEsS0FBTSxTQUFRLHNCQUFTOzs7O0lBT2xDLFlBQVksS0FBZ0IsRUFBRSxFQUFVLEVBQUUsVUFBd0IsRUFBRzs7UUFDbkUsS0FBSyxDQUFDLEtBQUssRUFBRSxFQUFFLENBQUMsQ0FBQztRQUVqQixNQUFNLE9BQU8sR0FBRyxJQUFJLHNDQUFpQixDQUFDLElBQUksRUFBRSxTQUFTLEVBQUU7WUFDckQsS0FBSyxFQUFFLHNCQUFzQjtZQUM3QixhQUFhLE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QyxJQUFJLENBQUM7U0FDakM7SUFDSCxDQUFDOztBQTlDSCxzQkErQ0MiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBDb25zdHJ1Y3QgfSBmcm9tICdjb25zdHJ1Y3RzJztcbmltcG9ydCB7IFNlcnZpY2VEZXBsb3ltZW50IH0gZnJvbSAnLi9zZXJ2aWNlLWRlcGxveW1lbnQnO1xuXG5leHBvcnQgaW50ZXJmYWNlIFJlZGlzT3B0aW9ucyB7XG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHJlYWRvbmx5IHJlcGxpY2FzPzogbnVtYmVyO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHJlYWRvbmx5IGxhYmVscz86IHsgW25hbWU6IHN0cmluZ106IHN0cmluZyB9O1xufVxuXG5leHBvcnQgY2xhc3MgUmVkaXMgZXh0ZW5kcyBDb25zdHJ1Y3Qge1xuICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgXG4gIHB1YmxpYyByZWFkb25seSBwcmltYXJ5SG9zdDogc3RyaW5nO1xuXG4gICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBcbiAgcHVibGljIHJlYWRvbmx5IHJlcGxpY2FIb3N0OiBzdHJpbmc7XG5cbiAgY29uc3RydWN0b3Ioc2NvcGU6IENvbnN0cnVjdCwgaWQ6IHN0cmluZywgb3B0aW9uczogUmVkaXNPcHRpb25zID0geyB9KSB7XG4gICAgc3VwZXIoc2NvcGUsIGlkKTtcblxuICAgIGNvbnN0IHByaW1hcnkgPSBuZXcgU2VydmljZURlcGxveW1lbnQodGhpcywgJ3ByaW1hcnknLCB7XG4gICAgICBpbWFnZTogJ2s4cy5nY3IuaW8vcmVkaXM6ZTJlJyxcbiAgICAgIGNvbnRhaW5lclBvcnQ6IDYzNzksXG4gICAgICBleHRlcm5hbFBvcnQ6IDYzNzksXG4gICAgICBjb250YWluZXJOYW1lOiAncHJpbWFyeScsXG4gICAgICBlbnY6IHsgR0VUX0hPU1RTX0ZST006ICdkbnMnIH0sXG4gICAgICBsYWJlbHM6IHtcbiAgICAgICAgYXBwOiAncmVkaXMnLFxuICAgICAgICByb2xlOiAncHJpbWFyeScsXG4gICAgICAgIC4uLm9wdGlvbnMubGFiZWxzLFxuICAgICAgfSxcbiAgICB9KTtcblxuICAgIHRoaXMucHJpbWFyeUhvc3QgPSBwcmltYXJ5Lmhvc3Q7XG5cbiAgICBjb25zdCByZXBsaWNhcyA9IG9wdGlvbnMucmVwbGljYXMgPz8gMjtcbiAgICBpZiAocmVwbGljYXMgPiAwKSB7XG4gICAgICBjb25zdCByZXBsaWNhID0gbmV3IFNlcnZpY2VEZXBsb3ltZW50KHRoaXMsICdyZXBsaWNhJywge1xuICAgICAgICBpbWFnZTogJ2djci5pby9nb29nbGVfc2FtcGxlcy9nYi1yZWRpc3NsYXZlOnYxJyxcbiAgICAgICAgY29udGFpbmVyTmFtZTogJ3JlcGxpY2EnLFxuICAgICAgICBjb250YWluZXJQb3J0OiA2Mzc5LFxuICAgICAgICBleHRlcm5hbFBvcnQ6IDYzNzksXG4gICAgICAgIGVudjogeyBHRVRfSE9TVFNfRlJPTTogJ2VudicsIFJFRElTX01BU1RFUl9TRVJWSUNFX0hPU1Q6IHRoaXMucHJpbWFyeUhvc3QgfSxcbiAgICAgICAgcmVwbGljYXM6IHJlcGxpY2FzLFxuICAgICAgICBsYWJlbHM6IHtcbiAgICAgICAgICBhcHA6ICdyZWRpcycsXG4gICAgICAgICAgcm9sZTogJ3JlcGxpY2EnLFxuICAgICAgICAgIC4uLm9wdGlvbnMubGFiZWxzLFxuICAgICAgICB9LFxuICAgICAgfSk7XG5cbiAgICAgIHRoaXMucmVwbGljYUhvc3QgPSByZXBsaWNhLmhvc3Q7XG4gICAgfSBlbHNlIHtcbiAgICAgIC8vIGlmIHdlIGhhdmUgbm8gc2xhdmUsIHRoZW4gdXNlIHRoZSBzYW1lIGhvc3QgYXMgdGhlIHByaW1hcnlcbiAgICAgIHRoaXMucmVwbGljYUhvc3QgPSBwcmltYXJ5Lmhvc3Q7XG4gICAgfVxuICB9XG59XG4iXX0= |
@@ -68,3 +68,3 @@ { | ||
"license": "Apache-2.0", | ||
"version": "0.1.86", | ||
"version": "0.1.87", | ||
"jest": { | ||
@@ -71,0 +71,0 @@ "testMatch": [ |
@@ -9,3 +9,3 @@ # cdk8s-redis | ||
The following will define a Redis cluster with a master and 2 slave replicas: | ||
The following will define a Redis cluster with a primary and 2 replicas: | ||
@@ -19,17 +19,17 @@ ```ts | ||
DNS names can be obtained from `redis.masterHost` and `redis.slaveHost`. | ||
DNS names can be obtained from `redis.primaryHost` and `redis.replicaHost`. | ||
You can specify how many slave replicas to define: | ||
You can specify how many replicas to define: | ||
```ts | ||
new Redis(this, 'my-redis', { | ||
slaveReplicas: 4 | ||
replicas: 4 | ||
}); | ||
``` | ||
Or, you can specify no slave: | ||
Or, you can specify no replicas: | ||
```ts | ||
new Redis(this, 'my-redis', { | ||
slaveReplicas: 0 | ||
replicas: 0 | ||
}); | ||
@@ -36,0 +36,0 @@ ``` |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
1301540