Skip to content

Commit

Permalink
Merge branch 'main' into dependabot/npm_and_yarn/dev-tools/vscode/dra…
Browse files Browse the repository at this point in the history
…si/jsonpath-plus-10.3.0
  • Loading branch information
ruokun-niu authored Feb 26, 2025
2 parents ebdb28d + 6f27e8a commit e317db8
Show file tree
Hide file tree
Showing 18 changed files with 187 additions and 111 deletions.
4 changes: 2 additions & 2 deletions cli/cmd/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,8 @@ Usage examples:
initCommand.Flags().String("registry", config.Registry, "Container registry to pull images from.")
initCommand.Flags().String("version", config.Version, "Container image version tag.")
initCommand.Flags().StringP("namespace", "n", "drasi-system", "Kubernetes namespace to install Drasi into.")
initCommand.Flags().String("dapr-runtime-version", "1.10.0", "Dapr runtime version to install.")
initCommand.Flags().String("dapr-sidecar-version", "1.9.0", "Dapr sidecar (daprd) version to install.")
initCommand.Flags().String("dapr-runtime-version", "", "Dapr runtime version to install.")
initCommand.Flags().String("dapr-sidecar-version", "latest", "Dapr sidecar (daprd) version to install.")
initCommand.Flags().String("dapr-registry", "docker.io/daprio", "Container registry to pull Dapr images from.")
return initCommand
}
7 changes: 4 additions & 3 deletions cli/service/installer.go
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,7 @@ func (t *Installer) createConfig(localMode bool, acr string, version string) err
} else {
cfg["ACR"] = acr
cfg["IMAGE_VERSION_TAG"] = version
cfg["IMAGE_PULL_POLICY"] = "Always"
cfg["IMAGE_PULL_POLICY"] = "IfNotPresent"
}

