Monday, June 1, 2026

React Custom Hooks

React custom hooks are reusable JavaScript functions that encapsulate stateful logic, allowing you to share functionality across multiple components without duplicating code. They act as clean abstractions that combine React's built-in hooks (like useState and useEffect) into a single, cohesive engine.

Core Rules for Custom Hooks

  • Name must start with "use": The prefix use (e.g., useFetch, useAuth) is mandatory so React's linter can identify it and enforce hook rules.
  • Isolated state: Two components using the exact same custom hook do not share state. Each execution initializes an independent sandbox of state and side-effects.
  • Top-level execution: They must be executed only at the top level of your components or other custom hooks, never inside loops, conditions, or nested functions.

Step-by-Step Practical Example

Consider an application requiring network status verification. Instead of hardcoding window event listeners in every individual component, you can isolate the logic inside a single hook.

1. Define the Custom Hook

Create a file named useOnlineStatus.js to manage the underlying state and side effects:

import { useState, useEffect } from 'react';

export function useOnlineStatus() {
  const [isOnline, setIsOnline] = useState(navigator.onLine);

  useEffect(() => {
    const handleOnline = () => setIsOnline(true);
    const handleOffline = () => setIsOnline(false);

    window.addEventListener('online', handleOnline);
    window.addEventListener('offline', handleOffline);

    // Clean up event listeners on unmount to prevent memory leaks
    return () => {
      window.removeEventListener('online', handleOnline);
      window.removeEventListener('offline', handleOffline);
    };
  }, []);

  return isOnline;
}

Use code with caution.

2. Consuming the Hook in Components

You can now pull this isolated logic directly into any functional component:

import { useOnlineStatus } from './useOnlineStatus';

export default function StatusBar() {
  const isOnline = useOnlineStatus();

  return (
    <h1>
      {isOnline ? '✅ Connected' : '❌ Disconnected'}
    </h1>
  );
}

Use code with caution.

Common Use Cases

  • Data Fetching: Consolidating fetch workflows, loading states, and error parsing into a structured useFetch module.
  • Form Handling: Creating a useForm utility to track user inputs, handle reset triggers, and run validations dynamically.
  • Event Listeners: Tracking mouse positions, window resizing, or keyboard strokes cleanly with automated event cleanup.
  • Storage Interactivity: Syncing component states directly with localStorage or sessionStorage.
Learning Resource

Explore the official guide on Reusing Logic with Custom Hooks from the React documentation to dive deeper into custom design patterns.

Angular Pipes

1. Introduction & Core Structure

Angular custom pipes are powerful tools designed to transform data directly within your HTML templates. They allow developers to keep presentation layouts clean by extracting heavy data-formatting logic out of templates and into reusable classes.

To build a custom pipe, you implement the PipeTransform interface and decorate the class with the @Pipe metadata token.

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'exponentialStrength',
  standalone: true // Standard configuration for modern Angular applications
})
export class ExponentialStrengthPipe implements PipeTransform {
  transform(value: number, exponent = 1): number {
    return Math.pow(value, isNaN(exponent) ? 1 : exponent);
  }
}

Template Consumption

<!-- Basic usage (Returns 2) -->
<p>{{ 2 | exponentialStrength }}</p>

<!-- Parameterized usage (Returns 8) -->
<p>{{ 2 | exponentialStrength:3 }}</p>

2. Real-World Production Examples

Truncate Text Pipe

Limits a string to a safe maximum size limit and appends a customizable fallback visual suffix.

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'truncate',
  standalone: true
})
export class TruncatePipe implements PipeTransform {
  transform(value: string, limit = 20, suffix = '...'): string {
    if (!value) return '';
    return value.length > limit ? value.substring(0, limit) + suffix : value;
  }
}

File Size Converter Pipe

Converts raw numerical bytes into highly readable string formats (KB, MB, GB) with strict data boundaries.

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'fileSize',
  standalone: true
})
export class FileSizePipe implements PipeTransform {
  private units = ['Bytes', 'KB', 'MB', 'GB', 'TB'];

