diff --git a/Makefile b/Makefile index d4f54eb..363facf 100755 --- a/Makefile +++ b/Makefile @@ -73,7 +73,7 @@ init: @./init.sh certs: - @./generate-certs.sh + @./hack/generate-certs.sh deps: @mkdir -p "$(ROOT_BIN_DIR)" diff --git a/compute-agent b/compute-agent index ca4cfd8..691de36 160000 --- a/compute-agent +++ b/compute-agent @@ -1 +1 @@ -Subproject commit ca4cfd878a45f27e02aefceefd60a9ce6d713322 +Subproject commit 691de36cdb7fc9790e49e50b2b69f115f5480c45 diff --git a/generate-certs.sh b/hack/generate-certs.sh similarity index 100% rename from generate-certs.sh rename to hack/generate-certs.sh diff --git a/hack/start-etcd-docker.sh b/hack/start-etcd-docker.sh deleted file mode 100755 index 80c3686..0000000 --- a/hack/start-etcd-docker.sh +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/bash -if ! command -v docker &> /dev/null -then - echo "Docker is not installed. Please install Docker and try again." - exit 1 -fi - if [ $# -eq 0 ] -then - # Start etcd in standalone mode - echo "Starting etcd in standalone mode..." - docker run -d \ - --name etcd \ - -p 2379:2379 \ - -p 4001:4001 \ - quay.io/coreos/etcd:v3.5.0 \ - etcd \ - --advertise-client-urls http://localhost:2379,http://localhost:4001 \ - --listen-client-urls http://0.0.0.0:2379,http://0.0.0.0:4001 - echo "etcd started in standalone mode and ports 2379 and 4001 are exposed on the local machine." -else - # Start etcd in cluster mode - if [[ ! $1 =~ ^[0-9]+$ ]] - then - echo "Invalid argument. Please specify a valid number of nodes." - exit 1 - fi - if [ "$1" -lt 1 ] - then - echo "Invalid argument. Please specify a number greater than or equal to 1." - exit 1 - fi - nodes="" - echo "Starting $1-node etcd cluster..." - for i in $(seq 1 "$1") - do - name="node$i" - peer_port=$((2380 + $i - 1)) - client_port=$((2379 + $i - 1)) - node=",$name=http://localhost:$peer_port" - nodes="$nodes$node" - docker run -d \ - --name etcd-"$name" \ - -p $client_port:$client_port \ - -p $peer_port:$peer_port \ - quay.io/coreos/etcd:v3.5.0 \ - etcd \ - --name "$name" \ - --advertise-client-urls http://localhost:$client_port \ - --listen-client-urls http://0.0.0.0:$client_port \ - --initial-advertise-peer-urls http://localhost:$peer_port \ - --listen-peer-urls http://0.0.0.0:$peer_port \ - --initial-cluster node1=http://localhost:2380"$nodes" \ - --initial-cluster-token my-etcd-token \ - --initial-cluster-state new - done - echo "$1-node etcd cluster started and etcd ports are exposed on the local machine." -fi \ No newline at end of file diff --git a/infra/ansible/infra-init.sh b/infra/ansible/infra-init.sh deleted file mode 100644 index 9851579..0000000 --- a/infra/ansible/infra-init.sh +++ /dev/null @@ -1,9 +0,0 @@ -export DATACENTER_NAME=my-datacenter -export CLUSTER_NAME=my-cluster -export VCENTER_HOSTNAME=my-vcenter-hostname -export VCENTER_USERNAME=my-vcenter-username -export VCENTER_PASSWORD=my-vcenter-password -export DATASTORE_NAME=my-datastore-name -export NETWORK_NAME=my-network-name -export CLUSTER_API_VSPHERE_VERSION=0.7.3 -ansible-playbook setup-vsphere-infra.yml \ No newline at end of file diff --git a/infra/ansible/setup-vsphere-infra.yml b/infra/ansible/setup-vsphere-infra.yml deleted file mode 100644 index e4a740a..0000000 --- a/infra/ansible/setup-vsphere-infra.yml +++ /dev/null @@ -1,117 +0,0 @@ ---- -- name: Fetch Kubernetes nodes - hosts: localhost - tasks: - - name: Get Kubernetes nodes - kubectl_info: - kind: Node - register: k8s_nodes - - - name: Add Kubernetes nodes to in-memory inventory - add_host: - name: "{{ item.metadata.name }}" - groups: kubernetes_nodes - loop: "{{ k8s_nodes.resources }}" - -- name: Setup vSphere provider and deploy Kubernetes cluster - hosts: localhost - vars: - datacenter_name: "{{ lookup('env', 'DATACENTER_NAME') }}" - cluster_name: "{{ lookup('env', 'CLUSTER_NAME') }}" - tasks: - - name: Create datacenter - community.vmware.vmware_datacenter: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - validate_certs: no - name: "{{ datacenter_name }}" - - - name: Create cluster - community.vmware.vmware_cluster: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - validate_certs: no - datacenter_name: "{{ datacenter_name }}" - name: "{{ cluster_name }}" - - - name: Create datastore - community.vmware.vmware_datastore: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - validate_certs: no - datacenter_name: "{{ datacenter_name }}" - name: "{{ datastore_name }}" - type: vmfs - - - name: Create network - community.vmware.vmware_network: - hostname: "{{ vcenter_hostname }}" - username: "{{ vcenter_username }}" - password: "{{ vcenter_password }}" - validate_certs: no - datacenter_name: "{{ datacenter_name }}" - name: "{{ network_name }}" - vlan_id: 0 - - - name: Setup vSphere provider for Cluster API - include_role: - name: scottd018.ansible_cluster_api_provider_vsphere_setup - vars: - vcenter_server: "{{ vcenter_hostname }}" - vcenter_username: "{{ vcenter_username }}" - vcenter_password: "{{ vcenter_password }}" - datacenter: "{{ datacenter_name }}" - datastore: "{{ datastore_name }}" - network: "{{ network_name }}" - resource_pool: "{{ cluster_name }}" - - - name: Deploy Kubernetes cluster using Cluster API - community.kubernetes.kubectl: - src: "https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/v{{ cluster_api_vsphere_version }}/infrastructure-components.yaml" - state: present - - - name: Wait for Kubernetes cluster to be ready - community.kubernetes.kubectl: - wait_for: - type: "condition" - condition: "Ready" - kind: "Machine" - namespace: "capi-system" - timeout: "300s" - - - name: Install Kubernetes control plane components - community.kubernetes.kubectl: - src: "https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/v{{ cluster_api_vsphere_version }}/control-plane-components.yaml" - state: present - - - name: Install Kubernetes worker components - community.kubernetes.kubectl: - src: "https://github.com/kubernetes-sigs/cluster-api-provider-vsphere/releases/download/v{{ cluster_api_vsphere_version }}/bootstrap-components.yaml" - state: present - -- name: Install and configure Kubernetes VMware autoscaler - hosts: kubernetes_nodes - become: true - vars: - autoscaler_version: "1.21.0" - autoscaler_namespace: "kube-system" - autoscaler_min_nodes: 1 - autoscaler_max_nodes: 10 - tasks: - - name: Install Kubernetes VMware autoscaler - kubectl: - name: autoscaler - namespace: "{{ autoscaler_namespace }}" - src: "https://github.com/kubernetes/autoscaler/releases/download/cluster-autoscaler-{{ autoscaler_version }}/cluster-autoscaler-{{ autoscaler_version }}.yaml" - state: present - register: autoscaler_install_result - - - name: Configure Kubernetes VMware autoscaler - kubectl: - namespace: "{{ autoscaler_namespace }}" - command: "autoscale" - args: ["deployment.apps/kubernetes-autoscaler", "--min={{ autoscaler_min_nodes }}", "--max={{ autoscaler_max_nodes }}"] - when: autoscaler_install_result.changed \ No newline at end of file diff --git a/infra/docker/docker-compose.yml b/infra/docker/docker-compose.yml index 7b0b262..994f43d 100644 --- a/infra/docker/docker-compose.yml +++ b/infra/docker/docker-compose.yml @@ -1,9 +1,8 @@ # Persys Cloud Full Stack Docker Compose # # This file defines all core services for local development and integration: -# - API Gateway, Prow Scheduler, CoreDNS, CFSSL, MongoDB, Prometheus, Grafana, Jaeger, etcd, Node Exporter -# - All services are connected via the 'milx-cloud-net' bridge network -# - Certificates are shared via the 'certs' volume +# - Persys Gateway, Persys Scheduler, Persys Automation, Persys Forgery, Persys Federation, Persys Intelligence,CoreDNS, Hashicorp Vault, MongoDB, MySQL, Postgres, Prometheus, Grafana, Jaeger, etcd, Node Exporter +# - All services are connected via the 'persys-cloud-net' bridge network services: @@ -38,34 +37,6 @@ services: networks: - persys-cloud-net - # --- Persys Forgery (Internal build orchestration only) --- - persys-forgery: - build: ../../persys-forgery - ports: - - 8087:8087 - depends_on: - - vault - - mysql - - redis - environment: - - OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT:-jaeger:4318} - - OTEL_SERVICE_NAME=${PERSYS_FORGERY_OTEL_SERVICE_NAME:-persys-forgery} - - PERSYS_FORGERY_MYSQL_DSN=${PERSYS_FORGERY_MYSQL_DSN:-forgery:password@tcp(mysql:3306)/forgery_db?parseTime=true} - - PERSYS_FORGERY_REDIS_ADDR=${PERSYS_FORGERY_REDIS_ADDR:-redis:6379} - - PERSYS_FORGERY_REDIS_PASSWORD=${PERSYS_FORGERY_REDIS_PASSWORD:-} - - PERSYS_FORGERY_REDIS_PASSWORD_FILE=${PERSYS_FORGERY_REDIS_PASSWORD_FILE:-} - - PERSYS_FORGERY_PIPELINE_STATUS_KEY=${PERSYS_FORGERY_PIPELINE_STATUS_KEY:-pipeline_status} - - PERSYS_FORGERY_VAULT_ADDR=${PERSYS_FORGERY_VAULT_ADDR:-http://vault:8200} - - PERSYS_FORGERY_VAULT_AUTH_METHOD=${PERSYS_FORGERY_VAULT_AUTH_METHOD:-approle} - - PERSYS_FORGERY_VAULT_TOKEN=${PERSYS_FORGERY_VAULT_TOKEN:-} - - PERSYS_FORGERY_VAULT_TOKEN_FILE=${PERSYS_FORGERY_VAULT_TOKEN_FILE:-} - - PERSYS_FORGERY_VAULT_ROLE_ID=${PERSYS_FORGERY_VAULT_ROLE_ID:-} - - PERSYS_FORGERY_VAULT_SECRET_ID=${PERSYS_FORGERY_VAULT_SECRET_ID:-} - - PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET=${PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET:-} - - PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET_FILE=${PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET_FILE:-} - networks: - - persys-cloud-net - # --- Persys Scheduler (Workload scheduler and reconciler) --- persys-scheduler: build: ../../persys-scheduler @@ -99,6 +70,34 @@ services: networks: - persys-cloud-net + # --- Persys Forgery (Internal build orchestration only) --- + persys-forgery: + build: ../../persys-forgery + ports: + - 8087:8087 + depends_on: + - vault + - mysql + - redis + environment: + - OTEL_EXPORTER_OTLP_ENDPOINT=${OTEL_EXPORTER_OTLP_ENDPOINT:-jaeger:4318} + - OTEL_SERVICE_NAME=${PERSYS_FORGERY_OTEL_SERVICE_NAME:-persys-forgery} + - PERSYS_FORGERY_MYSQL_DSN=${PERSYS_FORGERY_MYSQL_DSN:-forgery:password@tcp(mysql:3306)/forgery_db?parseTime=true} + - PERSYS_FORGERY_REDIS_ADDR=${PERSYS_FORGERY_REDIS_ADDR:-redis:6379} + - PERSYS_FORGERY_REDIS_PASSWORD=${PERSYS_FORGERY_REDIS_PASSWORD:-} + - PERSYS_FORGERY_REDIS_PASSWORD_FILE=${PERSYS_FORGERY_REDIS_PASSWORD_FILE:-} + - PERSYS_FORGERY_PIPELINE_STATUS_KEY=${PERSYS_FORGERY_PIPELINE_STATUS_KEY:-pipeline_status} + - PERSYS_FORGERY_VAULT_ADDR=${PERSYS_FORGERY_VAULT_ADDR:-http://vault:8200} + - PERSYS_FORGERY_VAULT_AUTH_METHOD=${PERSYS_FORGERY_VAULT_AUTH_METHOD:-approle} + - PERSYS_FORGERY_VAULT_TOKEN=${PERSYS_FORGERY_VAULT_TOKEN:-} + - PERSYS_FORGERY_VAULT_TOKEN_FILE=${PERSYS_FORGERY_VAULT_TOKEN_FILE:-} + - PERSYS_FORGERY_VAULT_ROLE_ID=${PERSYS_FORGERY_VAULT_ROLE_ID:-} + - PERSYS_FORGERY_VAULT_SECRET_ID=${PERSYS_FORGERY_VAULT_SECRET_ID:-} + - PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET=${PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET:-} + - PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET_FILE=${PERSYS_FORGERY_GITHUB_WEBHOOK_SECRET_FILE:-} + networks: + - persys-cloud-net + # --- Persys Automation (policy engine and control-plane automation) --- persys-automation: build: ../../persys-automation @@ -357,7 +356,7 @@ services: networks: - persys-cloud-net - # --- Redis (Forgery internal queues) --- + # --- Redis (Persys Scheduler/Forgery internal queues) --- redis: image: redis:7-alpine restart: unless-stopped @@ -370,8 +369,8 @@ services: - persys-cloud-net # --- Postgres (Automation policy and audit store) --- - automation-postgres: - image: postgres:16-alpine + postgres: + image: postgres:17-alpine restart: unless-stopped environment: - POSTGRES_DB=${AUTOMATION_POSTGRES_DB:-persys_automation} @@ -399,7 +398,7 @@ services: networks: - persys-cloud-net - # --- etcd (Key-value store for Prow and CoreDNS) --- + # --- etcd (Key-value store for Persys Scheduler and CoreDNS) --- etcd: image: quay.io/coreos/etcd:v3.5.0 command: etcd --advertise-client-urls http://etcd:2379 --listen-client-urls http://0.0.0.0:2379 --auto-compaction-retention=1h diff --git a/infra/manifests/deployment.yaml.template b/infra/manifests/deployment.yaml.template deleted file mode 100644 index 98ae0bf..0000000 --- a/infra/manifests/deployment.yaml.template +++ /dev/null @@ -1,19 +0,0 @@ -apiVersion: apps/v1 -kind: Deployment -metadata: - name: {{MICROSERVICE}} -spec: - replicas: 1 - selector: - matchLabels: - app: {{MICROSERVICE}} - template: - metadata: - labels: - app: {{MICROSERVICE}} - spec: - containers: - - name: {{MICROSERVICE}} - image: {{{IMAGE}} - ports: - - containerPort: 8551 \ No newline at end of file diff --git a/infra/manifests/service.yaml.template b/infra/manifests/service.yaml.template deleted file mode 100644 index 2cb280d..0000000 --- a/infra/manifests/service.yaml.template +++ /dev/null @@ -1,11 +0,0 @@ -apiVersion: v1 -kind: Service -metadata: - name: {{MICROSERVICE}} -spec: - selector: - app: {{MICROSERVICE}} - ports: - - protocol: TCP - port: 8551 - targetPort: 8551 \ No newline at end of file diff --git a/persysctl b/persysctl index ea19094..9c52dee 160000 --- a/persysctl +++ b/persysctl @@ -1 +1 @@ -Subproject commit ea19094e28beae3505d49fbe3c95d446a73b39e3 +Subproject commit 9c52dee1d7ba4948854708f4398d027438be08a8