Skip to content

Commit

Permalink
feat: remove modsoft and optTraffic algorithm
Browse files Browse the repository at this point in the history
  • Loading branch information
AposLaz committed Aug 2, 2024
1 parent bf7ec01 commit 974a756
Show file tree
Hide file tree
Showing 14 changed files with 24 additions and 28 deletions.
4 changes: 2 additions & 2 deletions addons/sample/app/hello-world.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
selector:
matchLabels:
app: hello-world
replicas: 8
replicas: 4
template:
metadata:
labels:
Expand Down Expand Up @@ -40,7 +40,7 @@ spec:
selector:
matchLabels:
app: hello-proxy
replicas: 16
replicas: 1
template:
metadata:
labels:
Expand Down
3 changes: 1 addition & 2 deletions addons/sample/app/zone-rules.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ spec:
distribute:
- from: europe-west8/europe-west8-a/*
to:
"europe-west8/europe-west8-c/*": 1
"europe-west8/europe-west8-a/*": 99
"europe-west8/europe-west8-a/node-1-b": 100
outlierDetection:
consecutive5xxErrors: 100
interval: 1s
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { logger } from '../../config/logger';
import { appExchangedBytesAndSizeMessages } from '../metrics/exchangedBytesAndSizeMessages';
import { totalLatencyBetweenPods } from '../metrics/latencyBetweenPods';
import { totalMessagesExchanged } from '../metrics/totalMessagesExchanged';
import { appExchangedBytesAndSizeMessages } from '../../services/metrics/exchangedBytesAndSizeMessages';
import { totalLatencyBetweenPods } from '../../services/metrics/latencyBetweenPods';
import { totalMessagesExchanged } from '../../services/metrics/totalMessagesExchanged';
import {
AppLinksGraphAffinities,
AppLinksGraphAvgPropAndAffinities,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

import { getK8sClient } from '../../config/k8sClient';
import { CommunitiesReplicaPods, PartitionsType } from './types';
import { clusterResources } from '../metrics/clusterResources';
import { clusterResources } from '../../services/metrics/clusterResources';
import * as k8s from '@kubernetes/client-node';
import prometheusApi from '../../api/prometheus/prometheusApi';
/**
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@ import {
DestinationRuleFromToZones,
DestinationRuleProps,
TrafficSummaryPerZone,
} from './types';
import kubernetesApi from '../api/k8s/kubernetesApi';
import kialiApi from '../api/kiali/kialiApi';
import { createLinksForSourceAndTarget } from '../api/kiali/services';
import { GraphEdges } from '../api/kiali/types';
import { to2Digits } from '../common/helper';
} from '../../services/types';
import kubernetesApi from '../../api/k8s/kubernetesApi';
import kialiApi from '../../api/kiali/kialiApi';
import { createLinksForSourceAndTarget } from '../../api/kiali/services';
import { GraphEdges } from '../../api/kiali/types';
import { to2Digits } from '../../common/helper';
import * as path from 'path';
import * as yaml from 'js-yaml';
import * as fs from 'fs';
import { logger } from '../config/logger';
import { logger } from '../../config/logger';

export const setUpGraphLinks = async (
ns: string
Expand Down
13 changes: 5 additions & 8 deletions placement/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import { app } from './app';
import { Config } from './config/config';
import { logger } from './config/logger';
import { gkeSetupConfigs } from './config/setup';
import { modSoft } from './services/modSoft';

import {
setUpGraphLinks,
setupDestinationRulesPerZone,
trafficAllocation,
} from './services/trafficGenerator/trafficSplit';
} from './algorithms/optTraffic/optTraffic';
import { SetupGkeConfigs } from './types';
import { setupWatchers } from './watchers';

Expand All @@ -29,7 +29,7 @@ setupWatchers().catch((error: unknown) => {
logger.error(`Could not setup watchers ${err.message}`);
});

const setTrafficSplit = async (region: string) => {
const setTrafficLocalization = async (region: string) => {
//TODO => for each namespace
const ns = 'default';

Expand All @@ -48,9 +48,7 @@ const setTrafficSplit = async (region: string) => {

export let setupConfigs: SetupGkeConfigs;

const initPlacement = async () => {
await modSoft('online-boutique');
};
const initPlacement = async () => {};

const initSetup = async () => {
try {
Expand All @@ -60,8 +58,7 @@ const initSetup = async () => {

if (!currentRegion) return;

//await setTrafficSplit(currentRegion);
await initPlacement();
//await setTrafficLocalization(currentRegion);
} catch (error: unknown) {
logger.error('Error during setup:', error);
}
Expand Down
4 changes: 2 additions & 2 deletions placement/src/services/metrics/appResponseTimes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@ import kialiApi from '../../api/kiali/kialiApi';
import { GraphData } from '../../api/kiali/types';
import { FormattedEdge } from './types';

export const appResponseTimes = async () => {
export const appResponseTimes = async (namespace: string) => {
// Sample JSON data
const rawData: GraphData | undefined = await kialiApi.getGraphMetrics(
'online-boutique'
namespace
);

//console.log(JSON.stringify(rawData, null, 2));
Expand Down
6 changes: 3 additions & 3 deletions setup-istio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ cd ..
kubectl apply -f addons/istio/addons

# deploy online boutique
kubectl apply -f kubernetes-cluster/multicluster-gke/apps/online-boutique/kubernetes-manifests/namespaces
kubectl apply -f kubernetes-cluster/multicluster-gke/apps/online-boutique/kubernetes-manifests/deployments
# kubectl apply -f kubernetes-cluster/multicluster-gke/apps/online-boutique/kubernetes-manifests/namespaces
# kubectl apply -f kubernetes-cluster/multicluster-gke/apps/online-boutique/kubernetes-manifests/deployments

# sleep 20
# kubectl apply -f istio/prometheus/extras
Expand Down Expand Up @@ -71,4 +71,4 @@ kubectl apply -f kubernetes-cluster/multicluster-gke/apps/online-boutique/kubern



# gcloud beta container --project "lively-shelter-294615" clusters create "cluster-0" --region "europe-west8" --no-enable-basic-auth --cluster-version "1.29.4-gke.1043002" --release-channel "regular" --machine-type "n2-standard-2" --image-type "COS_CONTAINERD" --disk-type "pd-balanced" --disk-size "20" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "2" --enable-ip-alias --network "projects/lively-shelter-294615/global/networks/default" --subnetwork "projects/lively-shelter-294615/regions/europe-west8/subnetworks/default" --no-enable-intra-node-visibility --default-max-pods-per-node "110" --security-posture=standard --workload-vulnerability-scanning=disabled --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing,GcePersistentDiskCsiDriver --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0 --binauthz-evaluation-mode=DISABLED --no-enable-managed-prometheus --enable-shielded-nodes --node-locations "europe-west8-a","europe-west8-c"
# gcloud beta container --project "lively-shelter-294615" clusters create "cluster-0" --region "europe-west8" --no-enable-basic-auth --cluster-version "1.29.5-gke.1091002" --release-channel "regular" --machine-type "n2-standard-2" --image-type "COS_CONTAINERD" --disk-type "pd-balanced" --disk-size "20" --metadata disable-legacy-endpoints=true --scopes "https://www.googleapis.com/auth/devstorage.read_only","https://www.googleapis.com/auth/logging.write","https://www.googleapis.com/auth/monitoring","https://www.googleapis.com/auth/servicecontrol","https://www.googleapis.com/auth/service.management.readonly","https://www.googleapis.com/auth/trace.append" --num-nodes "2" --enable-ip-alias --network "projects/lively-shelter-294615/global/networks/default" --subnetwork "projects/lively-shelter-294615/regions/europe-west8/subnetworks/default" --no-enable-intra-node-visibility --default-max-pods-per-node "110" --security-posture=standard --workload-vulnerability-scanning=disabled --no-enable-master-authorized-networks --addons HorizontalPodAutoscaling,HttpLoadBalancing,GcePersistentDiskCsiDriver --enable-autoupgrade --enable-autorepair --max-surge-upgrade 1 --max-unavailable-upgrade 0 --binauthz-evaluation-mode=DISABLED --no-enable-managed-prometheus --enable-shielded-nodes --node-locations "europe-west8-a","europe-west8-c"

0 comments on commit 974a756

Please sign in to comment.