  transform(bytes: number, decimalPlaces = 2): string {
    if (bytes === 0) return '0 Bytes';
    if (!bytes || isNaN(bytes)) return '-';

    const index = Math.floor(Math.log(bytes) / Math.log(1024));
    const size = (bytes / Math.pow(1024, index)).toFixed(decimalPlaces);

    return `${size} ${this.units[index]}`;
  }
}

Initials Extractor Pipe

Pulls the first character of structural first and last names to render crisp UI user avatars.

import { Pipe, PipeTransform } from '@angular/core';

@Pipe({
  name: 'initials',
  standalone: true
})
export class InitialsPipe implements PipeTransform {
  transform(fullName: string): string {
    if (!fullName) return '';

    const parts = fullName.trim().split(/\s+/);
    const firstInitial = parts[0] || '';
    const lastInitial = parts.length > 1 ? parts[parts.length - 1] : '';

    return (firstInitial[0] + (lastInitial[0] || '')).toUpperCase();
  }
}

3. Injecting Services into Custom Pipes

Pipes often need external context or configurations. Modern applications use the global inject() function to pull background services into the formatting block cleanly.

The Service Dependency

import { Injectable } from '@angular/core';

@Injectable({ providedIn: 'root' })
export class ConfigService {
  getLanguage(): string { return 'en'; }
}

The Injected Pipe

import { Pipe, PipeTransform, inject } from '@angular/core';
import { ConfigService } from './config.service';

@Pipe({
  name: 'age',
  standalone: true
})
export class AgePipe implements PipeTransform {
  private configService = inject(ConfigService);

  transform(birthDate: Date | string): string {
    if (!birthDate) return '';

    const today = new Date();
    const birth = new Date(birthDate);
    let age = today.getFullYear() - birth.getFullYear();
    const monthDiff = today.getMonth() - birth.getMonth();

    if (monthDiff < 0 || (monthDiff === 0 && today.getDate() < birth.getDate())) {
      age--;
    }

    return this.configService.getLanguage() === 'es'
      ? `${age} aƱos`
      : `${age} years old`;
  }
}

4. Pure vs. Impure Performance Benchmarks

Angular splits pipes into two performance execution modes:

  • Pure Pipes (Default): Executes exclusively when primitive values change (String, Number) or reference pointers flip (Array, Object).
  • Impure Pipes: Executes on every single change detection pass, degrading rendering smoothness.

The Profiling Pipeline

@Pipe({ name: 'pureLog', pure: true, standalone: true })
export class PureLogPipe implements PipeTransform {
  private count = 0;
  transform(val: string): string {
    console.log(`Pure: ${++this.count}`);
    return val;
  }
}

@Pipe({ name: 'impureLog', pure: false, standalone: true })
export class ImpureLogPipe implements PipeTransform {
  private count = 0;
  transform(val: string): string {
    console.log(`Impure: ${++this.count}`);
    return val;
  }
}
The Profiling Results
  • Initial Page Painting: Both pure and impure instances run exactly once.
  • Unrelated Click Actions: Button triggers that do not update the data inputs will cause zero pure logs, while the impure pipe logs recalculate constantly, draining CPU frames.

5. Advanced Layout Patterns

Pipe Chaining

Pipes can string along sequentially. Streams parse strictly from left to right.

<!-- Input -> Capitalized -> Sliced at 16 characters -->
<p>{{ 'This is an example string' | uppercase | truncate:16 }}</p>

Streamed Asynchronous Data

<!-- Fetches from backend API stream, resolves value, handles formatting -->
<p>{{ sizeInBytes$ | async | fileSize }}</p>

TypeScript Programmatic Activation

import { Component, OnInit, inject } from '@angular/core';
import { CurrencyPipe } from '@angular/common';
import { FileSizePipe } from './file-size.pipe';

@Component({
  standalone: true,
  providers: [CurrencyPipe, FileSizePipe],
  template: `<p>{{ report }}</p>`
})
export class ReportComponent implements OnInit {
  private currency = inject(CurrencyPipe);
  private fileSize = inject(FileSizePipe);
  report = '';

  ngOnInit() {
    const price = this.currency.transform(29.99, 'USD');
    const size = this.fileSize.transform(1048576);
    this.report = `Asset cost: ${price} | Download payload: ${size}`;
  }
}

6. Guards & Resolvers Core Integration