cfg["DAPR_SIDECAR"] = "daprio/daprd:" + DAPR_SIDECAR_VERSION
Expand Down Expand Up @@ -329,7 +329,8 @@ func (t *Installer) installQueryContainer(output output.TaskOutput, namespace st
if err := drasiClient.Apply(manifests, subOutput); err != nil {
return err
}
if err := drasiClient.ReadyWait(manifests, 150, subOutput); err != nil {

if err := drasiClient.ReadyWait(manifests, 240, subOutput); err != nil {
return err
}
output.SucceedTask("Query-Container", "Query container created")
Expand Down Expand Up @@ -625,7 +626,7 @@ func (t *Installer) checkDaprInstallation(output output.TaskOutput) (bool, error
podsClient := t.kubeClient.CoreV1().Pods("dapr-system")

pods, err := podsClient.List(context.TODO(), metav1.ListOptions{
LabelSelector: "app.kubernetes.io/name=dapr",
LabelSelector: "app.kubernetes.io/part-of=dapr",
})
if err != nil {
output.FailTask("Dapr-Check", fmt.Sprintf("Error checking for Dapr: %v", err.Error()))
Expand Down
41 changes: 20 additions & 21 deletions cli/service/resources/infra.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
# Copyright 2024 The Drasi Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# Copyright 2024 The Drasi Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

apiVersion: scheduling.k8s.io/v1
kind: PriorityClass
metadata:
Expand Down Expand Up @@ -316,12 +316,12 @@ spec:
type: state.mongodb
version: v1
metadata:
- name: host
value: drasi-mongo:27017
- name: username
value:
- name: password
value:
- name: connectionString
value: "mongodb://drasi-mongo:27017/?replicaSet=rs0"
# The replicaSet parameter is required to enable MongoDB transactions.
# Without this, MongoDB treats the connection as a standalone instance,
# which does not support transactions (which ultimately means we won't be
# able to use it as an actor statestore).
- name: actorStateStore
value: "true"
---
Expand All @@ -344,4 +344,3 @@ spec:
- name: redisPassword
value: ""


8 changes: 4 additions & 4 deletions control-planes/mgmt_api/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

31 changes: 15 additions & 16 deletions control-planes/mgmt_api/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,19 +1,18 @@
# Copyright 2024 The Drasi Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM rust@sha256:8fae3b1a63a4dcfb6cf277a49fb5967ccbf479b9e9cee4588a077a9cb216e6d4 as builder
# rust:1.81-bullseye
# Copyright 2024 The Drasi Authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

FROM rust:1.84-bullseye as builder
RUN apt-get update && apt-get install -y protobuf-compiler cmake libc6-dev libssl-dev libclang-dev

WORKDIR /usr/src
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
kind: Reaction
apiVersion: v1
name: e2e-gremlin-reaction-duplicate
spec:
kind: Gremlin
queries:
query3:
properties:
addedResultCommand: g.addV('Item').property('ItemName', @Name).property('Name',@Name)
gremlinHost: gremlin-server.default.svc.cluster.local
gremlinPort: 8182
20 changes: 19 additions & 1 deletion e2e-tests/03-gremlin-reaction-scenario/gremlin-reaction.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,29 @@ test('Test Gremlin Reaction - deletedResultCommand', async () => {
}, 140000);


test('Test Gremlin Reaction - addedResultCommand with duplicate parameters', async () => {
const gremlinReaction = yaml.loadAll(fs.readFileSync(__dirname + '/gremlin-reaction-duplicate.yaml', 'utf8'));
await deployResources(gremlinReaction);

await postgresClient.query(`INSERT INTO "Item" ("ItemId", "Name", "Category") VALUES (5, 'Drasi', '3')`);
await waitForCondition(async () => {
const result = await gremlinClient.V().has('ItemName', 'Drasi').hasNext();
return result;
}, 1000,30000)
.then(() => {
expect(true).toBeTruthy();
})
.catch(() => {
expect(false).toBeTruthy();
});
}, 140000);

afterAll(async () => {
await postgresClient.end();
postgresPortForward.stop();

gremlinPortForward.stop();
gremlinDriverConnection.close();
gremlinDriverConnection?.close();

const postgresResources = yaml.loadAll(fs.readFileSync(__dirname + '/resources.yaml', 'utf8'));
await deleteResources(postgresResources);
Expand All @@ -118,6 +135,7 @@ afterAll(async () => {
});



function waitForCondition(checkFn, interval = 1000, timeout = 30000) {
return new Promise((resolve, reject) => {
let elapsedTime = 0;
Expand Down
16 changes: 16 additions & 0 deletions e2e-tests/03-gremlin-reaction-scenario/resources.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -120,3 +120,19 @@ spec:
i.ItemId AS Id,
i.Name as Name,
i.Category as Category
---
apiVersion: v1
kind: ContinuousQuery
name: query4
spec:
mode: query
sources:
subscriptions:
- id: test-source-3
query: >
MATCH
(i:Item {Category: '5'})
RETURN
i.ItemId AS Id,
i.Name as Name,
i.Category as Category
2 changes: 1 addition & 1 deletion e2e-tests/03-kubernetes-scenario/k8s.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ beforeAll(async () => {
dbClient.port = await dbPortForward.start();
await dbClient.connect();
await new Promise((r) => setTimeout(r, 5000));
}, 120000);
}, 180000);

afterAll(async () => {
await signalrFixture.stop();
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/fixtures/cluster-setup.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ const { loadDrasiImages, installDrasi, tryLoadInfraImages, waitForChildProcess }
module.exports = async function () {
console.log("Creating cluster...");
await waitForChildProcess(cp.exec(`kind delete cluster --name drasi-test`, { encoding: 'utf-8' }));
await waitForChildProcess(cp.exec(`kind create cluster --name drasi-test --image kindest/node:v1.25.3`, { encoding: 'utf-8' }));
await waitForChildProcess(cp.exec(`kind create cluster --name drasi-test`, { encoding: 'utf-8' }));
await waitForChildProcess(cp.exec(`docker update --memory=8g --memory-swap=8g --cpus=4 drasi-test-control-plane`, { encoding: 'utf-8' }));

await Promise.all([
tryLoadInfraImages("drasi-test"),
Expand Down
2 changes: 1 addition & 1 deletion e2e-tests/fixtures/deploy-resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ async function deployResources(resources) {
}),
);
await waitForChildProcess(
cp.exec(`drasi wait ${source.kind} ${source.name} -t 120`, {
cp.exec(`drasi wait ${source.kind} ${source.name} -t 150`, {
encoding: "utf-8",
}),
source.name,
Expand Down
6 changes: 4 additions & 2 deletions e2e-tests/fixtures/signalr-fixture.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class SignalrFixture {

async start() {
await deployResources([this.reactionManifest]);
await new Promise((r) => setTimeout(r, 5000));
await new Promise((r) => setTimeout(r, 10000));
this.localPort = await this.portForward.start();
this.signalr = new signalR.HubConnectionBuilder()
.withUrl(`http://127.0.0.1:${this.localPort}/hub`)
Expand Down Expand Up @@ -189,7 +189,9 @@ function signalrReactionManifest(queryIds) {
let result = {
apiVersion: "v1",
kind: "Reaction",
name: `signalr-${crypto.randomUUID().toString()}`,
name: `signalr-${crypto.randomUUID().toString()}`,
// Sometimes the uuid will begin with a number, which is not allowed in k8s resource names
// as a result, we prepend the name with 'signalr-' to ensure it is a valid name
spec: {
kind: "SignalR",
queries: queryIds.reduce((a, v) => ({ ...a, [v]: "" }), {}),
Expand Down
6 changes: 3 additions & 3 deletions e2e-tests/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions reactions/gremlin/gremlin-reaction/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@

#See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging.

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0 AS build
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/sdk:8.0-cbl-mariner2.0 AS build
ARG BUILD_CONFIGURATION=Release
WORKDIR /src
COPY . .
RUN dotnet restore
RUN dotnet build -c $BUILD_CONFIGURATION -o /app/build

FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-cbl-mariner2.0 AS final
FROM --platform=$TARGETPLATFORM mcr.microsoft.com/dotnet/aspnet:8.0-cbl-mariner2.0 AS final
WORKDIR /app
COPY --from=build /app/build .
ENTRYPOINT ["/app/gremlin-reaction"]
Loading

0 comments on commit e317db8

Please sign in to comment.