Pipes can operate directly inside navigation interceptors to filter data models before route assembly completes.

The Guard

import { inject } from '@angular/core';
import { CanActivateFn, Router } from '@angular/router';
import { map, take } from 'rxjs';
import { DataService } from './data.service';
import { FileSizePipe } from './file-size.pipe';

export const structuralGuard: CanActivateFn = (route) => {
  const router = inject(Router);
  const fileSizePipe = inject(FileSizePipe);

  return inject(DataService).getFileMetadata(route.paramMap.get('id')!).pipe(
    take(1),
    map(file => {
      const sizeStr = fileSizePipe.transform(file.sizeBytes);
      return (sizeStr.includes('GB') && parseFloat(sizeStr) > 5)
        ? router.createUrlTree(['/limit-exceeded'])
        : true;
    })
  );
};

The Resolver

import { inject } from '@angular/core';
import { ResolveFn } from '@angular/router';
import { map } from 'rxjs';
import { UserService } from './user.service';
import { InitialsPipe } from './initials.pipe';

export const profileResolver: ResolveFn<any> = (route) => {
  const initialsPipe = inject(InitialsPipe);

  return inject(UserService).getUserById(route.paramMap.get('id')!).pipe(
    map(user => ({
      ...user,
      avatarInitials: initialsPipe.transform(user.name)
    }))
  );
};

7. Isolated Testing & Mocking (Jasmine)

Because pipes are clean classes, regular implementations do not need heavy initialization overhead. When dependencies are present, leverage TestBed.inject.

import { TestBed } from '@angular/core/testing';
import { AgePipe } from './age.pipe';
import { ConfigService } from './config.service';

describe('AgePipe with Mock Service', () => {
  let pipe: AgePipe;
  let mockService: jasmine.SpyObj<ConfigService>;

  beforeEach(() => {
    const spy = jasmine.createSpyObj('ConfigService', ['getLanguage']);

    TestBed.configureTestingModule({
      providers: [AgePipe, { provide: ConfigService, useValue: spy }]
    });

    pipe = TestBed.inject(AgePipe);
    mockService = TestBed.inject(ConfigService) as jasmine.SpyObj<ConfigService>;

    jasmine.clock().install();
    jasmine.clock().mockDate(new Date('2026-06-01'));
  });

  afterEach(() => jasmine.clock().uninstall());

  it('should parse output text inside English localization targets', () => {
    mockService.getLanguage.and.returnValue('en');
    expect(pipe.transform('1990-06-01')).toBe('36 years old');
  });
});

Truncate Text Pipe Tests

import { TruncatePipe } from './truncate.pipe';

describe('TruncatePipe', () => {
  let pipe: TruncatePipe;

  beforeEach(() => {
    pipe = new TruncatePipe();
  });

  it('should create an instance', () => {
    expect(pipe).toBeTruthy();
  });

  it('should truncate text at default limit (20) and add "..."', () => {
    const text = 'This is a very long string for testing';
    expect(pipe.transform(text)).toBe('This is a very long ...');
  });

  it('should honor a custom limit parameter', () => {
    const text = 'Hello World';
    expect(pipe.transform(text, 5)).toBe('Hello...');
  });

  it('should append a custom suffix parameter', () => {
    const text = 'Hello World';
    expect(pipe.transform(text, 5, '!!!')).toBe('Hello!!!');
  });

  it('should return the original string if it is shorter than the limit', () => {
    const text = 'Short';
    expect(pipe.transform(text, 10)).toBe('Short');
  });

  it('should handle empty or null values gracefully', () => {
    expect(pipe.transform('')).toBe('');
    expect(pipe.transform(null as any)).toBe('');
  });
});

2. File Size Converter Pipe Tests

import { FileSizePipe } from './file-size.pipe';

describe('FileSizePipe', () => {
  let pipe: FileSizePipe;

  beforeEach(() => {
    pipe = new FileSizePipe();
  });

  it('should convert bytes to KB correctly', () => {
    expect(pipe.transform(1024)).toBe('1.00 KB');
  });

  it('should convert bytes to MB correctly', () => {
    expect(pipe.transform(1048576)).toBe('1.00 MB');
  });

  it('should respect custom decimal places parameter', () => {
    expect(pipe.transform(1500000, 3)).toBe('1.431 MB');
  });

  it('should return "0 Bytes" when input is 0', () => {
    expect(pipe.transform(0)).toBe('0 Bytes');
  });

  it('should return "-" for null or invalid numbers', () => {
    expect(pipe.transform(null as any)).toBe('-');
    expect(pipe.transform(NaN)).toBe('-');
  });
});

3. Initials Extractor Pipe Tests

import { InitialsPipe } from './initials.pipe';

describe('InitialsPipe', () => {
  let pipe: InitialsPipe;

  beforeEach(() => {
    pipe = new InitialsPipe();
  });

  it('should extract first and last initials and make them uppercase', () => {
    expect(pipe.transform('john doe')).toBe('JD');
  });

  it('should handle single names by returning one initial', () => {
    expect(pipe.transform('Alex')).toBe('A');
  });

  it('should handle middle names by extracting only the first and last initials', () => {
    expect(pipe.transform('John Fitzgerald Kennedy')).toBe('JK');
  });

  it('should handle extra whitespace around names', () => {
    expect(pipe.transform('   Jane   Smith   ')).toBe('JS');
  });

  it('should return an empty string for empty inputs', () => {
    expect(pipe.transform('')).toBe('');
    expect(pipe.transform(null as any)).toBe('');
  });
});

8. Transitioning to Modern Angular Signals

Angular Signals fundamentally update data strategy mechanics. With Signals, custom HTML pipes are completely obsolete.

Instead of routing values through pipes inside templates, use standard computed() signals. They cache calculations efficiently and update targeted elements instantly without running expensive change detection passes.

The Evolution Comparison

❌ The Legacy Template Approach
<div>{{ profileName | uppercase | truncate:10 }}</div>
The Modern Reactive Signals Approach
import { Component, signal, computed } from '@angular/core';

@Component({
  standalone: true,
  template: `<div>{{ managedProfileName() }}</div>` // Evaluates instantly via direct signal node linkage
})
export class ModernProfileComponent {
  // Writable input data stream
  profileName = signal('Jonathan Abernathy');

  // Unified computed transformation state matrix (Fully memoized out-of-the-box)
  managedProfileName = computed(() => {
    const current = this.profileName().toUpperCase();
    return current.length > 10 ? current.substring(0, 10) + '...' : current;
  });
}

Istio Learning Resources

Istio Basic Sample

Learn Microservices using Kubernetes and Istio

Beginner Evaluation Tasks

These tasks are a great place for beginners to further evaluate Istio’s features using this demo installation:

Production Readiness Resources

Deleting k8s PODs

Step 1: Find out who owns the Pods

Run this command to check the OWNER KIND column, which tells you exactly what resource is recreating or holding onto your Pods:

kubectl get pods -o custom-columns=NAME:.metadata.name,OWNER_KIND:.metadata.ownerReferences[0].kind,OWNER_NAME:.metadata.ownerReferences[0].name
Use code with caution.

Step 2: Delete based on the Owner Type

Depending on the output from Step 1, use the matching command below to stop the Pods from restarting:

  • If Owner is ReplicaSet: A leftover ReplicaSet is likely spinning them up. Run kubectl delete rs <replicaset-name>.
  • If Owner is StatefulSet: Run kubectl delete statefulset <statefulset-name>.
  • If Owner is DaemonSet: Run kubectl delete daemonset <daemonset-name>.
  • If Owner is Job: Run kubectl delete job <job-name>.
  • If Owner is <none>: These are standalone "naked" Pods. Run kubectl delete pod <pod-name>.

Step 3: Fast Nuke (Alternative)

If you just want everything gone immediately and do not care about the owner type, you can delete the Pods directly by their label or name.

Delete by label

Run kubectl delete pods -l <key>=<value> (e.g., kubectl delete pods -l app=nginx).

Force delete

If a Pod gets stuck in a "Terminating" loop, force it closed by running kubectl delete pod <pod-name> --grace-period=0 --force.

Sunday, May 31, 2026

kubernetes and istio components, resources and command line tools

Section Component / Resource / Utility Runs Where Purpose API / Interface
1. Kubernetes Core Components kube-apiserver Control Plane Main entry point for all Kubernetes operations REST API
1. Kubernetes Core Components etcd Control Plane Stores entire cluster state Internal KV API
1. Kubernetes Core Components kube-scheduler Control Plane Assigns Pods to Nodes Internal
1. Kubernetes Core Components kube-controller-manager Control Plane Runs reconciliation controllers Internal
1. Kubernetes Core Components cloud-controller-manager Control Plane (Cloud) Integrates Kubernetes with cloud services Internal
1. Kubernetes Core Components kubelet Every Node Creates and manages Pods Limited Node API
1. Kubernetes Core Components kube-proxy Every Node Implements Service networking and load balancing Internal
1. Kubernetes Core Components containerd / CRI-O Every Node Runs containers CRI API
2. Kubernetes Add-ons CoreDNS Cluster Add-on Service discovery and DNS resolution DNS Protocol
2. Kubernetes Add-ons Metrics Server Cluster Add-on Provides CPU/Memory metrics Metrics API
2. Kubernetes Add-ons NGINX Ingress Controller / Traefik Cluster Add-on Exposes applications externally Controller APIs
2. Kubernetes Add-ons CSI Drivers Cluster Add-on Storage provisioning CSI API
2. Kubernetes Add-ons Calico / Cilium / Flannel (CNI) Every Node Pod networking CNI API
2. Kubernetes Add-ons Prometheus Cluster Add-on Metrics collection REST API
2. Kubernetes Add-ons Grafana Cluster Add-on Visualization and dashboards REST API
2. Kubernetes Add-ons Fluentd / Fluent Bit Cluster Add-on Log collection Internal
2. Kubernetes Add-ons Kubernetes Dashboard Cluster Add-on Web UI Uses Kubernetes API
3. Kubernetes Resources (Artifacts) Pod Stored in etcd Smallest deployable unit Kubernetes API
3. Kubernetes Resources (Artifacts) Deployment Stored in etcd Replica management and rollout Kubernetes API
3. Kubernetes Resources (Artifacts) ReplicaSet Stored in etcd Maintains replica count Kubernetes API
3. Kubernetes Resources (Artifacts) StatefulSet Stored in etcd Stateful applications Kubernetes API
3. Kubernetes Resources (Artifacts) DaemonSet Stored in etcd One Pod per Node Kubernetes API
3. Kubernetes Resources (Artifacts) Job Stored in etcd Run-once workloads Kubernetes API
3. Kubernetes Resources (Artifacts) CronJob Stored in etcd Scheduled workloads Kubernetes API
3. Kubernetes Resources (Artifacts) Service Stored in etcd Stable network endpoint Kubernetes API
3. Kubernetes Resources (Artifacts) Ingress Stored in etcd HTTP entry point Kubernetes API
3. Kubernetes Resources (Artifacts) ConfigMap Stored in etcd Non-sensitive configuration Kubernetes API
3. Kubernetes Resources (Artifacts) Secret Stored in etcd Sensitive configuration Kubernetes API
3. Kubernetes Resources (Artifacts) Namespace Stored in etcd Logical isolation Kubernetes API
3. Kubernetes Resources (Artifacts) PersistentVolume (PV) Stored in etcd Physical storage representation Kubernetes API
3. Kubernetes Resources (Artifacts) PersistentVolumeClaim (PVC) Stored in etcd Storage request Kubernetes API
3. Kubernetes Resources (Artifacts) ServiceAccount Stored in etcd Workload identity Kubernetes API
3. Kubernetes Resources (Artifacts) Role / ClusterRole Stored in etcd Permissions Kubernetes API
3. Kubernetes Resources (Artifacts) RoleBinding / ClusterRoleBinding Stored in etcd Permission assignment Kubernetes API
3. Kubernetes Resources (Artifacts) NetworkPolicy Stored in etcd Network access control Kubernetes API
4. Istio Control Plane Components Istiod Usually Control Plane Nodes Service discovery, cert management, config distribution xDS APIs
5. Istio Data Plane (Sidecar Mode) Envoy Proxy Inside each meshed Pod Routing, mTLS, retries, telemetry xDS Client
6. Istio Data Plane (Ambient Mode) ztunnel One per Worker Node L4 proxy, mTLS, identity xDS Client
6. Istio Data Plane (Ambient Mode) Waypoint Proxy Selected namespaces/services Advanced L7 routing and policies xDS Client
7. Istio Resources VirtualService Stored in etcd Traffic routing rules Kubernetes API
7. Istio Resources DestinationRule Stored in etcd Backend policies Kubernetes API
7. Istio Resources Gateway Stored in etcd Traffic entry point Kubernetes API
7. Istio Resources ServiceEntry Stored in etcd External service registration Kubernetes API
7. Istio Resources AuthorizationPolicy Stored in etcd Access control Kubernetes API
7. Istio Resources PeerAuthentication Stored in etcd mTLS policy Kubernetes API
7. Istio Resources RequestAuthentication Stored in etcd JWT validation Kubernetes API
7. Istio Resources Telemetry Stored in etcd Metrics/tracing configuration Kubernetes API
7. Istio Resources Sidecar Stored in etcd Sidecar-specific settings Kubernetes API
8. Gateway API Resources GatewayClass Stored in etcd Gateway implementation definition Kubernetes API
8. Gateway API Resources Gateway Stored in etcd Traffic entry point Kubernetes API
8. Gateway API Resources HTTPRoute Stored in etcd HTTP routing Kubernetes API
8. Gateway API Resources GRPCRoute Stored in etcd gRPC routing Kubernetes API
8. Gateway API Resources TCPRoute Stored in etcd TCP routing Kubernetes API
8. Gateway API Resources TLSRoute Stored in etcd TLS routing Kubernetes API
8. Gateway API Resources UDPRoute Stored in etcd UDP routing Kubernetes API
9. Kubernetes Command-Line Utilities kubectl Client Machine Main Kubernetes CLI kube-apiserver
9. Kubernetes Command-Line Utilities kubeadm Client / Control Plane Cluster creation and management kube-apiserver
9. Kubernetes Command-Line Utilities crictl Client / Node Debug container runtime CRI
9. Kubernetes Command-Line Utilities ctr Client / Node Direct containerd interaction containerd
9. Kubernetes Command-Line Utilities nerdctl Client / Node Docker-like CLI for containerd containerd
9. Kubernetes Command-Line Utilities helm Client Machine Package manager kube-apiserver
9. Kubernetes Command-Line Utilities kustomize Client Machine Manifest customization kube-apiserver
9. Kubernetes Command-Line Utilities stern Client Machine Multi-pod log viewer kube-apiserver
9. Kubernetes Command-Line Utilities kubectx Client Machine Context switching kubeconfig
9. Kubernetes Command-Line Utilities kubens Client Machine Namespace switching kubeconfig
9. Kubernetes Command-Line Utilities k9s Client Machine Terminal UI kube-apiserver
9. Kubernetes Command-Line Utilities Kind Client Machine Kubernetes-in-Docker Local Cluster
9. Kubernetes Command-Line Utilities Minikube Client Machine Local Kubernetes cluster Local Cluster
9. Kubernetes Command-Line Utilities k3d Client Machine K3s in Docker Local Cluster
10. Istio Command-Line Utilities istioctl Client Machine Main Istio CLI Kubernetes API + Istiod
10. Istio Command-Line Utilities istioctl install Client Machine Install Istio Kubernetes API
10. Istio Command-Line Utilities istioctl uninstall Client Machine Remove Istio Kubernetes API
10. Istio Command-Line Utilities istioctl analyze Client Machine Validate Istio configuration Kubernetes API
10. Istio Command-Line Utilities istioctl proxy-config Client Machine Inspect Envoy configuration Envoy xDS
10. Istio Command-Line Utilities istioctl proxy-status Client Machine Check proxy synchronization Istiod
10. Istio Command-Line Utilities istioctl dashboard Client Machine Open Grafana/Kiali/Prometheus dashboards Various
10. Istio Command-Line Utilities istioctl x precheck Client Machine Cluster readiness validation Kubernetes API
10. Istio Command-Line Utilities istioctl x waypoint Client Machine Manage Ambient Waypoints Kubernetes API
11. Major Communication Paths kubectl → kube-apiserver Client → Control Plane Cluster management REST API
11. Major Communication Paths Helm → kube-apiserver Client → Control Plane Package deployment REST API
11. Major Communication Paths Istiod → kube-apiserver Control Plane → Control Plane Watch cluster resources REST API
11. Major Communication Paths kubelet → kube-apiserver Node → Control Plane Pod lifecycle management REST API
11. Major Communication Paths kube-apiserver → etcd Control Plane → Database State persistence etcd API
11. Major Communication Paths Envoy → Istiod Pod → Control Plane Configuration updates xDS
11. Major Communication Paths ztunnel → Istiod Node → Control Plane Ambient configuration xDS
11. Major Communication Paths CoreDNS → kube-apiserver Add-on → Control Plane Service discovery updates REST API
11. Major Communication Paths Metrics Server → kube-apiserver Add-on → Control Plane Metrics publishing Metrics API

Saturday, May 30, 2026

Machine Learning and AI Model Taxonomy

The following table compares major categories of Machine Learning, Deep Learning, Generative AI, and Reinforcement Learning models.

Category Model Type Core Purpose / Characteristic Ideal Input Data Type Training Paradigm Popular Examples
Traditional ML Linear Models Assumes linear relationships between features. Structured/Tabular (Numbers) Supervised Linear Regression, Logistic Regression
Tree-Based Models Splits data like flowchart branches based on values. Structured/Tabular (Mixed) Supervised Decision Trees, Random Forest, XGBoost
Distance-Based Classifies data points based on geometric proximity. Structured/Tabular (Normalized) Supervised K-Nearest Neighbors, SVM
Probabilistic Uses probability theory and Bayes' Theorem. Structured, Text (Word counts) Supervised Naive Bayes, Hidden Markov Models
Clustering Unsupervised grouping of similar unlabeled points. Structured/Tabular Unsupervised K-Means, DBSCAN
Dimensionality Compresses datasets by reducing redundant features. High-Dimensional Tabular Unsupervised PCA, t-SNE
RNNs & Sequence Vanilla RNN Processes sequences step-by-step with memory. Sequential (Text, Time-Series) Supervised/Self-Sup. Standard Elman RNN
LSTM Retains long-term context using gating mechanisms. Sequential (Text, Audio, Sensors) Supervised/Self-Sup. Standard LSTM, BiLSTM
GRU Streamlined, faster version of LSTM with fewer gates. Sequential (Text, Audio, Sensors) Supervised/Self-Sup. Standard GRU
CNNs (Spatial) Image Class. Identifies the main subject within a static frame. Spatial Grids (Images, Videos) Supervised ResNet, VGG16, MobileNet
Object Detection Locates and labels multiple distinct items in space. Spatial Grids (Images, Videos) Supervised YOLO, Faster R-CNN
Segmentation Classifies every single individual pixel. Spatial Grids (Medical scans) Supervised U-Net, Mask R-CNN
Transformers Encoder-Only Extracts context and meaning from sequences. Sequential (Text, Code) Self-Supervised BERT, RoBERTa
Decoder-Only Predicts the next sequence element autoregressively. Sequential (Text, Code) Self-Supervised GPT-4, Llama 3, Claude 3.5
Encoder-Decoder Translates/maps one sequence onto another. Sequential (Source Text) Self-Supervised T5, BART
Generative AI Multimodal Processes and outputs multiple mediums natively. Mixed (Text, Image, Video, Audio) Self-Supervised Google Gemini, GPT-4o
Diffusion Models Generates media by removing noise iteratively. Text prompts, Random noise Supervised (Latent) Stable Diffusion, Midjourney, Sora
GANs Two networks compete to create realistic data. Random noise vectors, Images Unsupervised/Adverserial StyleGAN, CycleGAN
VAEs Compresses data down and decodes new variants. Images, Structured vectors Unsupervised Beta-VAE
Reinforcement Value-Based RL Finds actions by calculating future rewards. Environment States, Screen pixels Trial-and-error Reward Deep Q-Networks (DQN)
Policy-Based RL Directly learns behaviors for a given environment. Environment States, Screen pixels Trial-and-error Reward

React Custom Hooks

React custom hooks are reusable JavaScript functions that encapsulate stateful logic, allowing you to share functionality a...