From e7316862c701204cf4910d2deba9f7499bc129cc Mon Sep 17 00:00:00 2001 From: Philipp Matthes
Fq%4iZQ~{~9D2S#BVXTG{WhP|d;%8TlEOno9qp=+)6{Xx*Ciqm=QfZ>?*7T2Jd~J*}^Q R{U-nb|Nj_?q>KP4004X22~_|9 literal 0 HcmV?d00001 diff --git a/decisions/dist/chart/templates/_helpers.tpl b/decisions/dist/chart/templates/_helpers.tpl new file mode 100644 index 00000000..05ce24c6 --- /dev/null +++ b/decisions/dist/chart/templates/_helpers.tpl @@ -0,0 +1,50 @@ +{{- define "chart.name" -}} +{{- if .Chart }} + {{- if .Chart.Name }} + {{- .Chart.Name | trunc 63 | trimSuffix "-" }} + {{- else if .Values.nameOverride }} + {{ .Values.nameOverride | trunc 63 | trimSuffix "-" }} + {{- else }} + decisions + {{- end }} +{{- else }} + decisions +{{- end }} +{{- end }} + + +{{- define "chart.labels" -}} +{{- if .Chart.AppVersion -}} +app.kubernetes.io/version: {{ .Chart.AppVersion | quote }} +{{- end }} +{{- if .Chart.Version }} +helm.sh/chart: {{ .Chart.Version | quote }} +{{- end }} +app.kubernetes.io/name: {{ include "chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +app.kubernetes.io/managed-by: {{ .Release.Service }} +{{- end }} + + +{{- define "chart.selectorLabels" -}} +app.kubernetes.io/name: {{ include "chart.name" . }} +app.kubernetes.io/instance: {{ .Release.Name }} +{{- end }} + + +{{- define "chart.hasMutatingWebhooks" -}} +{{- $hasMutating := false }} +{{- range . }} + {{- if eq .type "mutating" }} + $hasMutating = true }}{{- end }} +{{- end }} +{{ $hasMutating }}}}{{- end }} + + +{{- define "chart.hasValidatingWebhooks" -}} +{{- $hasValidating := false }} +{{- range . }} + {{- if eq .type "validating" }} + $hasValidating = true }}{{- end }} +{{- end }} +{{ $hasValidating }}}}{{- end }} diff --git a/decisions/dist/chart/templates/certmanager/certificate.yaml b/decisions/dist/chart/templates/certmanager/certificate.yaml new file mode 100644 index 00000000..b1b42606 --- /dev/null +++ b/decisions/dist/chart/templates/certmanager/certificate.yaml @@ -0,0 +1,36 @@ +{{- if .Values.certmanager.enable }} +# Self-signed Issuer +apiVersion: cert-manager.io/v1 +kind: Issuer +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: selfsigned-issuer + namespace: {{ .Release.Namespace }} +spec: + selfSigned: {} +{{- if .Values.metrics.enable }} +--- +# Certificate for the metrics +apiVersion: cert-manager.io/v1 +kind: Certificate +metadata: + annotations: + {{- if .Values.crd.keep }} + "helm.sh/resource-policy": keep + {{- end }} + labels: + {{- include "chart.labels" . | nindent 4 }} + name: metrics-certs + namespace: {{ .Release.Namespace }} +spec: + dnsNames: + - decisions.{{ .Release.Namespace }}.svc + - decisions.{{ .Release.Namespace }}.svc.cluster.local + - decisions-metrics-service.{{ .Release.Namespace }}.svc + issuerRef: + kind: Issuer + name: selfsigned-issuer + secretName: metrics-server-cert +{{- end }} +{{- end }} diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml new file mode 100644 index 00000000..145e45f4 --- /dev/null +++ b/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml @@ -0,0 +1,98 @@ +{{- if .Values.crd.enable }} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + annotations: + {{- if .Values.crd.keep }} + "helm.sh/resource-policy": keep + {{- end }} + controller-gen.kubebuilder.io/version: v0.17.2 + name: computedecisions.decisions.cortex +spec: + group: decisions.cortex + names: + kind: ComputeDecision + listKind: ComputeDecisionList + plural: computedecisions + shortNames: + - cdec + singular: computedecision + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: ComputeDecision is the Schema for the computedecisions API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: spec defines the desired state of ComputeDecision + properties: + pipeline: + properties: + name: + type: string + outputs: + items: + properties: + step: + type: string + weights: + additionalProperties: + type: number + type: object + required: + - step + type: object + type: array + required: + - name + type: object + required: + - pipeline + type: object + status: + description: status defines the observed state of ComputeDecision + properties: + description: + type: string + factors: + items: + properties: + expl: + type: string + host: + type: string + required: + - expl + - host + type: object + type: array + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +{{- end -}} diff --git a/decisions/dist/chart/templates/manager/manager.yaml b/decisions/dist/chart/templates/manager/manager.yaml new file mode 100644 index 00000000..060d2e6f --- /dev/null +++ b/decisions/dist/chart/templates/manager/manager.yaml @@ -0,0 +1,107 @@ +# This file is safe from kubebuilder edit --plugins=helm/v1-alpha +# If you want to re-generate, add the --force flag. + +apiVersion: apps/v1 +kind: Deployment +metadata: + name: decisions-controller-manager + namespace: {{ .Release.Namespace }} + labels: + {{- include "chart.labels" . | nindent 4 }} + control-plane: controller-manager +spec: + replicas: {{ .Values.controllerManager.replicas }} + selector: + matchLabels: + {{- include "chart.selectorLabels" . | nindent 6 }} + control-plane: controller-manager + template: + metadata: + annotations: + kubectl.kubernetes.io/default-container: manager + labels: + {{- include "chart.labels" . | nindent 8 }} + control-plane: controller-manager + {{- if and .Values.controllerManager.pod .Values.controllerManager.pod.labels }} + {{- range $key, $value := .Values.controllerManager.pod.labels }} + {{ $key }}: {{ $value }} + {{- end }} + {{- end }} + spec: + containers: + - name: manager + args: + {{- range .Values.controllerManager.container.args }} + - {{ . }} + {{- end }} + command: + - /manager + image: {{ .Values.controllerManager.container.image.repository }}:{{ .Values.controllerManager.container.image.tag | default .Chart.AppVersion }} + {{- if .Values.controllerManager.container.env }} + env: + {{- range $key, $value := .Values.controllerManager.container.env }} + - name: {{ $key }} + value: {{ $value }} + {{- end }} + {{- end }} + livenessProbe: + {{- toYaml .Values.controllerManager.container.livenessProbe | nindent 12 }} + readinessProbe: + {{- toYaml .Values.controllerManager.container.readinessProbe | nindent 12 }} + resources: + {{- toYaml .Values.controllerManager.container.resources | nindent 12 }} + securityContext: + {{- toYaml .Values.controllerManager.container.securityContext | nindent 12 }} + volumeMounts: + - name: decisions-controller-manager-config-volume + mountPath: /etc/config + - name: decisions-controller-manager-secrets-volume + mountPath: /etc/secrets + readOnly: true + {{- if and .Values.metrics.enable .Values.certmanager.enable }} + - name: metrics-certs + mountPath: /tmp/k8s-metrics-server/metrics-certs + readOnly: true + {{- end }} + securityContext: + {{- toYaml .Values.controllerManager.securityContext | nindent 8 }} + serviceAccountName: {{ .Values.controllerManager.serviceAccountName }} + terminationGracePeriodSeconds: {{ .Values.controllerManager.terminationGracePeriodSeconds }} + volumes: + # Custom values to configure the controller-manager. + - name: decisions-controller-manager-config-volume + configMap: + name: decisions-controller-manager-config + - name: decisions-controller-manager-secrets-volume + secret: + secretName: decisions-controller-manager-secrets + {{- if and .Values.metrics.enable .Values.certmanager.enable }} + - name: metrics-certs + secret: + secretName: metrics-server-cert + {{- end }} +--- +apiVersion: v1 +kind: ConfigMap +metadata: + name: decisions-controller-manager-config +data: + conf.json: |- + {{- if .Values.decisions.conf }} + {{ toJson .Values.decisions.conf }} + {{- else }} + {} + {{- end }} +--- +apiVersion: v1 +kind: Secret +metadata: + name: decisions-controller-manager-secrets +type: Opaque +data: + secrets.json: |- + {{- if .Values.decisions.secrets }} + {{ toJson .Values.decisions.secrets | b64enc }} + {{- else }} + {{ "{}" | b64enc }} + {{- end }} \ No newline at end of file diff --git a/decisions/dist/chart/templates/metrics/metrics-service.yaml b/decisions/dist/chart/templates/metrics/metrics-service.yaml new file mode 100644 index 00000000..818e728d --- /dev/null +++ b/decisions/dist/chart/templates/metrics/metrics-service.yaml @@ -0,0 +1,18 @@ +{{- if .Values.metrics.enable }} +apiVersion: v1 +kind: Service +metadata: + name: decisions-controller-manager-metrics-service + namespace: {{ .Release.Namespace }} + labels: + {{- include "chart.labels" . | nindent 4 }} + control-plane: controller-manager +spec: + ports: + - port: 8443 + targetPort: 8443 + protocol: TCP + name: https + selector: + control-plane: controller-manager +{{- end }} diff --git a/decisions/dist/chart/templates/network-policy/allow-metrics-traffic.yaml b/decisions/dist/chart/templates/network-policy/allow-metrics-traffic.yaml new file mode 100644 index 00000000..9d54a550 --- /dev/null +++ b/decisions/dist/chart/templates/network-policy/allow-metrics-traffic.yaml @@ -0,0 +1,28 @@ +{{- if .Values.networkPolicy.enable }} +# This NetworkPolicy allows ingress traffic +# with Pods running on namespaces labeled with 'metrics: enabled'. Only Pods on those +# namespaces are able to gather data from the metrics endpoint. +apiVersion: networking.k8s.io/v1 +kind: NetworkPolicy +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: allow-metrics-traffic + namespace: {{ .Release.Namespace }} +spec: + podSelector: + matchLabels: + control-plane: controller-manager + app.kubernetes.io/name: decisions + policyTypes: + - Ingress + ingress: + # This allows ingress traffic from any namespace with the label metrics: enabled + - from: + - namespaceSelector: + matchLabels: + metrics: enabled # Only from namespaces with this label + ports: + - port: 8443 + protocol: TCP +{{- end -}} diff --git a/decisions/dist/chart/templates/prometheus/monitor.yaml b/decisions/dist/chart/templates/prometheus/monitor.yaml new file mode 100644 index 00000000..1720ee91 --- /dev/null +++ b/decisions/dist/chart/templates/prometheus/monitor.yaml @@ -0,0 +1,40 @@ +# To integrate with Prometheus. +{{- if .Values.prometheus.enable }} +apiVersion: monitoring.coreos.com/v1 +kind: ServiceMonitor +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + control-plane: controller-manager + name: decisions-controller-manager-metrics-monitor + namespace: {{ .Release.Namespace }} +spec: + endpoints: + - path: /metrics + port: https + scheme: https + bearerTokenFile: /var/run/secrets/kubernetes.io/serviceaccount/token + tlsConfig: + {{- if .Values.certmanager.enable }} + serverName: decisions-controller-manager-metrics-service.{{ .Release.Namespace }}.svc + # Apply secure TLS configuration with cert-manager + insecureSkipVerify: false + ca: + secret: + name: metrics-server-cert + key: ca.crt + cert: + secret: + name: metrics-server-cert + key: tls.crt + keySecret: + name: metrics-server-cert + key: tls.key + {{- else }} + # Development/Test mode (insecure configuration) + insecureSkipVerify: true + {{- end }} + selector: + matchLabels: + control-plane: controller-manager +{{- end }} diff --git a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml new file mode 100644 index 00000000..fee77c79 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml @@ -0,0 +1,28 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants full permissions ('*') over decisions.cortex. +# This role is intended for users authorized to modify roles and bindings within the cluster, +# enabling them to delegate specific permissions to other users or groups as needed. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: computedecision-admin-role +rules: +- apiGroups: + - decisions.cortex + resources: + - computedecisions + verbs: + - '*' +- apiGroups: + - decisions.cortex + resources: + - computedecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml new file mode 100644 index 00000000..d435a404 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml @@ -0,0 +1,34 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants permissions to create, update, and delete resources within the decisions.cortex. +# This role is intended for users who need to manage these resources +# but should not control RBAC or manage permissions for others. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: computedecision-editor-role +rules: +- apiGroups: + - decisions.cortex + resources: + - computedecisions + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - decisions.cortex + resources: + - computedecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml new file mode 100644 index 00000000..879ecb27 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml @@ -0,0 +1,30 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants read-only access to decisions.cortex resources. +# This role is intended for users who need visibility into these resources +# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: computedecision-viewer-role +rules: +- apiGroups: + - decisions.cortex + resources: + - computedecisions + verbs: + - get + - list + - watch +- apiGroups: + - decisions.cortex + resources: + - computedecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/leader_election_role.yaml b/decisions/dist/chart/templates/rbac/leader_election_role.yaml new file mode 100644 index 00000000..5e5e2ded --- /dev/null +++ b/decisions/dist/chart/templates/rbac/leader_election_role.yaml @@ -0,0 +1,42 @@ +{{- if .Values.rbac.enable }} +# permissions to do leader election. +apiVersion: rbac.authorization.k8s.io/v1 +kind: Role +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + namespace: {{ .Release.Namespace }} + name: decisions-leader-election-role +rules: +- apiGroups: + - "" + resources: + - configmaps + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - coordination.k8s.io + resources: + - leases + verbs: + - get + - list + - watch + - create + - update + - patch + - delete +- apiGroups: + - "" + resources: + - events + verbs: + - create + - patch +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/leader_election_role_binding.yaml b/decisions/dist/chart/templates/rbac/leader_election_role_binding.yaml new file mode 100644 index 00000000..a4be63be --- /dev/null +++ b/decisions/dist/chart/templates/rbac/leader_election_role_binding.yaml @@ -0,0 +1,17 @@ +{{- if .Values.rbac.enable }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: RoleBinding +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + namespace: {{ .Release.Namespace }} + name: decisions-leader-election-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: Role + name: decisions-leader-election-role +subjects: +- kind: ServiceAccount + name: {{ .Values.controllerManager.serviceAccountName }} + namespace: {{ .Release.Namespace }} +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/metrics_auth_role.yaml b/decisions/dist/chart/templates/rbac/metrics_auth_role.yaml new file mode 100644 index 00000000..8ed40055 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/metrics_auth_role.yaml @@ -0,0 +1,21 @@ +{{- if and .Values.rbac.enable .Values.metrics.enable }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: decisions-metrics-auth-role +rules: +- apiGroups: + - authentication.k8s.io + resources: + - tokenreviews + verbs: + - create +- apiGroups: + - authorization.k8s.io + resources: + - subjectaccessreviews + verbs: + - create +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/metrics_auth_role_binding.yaml b/decisions/dist/chart/templates/rbac/metrics_auth_role_binding.yaml new file mode 100644 index 00000000..d3ca3c7e --- /dev/null +++ b/decisions/dist/chart/templates/rbac/metrics_auth_role_binding.yaml @@ -0,0 +1,16 @@ +{{- if and .Values.rbac.enable .Values.metrics.enable }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: decisions-metrics-auth-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: decisions-metrics-auth-role +subjects: +- kind: ServiceAccount + name: {{ .Values.controllerManager.serviceAccountName }} + namespace: {{ .Release.Namespace }} +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/metrics_reader_role.yaml b/decisions/dist/chart/templates/rbac/metrics_reader_role.yaml new file mode 100644 index 00000000..81f7da70 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/metrics_reader_role.yaml @@ -0,0 +1,13 @@ +{{- if and .Values.rbac.enable .Values.metrics.enable }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: decisions-metrics-reader +rules: +- nonResourceURLs: + - "/metrics" + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/role.yaml b/decisions/dist/chart/templates/rbac/role.yaml new file mode 100644 index 00000000..24e720cf --- /dev/null +++ b/decisions/dist/chart/templates/rbac/role.yaml @@ -0,0 +1,36 @@ +{{- if .Values.rbac.enable }} +--- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: decisions-manager-role +rules: +- apiGroups: + - decisions.cortex + resources: + - computedecisions + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - decisions.cortex + resources: + - computedecisions/finalizers + verbs: + - update +- apiGroups: + - decisions.cortex + resources: + - computedecisions/status + verbs: + - get + - patch + - update +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/role_binding.yaml b/decisions/dist/chart/templates/rbac/role_binding.yaml new file mode 100644 index 00000000..09804a2a --- /dev/null +++ b/decisions/dist/chart/templates/rbac/role_binding.yaml @@ -0,0 +1,16 @@ +{{- if .Values.rbac.enable }} +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: decisions-manager-rolebinding +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + name: decisions-manager-role +subjects: +- kind: ServiceAccount + name: {{ .Values.controllerManager.serviceAccountName }} + namespace: {{ .Release.Namespace }} +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/service_account.yaml b/decisions/dist/chart/templates/rbac/service_account.yaml new file mode 100644 index 00000000..93e0a323 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/service_account.yaml @@ -0,0 +1,15 @@ +{{- if .Values.rbac.enable }} +apiVersion: v1 +kind: ServiceAccount +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + {{- if and .Values.controllerManager.serviceAccount .Values.controllerManager.serviceAccount.annotations }} + annotations: + {{- range $key, $value := .Values.controllerManager.serviceAccount.annotations }} + {{ $key }}: {{ $value }} + {{- end }} + {{- end }} + name: {{ .Values.controllerManager.serviceAccountName }} + namespace: {{ .Release.Namespace }} +{{- end -}} diff --git a/decisions/dist/chart/values.yaml b/decisions/dist/chart/values.yaml new file mode 100644 index 00000000..df67c7d0 --- /dev/null +++ b/decisions/dist/chart/values.yaml @@ -0,0 +1,129 @@ +# This file is safe from kubebuilder edit --plugins=helm/v1-alpha +# If you want to re-generate, add the --force flag. + +owner-info: + enabled: true + helm-chart-url: "https://github.com/cobaltcore-dev/cortex/decisions/dist/chart" + maintainers: + - "p.matthes@sap.com" + - "markus.wieland@sap.com" + - "arno.uhlig@sap.com" + support-group: "workload-management" + service: "cortex-decisions" + +# [MANAGER]: Manager Deployment Configurations +controllerManager: + replicas: 1 + container: + image: + repository: ghcr.io/cobaltcore-dev/cortex-decisions-operator + args: + - "--leader-elect" + - "--metrics-bind-address=:8443" + - "--health-probe-bind-address=:8081" + resources: + limits: + cpu: 500m + memory: 512Mi + requests: + cpu: 10m + memory: 64Mi + livenessProbe: + initialDelaySeconds: 15 + periodSeconds: 20 + httpGet: + path: /healthz + port: 8081 + readinessProbe: + initialDelaySeconds: 5 + periodSeconds: 10 + httpGet: + path: /readyz + port: 8081 + securityContext: + allowPrivilegeEscalation: false + capabilities: + drop: + - "ALL" + securityContext: + runAsNonRoot: true + seccompProfile: + type: RuntimeDefault + terminationGracePeriodSeconds: 10 + serviceAccountName: decisions-controller-manager + +# [RBAC]: To enable RBAC (Permissions) configurations +rbac: + enable: true + +# [CRDs]: To enable the CRDs +crd: + # This option determines whether the CRDs are included + # in the installation process. + enable: true + + # Enabling this option adds the "helm.sh/resource-policy": keep + # annotation to the CRD, ensuring it remains installed even when + # the Helm release is uninstalled. + # NOTE: Removing the CRDs will also remove all cert-manager CR(s) + # (Certificates, Issuers, ...) due to garbage collection. + keep: true + +# [METRICS]: Set to true to generate manifests for exporting metrics. +# To disable metrics export set false, and ensure that the +# ControllerManager argument "--metrics-bind-address=:8443" is removed. +metrics: + enable: true + +# [PROMETHEUS]: To enable a ServiceMonitor to export metrics to Prometheus set true +prometheus: + enable: true + +# [CERT-MANAGER]: To enable cert-manager injection to webhooks set true +certmanager: + enable: false + +# [NETWORK POLICIES]: To enable NetworkPolicies set true +networkPolicy: + enable: false + +# SSO certificate to use. +sharedSSOCert: &sharedSSOCert + # Certificate "public key". (Optional, remove this key if not needed) + cert: | + -----BEGIN CERTIFICATE----- + Your certificate here + -----END CERTIFICATE----- + # Certificate private key. (Optional, remove this key if not needed) + certKey: | + -----BEGIN PRIVATE KEY----- + Your private key here + -----END PRIVATE KEY + # Whether the certificate is self-signed. + # If true, the certificate is not verified. + selfSigned: false + +decisions: + # Default configuration provided through configmap to the operator. + conf: + # Which hypervisor types should be handled by the operator. + hypervisors: + - "QEMU" + - "CH" + # Not supported: + # - "VMware vCenter Server" + # - "ironic" + endpoints: + # The URL of the Nova external scheduler service. + novaExternalScheduler: "http://cortex-nova-scheduler:8080/scheduler/nova/external" + # Config provided here will override the config provided above. + secrets: + # Override the endpoints and credentials to your OpenStack. + keystone: + url: https://path-to-keystone/v3 + sso: *sharedSSOCert + username: openstack-user-with-all-project-read-access + password: openstack-user-password + projectName: openstack-project-of-user + userDomainName: openstack-domain-of-user + projectDomainName: openstack-domain-of-project-scoped-to diff --git a/decisions/go.mod b/decisions/go.mod new file mode 100644 index 00000000..7d25ec49 --- /dev/null +++ b/decisions/go.mod @@ -0,0 +1,105 @@ +module github.com/cobaltcore-dev/cortex/decisions + +go 1.25.0 + +replace ( + github.com/cobaltcore-dev/cortex => ../ + github.com/cobaltcore-dev/cortex/decisions/api => ./api +) + +require ( + github.com/cobaltcore-dev/cortex v0.0.0-00010101000000-000000000000 + github.com/cobaltcore-dev/cortex/decisions/api v0.0.0-00010101000000-000000000000 + k8s.io/apimachinery v0.34.1 + k8s.io/client-go v0.34.1 + sigs.k8s.io/controller-runtime v0.22.1 +) + +require ( + github.com/pmezard/go-difflib v1.0.0 // indirect + go.yaml.in/yaml/v2 v2.4.2 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect + sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect +) + +require ( + cel.dev/expr v0.24.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.0 // indirect + github.com/beorn7/perks v1.0.1 // indirect + github.com/blang/semver/v4 v4.0.0 // indirect + github.com/cenkalti/backoff/v4 v4.3.0 // indirect + github.com/cespare/xxhash/v2 v2.3.0 // indirect + github.com/davecgh/go-spew v1.1.1 // indirect + github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/evanphx/json-patch/v5 v5.9.11 // indirect + github.com/felixge/httpsnoop v1.0.4 // indirect + github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/fxamacker/cbor/v2 v2.9.0 // indirect + github.com/go-logr/logr v1.4.3 // indirect + github.com/go-logr/stdr v1.2.2 // indirect + github.com/go-logr/zapr v1.3.0 // indirect + github.com/go-openapi/jsonpointer v0.21.0 // indirect + github.com/go-openapi/jsonreference v0.20.2 // indirect + github.com/go-openapi/swag v0.23.0 // indirect + github.com/gogo/protobuf v1.3.2 // indirect + github.com/google/btree v1.1.3 // indirect + github.com/google/cel-go v0.26.0 // indirect + github.com/google/gnostic-models v0.7.0 // indirect + github.com/google/go-cmp v0.7.0 // indirect + github.com/google/uuid v1.6.0 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect + github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/josharian/intern v1.0.0 // indirect + github.com/json-iterator/go v1.1.12 // indirect + github.com/mailru/easyjson v0.7.7 // indirect + github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect + github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect + github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect + github.com/pkg/errors v0.9.1 // indirect + github.com/prometheus/client_golang v1.23.2 // indirect + github.com/prometheus/client_model v0.6.2 // indirect + github.com/prometheus/common v0.66.1 // indirect + github.com/prometheus/procfs v0.17.0 // indirect + github.com/spf13/cobra v1.9.1 // indirect + github.com/spf13/pflag v1.0.6 // indirect + github.com/stoewer/go-strcase v1.3.0 // indirect + github.com/x448/float16 v0.8.4 // indirect + go.opentelemetry.io/auto/sdk v1.1.0 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect + go.opentelemetry.io/otel v1.37.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect + go.opentelemetry.io/otel/metric v1.37.0 // indirect + go.opentelemetry.io/otel/sdk v1.35.0 // indirect + go.opentelemetry.io/otel/trace v1.37.0 // indirect + go.opentelemetry.io/proto/otlp v1.5.0 // indirect + go.uber.org/multierr v1.11.0 // indirect + go.uber.org/zap v1.27.0 // indirect + golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/net v0.44.0 // indirect + golang.org/x/oauth2 v0.30.0 // indirect + golang.org/x/sync v0.17.0 // indirect + golang.org/x/sys v0.36.0 // indirect + golang.org/x/term v0.35.0 // indirect + golang.org/x/text v0.29.0 // indirect + golang.org/x/time v0.12.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect + google.golang.org/grpc v1.72.1 // indirect + google.golang.org/protobuf v1.36.8 // indirect + gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect + gopkg.in/inf.v0 v0.9.1 // indirect + gopkg.in/yaml.v3 v3.0.1 // indirect + k8s.io/api v0.34.1 // indirect + k8s.io/apiextensions-apiserver v0.34.0 // indirect + k8s.io/apiserver v0.34.0 // indirect + k8s.io/component-base v0.34.0 // indirect + k8s.io/klog/v2 v2.130.1 // indirect + k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect + k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect + sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + sigs.k8s.io/randfill v1.0.0 // indirect + sigs.k8s.io/yaml v1.6.0 // indirect +) diff --git a/decisions/go.sum b/decisions/go.sum new file mode 100644 index 00000000..bc272d7d --- /dev/null +++ b/decisions/go.sum @@ -0,0 +1,259 @@ +cel.dev/expr v0.24.0 h1:56OvJKSH3hDGL0ml5uSxZmz3/3Pq4tJ+fb1unVLAFcY= +cel.dev/expr v0.24.0/go.mod h1:hLPLo1W4QUmuYdA72RBX06QTs6MXw941piREPl3Yfiw= +github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= +github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= +github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= +github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= +github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM= +github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= +github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= +github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= +github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= +github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= +github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= +github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= +github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= +github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= +github.com/evanphx/json-patch/v5 v5.9.11/go.mod h1:3j+LviiESTElxA4p3EMKAB9HXj3/XEtnUf6OZxqIQTM= +github.com/felixge/httpsnoop v1.0.4 h1:NFTV2Zj1bL4mc9sqWACXbQFVBBg2W3GPvqp8/ESS2Wg= +github.com/felixge/httpsnoop v1.0.4/go.mod h1:m8KPJKqk1gH5J9DgRY2ASl2lWCfGKXixSwevea8zH2U= +github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S9k= +github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= +github.com/fxamacker/cbor/v2 v2.9.0 h1:NpKPmjDBgUfBms6tr6JZkTHtfFGcMKsw3eGcmD/sapM= +github.com/fxamacker/cbor/v2 v2.9.0/go.mod h1:vM4b+DJCtHn+zz7h3FFp/hDAI9WNWCsZj23V5ytsSxQ= +github.com/go-logr/logr v1.2.2/go.mod h1:jdQByPbusPIv2/zmleS9BjJVeZ6kBagPoEUsqbVz/1A= +github.com/go-logr/logr v1.4.3 h1:CjnDlHq8ikf6E492q6eKboGOC0T8CDaOvkHCIg8idEI= +github.com/go-logr/logr v1.4.3/go.mod h1:9T104GzyrTigFIr8wt5mBrctHMim0Nb2HLGrmQ40KvY= +github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= +github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= +github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= +github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= +github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= +github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= +github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= +github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= +github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= +github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= +github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= +github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8= +github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= +github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= +github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek= +github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= +github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= +github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= +github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI= +github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= +github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= +github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= +github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= +github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db h1:097atOisP2aRj7vFgYQBbFN4U4JNXUNYpxael3UzMyo= +github.com/google/pprof v0.0.0-20241029153458-d1b30febd7db/go.mod h1:vavhavw2zAxS5dIdcRluK6cSGGPlZynqzFM8NdvU144= +github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= +github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= +github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= +github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= +github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= +github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= +github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= +github.com/json-iterator/go v1.1.12/go.mod h1:e30LSqwooZae/UwlEbR2852Gd8hjQvJoHmT4TnhNGBo= +github.com/kisielk/errcheck v1.5.0/go.mod h1:pFxgyoBC7bSaBwPgfKdkLd5X25qrDl4LWUI2bnpBCr8= +github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck= +github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= +github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= +github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= +github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= +github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/modern-go/concurrent v0.0.0-20180228061459-e0a39a4cb421/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd h1:TRLaZ9cD/w8PVh93nsPXa1VrQ6jlwL5oN8l14QlcNfg= +github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd/go.mod h1:6dJC0mAP4ikYIbvyc7fijjWJddQyLn8Ig3JB5CqoB9Q= +github.com/modern-go/reflect2 v1.0.2/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee h1:W5t00kpgFdJifH4BDsTlE89Zl93FEloxaWZfGcifgq8= +github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee/go.mod h1:yWuevngMOJpCy52FWWMvUC8ws7m/LJsjYzDa0/r8luk= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 h1:C3w9PqII01/Oq1c1nUAm88MOHcQC9l5mIlSMApZMrHA= +github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822/go.mod h1:+n7T8mK8HuQTcFwEeznm/DIxMOiR9yIdICNftLE1DvQ= +github.com/onsi/ginkgo/v2 v2.22.0 h1:Yed107/8DjTr0lKCNt7Dn8yQ6ybuDRQoMGrNFKzMfHg= +github.com/onsi/ginkgo/v2 v2.22.0/go.mod h1:7Du3c42kxCUegi0IImZ1wUQzMBVecgIHjR1C+NkhLQo= +github.com/onsi/gomega v1.36.1 h1:bJDPBO7ibjxcbHMgSCoo4Yj18UWbKDlLwX1x9sybDcw= +github.com/onsi/gomega v1.36.1/go.mod h1:PvZbdDc8J6XJEpDK4HCuRBm8a6Fzp9/DmhC9C7yFlog= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/prometheus/client_golang v1.23.2 h1:Je96obch5RDVy3FDMndoUsjAhG5Edi49h0RJWRi/o0o= +github.com/prometheus/client_golang v1.23.2/go.mod h1:Tb1a6LWHB3/SPIzCoaDXI4I8UHKeFTEQ1YCr+0Gyqmg= +github.com/prometheus/client_model v0.6.2 h1:oBsgwpGs7iVziMvrGhE53c/GrLUsZdHnqNwqPLxwZyk= +github.com/prometheus/client_model v0.6.2/go.mod h1:y3m2F6Gdpfy6Ut/GBsUqTWZqCUvMVzSfMLjcu6wAwpE= +github.com/prometheus/common v0.66.1 h1:h5E0h5/Y8niHc5DlaLlWLArTQI7tMrsfQjHV+d9ZoGs= +github.com/prometheus/common v0.66.1/go.mod h1:gcaUsgf3KfRSwHY4dIMXLPV0K/Wg1oZ8+SbZk/HH/dA= +github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= +github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= +github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= +github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= +github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= +github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= +github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= +github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= +github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= +github.com/stretchr/objx v0.5.0/go.mod h1:Yh+to48EsGEfYuaHDzXPcE3xhTkx73EhmCGUpEOglKo= +github.com/stretchr/objx v0.5.2 h1:xuMeJ0Sdp5ZMRXx/aWO6RZxdr3beISkG5/G/aIRr3pY= +github.com/stretchr/objx v0.5.2/go.mod h1:FRsXN1f5AsAjCGJKqEizvkpNtU+EGNCLh3NxZ/8L+MA= +github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= +github.com/stretchr/testify v1.7.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= +github.com/stretchr/testify v1.8.0/go.mod h1:yNjHg4UonilssWZ8iaSj1OCr/vHnekPRkoO+kdMU+MU= +github.com/stretchr/testify v1.8.1/go.mod h1:w2LPCIKwWwSfY2zedu0+kehJoqGctiVI29o6fzry7u4= +github.com/stretchr/testify v1.11.1 h1:7s2iGBzp5EwR7/aIZr8ao5+dra3wiQyKjjFuvgVKu7U= +github.com/stretchr/testify v1.11.1/go.mod h1:wZwfW3scLgRK+23gO65QZefKpKQRnfz6sD981Nm4B6U= +github.com/x448/float16 v0.8.4 h1:qLwI1I70+NjRFUR3zs1JPUCgaCXSh3SW62uAKT1mSBM= +github.com/x448/float16 v0.8.4/go.mod h1:14CWIYCyZA/cWjXOioeEpHeN/83MdbZDRQHoFcYsOfg= +github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= +go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ= +go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= +go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE= +go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= +go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= +go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= +go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= +go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= +go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= +go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= +go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= +go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= +go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= +go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= +go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= +go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= +go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= +go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= +go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= +go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= +go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= +golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= +golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= +golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= +golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= +golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.17.0 h1:l60nONMj9l5drqw6jlhIELNv9I0A4OFgRsG9k2oT9Ug= +golang.org/x/sync v0.17.0/go.mod h1:9KTHXmSnoGruLpwFjVSX0lNNA75CykiMECbovNTZqGI= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20200930185726-fdedc70b468f/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.36.0 h1:KVRy2GtZBrk1cBYA7MKu5bEZFxQk4NIDV6RLVcC8o0k= +golang.org/x/sys v0.36.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.35.0 h1:bZBVKBudEyhRcajGcNc3jIfWPqV4y/Kt2XcoigOWtDQ= +golang.org/x/term v0.35.0/go.mod h1:TPGtkTLesOwf2DE8CgVYiZinHAOuy5AYUYT1lENIZnA= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= +golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= +golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= +golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= +golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= +golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= +gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= +google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I= +google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA= +google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= +google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= +google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= +gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= +gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM= +k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk= +k8s.io/apiextensions-apiserver v0.34.0 h1:B3hiB32jV7BcyKcMU5fDaDxk882YrJ1KU+ZSkA9Qxoc= +k8s.io/apiextensions-apiserver v0.34.0/go.mod h1:hLI4GxE1BDBy9adJKxUxCEHBGZtGfIg98Q+JmTD7+g0= +k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4= +k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= +k8s.io/apiserver v0.34.0 h1:Z51fw1iGMqN7uJ1kEaynf2Aec1Y774PqU+FVWCFV3Jg= +k8s.io/apiserver v0.34.0/go.mod h1:52ti5YhxAvewmmpVRqlASvaqxt0gKJxvCeW7ZrwgazQ= +k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY= +k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8= +k8s.io/component-base v0.34.0 h1:bS8Ua3zlJzapklsB1dZgjEJuJEeHjj8yTu1gxE2zQX8= +k8s.io/component-base v0.34.0/go.mod h1:RSCqUdvIjjrEm81epPcjQ/DS+49fADvGSCkIP3IC6vg= +k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= +k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA= +k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y= +k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +sigs.k8s.io/controller-runtime v0.22.1 h1:Ah1T7I+0A7ize291nJZdS1CabF/lB4E++WizgV24Eqg= +sigs.k8s.io/controller-runtime v0.22.1/go.mod h1:FwiwRjkRPbiN+zp2QRp7wlTCzbUXxZ/D4OzuQUDwBHY= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= +sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= +sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= +sigs.k8s.io/structured-merge-diff/v6 v6.3.0/go.mod h1:M3W8sfWvn2HhQDIbGWj3S099YozAsymCo/wrT5ohRUE= +sigs.k8s.io/yaml v1.6.0 h1:G8fkbMSAFqgEFgh4b1wmtzDnioxFCUgTZhlbj5P9QYs= +sigs.k8s.io/yaml v1.6.0/go.mod h1:796bPqUfzR/0jLAl6XjHl3Ck7MiyVv8dbTdyT3/pMf4= diff --git a/decisions/hack/boilerplate.go.txt b/decisions/hack/boilerplate.go.txt new file mode 100644 index 00000000..0fb88f91 --- /dev/null +++ b/decisions/hack/boilerplate.go.txt @@ -0,0 +1,2 @@ +// Copyright 2025 SAP SE +// SPDX-License-Identifier: Apache-2.0 \ No newline at end of file diff --git a/decisions/internal/controller/conf.go b/decisions/internal/controller/conf.go new file mode 100644 index 00000000..4cf64100 --- /dev/null +++ b/decisions/internal/controller/conf.go @@ -0,0 +1,7 @@ +// Copyright 2025 SAP SE +// SPDX-License-Identifier: Apache-2.0 + +package controller + +// Configuration for the decisions operator. +type Config struct{} diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go new file mode 100644 index 00000000..baac2711 --- /dev/null +++ b/decisions/internal/controller/controller.go @@ -0,0 +1,58 @@ +// Copyright 2025 SAP SE +// SPDX-License-Identifier: Apache-2.0 + +package controller + +import ( + "context" + + "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/controller" + logf "sigs.k8s.io/controller-runtime/pkg/log" + + "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" + decisionsv1alpha1 "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" +) + +// ComputeDecisionReconciler reconciles a ComputeDecision object +type ComputeDecisionReconciler struct { + // Client for the kubernetes API. + client.Client + // Kubernetes scheme to use for the decisions. + Scheme *runtime.Scheme + // Configuration for the controller. + Conf Config +} + +// +kubebuilder:rbac:groups=decisions.cortex,resources=computedecisions,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=decisions.cortex,resources=computedecisions/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=decisions.cortex,resources=computedecisions/finalizers,verbs=update + +// Reconcile is part of the main kubernetes reconciliation loop which aims to +// move the current state of the cluster closer to the desired state. +func (r *ComputeDecisionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { + _ = logf.FromContext(ctx) + // Fetch the decision object. + var res v1alpha1.ComputeDecision + if err := r.Get(ctx, req.NamespacedName, &res); err != nil { + // Can happen when the resource was just deleted. + return ctrl.Result{}, err + } + + // TODO: Reconciliation logic. + + return ctrl.Result{}, nil // No need to requeue. +} + +// SetupWithManager sets up the controller with the Manager. +func (r *ComputeDecisionReconciler) SetupWithManager(mgr ctrl.Manager) error { + return ctrl.NewControllerManagedBy(mgr). + For(&decisionsv1alpha1.ComputeDecision{}). + Named("computedecision"). + WithOptions(controller.Options{ + MaxConcurrentReconciles: 1, // Default + }). + Complete(r) +} From 8f710b6ec09308f87c1a5279dd0830a22f56da92 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 10:15:34 +0200 Subject: [PATCH 02/58] Remove duplicated --- ...servations.cortex_computereservations.yaml | 118 ------------------ 1 file changed, 118 deletions(-) delete mode 100644 decisions/config/crd/bases/reservations.cortex_computereservations.yaml diff --git a/decisions/config/crd/bases/reservations.cortex_computereservations.yaml b/decisions/config/crd/bases/reservations.cortex_computereservations.yaml deleted file mode 100644 index 2dc1e1bd..00000000 --- a/decisions/config/crd/bases/reservations.cortex_computereservations.yaml +++ /dev/null @@ -1,118 +0,0 @@ ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - annotations: - controller-gen.kubebuilder.io/version: v0.17.2 - name: computedecisions.decisions.cortex -spec: - group: decisions.cortex - names: - kind: ComputeDecision - listKind: ComputeDecisionList - plural: computedecisions - shortNames: - - cres - singular: computedecision - scope: Cluster - versions: - - additionalPrinterColumns: - - jsonPath: .status.host - name: Host - type: string - - jsonPath: .status.phase - name: Phase - type: string - - jsonPath: .status.error - name: Error - type: string - name: v1alpha1 - schema: - openAPIV3Schema: - description: ComputeDecision is the Schema for the computedecisions - API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: spec defines the desired state of ComputeDecision - properties: - creator: - description: |- - A remark that can be used to identify the creator of the decision. - This can be used to clean up decisions synced from external systems - without touching decisions created manually or by other systems. - type: string - requests: - additionalProperties: - anyOf: - - type: integer - - type: string - pattern: ^(\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\+|-)?(([0-9]+(\.[0-9]*)?)|(\.[0-9]+))))?$ - x-kubernetes-int-or-string: true - description: Resources requested to reserve for this instance. - type: object - scheduler: - description: Specification of the scheduler that will handle the decision. - properties: - cortexNova: - description: |- - If the type of scheduler is cortex-nova, this field will contain additional - information used by cortex-nova to place the instance. - properties: - domainID: - description: The domain ID to reserve for. - type: string - flavorExtraSpecs: - additionalProperties: - type: string - description: Extra specifications relevant for initial placement - of the instance. - type: object - flavorName: - description: The flavor name of the instance to reserve. - type: string - projectID: - description: The project ID to reserve for. - type: string - type: object - type: object - type: object - status: - description: status defines the observed state of ComputeDecision - properties: - error: - description: An error explaining why the decision is failed, if - applicable. - type: string - host: - description: The name of the compute host that was allocated. - type: string - phase: - description: The current phase of the decision. - type: string - required: - - host - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} From 0692cd8e9009c10b89fe51544576ca6793963a26 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 10:33:45 +0200 Subject: [PATCH 03/58] Rename to schedulingdecision --- decisions/PROJECT | 2 +- .../api/v1alpha1/computedecision_types.go | 68 --------------- .../api/v1alpha1/schedulingdecision_types.go | 62 +++++++++++++ .../api/v1alpha1/zz_generated.deepcopy.go | 78 +++++++---------- decisions/cmd/main.go | 4 +- ...decisions.cortex_schedulingdecisions.yaml} | 30 ++----- ...decisions.cortex_schedulingdecisions.yaml} | 30 ++----- .../decisions.cortex_computedecisions.yaml | 22 ++--- .../decisions.cortex_schedulingdecisions.yaml | 86 +++++++++++++++++++ decisions/internal/controller/controller.go | 17 ++-- 10 files changed, 213 insertions(+), 186 deletions(-) delete mode 100644 decisions/api/v1alpha1/computedecision_types.go create mode 100644 decisions/api/v1alpha1/schedulingdecision_types.go rename decisions/config/crd/bases/{decisions.cortex_computedecisions.yaml => decisions.cortex_schedulingdecisions.yaml} (74%) rename decisions/config/crd/{decisions.cortex_computedecisions.yaml => decisions.cortex_schedulingdecisions.yaml} (74%) create mode 100644 decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml diff --git a/decisions/PROJECT b/decisions/PROJECT index 40012891..edd787f2 100644 --- a/decisions/PROJECT +++ b/decisions/PROJECT @@ -16,7 +16,7 @@ resources: controller: true domain: cortex group: decisions - kind: ComputeDecision + kind: SchedulingDecision path: github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1 version: v1alpha1 version: "3" diff --git a/decisions/api/v1alpha1/computedecision_types.go b/decisions/api/v1alpha1/computedecision_types.go deleted file mode 100644 index c282a848..00000000 --- a/decisions/api/v1alpha1/computedecision_types.go +++ /dev/null @@ -1,68 +0,0 @@ -// Copyright 2025 SAP SE -// SPDX-License-Identifier: Apache-2.0 - -package v1alpha1 - -import ( - metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" -) - -type ComputeDecisionPipelineOutputSpec struct { - Step string `json:"step"` - Weights map[string]float64 `json:"weights,omitempty"` -} - -type ComputeDecisionPipelineSpec struct { - Name string `json:"name"` - Outputs []ComputeDecisionPipelineOutputSpec `json:"outputs,omitempty"` -} - -// ComputeDecisionSpec defines the desired state of ComputeDecision. -type ComputeDecisionSpec struct { - Pipeline ComputeDecisionPipelineSpec `json:"pipeline"` -} - -type ComputeDecisionFactorStatus struct { - Host string `json:"host"` - Expl string `json:"expl"` -} - -// ComputeDecisionStatus defines the observed state of ComputeDecision. -type ComputeDecisionStatus struct { - Description string `json:"description,omitempty"` - Factors []ComputeDecisionFactorStatus `json:"factors,omitempty"` -} - -// +kubebuilder:object:root=true -// +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,shortName=cdec - -// ComputeDecision is the Schema for the computedecisions API -type ComputeDecision struct { - metav1.TypeMeta `json:",inline"` - - // metadata is a standard object metadata - // +optional - metav1.ObjectMeta `json:"metadata,omitempty,omitzero"` - - // spec defines the desired state of ComputeDecision - // +required - Spec ComputeDecisionSpec `json:"spec"` - - // status defines the observed state of ComputeDecision - // +optional - Status ComputeDecisionStatus `json:"status,omitempty,omitzero"` -} - -// +kubebuilder:object:root=true - -// ComputeDecisionList contains a list of ComputeDecision -type ComputeDecisionList struct { - metav1.TypeMeta `json:",inline"` - metav1.ListMeta `json:"metadata,omitempty"` - Items []ComputeDecision `json:"items"` -} - -func init() { - SchemeBuilder.Register(&ComputeDecision{}, &ComputeDecisionList{}) -} diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go new file mode 100644 index 00000000..1beace65 --- /dev/null +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -0,0 +1,62 @@ +// Copyright 2025 SAP SE +// SPDX-License-Identifier: Apache-2.0 + +package v1alpha1 + +import ( + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" +) + +type SchedulingDecisionPipelineOutputSpec struct { + Step string `json:"step"` + Weights map[string]float64 `json:"weights,omitempty"` +} + +type SchedulingDecisionPipelineSpec struct { + Name string `json:"name"` + Outputs []SchedulingDecisionPipelineOutputSpec `json:"outputs,omitempty"` +} + +// SchedulingDecisionSpec defines the desired state of SchedulingDecision. +type SchedulingDecisionSpec struct { + Pipeline SchedulingDecisionPipelineSpec `json:"pipeline"` +} + +// SchedulingDecisionStatus defines the observed state of SchedulingDecision. +type SchedulingDecisionStatus struct { + Description string `json:"description,omitempty"` +} + +// +kubebuilder:object:root=true +// +kubebuilder:subresource:status +// +kubebuilder:resource:scope=Cluster,shortName=sdecs + +// SchedulingDecision is the Schema for the computedecisions API +type SchedulingDecision struct { + metav1.TypeMeta `json:",inline"` + + // metadata is a standard object metadata + // +optional + metav1.ObjectMeta `json:"metadata,omitempty,omitzero"` + + // spec defines the desired state of SchedulingDecision + // +required + Spec SchedulingDecisionSpec `json:"spec"` + + // status defines the observed state of SchedulingDecision + // +optional + Status SchedulingDecisionStatus `json:"status,omitempty,omitzero"` +} + +// +kubebuilder:object:root=true + +// SchedulingDecisionList contains a list of SchedulingDecision +type SchedulingDecisionList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []SchedulingDecision `json:"items"` +} + +func init() { + SchemeBuilder.Register(&SchedulingDecision{}, &SchedulingDecisionList{}) +} diff --git a/decisions/api/v1alpha1/zz_generated.deepcopy.go b/decisions/api/v1alpha1/zz_generated.deepcopy.go index 763790e0..5d891098 100644 --- a/decisions/api/v1alpha1/zz_generated.deepcopy.go +++ b/decisions/api/v1alpha1/zz_generated.deepcopy.go @@ -12,26 +12,26 @@ import ( ) // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ComputeDecision) DeepCopyInto(out *ComputeDecision) { +func (in *SchedulingDecision) DeepCopyInto(out *SchedulingDecision) { *out = *in out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - in.Status.DeepCopyInto(&out.Status) + out.Status = in.Status } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeDecision. -func (in *ComputeDecision) DeepCopy() *ComputeDecision { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecision. +func (in *SchedulingDecision) DeepCopy() *SchedulingDecision { if in == nil { return nil } - out := new(ComputeDecision) + out := new(SchedulingDecision) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ComputeDecision) DeepCopyObject() runtime.Object { +func (in *SchedulingDecision) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -39,46 +39,31 @@ func (in *ComputeDecision) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ComputeDecisionFactorStatus) DeepCopyInto(out *ComputeDecisionFactorStatus) { - *out = *in -} - -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeDecisionFactorStatus. -func (in *ComputeDecisionFactorStatus) DeepCopy() *ComputeDecisionFactorStatus { - if in == nil { - return nil - } - out := new(ComputeDecisionFactorStatus) - in.DeepCopyInto(out) - return out -} - -// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ComputeDecisionList) DeepCopyInto(out *ComputeDecisionList) { +func (in *SchedulingDecisionList) DeepCopyInto(out *SchedulingDecisionList) { *out = *in out.TypeMeta = in.TypeMeta in.ListMeta.DeepCopyInto(&out.ListMeta) if in.Items != nil { in, out := &in.Items, &out.Items - *out = make([]ComputeDecision, len(*in)) + *out = make([]SchedulingDecision, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeDecisionList. -func (in *ComputeDecisionList) DeepCopy() *ComputeDecisionList { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecisionList. +func (in *SchedulingDecisionList) DeepCopy() *SchedulingDecisionList { if in == nil { return nil } - out := new(ComputeDecisionList) + out := new(SchedulingDecisionList) in.DeepCopyInto(out) return out } // DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. -func (in *ComputeDecisionList) DeepCopyObject() runtime.Object { +func (in *SchedulingDecisionList) DeepCopyObject() runtime.Object { if c := in.DeepCopy(); c != nil { return c } @@ -86,7 +71,7 @@ func (in *ComputeDecisionList) DeepCopyObject() runtime.Object { } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ComputeDecisionPipelineOutputSpec) DeepCopyInto(out *ComputeDecisionPipelineOutputSpec) { +func (in *SchedulingDecisionPipelineOutputSpec) DeepCopyInto(out *SchedulingDecisionPipelineOutputSpec) { *out = *in if in.Weights != nil { in, out := &in.Weights, &out.Weights @@ -97,70 +82,65 @@ func (in *ComputeDecisionPipelineOutputSpec) DeepCopyInto(out *ComputeDecisionPi } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeDecisionPipelineOutputSpec. -func (in *ComputeDecisionPipelineOutputSpec) DeepCopy() *ComputeDecisionPipelineOutputSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecisionPipelineOutputSpec. +func (in *SchedulingDecisionPipelineOutputSpec) DeepCopy() *SchedulingDecisionPipelineOutputSpec { if in == nil { return nil } - out := new(ComputeDecisionPipelineOutputSpec) + out := new(SchedulingDecisionPipelineOutputSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ComputeDecisionPipelineSpec) DeepCopyInto(out *ComputeDecisionPipelineSpec) { +func (in *SchedulingDecisionPipelineSpec) DeepCopyInto(out *SchedulingDecisionPipelineSpec) { *out = *in if in.Outputs != nil { in, out := &in.Outputs, &out.Outputs - *out = make([]ComputeDecisionPipelineOutputSpec, len(*in)) + *out = make([]SchedulingDecisionPipelineOutputSpec, len(*in)) for i := range *in { (*in)[i].DeepCopyInto(&(*out)[i]) } } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeDecisionPipelineSpec. -func (in *ComputeDecisionPipelineSpec) DeepCopy() *ComputeDecisionPipelineSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecisionPipelineSpec. +func (in *SchedulingDecisionPipelineSpec) DeepCopy() *SchedulingDecisionPipelineSpec { if in == nil { return nil } - out := new(ComputeDecisionPipelineSpec) + out := new(SchedulingDecisionPipelineSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ComputeDecisionSpec) DeepCopyInto(out *ComputeDecisionSpec) { +func (in *SchedulingDecisionSpec) DeepCopyInto(out *SchedulingDecisionSpec) { *out = *in in.Pipeline.DeepCopyInto(&out.Pipeline) } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeDecisionSpec. -func (in *ComputeDecisionSpec) DeepCopy() *ComputeDecisionSpec { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecisionSpec. +func (in *SchedulingDecisionSpec) DeepCopy() *SchedulingDecisionSpec { if in == nil { return nil } - out := new(ComputeDecisionSpec) + out := new(SchedulingDecisionSpec) in.DeepCopyInto(out) return out } // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. -func (in *ComputeDecisionStatus) DeepCopyInto(out *ComputeDecisionStatus) { +func (in *SchedulingDecisionStatus) DeepCopyInto(out *SchedulingDecisionStatus) { *out = *in - if in.Factors != nil { - in, out := &in.Factors, &out.Factors - *out = make([]ComputeDecisionFactorStatus, len(*in)) - copy(*out, *in) - } } -// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new ComputeDecisionStatus. -func (in *ComputeDecisionStatus) DeepCopy() *ComputeDecisionStatus { +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecisionStatus. +func (in *SchedulingDecisionStatus) DeepCopy() *SchedulingDecisionStatus { if in == nil { return nil } - out := new(ComputeDecisionStatus) + out := new(SchedulingDecisionStatus) in.DeepCopyInto(out) return out } diff --git a/decisions/cmd/main.go b/decisions/cmd/main.go index 25a4c09f..102f01e4 100644 --- a/decisions/cmd/main.go +++ b/decisions/cmd/main.go @@ -190,12 +190,12 @@ func main() { os.Exit(1) } - if err := (&controller.ComputeDecisionReconciler{ + if err := (&controller.SchedulingDecisionReconciler{ Client: mgr.GetClient(), Scheme: mgr.GetScheme(), Conf: conf.NewConfig[controller.Config](), }).SetupWithManager(mgr); err != nil { - setupLog.Error(err, "unable to create controller", "controller", "ComputeDecision") + setupLog.Error(err, "unable to create controller", "controller", "SchedulingDecision") os.Exit(1) } // +kubebuilder:scaffold:builder diff --git a/decisions/config/crd/bases/decisions.cortex_computedecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml similarity index 74% rename from decisions/config/crd/bases/decisions.cortex_computedecisions.yaml rename to decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index fcc4e894..426ca823 100644 --- a/decisions/config/crd/bases/decisions.cortex_computedecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -4,22 +4,22 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.17.2 - name: computedecisions.decisions.cortex + name: schedulingdecisions.decisions.cortex spec: group: decisions.cortex names: - kind: ComputeDecision - listKind: ComputeDecisionList - plural: computedecisions + kind: SchedulingDecision + listKind: SchedulingDecisionList + plural: schedulingdecisions shortNames: - - cdec - singular: computedecision + - sdecs + singular: schedulingdecision scope: Cluster versions: - name: v1alpha1 schema: openAPIV3Schema: - description: ComputeDecision is the Schema for the computedecisions API + description: SchedulingDecision is the Schema for the computedecisions API properties: apiVersion: description: |- @@ -39,7 +39,7 @@ spec: metadata: type: object spec: - description: spec defines the desired state of ComputeDecision + description: spec defines the desired state of SchedulingDecision properties: pipeline: properties: @@ -65,22 +65,10 @@ spec: - pipeline type: object status: - description: status defines the observed state of ComputeDecision + description: status defines the observed state of SchedulingDecision properties: description: type: string - factors: - items: - properties: - expl: - type: string - host: - type: string - required: - - expl - - host - type: object - type: array type: object required: - spec diff --git a/decisions/config/crd/decisions.cortex_computedecisions.yaml b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml similarity index 74% rename from decisions/config/crd/decisions.cortex_computedecisions.yaml rename to decisions/config/crd/decisions.cortex_schedulingdecisions.yaml index fcc4e894..426ca823 100644 --- a/decisions/config/crd/decisions.cortex_computedecisions.yaml +++ b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml @@ -4,22 +4,22 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.17.2 - name: computedecisions.decisions.cortex + name: schedulingdecisions.decisions.cortex spec: group: decisions.cortex names: - kind: ComputeDecision - listKind: ComputeDecisionList - plural: computedecisions + kind: SchedulingDecision + listKind: SchedulingDecisionList + plural: schedulingdecisions shortNames: - - cdec - singular: computedecision + - sdecs + singular: schedulingdecision scope: Cluster versions: - name: v1alpha1 schema: openAPIV3Schema: - description: ComputeDecision is the Schema for the computedecisions API + description: SchedulingDecision is the Schema for the computedecisions API properties: apiVersion: description: |- @@ -39,7 +39,7 @@ spec: metadata: type: object spec: - description: spec defines the desired state of ComputeDecision + description: spec defines the desired state of SchedulingDecision properties: pipeline: properties: @@ -65,22 +65,10 @@ spec: - pipeline type: object status: - description: status defines the observed state of ComputeDecision + description: status defines the observed state of SchedulingDecision properties: description: type: string - factors: - items: - properties: - expl: - type: string - host: - type: string - required: - - expl - - host - type: object - type: array type: object required: - spec diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml index 145e45f4..430f4fb0 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml @@ -14,8 +14,8 @@ metadata: spec: group: decisions.cortex names: - kind: ComputeDecision - listKind: ComputeDecisionList + kind: SchedulingDecision + listKind: SchedulingDecisionList plural: computedecisions shortNames: - cdec @@ -25,7 +25,7 @@ spec: - name: v1alpha1 schema: openAPIV3Schema: - description: ComputeDecision is the Schema for the computedecisions API + description: SchedulingDecision is the Schema for the computedecisions API properties: apiVersion: description: |- @@ -45,7 +45,7 @@ spec: metadata: type: object spec: - description: spec defines the desired state of ComputeDecision + description: spec defines the desired state of SchedulingDecision properties: pipeline: properties: @@ -71,22 +71,10 @@ spec: - pipeline type: object status: - description: status defines the observed state of ComputeDecision + description: status defines the observed state of SchedulingDecision properties: description: type: string - factors: - items: - properties: - expl: - type: string - host: - type: string - required: - - expl - - host - type: object - type: array type: object required: - spec diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml new file mode 100644 index 00000000..ed90d92b --- /dev/null +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -0,0 +1,86 @@ +{{- if .Values.crd.enable }} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + annotations: + {{- if .Values.crd.keep }} + "helm.sh/resource-policy": keep + {{- end }} + controller-gen.kubebuilder.io/version: v0.17.2 + name: schedulingdecisions.decisions.cortex +spec: + group: decisions.cortex + names: + kind: SchedulingDecision + listKind: SchedulingDecisionList + plural: schedulingdecisions + shortNames: + - sdecs + singular: schedulingdecision + scope: Cluster + versions: + - name: v1alpha1 + schema: + openAPIV3Schema: + description: SchedulingDecision is the Schema for the computedecisions API + properties: + apiVersion: + description: |- + APIVersion defines the versioned schema of this representation of an object. + Servers should convert recognized schemas to the latest internal value, and + may reject unrecognized values. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources + type: string + kind: + description: |- + Kind is a string value representing the REST resource this object represents. + Servers may infer this from the endpoint the client submits requests to. + Cannot be updated. + In CamelCase. + More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds + type: string + metadata: + type: object + spec: + description: spec defines the desired state of SchedulingDecision + properties: + pipeline: + properties: + name: + type: string + outputs: + items: + properties: + step: + type: string + weights: + additionalProperties: + type: number + type: object + required: + - step + type: object + type: array + required: + - name + type: object + required: + - pipeline + type: object + status: + description: status defines the observed state of SchedulingDecision + properties: + description: + type: string + type: object + required: + - spec + type: object + served: true + storage: true + subresources: + status: {} +{{- end -}} diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index baac2711..bdfb6853 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -16,8 +16,8 @@ import ( decisionsv1alpha1 "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" ) -// ComputeDecisionReconciler reconciles a ComputeDecision object -type ComputeDecisionReconciler struct { +// SchedulingDecisionReconciler reconciles a SchedulingDecision object +type SchedulingDecisionReconciler struct { // Client for the kubernetes API. client.Client // Kubernetes scheme to use for the decisions. @@ -32,24 +32,27 @@ type ComputeDecisionReconciler struct { // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. -func (r *ComputeDecisionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { +func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.Request) (ctrl.Result, error) { _ = logf.FromContext(ctx) // Fetch the decision object. - var res v1alpha1.ComputeDecision + var res v1alpha1.SchedulingDecision if err := r.Get(ctx, req.NamespacedName, &res); err != nil { // Can happen when the resource was just deleted. return ctrl.Result{}, err } - // TODO: Reconciliation logic. + res.Status.Description = "...." + if err := r.Status().Update(ctx, &res); err != nil { + return ctrl.Result{}, err + } return ctrl.Result{}, nil // No need to requeue. } // SetupWithManager sets up the controller with the Manager. -func (r *ComputeDecisionReconciler) SetupWithManager(mgr ctrl.Manager) error { +func (r *SchedulingDecisionReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). - For(&decisionsv1alpha1.ComputeDecision{}). + For(&decisionsv1alpha1.SchedulingDecision{}). Named("computedecision"). WithOptions(controller.Options{ MaxConcurrentReconciles: 1, // Default From 824fae19aacdccaf80ea480fc71680a10953dcc4 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 10:54:38 +0200 Subject: [PATCH 04/58] Add test for reconciler --- .../api/v1alpha1/schedulingdecision_types.go | 1 + .../internal/controller/controller_test.go | 70 +++++++++++++++++++ 2 files changed, 71 insertions(+) create mode 100644 decisions/internal/controller/controller_test.go diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index 1beace65..4e8f7785 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -19,6 +19,7 @@ type SchedulingDecisionPipelineSpec struct { // SchedulingDecisionSpec defines the desired state of SchedulingDecision. type SchedulingDecisionSpec struct { + Input map[string]float64 `json:"input,omitempty"` Pipeline SchedulingDecisionPipelineSpec `json:"pipeline"` } diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go new file mode 100644 index 00000000..40356958 --- /dev/null +++ b/decisions/internal/controller/controller_test.go @@ -0,0 +1,70 @@ +// Copyright 2025 SAP SE +// SPDX-License-Identifier: Apache-2.0 + +package controller + +import ( + "testing" + + "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" + "k8s.io/apimachinery/pkg/runtime" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" + "sigs.k8s.io/controller-runtime/pkg/client/fake" +) + +func TestReconcile(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-decision", + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "test-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "weigher", + Weights: map[string]float64{ + "host1": 0.5, + "host2": 0.5, + }, + }, + { + Step: "filter", + Weights: map[string]float64{ + "host1": 0.0, + }, + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-decision", + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + t.Logf("Reconcile completed successfully: %v", resource) +} From e4110a2646243660ee77db45baefa027e094fa6e Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 10:59:32 +0200 Subject: [PATCH 05/58] Explicitly init map --- decisions/internal/controller/controller_test.go | 1 + 1 file changed, 1 insertion(+) diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index 40356958..5d3c8250 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -19,6 +19,7 @@ func TestReconcile(t *testing.T) { Name: "test-decision", }, Spec: v1alpha1.SchedulingDecisionSpec{ + Input: map[string]float64{}, Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ Name: "test-pipeline", Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ From 41fcd9ed0cd5b58f833e0111f289aabf66510be3 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 11:02:53 +0200 Subject: [PATCH 06/58] Print description directly --- decisions/internal/controller/controller_test.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index 5d3c8250..450a7fc2 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -67,5 +67,5 @@ func TestReconcile(t *testing.T) { t.Fatalf("Reconcile returned an error: %v", err) } - t.Logf("Reconcile completed successfully: %v", resource) + t.Logf("Reconcile completed successfully: description=%s", resource.Status.Description) } From 9352171c742ae78675923659148357b4b77a08c6 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 11:15:00 +0200 Subject: [PATCH 07/58] Add state and optional error to spec --- .../api/v1alpha1/schedulingdecision_types.go | 12 ++++++++++++ .../api/v1alpha1/zz_generated.deepcopy.go | 7 +++++++ .../decisions.cortex_schedulingdecisions.yaml | 18 +++++++++++++++++- .../decisions.cortex_schedulingdecisions.yaml | 18 +++++++++++++++++- .../decisions.cortex_schedulingdecisions.yaml | 18 +++++++++++++++++- 5 files changed, 70 insertions(+), 3 deletions(-) diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index 4e8f7785..03b43205 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -23,14 +23,26 @@ type SchedulingDecisionSpec struct { Pipeline SchedulingDecisionPipelineSpec `json:"pipeline"` } +type SchedulingDecisionState string + +const ( + SchedulingDecisionStateResolved SchedulingDecisionState = "resolved" + SchedulingDecisionStateError SchedulingDecisionState = "error" +) + // SchedulingDecisionStatus defines the observed state of SchedulingDecision. type SchedulingDecisionStatus struct { + State SchedulingDecisionState `json:"state,omitempty"` + // Only given if state is "error". + Error string `json:"error,omitempty"` Description string `json:"description,omitempty"` } // +kubebuilder:object:root=true // +kubebuilder:subresource:status // +kubebuilder:resource:scope=Cluster,shortName=sdecs +// +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" +// +kubebuilder:printcolumn:name="Error",type="string",JSONPath=".status.error" // SchedulingDecision is the Schema for the computedecisions API type SchedulingDecision struct { diff --git a/decisions/api/v1alpha1/zz_generated.deepcopy.go b/decisions/api/v1alpha1/zz_generated.deepcopy.go index 5d891098..c6f7bc86 100644 --- a/decisions/api/v1alpha1/zz_generated.deepcopy.go +++ b/decisions/api/v1alpha1/zz_generated.deepcopy.go @@ -117,6 +117,13 @@ func (in *SchedulingDecisionPipelineSpec) DeepCopy() *SchedulingDecisionPipeline // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulingDecisionSpec) DeepCopyInto(out *SchedulingDecisionSpec) { *out = *in + if in.Input != nil { + in, out := &in.Input, &out.Input + *out = make(map[string]float64, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } in.Pipeline.DeepCopyInto(&out.Pipeline) } diff --git a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index 426ca823..144e33b5 100644 --- a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -16,7 +16,14 @@ spec: singular: schedulingdecision scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .status.state + name: State + type: string + - jsonPath: .status.error + name: Error + type: string + name: v1alpha1 schema: openAPIV3Schema: description: SchedulingDecision is the Schema for the computedecisions API @@ -41,6 +48,10 @@ spec: spec: description: spec defines the desired state of SchedulingDecision properties: + input: + additionalProperties: + type: number + type: object pipeline: properties: name: @@ -69,6 +80,11 @@ spec: properties: description: type: string + error: + description: Only given if state is "error". + type: string + state: + type: string type: object required: - spec diff --git a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml index 426ca823..144e33b5 100644 --- a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml @@ -16,7 +16,14 @@ spec: singular: schedulingdecision scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .status.state + name: State + type: string + - jsonPath: .status.error + name: Error + type: string + name: v1alpha1 schema: openAPIV3Schema: description: SchedulingDecision is the Schema for the computedecisions API @@ -41,6 +48,10 @@ spec: spec: description: spec defines the desired state of SchedulingDecision properties: + input: + additionalProperties: + type: number + type: object pipeline: properties: name: @@ -69,6 +80,11 @@ spec: properties: description: type: string + error: + description: Only given if state is "error". + type: string + state: + type: string type: object required: - spec diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml index ed90d92b..c38ed7bf 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -22,7 +22,14 @@ spec: singular: schedulingdecision scope: Cluster versions: - - name: v1alpha1 + - additionalPrinterColumns: + - jsonPath: .status.state + name: State + type: string + - jsonPath: .status.error + name: Error + type: string + name: v1alpha1 schema: openAPIV3Schema: description: SchedulingDecision is the Schema for the computedecisions API @@ -47,6 +54,10 @@ spec: spec: description: spec defines the desired state of SchedulingDecision properties: + input: + additionalProperties: + type: number + type: object pipeline: properties: name: @@ -75,6 +86,11 @@ spec: properties: description: type: string + error: + description: Only given if state is "error". + type: string + state: + type: string type: object required: - spec From 05c740eb37d0ff71801776bc8b58df83a3b5a46c Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 11:18:57 +0200 Subject: [PATCH 08/58] Rename computedecision -> schedulingdecision --- decisions/api/v1alpha1/schedulingdecision_types.go | 2 +- .../decisions.cortex_schedulingdecisions.yaml | 2 +- .../crd/decisions.cortex_schedulingdecisions.yaml | 2 +- decisions/config/crd/kustomization.yaml | 2 +- .../config/rbac/computereservation_admin_role.yaml | 6 +++--- .../rbac/computereservation_editor_role.yaml | 6 +++--- .../rbac/computereservation_viewer_role.yaml | 6 +++--- decisions/config/rbac/kustomization.yaml | 6 +++--- decisions/config/rbac/role.yaml | 6 +++--- .../crd/decisions.cortex_computedecisions.yaml | 8 ++++---- .../crd/decisions.cortex_schedulingdecisions.yaml | 2 +- .../rbac/computereservation_admin_role.yaml | 6 +++--- .../rbac/computereservation_editor_role.yaml | 6 +++--- .../rbac/computereservation_viewer_role.yaml | 6 +++--- decisions/dist/chart/templates/rbac/role.yaml | 6 +++--- decisions/internal/controller/controller.go | 8 ++++---- helm/library/cortex-core/templates/rbac.yaml | 14 ++++++++++++++ 17 files changed, 54 insertions(+), 40 deletions(-) diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index 03b43205..f3d02749 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -44,7 +44,7 @@ type SchedulingDecisionStatus struct { // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" // +kubebuilder:printcolumn:name="Error",type="string",JSONPath=".status.error" -// SchedulingDecision is the Schema for the computedecisions API +// SchedulingDecision is the Schema for the schedulingdecisions API type SchedulingDecision struct { metav1.TypeMeta `json:",inline"` diff --git a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index 144e33b5..29d3a7ce 100644 --- a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -26,7 +26,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: SchedulingDecision is the Schema for the computedecisions API + description: SchedulingDecision is the Schema for the schedulingdecisions API properties: apiVersion: description: |- diff --git a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml index 144e33b5..29d3a7ce 100644 --- a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml @@ -26,7 +26,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: SchedulingDecision is the Schema for the computedecisions API + description: SchedulingDecision is the Schema for the schedulingdecisions API properties: apiVersion: description: |- diff --git a/decisions/config/crd/kustomization.yaml b/decisions/config/crd/kustomization.yaml index 8c62eca2..c1caafe2 100644 --- a/decisions/config/crd/kustomization.yaml +++ b/decisions/config/crd/kustomization.yaml @@ -2,7 +2,7 @@ # since it depends on service name and namespace that are out of this kustomize package. # It should be run by config/default resources: -- bases/decisions.cortex_computedecisions.yaml +- bases/decisions.cortex_schedulingdecisions.yaml # +kubebuilder:scaffold:crdkustomizeresource patches: diff --git a/decisions/config/rbac/computereservation_admin_role.yaml b/decisions/config/rbac/computereservation_admin_role.yaml index 3a10d614..cd8699f9 100644 --- a/decisions/config/rbac/computereservation_admin_role.yaml +++ b/decisions/config/rbac/computereservation_admin_role.yaml @@ -11,17 +11,17 @@ metadata: labels: app.kubernetes.io/name: decisions app.kubernetes.io/managed-by: kustomize - name: computedecision-admin-role + name: schedulingdecision-admin-role rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - '*' - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get diff --git a/decisions/config/rbac/computereservation_editor_role.yaml b/decisions/config/rbac/computereservation_editor_role.yaml index 09f6ccd7..864ce9ad 100644 --- a/decisions/config/rbac/computereservation_editor_role.yaml +++ b/decisions/config/rbac/computereservation_editor_role.yaml @@ -11,12 +11,12 @@ metadata: labels: app.kubernetes.io/name: decisions app.kubernetes.io/managed-by: kustomize - name: computedecision-editor-role + name: schedulingdecision-editor-role rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - create - delete @@ -28,6 +28,6 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get diff --git a/decisions/config/rbac/computereservation_viewer_role.yaml b/decisions/config/rbac/computereservation_viewer_role.yaml index cbe78ad4..4d62565e 100644 --- a/decisions/config/rbac/computereservation_viewer_role.yaml +++ b/decisions/config/rbac/computereservation_viewer_role.yaml @@ -11,12 +11,12 @@ metadata: labels: app.kubernetes.io/name: decisions app.kubernetes.io/managed-by: kustomize - name: computedecision-viewer-role + name: schedulingdecision-viewer-role rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - get - list @@ -24,6 +24,6 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get diff --git a/decisions/config/rbac/kustomization.yaml b/decisions/config/rbac/kustomization.yaml index d3da9c0e..9a3976b9 100644 --- a/decisions/config/rbac/kustomization.yaml +++ b/decisions/config/rbac/kustomization.yaml @@ -22,7 +22,7 @@ resources: # default, aiding admins in cluster management. Those roles are # not used by the decisions itself. You can comment the following lines # if you do not want those helpers be installed with your Project. -- computedecision_admin_role.yaml -- computedecision_editor_role.yaml -- computedecision_viewer_role.yaml +- schedulingdecision_admin_role.yaml +- schedulingdecision_editor_role.yaml +- schedulingdecision_viewer_role.yaml diff --git a/decisions/config/rbac/role.yaml b/decisions/config/rbac/role.yaml index c249a499..ee66f8a1 100644 --- a/decisions/config/rbac/role.yaml +++ b/decisions/config/rbac/role.yaml @@ -7,7 +7,7 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - create - delete @@ -19,13 +19,13 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions/finalizers + - schedulingdecisions/finalizers verbs: - update - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get - patch diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml index 430f4fb0..f7104190 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml @@ -10,22 +10,22 @@ metadata: "helm.sh/resource-policy": keep {{- end }} controller-gen.kubebuilder.io/version: v0.17.2 - name: computedecisions.decisions.cortex + name: schedulingdecisions.decisions.cortex spec: group: decisions.cortex names: kind: SchedulingDecision listKind: SchedulingDecisionList - plural: computedecisions + plural: schedulingdecisions shortNames: - cdec - singular: computedecision + singular: schedulingdecision scope: Cluster versions: - name: v1alpha1 schema: openAPIV3Schema: - description: SchedulingDecision is the Schema for the computedecisions API + description: SchedulingDecision is the Schema for the schedulingdecisions API properties: apiVersion: description: |- diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml index c38ed7bf..7a4286bf 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -32,7 +32,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: SchedulingDecision is the Schema for the computedecisions API + description: SchedulingDecision is the Schema for the schedulingdecisions API properties: apiVersion: description: |- diff --git a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml index fee77c79..6db64811 100644 --- a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml +++ b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml @@ -11,18 +11,18 @@ kind: ClusterRole metadata: labels: {{- include "chart.labels" . | nindent 4 }} - name: computedecision-admin-role + name: schedulingdecision-admin-role rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - '*' - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get {{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml index d435a404..7a82611c 100644 --- a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml +++ b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml @@ -11,12 +11,12 @@ kind: ClusterRole metadata: labels: {{- include "chart.labels" . | nindent 4 }} - name: computedecision-editor-role + name: schedulingdecision-editor-role rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - create - delete @@ -28,7 +28,7 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get {{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml index 879ecb27..4375bd65 100644 --- a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml +++ b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml @@ -11,12 +11,12 @@ kind: ClusterRole metadata: labels: {{- include "chart.labels" . | nindent 4 }} - name: computedecision-viewer-role + name: schedulingdecision-viewer-role rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - get - list @@ -24,7 +24,7 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get {{- end -}} diff --git a/decisions/dist/chart/templates/rbac/role.yaml b/decisions/dist/chart/templates/rbac/role.yaml index 24e720cf..b93e56fc 100644 --- a/decisions/dist/chart/templates/rbac/role.yaml +++ b/decisions/dist/chart/templates/rbac/role.yaml @@ -10,7 +10,7 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions + - schedulingdecisions verbs: - create - delete @@ -22,13 +22,13 @@ rules: - apiGroups: - decisions.cortex resources: - - computedecisions/finalizers + - schedulingdecisions/finalizers verbs: - update - apiGroups: - decisions.cortex resources: - - computedecisions/status + - schedulingdecisions/status verbs: - get - patch diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index bdfb6853..734eaf1f 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -26,9 +26,9 @@ type SchedulingDecisionReconciler struct { Conf Config } -// +kubebuilder:rbac:groups=decisions.cortex,resources=computedecisions,verbs=get;list;watch;create;update;patch;delete -// +kubebuilder:rbac:groups=decisions.cortex,resources=computedecisions/status,verbs=get;update;patch -// +kubebuilder:rbac:groups=decisions.cortex,resources=computedecisions/finalizers,verbs=update +// +kubebuilder:rbac:groups=decisions.cortex,resources=schedulingdecisions,verbs=get;list;watch;create;update;patch;delete +// +kubebuilder:rbac:groups=decisions.cortex,resources=schedulingdecisions/status,verbs=get;update;patch +// +kubebuilder:rbac:groups=decisions.cortex,resources=schedulingdecisions/finalizers,verbs=update // Reconcile is part of the main kubernetes reconciliation loop which aims to // move the current state of the cluster closer to the desired state. @@ -53,7 +53,7 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R func (r *SchedulingDecisionReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). For(&decisionsv1alpha1.SchedulingDecision{}). - Named("computedecision"). + Named("schedulingdecision"). WithOptions(controller.Options{ MaxConcurrentReconciles: 1, // Default }). diff --git a/helm/library/cortex-core/templates/rbac.yaml b/helm/library/cortex-core/templates/rbac.yaml index 57903041..688a8d79 100644 --- a/helm/library/cortex-core/templates/rbac.yaml +++ b/helm/library/cortex-core/templates/rbac.yaml @@ -12,6 +12,20 @@ subjects: name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }} namespace: {{ .Release.Namespace }} --- +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRoleBinding +metadata: + name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }} +roleRef: + apiGroup: rbac.authorization.k8s.io + kind: ClusterRole + # From the decisions operator. + name: schedulingdecision-viewer-role +subjects: +- kind: ServiceAccount + name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }} + namespace: {{ .Release.Namespace }} +--- apiVersion: v1 kind: ServiceAccount metadata: From 3b3ab1e9adc4474dc82dcde4959dba617a05edc2 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 11:19:52 +0200 Subject: [PATCH 09/58] Also rename rbac files --- ...rvation_admin_role.yaml => schedulingdecision_admin_role.yaml} | 0 ...ation_editor_role.yaml => schedulingdecision_editor_role.yaml} | 0 ...ation_viewer_role.yaml => schedulingdecision_viewer_role.yaml} | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename decisions/dist/chart/templates/rbac/{computereservation_admin_role.yaml => schedulingdecision_admin_role.yaml} (100%) rename decisions/dist/chart/templates/rbac/{computereservation_editor_role.yaml => schedulingdecision_editor_role.yaml} (100%) rename decisions/dist/chart/templates/rbac/{computereservation_viewer_role.yaml => schedulingdecision_viewer_role.yaml} (100%) diff --git a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml b/decisions/dist/chart/templates/rbac/schedulingdecision_admin_role.yaml similarity index 100% rename from decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml rename to decisions/dist/chart/templates/rbac/schedulingdecision_admin_role.yaml diff --git a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml b/decisions/dist/chart/templates/rbac/schedulingdecision_editor_role.yaml similarity index 100% rename from decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml rename to decisions/dist/chart/templates/rbac/schedulingdecision_editor_role.yaml diff --git a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml b/decisions/dist/chart/templates/rbac/schedulingdecision_viewer_role.yaml similarity index 100% rename from decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml rename to decisions/dist/chart/templates/rbac/schedulingdecision_viewer_role.yaml From 242ac6fe434ef167e95e43f7e73d4bad266e10df Mon Sep 17 00:00:00 2001 From: mblos <> Date: Thu, 25 Sep 2025 11:21:19 +0200 Subject: [PATCH 10/58] Check there is at least one host in the input --- decisions/internal/controller/controller.go | 10 +- .../internal/controller/controller_test.go | 93 ++++++++++++++++++- 2 files changed, 100 insertions(+), 3 deletions(-) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 734eaf1f..4d1bd519 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -41,7 +41,15 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R return ctrl.Result{}, err } - res.Status.Description = "...." + // Validate that there is at least one host in the input + if len(res.Spec.Input) == 0 { + res.Status.State = v1alpha1.SchedulingDecisionStateError + res.Status.Error = "No hosts provided in input" + } else { + res.Status.State = v1alpha1.SchedulingDecisionStateResolved + res.Status.Description = "...." + } + if err := r.Status().Update(ctx, &res); err != nil { return ctrl.Result{}, err } diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index 450a7fc2..cd36faa7 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -19,7 +19,10 @@ func TestReconcile(t *testing.T) { Name: "test-decision", }, Spec: v1alpha1.SchedulingDecisionSpec{ - Input: map[string]float64{}, + Input: map[string]float64{ + "host1": 1.0, + "host2": 2.0, + }, Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ Name: "test-pipeline", Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ @@ -67,5 +70,91 @@ func TestReconcile(t *testing.T) { t.Fatalf("Reconcile returned an error: %v", err) } - t.Logf("Reconcile completed successfully: description=%s", resource.Status.Description) + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-decision"}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify success state + if updatedResource.Status.State != v1alpha1.SchedulingDecisionStateResolved { + t.Errorf("Expected state '%s', got '%s'", v1alpha1.SchedulingDecisionStateResolved, updatedResource.Status.State) + } + if updatedResource.Status.Error != "" { + t.Errorf("Expected empty error, got '%s'", updatedResource.Status.Error) + } + if updatedResource.Status.Description != "...." { + t.Errorf("Expected description '....', got '%s'", updatedResource.Status.Description) + } + + t.Logf("Reconcile completed successfully: state=%s, description=%s", updatedResource.Status.State, updatedResource.Status.Description) +} + +func TestReconcileEmptyInput(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-decision-empty-input", + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: map[string]float64{}, // Empty input - no hosts + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "test-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "weigher", + Weights: map[string]float64{ + "host1": 0.5, + "host2": 0.5, + }, + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-decision-empty-input", + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-decision-empty-input"}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify error state + if updatedResource.Status.State != v1alpha1.SchedulingDecisionStateError { + t.Errorf("Expected state '%s', got '%s'", v1alpha1.SchedulingDecisionStateError, updatedResource.Status.State) + } + expectedError := "No hosts provided in input" + if updatedResource.Status.Error != expectedError { + t.Errorf("Expected error '%s', got '%s'", expectedError, updatedResource.Status.Error) + } + if updatedResource.Status.Description != "" { + t.Errorf("Expected empty description, got '%s'", updatedResource.Status.Description) + } + + t.Logf("Reconcile completed with error: state=%s, error=%s", updatedResource.Status.State, updatedResource.Status.Error) } From ec3230bbf62d89a61a520ec44a10b91696e6ed2d Mon Sep 17 00:00:00 2001 From: mblos <> Date: Thu, 25 Sep 2025 11:25:15 +0200 Subject: [PATCH 11/58] Check that all hosts in output exist --- decisions/internal/controller/controller.go | 15 ++++ .../internal/controller/controller_test.go | 72 +++++++++++++++++++ 2 files changed, 87 insertions(+) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 4d1bd519..922d0002 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -46,7 +46,22 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R res.Status.State = v1alpha1.SchedulingDecisionStateError res.Status.Error = "No hosts provided in input" } else { + // Validate that all hosts in pipeline outputs exist in input + for _, output := range res.Spec.Pipeline.Outputs { + for hostName := range output.Weights { + if _, exists := res.Spec.Input[hostName]; !exists { + res.Status.State = v1alpha1.SchedulingDecisionStateError + res.Status.Error = "Host '" + hostName + "' in pipeline output not found in input" + if err := r.Status().Update(ctx, &res); err != nil { + return ctrl.Result{}, err + } + return ctrl.Result{}, nil + } + } + } + res.Status.State = v1alpha1.SchedulingDecisionStateResolved + res.Status.Error = "" res.Status.Description = "...." } diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index cd36faa7..596fb9e3 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -158,3 +158,75 @@ func TestReconcileEmptyInput(t *testing.T) { t.Logf("Reconcile completed with error: state=%s, error=%s", updatedResource.Status.State, updatedResource.Status.Error) } + +func TestReconcileHostMismatch(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-decision-host-mismatch", + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: map[string]float64{ + "host1": 1.0, + "host2": 2.0, + }, // host3 is missing but referenced in pipeline output + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "test-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "weigher", + Weights: map[string]float64{ + "host1": 0.5, + "host3": 0.3, // host3 doesn't exist in input + }, + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-decision-host-mismatch", + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-decision-host-mismatch"}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify error state for host mismatch + if updatedResource.Status.State != v1alpha1.SchedulingDecisionStateError { + t.Errorf("Expected state '%s', got '%s'", v1alpha1.SchedulingDecisionStateError, updatedResource.Status.State) + } + expectedError := "Host 'host3' in pipeline output not found in input" + if updatedResource.Status.Error != expectedError { + t.Errorf("Expected error '%s', got '%s'", expectedError, updatedResource.Status.Error) + } + if updatedResource.Status.Description != "" { + t.Errorf("Expected empty description, got '%s'", updatedResource.Status.Description) + } + + t.Logf("Reconcile completed with host mismatch error: state=%s, error=%s", updatedResource.Status.State, updatedResource.Status.Error) +} From 941f700fcdbaef630b938be4837f2ffd2aef687c Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 11:31:12 +0200 Subject: [PATCH 12/58] Rename weights in spec to activations --- .../api/v1alpha1/schedulingdecision_types.go | 5 +-- .../api/v1alpha1/zz_generated.deepcopy.go | 4 +-- .../decisions.cortex_schedulingdecisions.yaml | 11 +++--- .../decisions.cortex_schedulingdecisions.yaml | 11 +++--- .../decisions.cortex_schedulingdecisions.yaml | 11 +++--- .../rbac/computereservation_admin_role.yaml | 28 +++++++++++++++ .../rbac/computereservation_editor_role.yaml | 34 +++++++++++++++++++ .../rbac/computereservation_viewer_role.yaml | 30 ++++++++++++++++ decisions/internal/controller/controller.go | 2 +- .../internal/controller/controller_test.go | 8 ++--- 10 files changed, 123 insertions(+), 21 deletions(-) create mode 100644 decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml create mode 100644 decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml create mode 100644 decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index f3d02749..9a1cd356 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -8,8 +8,9 @@ import ( ) type SchedulingDecisionPipelineOutputSpec struct { - Step string `json:"step"` - Weights map[string]float64 `json:"weights,omitempty"` + Step string `json:"step"` + // Weights calculated by this step subjected to the activation function. + Activations map[string]float64 `json:"activations,omitempty"` } type SchedulingDecisionPipelineSpec struct { diff --git a/decisions/api/v1alpha1/zz_generated.deepcopy.go b/decisions/api/v1alpha1/zz_generated.deepcopy.go index c6f7bc86..c64d3653 100644 --- a/decisions/api/v1alpha1/zz_generated.deepcopy.go +++ b/decisions/api/v1alpha1/zz_generated.deepcopy.go @@ -73,8 +73,8 @@ func (in *SchedulingDecisionList) DeepCopyObject() runtime.Object { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulingDecisionPipelineOutputSpec) DeepCopyInto(out *SchedulingDecisionPipelineOutputSpec) { *out = *in - if in.Weights != nil { - in, out := &in.Weights, &out.Weights + if in.Activations != nil { + in, out := &in.Activations, &out.Activations *out = make(map[string]float64, len(*in)) for key, val := range *in { (*out)[key] = val diff --git a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index 29d3a7ce..252ddd08 100644 --- a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -26,7 +26,8 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: SchedulingDecision is the Schema for the schedulingdecisions API + description: SchedulingDecision is the Schema for the schedulingdecisions + API properties: apiVersion: description: |- @@ -59,12 +60,14 @@ spec: outputs: items: properties: - step: - type: string - weights: + activations: additionalProperties: type: number + description: Weights calculated by this step subjected to + the activation function. type: object + step: + type: string required: - step type: object diff --git a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml index 29d3a7ce..252ddd08 100644 --- a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml @@ -26,7 +26,8 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: SchedulingDecision is the Schema for the schedulingdecisions API + description: SchedulingDecision is the Schema for the schedulingdecisions + API properties: apiVersion: description: |- @@ -59,12 +60,14 @@ spec: outputs: items: properties: - step: - type: string - weights: + activations: additionalProperties: type: number + description: Weights calculated by this step subjected to + the activation function. type: object + step: + type: string required: - step type: object diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml index 7a4286bf..02dc9a53 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -32,7 +32,8 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: SchedulingDecision is the Schema for the schedulingdecisions API + description: SchedulingDecision is the Schema for the schedulingdecisions + API properties: apiVersion: description: |- @@ -65,12 +66,14 @@ spec: outputs: items: properties: - step: - type: string - weights: + activations: additionalProperties: type: number + description: Weights calculated by this step subjected to + the activation function. type: object + step: + type: string required: - step type: object diff --git a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml new file mode 100644 index 00000000..6db64811 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml @@ -0,0 +1,28 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants full permissions ('*') over decisions.cortex. +# This role is intended for users authorized to modify roles and bindings within the cluster, +# enabling them to delegate specific permissions to other users or groups as needed. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: schedulingdecision-admin-role +rules: +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions + verbs: + - '*' +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml new file mode 100644 index 00000000..7a82611c --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml @@ -0,0 +1,34 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants permissions to create, update, and delete resources within the decisions.cortex. +# This role is intended for users who need to manage these resources +# but should not control RBAC or manage permissions for others. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: schedulingdecision-editor-role +rules: +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml new file mode 100644 index 00000000..4375bd65 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml @@ -0,0 +1,30 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants read-only access to decisions.cortex resources. +# This role is intended for users who need visibility into these resources +# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: schedulingdecision-viewer-role +rules: +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions + verbs: + - get + - list + - watch +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 922d0002..3840cb1d 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -48,7 +48,7 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R } else { // Validate that all hosts in pipeline outputs exist in input for _, output := range res.Spec.Pipeline.Outputs { - for hostName := range output.Weights { + for hostName := range output.Activations { if _, exists := res.Spec.Input[hostName]; !exists { res.Status.State = v1alpha1.SchedulingDecisionStateError res.Status.Error = "Host '" + hostName + "' in pipeline output not found in input" diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index 596fb9e3..ca2833c2 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -28,14 +28,14 @@ func TestReconcile(t *testing.T) { Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ { Step: "weigher", - Weights: map[string]float64{ + Activations: map[string]float64{ "host1": 0.5, "host2": 0.5, }, }, { Step: "filter", - Weights: map[string]float64{ + Activations: map[string]float64{ "host1": 0.0, }, }, @@ -102,7 +102,7 @@ func TestReconcileEmptyInput(t *testing.T) { Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ { Step: "weigher", - Weights: map[string]float64{ + Activations: map[string]float64{ "host1": 0.5, "host2": 0.5, }, @@ -174,7 +174,7 @@ func TestReconcileHostMismatch(t *testing.T) { Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ { Step: "weigher", - Weights: map[string]float64{ + Activations: map[string]float64{ "host1": 0.5, "host3": 0.3, // host3 doesn't exist in input }, From b65e394548f92905bdf7ece54f494a452acce7c7 Mon Sep 17 00:00:00 2001 From: mblos <> Date: Thu, 25 Sep 2025 11:46:59 +0200 Subject: [PATCH 13/58] Get final actions of each host --- .../api/v1alpha1/schedulingdecision_types.go | 4 + .../decisions.cortex_schedulingdecisions.yaml | 12 + .../decisions.cortex_schedulingdecisions.yaml | 12 + decisions/internal/controller/controller.go | 35 ++- .../internal/controller/controller_test.go | 280 +++++++++++++++++- 5 files changed, 339 insertions(+), 4 deletions(-) diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index 9a1cd356..a19f8123 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -37,6 +37,10 @@ type SchedulingDecisionStatus struct { // Only given if state is "error". Error string `json:"error,omitempty"` Description string `json:"description,omitempty"` + // Final scores for each host after processing all pipeline steps. + FinalScores map[string]float64 `json:"finalScores,omitempty"` + // Hosts that were deleted during pipeline processing and all steps that attempted to delete them. + DeletedHosts map[string][]string `json:"deletedHosts,omitempty"` } // +kubebuilder:object:root=true diff --git a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index 252ddd08..0f2a8e98 100644 --- a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -81,11 +81,23 @@ spec: status: description: status defines the observed state of SchedulingDecision properties: + deletedHosts: + additionalProperties: + type: string + description: Hosts that were deleted during pipeline processing and + the step that deleted them. + type: object description: type: string error: description: Only given if state is "error". type: string + finalScores: + additionalProperties: + type: number + description: Final scores for each host after processing all pipeline + steps. + type: object state: type: string type: object diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml index 02dc9a53..32117e90 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -87,11 +87,23 @@ spec: status: description: status defines the observed state of SchedulingDecision properties: + deletedHosts: + additionalProperties: + type: string + description: Hosts that were deleted during pipeline processing and + the step that deleted them. + type: object description: type: string error: description: Only given if state is "error". type: string + finalScores: + additionalProperties: + type: number + description: Final scores for each host after processing all pipeline + steps. + type: object state: type: string type: object diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 3840cb1d..99c1e800 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -60,9 +60,42 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R } } + // Calculate final scores for all hosts + finalScores := make(map[string]float64) + deletedHosts := make(map[string][]string) + + // Start with input values as initial scores + for hostName, inputValue := range res.Spec.Input { + finalScores[hostName] = inputValue + } + + // Process each pipeline step sequentially + for _, output := range res.Spec.Pipeline.Outputs { + // Check which hosts will be deleted in this step + for hostName := range finalScores { + if _, exists := output.Activations[hostName]; !exists { + // Host not in this step's activations - will be deleted + deletedHosts[hostName] = append(deletedHosts[hostName], output.Step) + } + } + + // Apply activations and remove hosts not in this step + for hostName := range finalScores { + if activation, exists := output.Activations[hostName]; exists { + // Add activation to current score + finalScores[hostName] = finalScores[hostName] + activation + } else { + // Host not in this step - remove it + delete(finalScores, hostName) + } + } + } + res.Status.State = v1alpha1.SchedulingDecisionStateResolved res.Status.Error = "" - res.Status.Description = "...." + res.Status.FinalScores = finalScores + res.Status.DeletedHosts = deletedHosts + res.Status.Description = "Calculated final scores for hosts" } if err := r.Status().Update(ctx, &res); err != nil { diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index ca2833c2..946a7f20 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -83,11 +83,49 @@ func TestReconcile(t *testing.T) { if updatedResource.Status.Error != "" { t.Errorf("Expected empty error, got '%s'", updatedResource.Status.Error) } - if updatedResource.Status.Description != "...." { - t.Errorf("Expected description '....', got '%s'", updatedResource.Status.Description) + if updatedResource.Status.Description != "Calculated final scores for hosts" { + t.Errorf("Expected description 'Calculated final scores for hosts', got '%s'", updatedResource.Status.Description) } - t.Logf("Reconcile completed successfully: state=%s, description=%s", updatedResource.Status.State, updatedResource.Status.Description) + // Verify final scores calculation + // Expected: host1: 1.0 + 0.5 + 0.0 = 1.5, host2: removed by filter step + expectedFinalScores := map[string]float64{ + "host1": 1.5, + } + if len(updatedResource.Status.FinalScores) != len(expectedFinalScores) { + t.Errorf("Expected %d final scores, got %d", len(expectedFinalScores), len(updatedResource.Status.FinalScores)) + } + for host, expectedScore := range expectedFinalScores { + if actualScore, exists := updatedResource.Status.FinalScores[host]; !exists { + t.Errorf("Expected final score for host '%s', but it was not found", host) + } else if actualScore != expectedScore { + t.Errorf("Expected final score for host '%s' to be %f, got %f", host, expectedScore, actualScore) + } + } + + // Verify deleted hosts tracking + expectedDeletedHosts := map[string][]string{ + "host2": {"filter"}, // host2 was deleted by the filter step + } + if len(updatedResource.Status.DeletedHosts) != len(expectedDeletedHosts) { + t.Errorf("Expected %d deleted hosts, got %d", len(expectedDeletedHosts), len(updatedResource.Status.DeletedHosts)) + } + for host, expectedSteps := range expectedDeletedHosts { + if actualSteps, exists := updatedResource.Status.DeletedHosts[host]; !exists { + t.Errorf("Expected deleted host '%s', but it was not found", host) + } else if len(actualSteps) != len(expectedSteps) { + t.Errorf("Expected host '%s' to be deleted by %d steps, got %d", host, len(expectedSteps), len(actualSteps)) + } else { + for i, expectedStep := range expectedSteps { + if actualSteps[i] != expectedStep { + t.Errorf("Expected host '%s' step %d to be '%s', got '%s'", host, i, expectedStep, actualSteps[i]) + } + } + } + } + + t.Logf("Reconcile completed successfully: state=%s, finalScores=%v, deletedHosts=%v", + updatedResource.Status.State, updatedResource.Status.FinalScores, updatedResource.Status.DeletedHosts) } func TestReconcileEmptyInput(t *testing.T) { @@ -230,3 +268,239 @@ func TestReconcileHostMismatch(t *testing.T) { t.Logf("Reconcile completed with host mismatch error: state=%s, error=%s", updatedResource.Status.State, updatedResource.Status.Error) } + +func TestReconcileComplexScoring(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-decision-complex", + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: map[string]float64{ + "host1": 1.0, + "host2": 2.0, + "host3": 3.0, + "host4": 4.0, + }, + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "complex-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "weigher1", + Activations: map[string]float64{ + "host1": 0.5, + "host2": 1.0, + "host3": -0.5, + "host4": 2.0, + }, + }, + { + Step: "filter1", + Activations: map[string]float64{ + "host1": 0.2, + "host3": 0.1, // host2 and host4 removed by this step + }, + }, + { + Step: "weigher2", + Activations: map[string]float64{ + "host1": -0.3, // host3 removed by this step + }, + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-decision-complex", + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-decision-complex"}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify success state + if updatedResource.Status.State != v1alpha1.SchedulingDecisionStateResolved { + t.Errorf("Expected state '%s', got '%s'", v1alpha1.SchedulingDecisionStateResolved, updatedResource.Status.State) + } + + // Verify final scores calculation + // Expected: host1: 1.0 + 0.5 + 0.2 + (-0.3) = 1.4 + // host2: removed by filter1, host3: removed by weigher2, host4: removed by filter1 + expectedFinalScores := map[string]float64{ + "host1": 1.4, + } + if len(updatedResource.Status.FinalScores) != len(expectedFinalScores) { + t.Errorf("Expected %d final scores, got %d", len(expectedFinalScores), len(updatedResource.Status.FinalScores)) + } + for host, expectedScore := range expectedFinalScores { + if actualScore, exists := updatedResource.Status.FinalScores[host]; !exists { + t.Errorf("Expected final score for host '%s', but it was not found", host) + } else if actualScore != expectedScore { + t.Errorf("Expected final score for host '%s' to be %f, got %f", host, expectedScore, actualScore) + } + } + + // Verify deleted hosts tracking + expectedDeletedHosts := map[string][]string{ + "host2": {"filter1"}, // host2 deleted by filter1 + "host4": {"filter1"}, // host4 deleted by filter1 + "host3": {"weigher2"}, // host3 deleted by weigher2 + } + if len(updatedResource.Status.DeletedHosts) != len(expectedDeletedHosts) { + t.Errorf("Expected %d deleted hosts, got %d", len(expectedDeletedHosts), len(updatedResource.Status.DeletedHosts)) + } + for host, expectedSteps := range expectedDeletedHosts { + if actualSteps, exists := updatedResource.Status.DeletedHosts[host]; !exists { + t.Errorf("Expected deleted host '%s', but it was not found", host) + } else if len(actualSteps) != len(expectedSteps) { + t.Errorf("Expected host '%s' to be deleted by %d steps, got %d", host, len(expectedSteps), len(actualSteps)) + } else { + for i, expectedStep := range expectedSteps { + if actualSteps[i] != expectedStep { + t.Errorf("Expected host '%s' step %d to be '%s', got '%s'", host, i, expectedStep, actualSteps[i]) + } + } + } + } + + t.Logf("Complex scoring completed: finalScores=%v, deletedHosts=%v", + updatedResource.Status.FinalScores, updatedResource.Status.DeletedHosts) +} + +func TestReconcileMultipleDeletionSteps(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-decision-multiple-deletions", + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: map[string]float64{ + "host1": 1.0, + "host2": 2.0, + "host3": 3.0, + }, + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "multiple-deletion-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "weigher1", + Activations: map[string]float64{ + "host1": 0.5, + "host2": 1.0, + "host3": -0.5, + }, + }, + { + Step: "filter1", + Activations: map[string]float64{ + "host1": 0.2, + // host2 and host3 removed by this step + }, + }, + { + Step: "filter2", + Activations: map[string]float64{ + // host1 removed by this step + // host2 and host3 would be removed again, but they're already gone + }, + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-decision-multiple-deletions", + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-decision-multiple-deletions"}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify success state + if updatedResource.Status.State != v1alpha1.SchedulingDecisionStateResolved { + t.Errorf("Expected state '%s', got '%s'", v1alpha1.SchedulingDecisionStateResolved, updatedResource.Status.State) + } + + // Verify final scores calculation + // Expected: All hosts should be removed, no final scores + expectedFinalScores := map[string]float64{} + if len(updatedResource.Status.FinalScores) != len(expectedFinalScores) { + t.Errorf("Expected %d final scores, got %d", len(expectedFinalScores), len(updatedResource.Status.FinalScores)) + } + + // Verify deleted hosts tracking + // host2 and host3 deleted by filter1, host1 deleted by filter2 + expectedDeletedHosts := map[string][]string{ + "host2": {"filter1"}, // host2 deleted by filter1 + "host3": {"filter1"}, // host3 deleted by filter1 + "host1": {"filter2"}, // host1 deleted by filter2 + } + if len(updatedResource.Status.DeletedHosts) != len(expectedDeletedHosts) { + t.Errorf("Expected %d deleted hosts, got %d", len(expectedDeletedHosts), len(updatedResource.Status.DeletedHosts)) + } + for host, expectedSteps := range expectedDeletedHosts { + if actualSteps, exists := updatedResource.Status.DeletedHosts[host]; !exists { + t.Errorf("Expected deleted host '%s', but it was not found", host) + } else if len(actualSteps) != len(expectedSteps) { + t.Errorf("Expected host '%s' to be deleted by %d steps, got %d", host, len(expectedSteps), len(actualSteps)) + } else { + for i, expectedStep := range expectedSteps { + if actualSteps[i] != expectedStep { + t.Errorf("Expected host '%s' step %d to be '%s', got '%s'", host, i, expectedStep, actualSteps[i]) + } + } + } + } + + t.Logf("Multiple deletion test completed: finalScores=%v, deletedHosts=%v", + updatedResource.Status.FinalScores, updatedResource.Status.DeletedHosts) +} From 858197fe206e098a024639a9d92eaded7b43feec Mon Sep 17 00:00:00 2001 From: Markus Wieland Date: Thu, 25 Sep 2025 11:58:45 +0200 Subject: [PATCH 14/58] Update ClusterRoleBinding names for computereservation and schedulingdecision --- helm/library/cortex-core/templates/rbac.yaml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/helm/library/cortex-core/templates/rbac.yaml b/helm/library/cortex-core/templates/rbac.yaml index 688a8d79..d30b5596 100644 --- a/helm/library/cortex-core/templates/rbac.yaml +++ b/helm/library/cortex-core/templates/rbac.yaml @@ -1,7 +1,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }} + name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }}-computereservation roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole @@ -15,7 +15,7 @@ subjects: apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRoleBinding metadata: - name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }} + name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }}-schedulingdescision roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole From 8525025ca1502bc544f75a38239565233adbbdc0 Mon Sep 17 00:00:00 2001 From: mblos <> Date: Thu, 25 Sep 2025 11:59:40 +0200 Subject: [PATCH 15/58] Simple description added in crd status --- decisions/internal/controller/controller.go | 63 +++++- .../internal/controller/controller_test.go | 203 +++++++++++++++++- 2 files changed, 262 insertions(+), 4 deletions(-) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 99c1e800..5fca53e8 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -5,6 +5,8 @@ package controller import ( "context" + "fmt" + "sort" "k8s.io/apimachinery/pkg/runtime" ctrl "sigs.k8s.io/controller-runtime" @@ -93,9 +95,13 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R res.Status.State = v1alpha1.SchedulingDecisionStateResolved res.Status.Error = "" - res.Status.FinalScores = finalScores + + // Sort finalScores by score (highest to lowest) and generate enhanced description + orderedScores, description := r.generateOrderedScoresAndDescription(finalScores, len(res.Spec.Input)) + + res.Status.FinalScores = orderedScores res.Status.DeletedHosts = deletedHosts - res.Status.Description = "Calculated final scores for hosts" + res.Status.Description = description } if err := r.Status().Update(ctx, &res); err != nil { @@ -105,6 +111,59 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R return ctrl.Result{}, nil // No need to requeue. } +// generateOrderedScoresAndDescription sorts final scores by value (highest to lowest) +// and generates a brief description with highest host, certainty, and host count +func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(finalScores map[string]float64, totalInputHosts int) (map[string]float64, string) { + if len(finalScores) == 0 { + return finalScores, fmt.Sprintf("No hosts remaining after filtering, %d hosts evaluated", totalInputHosts) + } + + // Create a slice of host-score pairs for sorting + type hostScore struct { + host string + score float64 + } + + var sortedHosts []hostScore + for host, score := range finalScores { + sortedHosts = append(sortedHosts, hostScore{host: host, score: score}) + } + + // Sort by score (highest to lowest) + sort.Slice(sortedHosts, func(i, j int) bool { + return sortedHosts[i].score > sortedHosts[j].score + }) + + // Create ordered map (Go maps maintain insertion order as of Go 1.8+) + orderedScores := make(map[string]float64) + for _, hs := range sortedHosts { + orderedScores[hs.host] = hs.score + } + + // Generate description + var description string + if len(sortedHosts) == 1 { + description = fmt.Sprintf("Selected: %s (score: %.2f), certainty: perfect, %d hosts evaluated", + sortedHosts[0].host, sortedHosts[0].score, totalInputHosts) + } else { + // Calculate certainty based on gap between 1st and 2nd place + gap := sortedHosts[0].score - sortedHosts[1].score + var certainty string + if gap >= 0.5 { + certainty = "high" + } else if gap >= 0.2 { + certainty = "medium" + } else { + certainty = "low" + } + + description = fmt.Sprintf("Selected: %s (score: %.2f), certainty: %s (gap: %.2f), %d hosts evaluated", + sortedHosts[0].host, sortedHosts[0].score, certainty, gap, totalInputHosts) + } + + return orderedScores, description +} + // SetupWithManager sets up the controller with the Manager. func (r *SchedulingDecisionReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index 946a7f20..b330fa57 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -83,8 +83,9 @@ func TestReconcile(t *testing.T) { if updatedResource.Status.Error != "" { t.Errorf("Expected empty error, got '%s'", updatedResource.Status.Error) } - if updatedResource.Status.Description != "Calculated final scores for hosts" { - t.Errorf("Expected description 'Calculated final scores for hosts', got '%s'", updatedResource.Status.Description) + expectedDescription := "Selected: host1 (score: 1.50), certainty: perfect, 2 hosts evaluated" + if updatedResource.Status.Description != expectedDescription { + t.Errorf("Expected description '%s', got '%s'", expectedDescription, updatedResource.Status.Description) } // Verify final scores calculation @@ -504,3 +505,201 @@ func TestReconcileMultipleDeletionSteps(t *testing.T) { t.Logf("Multiple deletion test completed: finalScores=%v, deletedHosts=%v", updatedResource.Status.FinalScores, updatedResource.Status.DeletedHosts) } + +func TestReconcileCertaintyLevels(t *testing.T) { + tests := []struct { + name string + input map[string]float64 + activations map[string]float64 + expectedWinner string + expectedCertainty string + }{ + { + name: "high-certainty", + input: map[string]float64{ + "host1": 1.0, + "host2": 1.0, + }, + activations: map[string]float64{ + "host1": 1.0, // host1: 2.0, host2: 1.0, gap = 1.0 (high) + "host2": 0.0, + }, + expectedWinner: "host1", + expectedCertainty: "high", + }, + { + name: "medium-certainty", + input: map[string]float64{ + "host1": 1.0, + "host2": 1.0, + }, + activations: map[string]float64{ + "host1": 0.3, // host1: 1.3, host2: 1.0, gap = 0.3 (medium) + "host2": 0.0, + }, + expectedWinner: "host1", + expectedCertainty: "medium", + }, + { + name: "low-certainty", + input: map[string]float64{ + "host1": 1.0, + "host2": 1.0, + }, + activations: map[string]float64{ + "host1": 0.1, // host1: 1.1, host2: 1.0, gap = 0.1 (low) + "host2": 0.0, + }, + expectedWinner: "host1", + expectedCertainty: "low", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-certainty-" + tt.name, + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: tt.input, + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "certainty-test-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "weigher", + Activations: tt.activations, + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-certainty-" + tt.name, + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-certainty-" + tt.name}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify the description contains the expected winner and certainty + description := updatedResource.Status.Description + if !contains(description, "Selected: "+tt.expectedWinner) { + t.Errorf("Expected description to contain 'Selected: %s', got '%s'", tt.expectedWinner, description) + } + if !contains(description, "certainty: "+tt.expectedCertainty) { + t.Errorf("Expected description to contain 'certainty: %s', got '%s'", tt.expectedCertainty, description) + } + + t.Logf("Certainty test %s completed: %s", tt.name, description) + }) + } +} + +func TestReconcileNoHostsRemaining(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-no-hosts-remaining", + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: map[string]float64{ + "host1": 1.0, + "host2": 2.0, + }, + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "filter-all-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "filter-all", + Activations: map[string]float64{ + // No hosts in activations - all will be filtered out + }, + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-no-hosts-remaining", + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-no-hosts-remaining"}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify success state but no final scores + if updatedResource.Status.State != v1alpha1.SchedulingDecisionStateResolved { + t.Errorf("Expected state '%s', got '%s'", v1alpha1.SchedulingDecisionStateResolved, updatedResource.Status.State) + } + + if len(updatedResource.Status.FinalScores) != 0 { + t.Errorf("Expected 0 final scores, got %d", len(updatedResource.Status.FinalScores)) + } + + expectedDescription := "No hosts remaining after filtering, 2 hosts evaluated" + if updatedResource.Status.Description != expectedDescription { + t.Errorf("Expected description '%s', got '%s'", expectedDescription, updatedResource.Status.Description) + } + + t.Logf("No hosts remaining test completed: %s", updatedResource.Status.Description) +} + +// Helper function to check if a string contains a substring +func contains(s, substr string) bool { + for i := 0; i <= len(s)-len(substr); i++ { + if s[i:i+len(substr)] == substr { + return true + } + } + return false +} From 109b44851271c58dfcfcabe1698b7895df1ed384 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 12:00:49 +0200 Subject: [PATCH 16/58] Integrate with scheduler --- go.mod | 2 + internal/scheduler/cinder/api/messages.go | 5 ++ internal/scheduler/manila/api/messages.go | 5 ++ internal/scheduler/nova/api/messages.go | 3 + internal/scheduler/pipeline.go | 69 +++++++++++++++++++++++ internal/scheduler/pipeline_test.go | 6 ++ internal/scheduler/request.go | 4 ++ internal/scheduler/request_test.go | 1 + 8 files changed, 95 insertions(+) diff --git a/go.mod b/go.mod index d7eecf1d..0bed916a 100644 --- a/go.mod +++ b/go.mod @@ -4,11 +4,13 @@ go 1.25.0 replace ( github.com/cobaltcore-dev/cortex/commands => ./commands + github.com/cobaltcore-dev/cortex/decisions/api => ./decisions/api github.com/cobaltcore-dev/cortex/reservations/api => ./reservations/api github.com/cobaltcore-dev/cortex/testlib => ./testlib ) require ( + github.com/cobaltcore-dev/cortex/decisions/api v0.0.0-00010101000000-000000000000 github.com/cobaltcore-dev/cortex/reservations/api v0.0.0-00010101000000-000000000000 github.com/dlmiddlecote/sqlstats v1.0.2 github.com/eclipse/paho.mqtt.golang v1.5.1 diff --git a/internal/scheduler/cinder/api/messages.go b/internal/scheduler/cinder/api/messages.go index a6d1414a..3083e3f6 100644 --- a/internal/scheduler/cinder/api/messages.go +++ b/internal/scheduler/cinder/api/messages.go @@ -60,6 +60,11 @@ func (r ExternalSchedulerRequest) WithPipeline(pipeline string) scheduler.Pipeli r.Pipeline = pipeline return r } +func (r ExternalSchedulerRequest) GetResourceID() string { + // TODO: We don't properly unwrap the spec yet, + // so we don't have access to the actual resource ID. + return "" +} // Response generated by cortex for the Cinder scheduler. // Cortex returns an ordered list of hosts that the share should be scheduled on. diff --git a/internal/scheduler/manila/api/messages.go b/internal/scheduler/manila/api/messages.go index 5a5d2353..e33c576a 100644 --- a/internal/scheduler/manila/api/messages.go +++ b/internal/scheduler/manila/api/messages.go @@ -60,6 +60,11 @@ func (r ExternalSchedulerRequest) WithPipeline(pipeline string) scheduler.Pipeli r.Pipeline = pipeline return r } +func (r ExternalSchedulerRequest) GetResourceID() string { + // TODO: We don't properly unwrap the spec yet, + // so we don't have access to the actual resource ID. + return "" +} // Response generated by cortex for the Manila scheduler. // Cortex returns an ordered list of hosts that the share should be scheduled on. diff --git a/internal/scheduler/nova/api/messages.go b/internal/scheduler/nova/api/messages.go index 2b8afede..552c751a 100644 --- a/internal/scheduler/nova/api/messages.go +++ b/internal/scheduler/nova/api/messages.go @@ -78,6 +78,9 @@ func (r ExternalSchedulerRequest) WithPipeline(pipeline string) scheduler.Pipeli r.Pipeline = pipeline return r } +func (r ExternalSchedulerRequest) GetResourceID() string { + return r.Spec.Data.InstanceUUID +} // Response generated by cortex for the Nova scheduler. // Cortex returns an ordered list of hosts that the VM should be scheduled on. diff --git a/internal/scheduler/pipeline.go b/internal/scheduler/pipeline.go index 1b0ac0cd..cffee1e2 100644 --- a/internal/scheduler/pipeline.go +++ b/internal/scheduler/pipeline.go @@ -4,6 +4,7 @@ package scheduler import ( + "context" "errors" "log/slog" "maps" @@ -16,6 +17,10 @@ import ( "github.com/cobaltcore-dev/cortex/internal/conf" "github.com/cobaltcore-dev/cortex/internal/db" "github.com/cobaltcore-dev/cortex/internal/mqtt" + + "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" + ctrl "sigs.k8s.io/controller-runtime" + "sigs.k8s.io/controller-runtime/pkg/client" ) type Pipeline[RequestType PipelineRequest] interface { @@ -43,6 +48,9 @@ type pipeline[RequestType PipelineRequest] struct { mqttClient mqtt.Client // MQTT topic to publish telemetry data on when the pipeline is finished. mqttTopic string + + // Kubernetes client to create decision resources. + Client client.Client } type StepWrapper[RequestType PipelineRequest] func(Step[RequestType], conf.SchedulerStepConfig) Step[RequestType] @@ -96,6 +104,16 @@ func NewPipeline[RequestType PipelineRequest]( ) } + var kubernetesClient client.Client + if scheme, err := v1alpha1.SchemeBuilder.Build(); err == nil { + if clientConfig, err := ctrl.GetConfig(); err == nil { + if cl, err := client.New(clientConfig, client.Options{Scheme: scheme}); err == nil { + // Successfully created a client, use it. + kubernetesClient = cl + } + } + } + return &pipeline[RequestType]{ // All steps can be run in parallel. executionOrder: [][]Step[RequestType]{steps}, @@ -103,6 +121,7 @@ func NewPipeline[RequestType PipelineRequest]( monitor: monitor, mqttClient: mqttClient, mqttTopic: mqttTopic, + Client: kubernetesClient, } } @@ -232,5 +251,55 @@ func (p *pipeline[RequestType]) Run(request RequestType) ([]string, error) { Out: outWeights, }) + // Create a new scheduling decision object for this object. + go func() { + if p.Client == nil { + return + } + var existing v1alpha1.SchedulingDecision + if err := p.Client.Get( + context.Background(), + client.ObjectKey{Name: request.GetResourceID()}, + &existing, + ); err == nil { + // Decision already exists, do not create a new one. + // TODO: Add new decisions for the same vm id if this is a migration. + traceLog.Info("scheduler: decision already exists, not creating a new one", "resourceID", request.GetResourceID()) + return + } + outputs := []v1alpha1.SchedulingDecisionPipelineOutputSpec{} + for _, stepKey := range p.applicationOrder { + weights, ok := stepWeights[stepKey] + if !ok { + // This is ok, since steps can be skipped. + continue + } + activations := make(map[string]float64, len(weights)) + for k, v := range weights { + activations[k] = p.ActivationFunction.Norm(v) + } + outputs = append(outputs, v1alpha1.SchedulingDecisionPipelineOutputSpec{ + Step: stepKey, + Activations: activations, + }) + } + decision := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{Name: request.GetResourceID()}, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: inWeights, + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: request.GetPipeline(), + Outputs: outputs, + }, + }, + // Status will be filled in by the controller. + } + if err := p.Client.Create(context.Background(), decision); err != nil { + traceLog.Error("scheduler: failed to create decision", "error", err) + return + } + traceLog.Info("scheduler: created decision", "resourceID", request.GetResourceID()) + }() + return subjects, nil } diff --git a/internal/scheduler/pipeline_test.go b/internal/scheduler/pipeline_test.go index b84a0c4c..734b8806 100644 --- a/internal/scheduler/pipeline_test.go +++ b/internal/scheduler/pipeline_test.go @@ -11,6 +11,7 @@ import ( "github.com/cobaltcore-dev/cortex/internal/conf" "github.com/cobaltcore-dev/cortex/internal/db" "github.com/cobaltcore-dev/cortex/testlib/mqtt" + "k8s.io/client-go/rest" ) type mockPipelineStep struct { @@ -227,6 +228,11 @@ func TestNewPipeline(t *testing.T) { database := db.DB{} // Mock or initialize as needed monitor := PipelineMonitor{} // Replace with an actual mock implementation if available mqttClient := &mqtt.MockClient{} + + // Set up kubekonfig for GetConfigOrDie + restConfig := &rest.Config{} + _ = restConfig + supportedSteps := map[string]func() Step[mockPipelineRequest]{ "mock_pipeline_step": func() Step[mockPipelineRequest] { return &mockPipelineStep{ diff --git a/internal/scheduler/request.go b/internal/scheduler/request.go index c3343cce..95dc09b8 100644 --- a/internal/scheduler/request.go +++ b/internal/scheduler/request.go @@ -19,4 +19,8 @@ type PipelineRequest interface { GetPipeline() string // Return a copy of the request with the pipeline name set. WithPipeline(pipeline string) PipelineRequest + + // Get the identifier of the resource that should be placed, + // e.g. the virtual machine id for virtual machines. + GetResourceID() string } diff --git a/internal/scheduler/request_test.go b/internal/scheduler/request_test.go index a4308854..5bfb332f 100644 --- a/internal/scheduler/request_test.go +++ b/internal/scheduler/request_test.go @@ -22,3 +22,4 @@ func (m mockPipelineRequest) WithPipeline(pipeline string) PipelineRequest { m.Pipeline = pipeline return m } +func (m mockPipelineRequest) GetResourceID() string { return "mock-resource-id" } From 169ee9922c8dfd523459a9af151fdd8192f4b882 Mon Sep 17 00:00:00 2001 From: mblos <> Date: Thu, 25 Sep 2025 12:14:57 +0200 Subject: [PATCH 17/58] Compare Cortex decision with input decision --- decisions/internal/controller/controller.go | 63 ++++++++- .../internal/controller/controller_test.go | 123 +++++++++++++++++- 2 files changed, 181 insertions(+), 5 deletions(-) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 5fca53e8..fde10065 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -97,7 +97,7 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R res.Status.Error = "" // Sort finalScores by score (highest to lowest) and generate enhanced description - orderedScores, description := r.generateOrderedScoresAndDescription(finalScores, len(res.Spec.Input)) + orderedScores, description := r.generateOrderedScoresAndDescription(finalScores, res.Spec.Input) res.Status.FinalScores = orderedScores res.Status.DeletedHosts = deletedHosts @@ -112,8 +112,9 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R } // generateOrderedScoresAndDescription sorts final scores by value (highest to lowest) -// and generates a brief description with highest host, certainty, and host count -func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(finalScores map[string]float64, totalInputHosts int) (map[string]float64, string) { +// and generates a brief description with highest host, certainty, host count, and input comparison +func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(finalScores map[string]float64, inputScores map[string]float64) (map[string]float64, string) { + totalInputHosts := len(inputScores) if len(finalScores) == 0 { return finalScores, fmt.Sprintf("No hosts remaining after filtering, %d hosts evaluated", totalInputHosts) } @@ -140,7 +141,30 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final orderedScores[hs.host] = hs.score } - // Generate description + // Sort input scores to determine input-based ranking + var sortedInputHosts []hostScore + for host, score := range inputScores { + sortedInputHosts = append(sortedInputHosts, hostScore{host: host, score: score}) + } + sort.Slice(sortedInputHosts, func(i, j int) bool { + return sortedInputHosts[i].score > sortedInputHosts[j].score + }) + + // Find positions and generate comparison + finalWinner := sortedHosts[0].host + inputWinner := sortedInputHosts[0].host + finalWinnerInputScore := inputScores[finalWinner] + + // Find final winner's position in input ranking + finalWinnerInputPosition := -1 + for i, hs := range sortedInputHosts { + if hs.host == finalWinner { + finalWinnerInputPosition = i + 1 // 1-based position + break + } + } + + // Generate main description var description string if len(sortedHosts) == 1 { description = fmt.Sprintf("Selected: %s (score: %.2f), certainty: perfect, %d hosts evaluated", @@ -161,6 +185,37 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final sortedHosts[0].host, sortedHosts[0].score, certainty, gap, totalInputHosts) } + // Add input vs. final comparison + var comparison string + if inputWinner == finalWinner { + // Input choice confirmed + comparison = fmt.Sprintf("\nInput choice confirmed: %s (%.2f→%.2f, remained #1).", + finalWinner, finalWinnerInputScore, sortedHosts[0].score) + } else { + // Input winner different from final winner + inputWinnerScore := sortedInputHosts[0].score + + // Check if input winner was filtered out + _, inputWinnerSurvived := finalScores[inputWinner] + if !inputWinnerSurvived { + comparison = fmt.Sprintf("\nInput favored %s (score: %.2f, now filtered), final winner was #%d in input (%.2f→%.2f).", + inputWinner, inputWinnerScore, finalWinnerInputPosition, finalWinnerInputScore, sortedHosts[0].score) + } else { + // Find input winner's position in final ranking + inputWinnerFinalPosition := -1 + for i, hs := range sortedHosts { + if hs.host == inputWinner { + inputWinnerFinalPosition = i + 1 // 1-based position + break + } + } + comparison = fmt.Sprintf("\nInput favored %s (score: %.2f, now #%d with %.2f), final winner was #%d in input (%.2f→%.2f).", + inputWinner, inputWinnerScore, inputWinnerFinalPosition, finalScores[inputWinner], + finalWinnerInputPosition, finalWinnerInputScore, sortedHosts[0].score) + } + } + + description += comparison return orderedScores, description } diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index b330fa57..fb153dd8 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -83,7 +83,7 @@ func TestReconcile(t *testing.T) { if updatedResource.Status.Error != "" { t.Errorf("Expected empty error, got '%s'", updatedResource.Status.Error) } - expectedDescription := "Selected: host1 (score: 1.50), certainty: perfect, 2 hosts evaluated" + expectedDescription := "Selected: host1 (score: 1.50), certainty: perfect, 2 hosts evaluated\nInput favored host2 (score: 2.00, now filtered), final winner was #2 in input (1.00→1.50)." if updatedResource.Status.Description != expectedDescription { t.Errorf("Expected description '%s', got '%s'", expectedDescription, updatedResource.Status.Description) } @@ -694,6 +694,127 @@ func TestReconcileNoHostsRemaining(t *testing.T) { t.Logf("No hosts remaining test completed: %s", updatedResource.Status.Description) } +func TestReconcileInputVsFinalComparison(t *testing.T) { + tests := []struct { + name string + input map[string]float64 + activations []map[string]float64 + expectedDescContains []string + }{ + { + name: "input-choice-confirmed", + input: map[string]float64{ + "host1": 3.0, // highest in input + "host2": 2.0, + "host3": 1.0, + }, + activations: []map[string]float64{ + {"host1": 0.5, "host2": 0.3, "host3": 0.1}, // host1 stays winner + }, + expectedDescContains: []string{ + "Selected: host1", + "Input choice confirmed: host1 (3.00→3.50, remained #1)", + }, + }, + { + name: "input-winner-filtered", + input: map[string]float64{ + "host1": 1.0, + "host2": 3.0, // highest in input + "host3": 2.0, + }, + activations: []map[string]float64{ + {"host1": 0.5, "host3": 0.3}, // host2 filtered out, host3 becomes winner + }, + expectedDescContains: []string{ + "Selected: host3", + "Input favored host2 (score: 3.00, now filtered)", + "final winner was #2 in input (2.00→2.30)", + }, + }, + { + name: "input-winner-demoted", + input: map[string]float64{ + "host1": 1.0, + "host2": 3.0, // highest in input + "host3": 2.0, + }, + activations: []map[string]float64{ + {"host1": 2.5, "host2": -0.5, "host3": 0.8}, // host1 becomes winner, host2 demoted to #3 + }, + expectedDescContains: []string{ + "Selected: host1", + "Input favored host2 (score: 3.00, now #3 with 2.50)", + "final winner was #3 in input (1.00→3.50)", + }, + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-input-vs-final-" + tt.name, + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: tt.input, + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "input-vs-final-pipeline", + Outputs: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "weigher", + Activations: tt.activations[0], + }, + }, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-input-vs-final-" + tt.name, + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-input-vs-final-" + tt.name}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify the description contains expected elements + description := updatedResource.Status.Description + for _, expectedContent := range tt.expectedDescContains { + if !contains(description, expectedContent) { + t.Errorf("Expected description to contain '%s', got '%s'", expectedContent, description) + } + } + + t.Logf("Input vs Final test %s completed: %s", tt.name, description) + }) + } +} + // Helper function to check if a string contains a substring func contains(s, substr string) bool { for i := 0; i <= len(s)-len(substr); i++ { From 9e244544a0bb056f420214da4b625059613b603b Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 12:19:16 +0200 Subject: [PATCH 18/58] Role fix + add operator to tiltfile + e2e test fix --- Tiltfile | 11 +++ commands/checks/nova/checks.go | 1 + .../decisions.cortex_computedecisions.yaml | 86 ------------------- .../rbac/computereservation_admin_role.yaml | 28 ------ .../rbac/computereservation_editor_role.yaml | 34 -------- .../rbac/computereservation_viewer_role.yaml | 30 ------- helm/library/cortex-core/templates/rbac.yaml | 2 +- 7 files changed, 13 insertions(+), 179 deletions(-) delete mode 100644 decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml delete mode 100644 decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml delete mode 100644 decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml delete mode 100644 decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml diff --git a/Tiltfile b/Tiltfile index da22cf74..e18c068f 100644 --- a/Tiltfile +++ b/Tiltfile @@ -37,6 +37,16 @@ local('sh helm/sync.sh reservations/dist/chart') k8s_yaml(helm('reservations/dist/chart', name='cortex-reservations', values=[tilt_values])) k8s_resource('reservations-controller-manager', labels=['Reservations']) +########### Decisions Operator & CRDs +docker_build('ghcr.io/cobaltcore-dev/cortex-decisions-operator', '.', + dockerfile='Dockerfile.kubebuilder', + build_args={'GO_MOD_PATH': 'decisions'}, + only=kubebuilder_binary_files('decisions') + ['internal/', 'go.mod', 'go.sum'], +) +local('sh helm/sync.sh decisions/dist/chart') +k8s_yaml(helm('decisions/dist/chart', name='cortex-decisions', values=[tilt_values])) +k8s_resource('decisions-controller-manager', labels=['Decisions']) + ########### Dev Dependencies local('sh helm/sync.sh helm/dev/cortex-prometheus-operator') k8s_yaml(helm('./helm/dev/cortex-prometheus-operator', name='cortex-prometheus-operator')) # Operator @@ -76,6 +86,7 @@ k8s_resource('cortex-plutono', port_forwards=[ docker_build('ghcr.io/cobaltcore-dev/cortex', '.', only=[ 'internal/', 'commands/', 'main.go', 'go.mod', 'go.sum', 'Makefile', 'reservations/api/', # API module of the reservations operator needed for the scheduler. + 'decisions/api/', # API module of the decisions operator needed for the scheduler. ]) docker_build('ghcr.io/cobaltcore-dev/cortex-postgres', 'postgres') diff --git a/commands/checks/nova/checks.go b/commands/checks/nova/checks.go index a0d8916f..11027589 100644 --- a/commands/checks/nova/checks.go +++ b/commands/checks/nova/checks.go @@ -271,6 +271,7 @@ func randomRequest(dc datacenter, seed int) api.ExternalSchedulerRequest { slog.Info("using flavor extra specs", "extraSpecs", extraSpecs) request := api.ExternalSchedulerRequest{ Spec: api.NovaObject[api.NovaSpec]{Data: api.NovaSpec{ + InstanceUUID: "cortex-e2e-tests", AvailabilityZone: az, ProjectID: project.ID, Flavor: api.NovaObject[api.NovaFlavor]{Data: api.NovaFlavor{ diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml deleted file mode 100644 index f7104190..00000000 --- a/decisions/dist/chart/templates/crd/decisions.cortex_computedecisions.yaml +++ /dev/null @@ -1,86 +0,0 @@ -{{- if .Values.crd.enable }} ---- -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - labels: - {{- include "chart.labels" . | nindent 4 }} - annotations: - {{- if .Values.crd.keep }} - "helm.sh/resource-policy": keep - {{- end }} - controller-gen.kubebuilder.io/version: v0.17.2 - name: schedulingdecisions.decisions.cortex -spec: - group: decisions.cortex - names: - kind: SchedulingDecision - listKind: SchedulingDecisionList - plural: schedulingdecisions - shortNames: - - cdec - singular: schedulingdecision - scope: Cluster - versions: - - name: v1alpha1 - schema: - openAPIV3Schema: - description: SchedulingDecision is the Schema for the schedulingdecisions API - properties: - apiVersion: - description: |- - APIVersion defines the versioned schema of this representation of an object. - Servers should convert recognized schemas to the latest internal value, and - may reject unrecognized values. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources - type: string - kind: - description: |- - Kind is a string value representing the REST resource this object represents. - Servers may infer this from the endpoint the client submits requests to. - Cannot be updated. - In CamelCase. - More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds - type: string - metadata: - type: object - spec: - description: spec defines the desired state of SchedulingDecision - properties: - pipeline: - properties: - name: - type: string - outputs: - items: - properties: - step: - type: string - weights: - additionalProperties: - type: number - type: object - required: - - step - type: object - type: array - required: - - name - type: object - required: - - pipeline - type: object - status: - description: status defines the observed state of SchedulingDecision - properties: - description: - type: string - type: object - required: - - spec - type: object - served: true - storage: true - subresources: - status: {} -{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml deleted file mode 100644 index 6db64811..00000000 --- a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.rbac.enable }} -# This rule is not used by the project decisions itself. -# It is provided to allow the cluster admin to help manage permissions for users. -# -# Grants full permissions ('*') over decisions.cortex. -# This role is intended for users authorized to modify roles and bindings within the cluster, -# enabling them to delegate specific permissions to other users or groups as needed. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - {{- include "chart.labels" . | nindent 4 }} - name: schedulingdecision-admin-role -rules: -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions - verbs: - - '*' -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions/status - verbs: - - get -{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml deleted file mode 100644 index 7a82611c..00000000 --- a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- if .Values.rbac.enable }} -# This rule is not used by the project decisions itself. -# It is provided to allow the cluster admin to help manage permissions for users. -# -# Grants permissions to create, update, and delete resources within the decisions.cortex. -# This role is intended for users who need to manage these resources -# but should not control RBAC or manage permissions for others. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - {{- include "chart.labels" . | nindent 4 }} - name: schedulingdecision-editor-role -rules: -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions/status - verbs: - - get -{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml deleted file mode 100644 index 4375bd65..00000000 --- a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml +++ /dev/null @@ -1,30 +0,0 @@ -{{- if .Values.rbac.enable }} -# This rule is not used by the project decisions itself. -# It is provided to allow the cluster admin to help manage permissions for users. -# -# Grants read-only access to decisions.cortex resources. -# This role is intended for users who need visibility into these resources -# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - {{- include "chart.labels" . | nindent 4 }} - name: schedulingdecision-viewer-role -rules: -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions - verbs: - - get - - list - - watch -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions/status - verbs: - - get -{{- end -}} diff --git a/helm/library/cortex-core/templates/rbac.yaml b/helm/library/cortex-core/templates/rbac.yaml index d30b5596..baca03ab 100644 --- a/helm/library/cortex-core/templates/rbac.yaml +++ b/helm/library/cortex-core/templates/rbac.yaml @@ -20,7 +20,7 @@ roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole # From the decisions operator. - name: schedulingdecision-viewer-role + name: schedulingdecision-editor-role subjects: - kind: ServiceAccount name: {{ .Release.Namespace }}-{{ include "cortex.fullname" . }} From dd075a3f5f3f656a8525fc20d8139b6919522b27 Mon Sep 17 00:00:00 2001 From: mblos <> Date: Thu, 25 Sep 2025 12:29:37 +0200 Subject: [PATCH 19/58] Add importance of steps --- decisions/internal/controller/controller.go | 158 ++++++++++++++---- .../internal/controller/controller_test.go | 149 ++++++++++++++++- 2 files changed, 273 insertions(+), 34 deletions(-) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index fde10065..494071f0 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -62,42 +62,17 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R } } - // Calculate final scores for all hosts - finalScores := make(map[string]float64) - deletedHosts := make(map[string][]string) + // Calculate final scores with full pipeline + finalScores, deletedHosts := r.calculateScores(res.Spec.Input, res.Spec.Pipeline.Outputs) - // Start with input values as initial scores - for hostName, inputValue := range res.Spec.Input { - finalScores[hostName] = inputValue - } - - // Process each pipeline step sequentially - for _, output := range res.Spec.Pipeline.Outputs { - // Check which hosts will be deleted in this step - for hostName := range finalScores { - if _, exists := output.Activations[hostName]; !exists { - // Host not in this step's activations - will be deleted - deletedHosts[hostName] = append(deletedHosts[hostName], output.Step) - } - } - - // Apply activations and remove hosts not in this step - for hostName := range finalScores { - if activation, exists := output.Activations[hostName]; exists { - // Add activation to current score - finalScores[hostName] = finalScores[hostName] + activation - } else { - // Host not in this step - remove it - delete(finalScores, hostName) - } - } - } + // Find minimal critical path + criticalSteps, criticalStepCount := r.findCriticalSteps(res.Spec.Input, res.Spec.Pipeline.Outputs, finalScores) res.Status.State = v1alpha1.SchedulingDecisionStateResolved res.Status.Error = "" // Sort finalScores by score (highest to lowest) and generate enhanced description - orderedScores, description := r.generateOrderedScoresAndDescription(finalScores, res.Spec.Input) + orderedScores, description := r.generateOrderedScoresAndDescription(finalScores, res.Spec.Input, criticalSteps, criticalStepCount, len(res.Spec.Pipeline.Outputs)) res.Status.FinalScores = orderedScores res.Status.DeletedHosts = deletedHosts @@ -111,9 +86,99 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R return ctrl.Result{}, nil // No need to requeue. } +// calculateScores processes pipeline outputs and returns final scores and deleted hosts +func (r *SchedulingDecisionReconciler) calculateScores(input map[string]float64, outputs []v1alpha1.SchedulingDecisionPipelineOutputSpec) (map[string]float64, map[string][]string) { + finalScores := make(map[string]float64) + deletedHosts := make(map[string][]string) + + // Start with input values as initial scores + for hostName, inputValue := range input { + finalScores[hostName] = inputValue + } + + // Process each pipeline step sequentially + for _, output := range outputs { + // Check which hosts will be deleted in this step + for hostName := range finalScores { + if _, exists := output.Activations[hostName]; !exists { + // Host not in this step's activations - will be deleted + deletedHosts[hostName] = append(deletedHosts[hostName], output.Step) + } + } + + // Apply activations and remove hosts not in this step + for hostName := range finalScores { + if activation, exists := output.Activations[hostName]; exists { + // Add activation to current score + finalScores[hostName] = finalScores[hostName] + activation + } else { + // Host not in this step - remove it + delete(finalScores, hostName) + } + } + } + + return finalScores, deletedHosts +} + +// findCriticalSteps identifies which pipeline steps are essential for the final decision +// using backward elimination approach +func (r *SchedulingDecisionReconciler) findCriticalSteps(input map[string]float64, outputs []v1alpha1.SchedulingDecisionPipelineOutputSpec, baselineFinalScores map[string]float64) ([]string, int) { + if len(outputs) == 0 { + return []string{}, 0 + } + + // Get baseline winner + baselineWinner := "" + maxScore := float64(-999999) + for host, score := range baselineFinalScores { + if score > maxScore { + maxScore = score + baselineWinner = host + } + } + + if baselineWinner == "" { + return []string{}, 0 + } + + criticalSteps := make([]string, 0) + + // Try removing each step one by one + for i, stepToRemove := range outputs { + // Create pipeline without this step + reducedOutputs := make([]v1alpha1.SchedulingDecisionPipelineOutputSpec, 0, len(outputs)-1) + for j, output := range outputs { + if j != i { + reducedOutputs = append(reducedOutputs, output) + } + } + + // Calculate scores without this step + reducedFinalScores, _ := r.calculateScores(input, reducedOutputs) + + // Find winner without this step + reducedWinner := "" + reducedMaxScore := float64(-999999) + for host, score := range reducedFinalScores { + if score > reducedMaxScore { + reducedMaxScore = score + reducedWinner = host + } + } + + // If removing this step changes the winner, it's critical + if reducedWinner != baselineWinner { + criticalSteps = append(criticalSteps, stepToRemove.Step) + } + } + + return criticalSteps, len(criticalSteps) +} + // generateOrderedScoresAndDescription sorts final scores by value (highest to lowest) -// and generates a brief description with highest host, certainty, host count, and input comparison -func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(finalScores map[string]float64, inputScores map[string]float64) (map[string]float64, string) { +// and generates a brief description with highest host, certainty, host count, input comparison, and critical path +func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(finalScores map[string]float64, inputScores map[string]float64, criticalSteps []string, criticalStepCount int, totalSteps int) (map[string]float64, string) { totalInputHosts := len(inputScores) if len(finalScores) == 0 { return finalScores, fmt.Sprintf("No hosts remaining after filtering, %d hosts evaluated", totalInputHosts) @@ -215,7 +280,34 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final } } - description += comparison + // Add critical path information + var criticalPath string + if totalSteps > 0 { + if criticalStepCount == 0 { + criticalPath = fmt.Sprintf("\nDecision driven by input only (all %d steps are non-critical).", totalSteps) + } else if criticalStepCount == totalSteps { + criticalPath = fmt.Sprintf("\nDecision requires all %d pipeline steps.", totalSteps) + } else { + if criticalStepCount == 1 { + criticalPath = fmt.Sprintf("\nDecision driven by 1/%d pipeline step: %s.", totalSteps, criticalSteps[0]) + } else { + // Join critical steps with commas + stepList := "" + for i, step := range criticalSteps { + if i == len(criticalSteps)-1 { + stepList += step + } else if i == len(criticalSteps)-2 { + stepList += step + " and " + } else { + stepList += step + ", " + } + } + criticalPath = fmt.Sprintf("\nDecision driven by %d/%d pipeline steps: %s.", criticalStepCount, totalSteps, stepList) + } + } + } + + description += comparison + criticalPath return orderedScores, description } diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index fb153dd8..967b8088 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -83,7 +83,7 @@ func TestReconcile(t *testing.T) { if updatedResource.Status.Error != "" { t.Errorf("Expected empty error, got '%s'", updatedResource.Status.Error) } - expectedDescription := "Selected: host1 (score: 1.50), certainty: perfect, 2 hosts evaluated\nInput favored host2 (score: 2.00, now filtered), final winner was #2 in input (1.00→1.50)." + expectedDescription := "Selected: host1 (score: 1.50), certainty: perfect, 2 hosts evaluated\nInput favored host2 (score: 2.00, now filtered), final winner was #2 in input (1.00→1.50).\nDecision driven by 1/2 pipeline step: filter." if updatedResource.Status.Description != expectedDescription { t.Errorf("Expected description '%s', got '%s'", expectedDescription, updatedResource.Status.Description) } @@ -815,6 +815,153 @@ func TestReconcileInputVsFinalComparison(t *testing.T) { } } +func TestReconcileCriticalStepElimination(t *testing.T) { + tests := []struct { + name string + input map[string]float64 + pipeline []v1alpha1.SchedulingDecisionPipelineOutputSpec + expectedCriticalMessage string + }{ + { + name: "single-critical-step", + input: map[string]float64{ + "host1": 2.0, // Would win without pipeline + "host2": 1.0, + "host3": 1.5, + }, + pipeline: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "non-critical-weigher", + Activations: map[string]float64{ + "host1": 0.1, // Small changes don't affect winner + "host2": 0.1, + "host3": 0.1, + }, + }, + { + Step: "critical-filter", + Activations: map[string]float64{ + "host2": 0.0, // host1 and host3 filtered out, host2 becomes winner + "host3": 0.0, + }, + }, + }, + expectedCriticalMessage: "Decision driven by 1/2 pipeline step: critical-filter.", + }, + { + name: "multiple-critical-steps", + input: map[string]float64{ + "host1": 1.0, + "host2": 2.0, // Would win without pipeline + "host3": 1.5, + }, + pipeline: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "critical-weigher1", + Activations: map[string]float64{ + "host1": 1.5, // Gives host1 strong boost to overtake host2 + "host2": 0.0, + "host3": 0.5, + }, + }, + { + Step: "critical-weigher2", + Activations: map[string]float64{ + "host1": 0.1, // Further secures host1's lead + "host2": 0.0, + "host3": 0.0, + }, + }, + }, + expectedCriticalMessage: "Decision driven by 1/2 pipeline step: critical-weigher1.", + }, + { + name: "all-non-critical", + input: map[string]float64{ + "host1": 3.0, // Clear winner from input + "host2": 1.0, + "host3": 2.0, + }, + pipeline: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ + { + Step: "non-critical-weigher1", + Activations: map[string]float64{ + "host1": 0.1, // Small changes don't change winner + "host2": 0.1, + "host3": 0.1, + }, + }, + { + Step: "non-critical-weigher2", + Activations: map[string]float64{ + "host1": 0.2, + "host2": 0.0, + "host3": 0.1, + }, + }, + }, + expectedCriticalMessage: "Decision driven by input only (all 2 steps are non-critical).", + }, + } + + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + resource := &v1alpha1.SchedulingDecision{ + ObjectMeta: ctrl.ObjectMeta{ + Name: "test-critical-steps-" + tt.name, + }, + Spec: v1alpha1.SchedulingDecisionSpec{ + Input: tt.input, + Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ + Name: "critical-step-test-pipeline", + Outputs: tt.pipeline, + }, + }, + } + + scheme := runtime.NewScheme() + if err := v1alpha1.AddToScheme(scheme); err != nil { + t.Fatalf("Failed to add scheme: %v", err) + } + + fakeClient := fake.NewClientBuilder(). + WithScheme(scheme). + WithObjects(resource). + WithStatusSubresource(&v1alpha1.SchedulingDecision{}). + Build() + + req := ctrl.Request{ + NamespacedName: client.ObjectKey{ + Name: "test-critical-steps-" + tt.name, + }, + } + + reconciler := &SchedulingDecisionReconciler{ + Conf: Config{}, + Client: fakeClient, + } + _, err := reconciler.Reconcile(t.Context(), req) + if err != nil { + t.Fatalf("Reconcile returned an error: %v", err) + } + + // Fetch the updated resource to check status + var updatedResource v1alpha1.SchedulingDecision + if err := fakeClient.Get(t.Context(), client.ObjectKey{Name: "test-critical-steps-" + tt.name}, &updatedResource); err != nil { + t.Fatalf("Failed to get updated resource: %v", err) + } + + // Verify the description contains the expected critical step message + description := updatedResource.Status.Description + if !contains(description, tt.expectedCriticalMessage) { + t.Errorf("Expected description to contain '%s', got '%s'", tt.expectedCriticalMessage, description) + } + + t.Logf("Critical step test %s completed: %s", tt.name, description) + }) + } +} + // Helper function to check if a string contains a substring func contains(s, substr string) bool { for i := 0; i <= len(s)-len(substr); i++ { From 1d9f808837648644607d4dfb04e77f703248daf8 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 14:06:42 +0200 Subject: [PATCH 20/58] Cleanup & better make & add printercolumn for creation timestamp --- decisions/Makefile | 10 +++++- .../api/v1alpha1/schedulingdecision_types.go | 3 +- .../api/v1alpha1/zz_generated.deepcopy.go | 25 +++++++++++++- .../decisions.cortex_schedulingdecisions.yaml | 10 ++++-- .../decisions.cortex_schedulingdecisions.yaml | 18 ++++++++++ ...aml => schedulingdecision_admin_role.yaml} | 0 ...ml => schedulingdecision_editor_role.yaml} | 0 ...ml => schedulingdecision_viewer_role.yaml} | 0 .../decisions.cortex_schedulingdecisions.yaml | 10 ++++-- .../rbac/computereservation_admin_role.yaml | 28 +++++++++++++++ .../rbac/computereservation_editor_role.yaml | 34 +++++++++++++++++++ .../rbac/computereservation_viewer_role.yaml | 30 ++++++++++++++++ 12 files changed, 161 insertions(+), 7 deletions(-) rename decisions/config/rbac/{computereservation_admin_role.yaml => schedulingdecision_admin_role.yaml} (100%) rename decisions/config/rbac/{computereservation_editor_role.yaml => schedulingdecision_editor_role.yaml} (100%) rename decisions/config/rbac/{computereservation_viewer_role.yaml => schedulingdecision_viewer_role.yaml} (100%) create mode 100644 decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml create mode 100644 decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml create mode 100644 decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml diff --git a/decisions/Makefile b/decisions/Makefile index 313dd550..4d454b5b 100644 --- a/decisions/Makefile +++ b/decisions/Makefile @@ -9,10 +9,18 @@ manifests: controller-gen ## Generate WebhookConfiguration, ClusterRole and Cust generate: controller-gen ## Generate code containing DeepCopy, DeepCopyInto, and DeepCopyObject method implementations. $(CONTROLLER_GEN) crd:allowDangerousTypes=true object:headerFile="hack/boilerplate.go.txt" paths="./..." +.PHONY: cleanup +cleanup: + rm -rf ./.github + +.PHONY: dekustomize +dekustomize: + kubebuilder edit --plugins=helm/v1-alpha + ##@ Build .PHONY: build -build: manifests generate +build: manifests generate dekustomize cleanup LOCALBIN ?= $(shell pwd)/bin $(LOCALBIN): diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index a19f8123..6aaa2344 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -45,9 +45,10 @@ type SchedulingDecisionStatus struct { // +kubebuilder:object:root=true // +kubebuilder:subresource:status -// +kubebuilder:resource:scope=Cluster,shortName=sdecs +// +kubebuilder:resource:scope=Cluster,shortName=sdec;sdecs // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" // +kubebuilder:printcolumn:name="Error",type="string",JSONPath=".status.error" +// +kubebuilder:printcolumn:name="Created",type="date",JSONPath=".metadata.creationTimestamp" // SchedulingDecision is the Schema for the schedulingdecisions API type SchedulingDecision struct { diff --git a/decisions/api/v1alpha1/zz_generated.deepcopy.go b/decisions/api/v1alpha1/zz_generated.deepcopy.go index c64d3653..e846dcb0 100644 --- a/decisions/api/v1alpha1/zz_generated.deepcopy.go +++ b/decisions/api/v1alpha1/zz_generated.deepcopy.go @@ -17,7 +17,7 @@ func (in *SchedulingDecision) DeepCopyInto(out *SchedulingDecision) { out.TypeMeta = in.TypeMeta in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) in.Spec.DeepCopyInto(&out.Spec) - out.Status = in.Status + in.Status.DeepCopyInto(&out.Status) } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecision. @@ -140,6 +140,29 @@ func (in *SchedulingDecisionSpec) DeepCopy() *SchedulingDecisionSpec { // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulingDecisionStatus) DeepCopyInto(out *SchedulingDecisionStatus) { *out = *in + if in.FinalScores != nil { + in, out := &in.FinalScores, &out.FinalScores + *out = make(map[string]float64, len(*in)) + for key, val := range *in { + (*out)[key] = val + } + } + if in.DeletedHosts != nil { + in, out := &in.DeletedHosts, &out.DeletedHosts + *out = make(map[string][]string, len(*in)) + for key, val := range *in { + var outVal []string + if val == nil { + (*out)[key] = nil + } else { + inVal := (*in)[key] + in, out := &inVal, &outVal + *out = make([]string, len(*in)) + copy(*out, *in) + } + (*out)[key] = outVal + } + } } // DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new SchedulingDecisionStatus. diff --git a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index 0f2a8e98..d815ebdd 100644 --- a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -12,6 +12,7 @@ spec: listKind: SchedulingDecisionList plural: schedulingdecisions shortNames: + - sdec - sdecs singular: schedulingdecision scope: Cluster @@ -23,6 +24,9 @@ spec: - jsonPath: .status.error name: Error type: string + - jsonPath: .metadata.creationTimestamp + name: Created + type: date name: v1alpha1 schema: openAPIV3Schema: @@ -83,9 +87,11 @@ spec: properties: deletedHosts: additionalProperties: - type: string + items: + type: string + type: array description: Hosts that were deleted during pipeline processing and - the step that deleted them. + all steps that attempted to delete them. type: object description: type: string diff --git a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml index 252ddd08..d815ebdd 100644 --- a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml @@ -12,6 +12,7 @@ spec: listKind: SchedulingDecisionList plural: schedulingdecisions shortNames: + - sdec - sdecs singular: schedulingdecision scope: Cluster @@ -23,6 +24,9 @@ spec: - jsonPath: .status.error name: Error type: string + - jsonPath: .metadata.creationTimestamp + name: Created + type: date name: v1alpha1 schema: openAPIV3Schema: @@ -81,11 +85,25 @@ spec: status: description: status defines the observed state of SchedulingDecision properties: + deletedHosts: + additionalProperties: + items: + type: string + type: array + description: Hosts that were deleted during pipeline processing and + all steps that attempted to delete them. + type: object description: type: string error: description: Only given if state is "error". type: string + finalScores: + additionalProperties: + type: number + description: Final scores for each host after processing all pipeline + steps. + type: object state: type: string type: object diff --git a/decisions/config/rbac/computereservation_admin_role.yaml b/decisions/config/rbac/schedulingdecision_admin_role.yaml similarity index 100% rename from decisions/config/rbac/computereservation_admin_role.yaml rename to decisions/config/rbac/schedulingdecision_admin_role.yaml diff --git a/decisions/config/rbac/computereservation_editor_role.yaml b/decisions/config/rbac/schedulingdecision_editor_role.yaml similarity index 100% rename from decisions/config/rbac/computereservation_editor_role.yaml rename to decisions/config/rbac/schedulingdecision_editor_role.yaml diff --git a/decisions/config/rbac/computereservation_viewer_role.yaml b/decisions/config/rbac/schedulingdecision_viewer_role.yaml similarity index 100% rename from decisions/config/rbac/computereservation_viewer_role.yaml rename to decisions/config/rbac/schedulingdecision_viewer_role.yaml diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml index 32117e90..7d8f6c84 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -18,6 +18,7 @@ spec: listKind: SchedulingDecisionList plural: schedulingdecisions shortNames: + - sdec - sdecs singular: schedulingdecision scope: Cluster @@ -29,6 +30,9 @@ spec: - jsonPath: .status.error name: Error type: string + - jsonPath: .metadata.creationTimestamp + name: Created + type: date name: v1alpha1 schema: openAPIV3Schema: @@ -89,9 +93,11 @@ spec: properties: deletedHosts: additionalProperties: - type: string + items: + type: string + type: array description: Hosts that were deleted during pipeline processing and - the step that deleted them. + all steps that attempted to delete them. type: object description: type: string diff --git a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml new file mode 100644 index 00000000..6db64811 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml @@ -0,0 +1,28 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants full permissions ('*') over decisions.cortex. +# This role is intended for users authorized to modify roles and bindings within the cluster, +# enabling them to delegate specific permissions to other users or groups as needed. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: schedulingdecision-admin-role +rules: +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions + verbs: + - '*' +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml new file mode 100644 index 00000000..7a82611c --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml @@ -0,0 +1,34 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants permissions to create, update, and delete resources within the decisions.cortex. +# This role is intended for users who need to manage these resources +# but should not control RBAC or manage permissions for others. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: schedulingdecision-editor-role +rules: +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions + verbs: + - create + - delete + - get + - list + - patch + - update + - watch +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions/status + verbs: + - get +{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml new file mode 100644 index 00000000..4375bd65 --- /dev/null +++ b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml @@ -0,0 +1,30 @@ +{{- if .Values.rbac.enable }} +# This rule is not used by the project decisions itself. +# It is provided to allow the cluster admin to help manage permissions for users. +# +# Grants read-only access to decisions.cortex resources. +# This role is intended for users who need visibility into these resources +# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing. + +apiVersion: rbac.authorization.k8s.io/v1 +kind: ClusterRole +metadata: + labels: + {{- include "chart.labels" . | nindent 4 }} + name: schedulingdecision-viewer-role +rules: +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions + verbs: + - get + - list + - watch +- apiGroups: + - decisions.cortex + resources: + - schedulingdecisions/status + verbs: + - get +{{- end -}} From 0db0dc19e65e243d6562686d132e37372b7c8f40 Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 14:22:28 +0200 Subject: [PATCH 21/58] Fix reservations operator and hopefully delete last stale yaml --- Tiltfile | 2 +- .../rbac/computereservation_admin_role.yaml | 28 --- .../rbac/computereservation_editor_role.yaml | 34 --- .../rbac/computereservation_viewer_role.yaml | 30 --- reservations/go.mod | 97 +++++---- reservations/go.sum | 203 ++++++++++-------- 6 files changed, 165 insertions(+), 229 deletions(-) delete mode 100644 decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml delete mode 100644 decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml delete mode 100644 decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml diff --git a/Tiltfile b/Tiltfile index e18c068f..74157f96 100644 --- a/Tiltfile +++ b/Tiltfile @@ -31,7 +31,7 @@ def kubebuilder_binary_files(path): docker_build('ghcr.io/cobaltcore-dev/cortex-reservations-operator', '.', dockerfile='Dockerfile.kubebuilder', build_args={'GO_MOD_PATH': 'reservations'}, - only=kubebuilder_binary_files('reservations') + ['internal/', 'go.mod', 'go.sum'], + only=kubebuilder_binary_files('reservations') + ['internal/', 'decisions/', 'go.mod', 'go.sum'], ) local('sh helm/sync.sh reservations/dist/chart') k8s_yaml(helm('reservations/dist/chart', name='cortex-reservations', values=[tilt_values])) diff --git a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml deleted file mode 100644 index 6db64811..00000000 --- a/decisions/dist/chart/templates/rbac/computereservation_admin_role.yaml +++ /dev/null @@ -1,28 +0,0 @@ -{{- if .Values.rbac.enable }} -# This rule is not used by the project decisions itself. -# It is provided to allow the cluster admin to help manage permissions for users. -# -# Grants full permissions ('*') over decisions.cortex. -# This role is intended for users authorized to modify roles and bindings within the cluster, -# enabling them to delegate specific permissions to other users or groups as needed. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - {{- include "chart.labels" . | nindent 4 }} - name: schedulingdecision-admin-role -rules: -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions - verbs: - - '*' -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions/status - verbs: - - get -{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml deleted file mode 100644 index 7a82611c..00000000 --- a/decisions/dist/chart/templates/rbac/computereservation_editor_role.yaml +++ /dev/null @@ -1,34 +0,0 @@ -{{- if .Values.rbac.enable }} -# This rule is not used by the project decisions itself. -# It is provided to allow the cluster admin to help manage permissions for users. -# -# Grants permissions to create, update, and delete resources within the decisions.cortex. -# This role is intended for users who need to manage these resources -# but should not control RBAC or manage permissions for others. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - {{- include "chart.labels" . | nindent 4 }} - name: schedulingdecision-editor-role -rules: -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions - verbs: - - create - - delete - - get - - list - - patch - - update - - watch -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions/status - verbs: - - get -{{- end -}} diff --git a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml b/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml deleted file mode 100644 index 4375bd65..00000000 --- a/decisions/dist/chart/templates/rbac/computereservation_viewer_role.yaml +++ /dev/null @@ -1,30 +0,0 @@ -{{- if .Values.rbac.enable }} -# This rule is not used by the project decisions itself. -# It is provided to allow the cluster admin to help manage permissions for users. -# -# Grants read-only access to decisions.cortex resources. -# This role is intended for users who need visibility into these resources -# without permissions to modify them. It is ideal for monitoring purposes and limited-access viewing. - -apiVersion: rbac.authorization.k8s.io/v1 -kind: ClusterRole -metadata: - labels: - {{- include "chart.labels" . | nindent 4 }} - name: schedulingdecision-viewer-role -rules: -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions - verbs: - - get - - list - - watch -- apiGroups: - - decisions.cortex - resources: - - schedulingdecisions/status - verbs: - - get -{{- end -}} diff --git a/reservations/go.mod b/reservations/go.mod index 9c1b6317..075198cd 100644 --- a/reservations/go.mod +++ b/reservations/go.mod @@ -4,12 +4,13 @@ go 1.25.0 replace ( github.com/cobaltcore-dev/cortex => ../ + github.com/cobaltcore-dev/cortex/decisions/api => ../decisions/api github.com/cobaltcore-dev/cortex/reservations/api => ./api ) require ( - github.com/cobaltcore-dev/cortex v0.0.0-00010101000000-000000000000 - github.com/cobaltcore-dev/cortex/reservations/api v0.0.0-00010101000000-000000000000 + github.com/cobaltcore-dev/cortex v0.0.0-20250925095218-954f58af3880 + github.com/cobaltcore-dev/cortex/reservations/api v0.0.0-20250925095218-954f58af3880 github.com/gophercloud/gophercloud/v2 v2.8.0 k8s.io/apimachinery v0.34.1 k8s.io/client-go v0.34.1 @@ -18,9 +19,22 @@ require ( require ( filippo.io/edwards25519 v1.1.0 // indirect + github.com/cenkalti/backoff/v5 v5.0.3 // indirect + github.com/cobaltcore-dev/cortex/decisions/api v0.0.0-00010101000000-000000000000 // indirect github.com/dlmiddlecote/sqlstats v1.0.2 // indirect github.com/eclipse/paho.mqtt.golang v1.5.1 // indirect github.com/go-gorp/gorp v2.2.0+incompatible // indirect + github.com/go-openapi/swag/cmdutils v0.25.0 // indirect + github.com/go-openapi/swag/conv v0.25.0 // indirect + github.com/go-openapi/swag/fileutils v0.25.0 // indirect + github.com/go-openapi/swag/jsonname v0.25.0 // indirect + github.com/go-openapi/swag/jsonutils v0.25.0 // indirect + github.com/go-openapi/swag/loading v0.25.0 // indirect + github.com/go-openapi/swag/mangling v0.25.0 // indirect + github.com/go-openapi/swag/netutils v0.25.0 // indirect + github.com/go-openapi/swag/stringutils v0.25.0 // indirect + github.com/go-openapi/swag/typeutils v0.25.0 // indirect + github.com/go-openapi/swag/yamlutils v0.25.0 // indirect github.com/golang-migrate/migrate/v4 v4.19.0 // indirect github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 // indirect github.com/hashicorp/errwrap v1.1.0 // indirect @@ -28,20 +42,19 @@ require ( github.com/lib/pq v1.10.9 // indirect github.com/pmezard/go-difflib v1.0.0 // indirect github.com/sapcc/go-api-declarations v1.17.4 // indirect - go.yaml.in/yaml/v2 v2.4.2 // indirect + go.yaml.in/yaml/v2 v2.4.3 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect sigs.k8s.io/structured-merge-diff/v6 v6.3.0 // indirect ) require ( cel.dev/expr v0.24.0 // indirect - github.com/antlr4-go/antlr/v4 v4.13.0 // indirect + github.com/antlr4-go/antlr/v4 v4.13.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/blang/semver/v4 v4.0.0 // indirect - github.com/cenkalti/backoff/v4 v4.3.0 // indirect github.com/cespare/xxhash/v2 v2.3.0 // indirect github.com/davecgh/go-spew v1.1.1 // indirect - github.com/emicklei/go-restful/v3 v3.12.2 // indirect + github.com/emicklei/go-restful/v3 v3.13.0 // indirect github.com/evanphx/json-patch/v5 v5.9.11 // indirect github.com/felixge/httpsnoop v1.0.4 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect @@ -49,69 +62,65 @@ require ( github.com/go-logr/logr v1.4.3 // indirect github.com/go-logr/stdr v1.2.2 // indirect github.com/go-logr/zapr v1.3.0 // indirect - github.com/go-openapi/jsonpointer v0.21.0 // indirect - github.com/go-openapi/jsonreference v0.20.2 // indirect - github.com/go-openapi/swag v0.23.0 // indirect + github.com/go-openapi/jsonpointer v0.22.0 // indirect + github.com/go-openapi/jsonreference v0.21.1 // indirect + github.com/go-openapi/swag v0.25.0 // indirect github.com/gogo/protobuf v1.3.2 // indirect github.com/google/btree v1.1.3 // indirect - github.com/google/cel-go v0.26.0 // indirect + github.com/google/cel-go v0.26.1 // indirect github.com/google/gnostic-models v0.7.0 // indirect github.com/google/go-cmp v0.7.0 // indirect github.com/google/uuid v1.6.0 // indirect - github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 // indirect + github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect - github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/mailru/easyjson v0.7.7 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.3-0.20250322232337-35a7c28c31ee // indirect github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect - github.com/pkg/errors v0.9.1 // indirect github.com/prometheus/client_golang v1.23.2 github.com/prometheus/client_model v0.6.2 github.com/prometheus/common v0.66.1 // indirect github.com/prometheus/procfs v0.17.0 // indirect - github.com/sapcc/go-bits v0.0.0-20250918190459-d63422aef730 - github.com/spf13/cobra v1.9.1 // indirect - github.com/spf13/pflag v1.0.6 // indirect - github.com/stoewer/go-strcase v1.3.0 // indirect + github.com/sapcc/go-bits v0.0.0-20250924092957-bcc75ecf4553 + github.com/spf13/cobra v1.10.1 // indirect + github.com/spf13/pflag v1.0.10 // indirect + github.com/stoewer/go-strcase v1.3.1 // indirect github.com/x448/float16 v0.8.4 // indirect - go.opentelemetry.io/auto/sdk v1.1.0 // indirect - go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 // indirect - go.opentelemetry.io/otel v1.37.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 // indirect - go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 // indirect - go.opentelemetry.io/otel/metric v1.37.0 // indirect - go.opentelemetry.io/otel/sdk v1.35.0 // indirect - go.opentelemetry.io/otel/trace v1.37.0 // indirect - go.opentelemetry.io/proto/otlp v1.5.0 // indirect + go.opentelemetry.io/auto/sdk v1.2.1 // indirect + go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 // indirect + go.opentelemetry.io/otel v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 // indirect + go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 // indirect + go.opentelemetry.io/otel/metric v1.38.0 // indirect + go.opentelemetry.io/otel/sdk v1.38.0 // indirect + go.opentelemetry.io/otel/trace v1.38.0 // indirect + go.opentelemetry.io/proto/otlp v1.8.0 // indirect go.uber.org/multierr v1.11.0 // indirect go.uber.org/zap v1.27.0 // indirect - golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 // indirect + golang.org/x/exp v0.0.0-20250911091902-df9299821621 // indirect golang.org/x/net v0.44.0 // indirect - golang.org/x/oauth2 v0.30.0 // indirect + golang.org/x/oauth2 v0.31.0 // indirect golang.org/x/sync v0.17.0 // indirect golang.org/x/sys v0.36.0 // indirect golang.org/x/term v0.35.0 // indirect golang.org/x/text v0.29.0 // indirect - golang.org/x/time v0.12.0 // indirect - gomodules.xyz/jsonpatch/v2 v2.4.0 // indirect - google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb // indirect - google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb // indirect - google.golang.org/grpc v1.72.1 // indirect - google.golang.org/protobuf v1.36.8 // indirect - gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect + golang.org/x/time v0.13.0 // indirect + gomodules.xyz/jsonpatch/v2 v2.5.0 // indirect + google.golang.org/genproto/googleapis/api v0.0.0-20250922171735-9219d122eba9 // indirect + google.golang.org/genproto/googleapis/rpc v0.0.0-20250922171735-9219d122eba9 // indirect + google.golang.org/grpc v1.75.1 // indirect + google.golang.org/protobuf v1.36.9 // indirect + gopkg.in/evanphx/json-patch.v4 v4.13.0 // indirect gopkg.in/inf.v0 v0.9.1 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect k8s.io/api v0.34.1 // indirect - k8s.io/apiextensions-apiserver v0.34.0 // indirect - k8s.io/apiserver v0.34.0 // indirect - k8s.io/component-base v0.34.0 // indirect + k8s.io/apiextensions-apiserver v0.34.1 // indirect + k8s.io/apiserver v0.34.1 // indirect + k8s.io/component-base v0.34.1 // indirect k8s.io/klog/v2 v2.130.1 // indirect - k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b // indirect - k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 // indirect - sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 // indirect - sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect + k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 // indirect + k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d // indirect + sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0 // indirect + sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 // indirect sigs.k8s.io/randfill v1.0.0 // indirect sigs.k8s.io/yaml v1.6.0 // indirect ) diff --git a/reservations/go.sum b/reservations/go.sum index 4ee1999d..bd6a9807 100644 --- a/reservations/go.sum +++ b/reservations/go.sum @@ -12,8 +12,8 @@ github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuy github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/antlr4-go/antlr/v4 v4.13.0 h1:lxCg3LAv+EUK6t1i0y1V6/SLeUi0eKEKdhQAlS8TVTI= -github.com/antlr4-go/antlr/v4 v4.13.0/go.mod h1:pfChB/xh/Unjila75QW7+VU4TSnWnnk9UTnmpPaOR2g= +github.com/antlr4-go/antlr/v4 v4.13.1 h1:SqQKkuVZ+zWkMMNkjy5FZe5mr5WURWnlpmOuzYWrPrQ= +github.com/antlr4-go/antlr/v4 v4.13.1/go.mod h1:GKmUxMtwp6ZgGwZSva4eWPC5mS6vUAmOABFgjdkM7Nw= github.com/beorn7/perks v0.0.0-20180321164747-3a771d992973/go.mod h1:Dwedo/Wpr24TaqPxmxbtue+5NUziq4I4S80YR8gNf3Q= github.com/beorn7/perks v1.0.0/go.mod h1:KWe93zE9D1o94FZ5RNwFwVgaQK1VOXiVxmqh+CedLV8= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= @@ -22,8 +22,8 @@ github.com/blang/semver/v4 v4.0.0 h1:1PFHFE6yCCTv8C1TeyNNarDzntLi7wMI5i/pzqYIsAM github.com/blang/semver/v4 v4.0.0/go.mod h1:IbckMUScFkM3pff0VJDNKRiT6TG/YpiHIM2yvyW5YoQ= github.com/cenkalti/backoff v2.2.1+incompatible h1:tNowT99t7UNflLxfYYSlKYsBpXdEet03Pg2g16Swow4= github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM= -github.com/cenkalti/backoff/v4 v4.3.0 h1:MyRJ/UdXutAwSAT+s3wNd7MfTIcy71VQueUuFK343L8= -github.com/cenkalti/backoff/v4 v4.3.0/go.mod h1:Y3VNntkOUPxTVeUxJ/G5vcM//AlwfmyYozVcomhLiZE= +github.com/cenkalti/backoff/v5 v5.0.3 h1:ZN+IMa753KfX5hd8vVaMixjnqRZ3y8CuJKRKj1xcsSM= +github.com/cenkalti/backoff/v5 v5.0.3/go.mod h1:rkhZdG3JZukswDf7f0cwqPNk4K0sa+F97BxZthm/crw= github.com/cespare/xxhash/v2 v2.1.1/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= @@ -34,7 +34,6 @@ github.com/containerd/errdefs v1.0.0/go.mod h1:+YBYIdtsnF4Iw6nWZhJcqGSg/dwvV7tyJ github.com/containerd/errdefs/pkg v0.3.0 h1:9IKJ06FvyNlexW690DXuQNx2KA2cUJXx151Xdx3ZPPE= github.com/containerd/errdefs/pkg v0.3.0/go.mod h1:NJw6s9HwNuRhnjJhM7pylWwMyAkmCQvQ4GpJHEqRLVk= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= -github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -52,8 +51,8 @@ github.com/docker/go-units v0.5.0 h1:69rxXcBk27SvSaaxTtLh/8llcHD8vYHT7WSdRZ/jvr4 github.com/docker/go-units v0.5.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/eclipse/paho.mqtt.golang v1.5.1 h1:/VSOv3oDLlpqR2Epjn1Q7b2bSTplJIeV2ISgCl2W7nE= github.com/eclipse/paho.mqtt.golang v1.5.1/go.mod h1:1/yJCneuyOoCOzKSsOTUc0AJfpsItBGWvYpBLimhArU= -github.com/emicklei/go-restful/v3 v3.12.2 h1:DhwDP0vY3k8ZzE0RunuJy8GhNpPL6zqLkDf9B/a0/xU= -github.com/emicklei/go-restful/v3 v3.12.2/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= +github.com/emicklei/go-restful/v3 v3.13.0 h1:C4Bl2xDndpU6nJ4bc1jXd+uTmYPVUwkD6bFY/oTyCes= +github.com/emicklei/go-restful/v3 v3.13.0/go.mod h1:6n3XBCmQQb25CM2LCACGz8ukIrRry+4bhvbpWn3mrbc= github.com/evanphx/json-patch v0.5.2 h1:xVCHIVMUu1wtM/VkR9jVZ45N3FhZfYMMYGorLCR8P3k= github.com/evanphx/json-patch v0.5.2/go.mod h1:ZWS5hhDbVDyob71nXKNL0+PWn6ToqBHMikGIFbs31qQ= github.com/evanphx/json-patch/v5 v5.9.11 h1:/8HVnzMq13/3x9TPvjG08wUGqBTmZBsCWzjTM0wiaDU= @@ -77,14 +76,36 @@ github.com/go-logr/stdr v1.2.2 h1:hSWxHoqTgW2S2qGc0LTAI563KZ5YKYRhT3MFKZMbjag= github.com/go-logr/stdr v1.2.2/go.mod h1:mMo/vtBO5dYbehREoey6XUKy/eSumjCCveDpRre4VKE= github.com/go-logr/zapr v1.3.0 h1:XGdV8XW8zdwFiwOA2Dryh1gj2KRQyOOoNmBy4EplIcQ= github.com/go-logr/zapr v1.3.0/go.mod h1:YKepepNBd1u/oyhd/yQmtjVXmm9uML4IXUgMOwR8/Gg= -github.com/go-openapi/jsonpointer v0.19.6/go.mod h1:osyAmYz/mB/C3I+WsTTSgw1ONzaLJoLCyoi6/zppojs= -github.com/go-openapi/jsonpointer v0.21.0 h1:YgdVicSA9vH5RiHs9TZW5oyafXZFc6+2Vc1rr/O9oNQ= -github.com/go-openapi/jsonpointer v0.21.0/go.mod h1:IUyH9l/+uyhIYQ/PXVA41Rexl+kOkAPDdXEYns6fzUY= -github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2KvnJRumpMGbE= -github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= -github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= -github.com/go-openapi/swag v0.23.0 h1:vsEVJDUo2hPJ2tu0/Xc+4noaxyEffXNIs3cOULZ+GrE= -github.com/go-openapi/swag v0.23.0/go.mod h1:esZ8ITTYEsH1V2trKHjAN8Ai7xHb8RV+YSZ577vPjgQ= +github.com/go-openapi/jsonpointer v0.22.0 h1:TmMhghgNef9YXxTu1tOopo+0BGEytxA+okbry0HjZsM= +github.com/go-openapi/jsonpointer v0.22.0/go.mod h1:xt3jV88UtExdIkkL7NloURjRQjbeUgcxFblMjq2iaiU= +github.com/go-openapi/jsonreference v0.21.1 h1:bSKrcl8819zKiOgxkbVNRUBIr6Wwj9KYrDbMjRs0cDA= +github.com/go-openapi/jsonreference v0.21.1/go.mod h1:PWs8rO4xxTUqKGu+lEvvCxD5k2X7QYkKAepJyCmSTT8= +github.com/go-openapi/swag v0.25.0 h1:xyZhlgInBg6wOtyTD5b+pzwVqHSOliAvgvKW+POFUts= +github.com/go-openapi/swag v0.25.0/go.mod h1:yhsa7GJvO1JBFZccLq9uh/MawsC0PQd8sNz88VBXQlU= +github.com/go-openapi/swag/cmdutils v0.25.0 h1:iYZ24DEGPEk6L1jO09vw39KfpxbG7KhS+WeQexS8U5A= +github.com/go-openapi/swag/cmdutils v0.25.0/go.mod h1:pdae/AFo6WxLl5L0rq87eRzVPm/XRHM3MoYgRMvG4A0= +github.com/go-openapi/swag/conv v0.25.0 h1:5K+e44HkOgCVE0IJTbivurzHahT62DPr2DEJqR/+4pA= +github.com/go-openapi/swag/conv v0.25.0/go.mod h1:oa1ZZnb1jubNdZlD1iAhGXt6Ic4hHtuO23MwTgAXR88= +github.com/go-openapi/swag/fileutils v0.25.0 h1:t7aQRuRfsP29dY4vfrNvDZv7RurwRHuyjUedtYVDmYY= +github.com/go-openapi/swag/fileutils v0.25.0/go.mod h1:+NXtt5xNZZqmpIpjqcujqojGFek9/w55b3ecmOdtg8M= +github.com/go-openapi/swag/jsonname v0.25.0 h1:+fuNs9gdkb2w10hgsgOBx9jtx0pvtUaDRYxD91BEpEQ= +github.com/go-openapi/swag/jsonname v0.25.0/go.mod h1:71Tekow6UOLBD3wS7XhdT98g5J5GR13NOTQ9/6Q11Zo= +github.com/go-openapi/swag/jsonutils v0.25.0 h1:ELKpJT29T4N/AvmDqMeDFLx2QRZQOYFthzctbIX30+A= +github.com/go-openapi/swag/jsonutils v0.25.0/go.mod h1:KYL8GyGoi6tek9ajpvn0le4BWmKoUVVv8yPxklViIMo= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.0 h1:ca9vKxLnJegL2bzqXRWNabKdqVGxBzrnO8/UZnr5W0Y= +github.com/go-openapi/swag/jsonutils/fixtures_test v0.25.0/go.mod h1:kjmweouyPwRUEYMSrbAidoLMGeJ5p6zdHi9BgZiqmsg= +github.com/go-openapi/swag/loading v0.25.0 h1:e9mjE5fJeaK0LTepHMtG0Ief+9ETXLFhWCx7ZfiI6LI= +github.com/go-openapi/swag/loading v0.25.0/go.mod h1:2ZCWXwVY1XYuoue8Bdjbn5GJK4/ufXbCfcvoSPFQJqM= +github.com/go-openapi/swag/mangling v0.25.0 h1:VdTfDWX5lS3yURxYHF5SK7kYelSK69Lv2xEAeudTzM8= +github.com/go-openapi/swag/mangling v0.25.0/go.mod h1:CdiMQ6pnfAgyQGSOIYnZkXvqhnnwOn997uXZMAd/7mQ= +github.com/go-openapi/swag/netutils v0.25.0 h1:/e1LPmXfF9fcOYbbaP3+SQgon1fRwe5EZ0FjpR4vAjs= +github.com/go-openapi/swag/netutils v0.25.0/go.mod h1:CAkkvqnUJX8NV96tNhEQvKz8SQo2KF0f7LleiJwIeRE= +github.com/go-openapi/swag/stringutils v0.25.0 h1:iYfCF45GUeI/1Yrh8rQtTFCp5K1ToqWhUdzJZwvXvv8= +github.com/go-openapi/swag/stringutils v0.25.0/go.mod h1:JLdSAq5169HaiDUbTvArA2yQxmgn4D6h4A+4HqVvAYg= +github.com/go-openapi/swag/typeutils v0.25.0 h1:iUTsxu3F3h9v6CBzVFGXKPSBQt6d8XXgYy1YAlu+HJ8= +github.com/go-openapi/swag/typeutils v0.25.0/go.mod h1:9McMC/oCdS4BKwk2shEB7x17P6HmMmA6dQRtAkSnNb8= +github.com/go-openapi/swag/yamlutils v0.25.0 h1:apgy77seWLEM9HKDcieIgW8bG9aSZgH6nQ9THlHYgHA= +github.com/go-openapi/swag/yamlutils v0.25.0/go.mod h1:0JvBRtc0mR02IqHURUeGgS9cG+Dfms4FCGXCnsgnt7c= github.com/go-sql-driver/mysql v1.9.2 h1:4cNKDYQ1I84SXslGddlsrMhc8k4LeDVj6Ad6WRjiHuU= github.com/go-sql-driver/mysql v1.9.2/go.mod h1:qn46aNg1333BRMNU69Lq93t8du/dwxI64Gl8i5p1WMU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= @@ -102,8 +123,8 @@ github.com/golang/protobuf v1.5.4 h1:i7eJL8qZTpSEXOPTxNKhASYpMn+8e5Q6AdndVa1dWek github.com/golang/protobuf v1.5.4/go.mod h1:lnTiLA8Wa4RWRcIUkrtSVa5nRhsEGBg48fD6rSs7xps= github.com/google/btree v1.1.3 h1:CVpQJjYgC4VbzxeGVHfvZrv1ctoYCAI8vbl07Fcxlyg= github.com/google/btree v1.1.3/go.mod h1:qOPhT0dTNdNzV6Z/lhRX0YXUafgPLFUh+gZMl761Gm4= -github.com/google/cel-go v0.26.0 h1:DPGjXackMpJWH680oGY4lZhYjIameYmR+/6RBdDGmaI= -github.com/google/cel-go v0.26.0/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= +github.com/google/cel-go v0.26.1 h1:iPbVVEdkhTX++hpe3lzSk7D3G3QSYqLGoHOcEio+UXQ= +github.com/google/cel-go v0.26.1/go.mod h1:A9O8OU9rdvrK5MQyrqfIxo1a0u4g3sF8KB6PUIaryMM= github.com/google/gnostic-models v0.7.0 h1:qwTtogB15McXDaNqTZdzPJRHvaVJlAl+HVQnLmJEJxo= github.com/google/gnostic-models v0.7.0/go.mod h1:whL5G0m6dmc5cPxKc5bdKdEN3UjI7OUGxBlw57miDrQ= github.com/google/go-cmp v0.3.1/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU= @@ -120,8 +141,8 @@ github.com/gophercloud/gophercloud/v2 v2.8.0 h1:of2+8tT6+FbEYHfYC8GBu8TXJNsXYSNm github.com/gophercloud/gophercloud/v2 v2.8.0/go.mod h1:Ki/ILhYZr/5EPebrPL9Ej+tUg4lqx71/YH2JWVeU+Qk= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674 h1:JeSE6pjso5THxAzdVpqr6/geYxZytqFMBCOtn/ujyeo= github.com/gorilla/websocket v1.5.4-0.20250319132907-e064f32e3674/go.mod h1:r4w70xmWCQKmi1ONH4KIaBptdivuRPyosB9RmPlGEwA= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3 h1:5ZPtiqj0JL5oKWmcsq4VMaAW5ukBEgSGXEN89zeH1Jo= -github.com/grpc-ecosystem/grpc-gateway/v2 v2.26.3/go.mod h1:ndYquD05frm2vACXE1nsccT4oJzjhw2arTS2cpUD1PI= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2 h1:8Tjv8EJ+pM1xP8mK6egEbD1OgnVTyacbefKhmbLhIhU= +github.com/grpc-ecosystem/grpc-gateway/v2 v2.27.2/go.mod h1:pkJQ2tZHJ0aFOVEEot6oZmaVEZcRme73eIFmhiVuRWs= github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= github.com/hashicorp/errwrap v1.1.0 h1:OxrOeh75EUXMY8TBjag2fzXGZ40LB6IKw45YeGUDY2I= github.com/hashicorp/errwrap v1.1.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4= @@ -129,8 +150,6 @@ github.com/hashicorp/go-multierror v1.1.1 h1:H5DkEtf6CXdFp0N0Em5UCwQpXMWke8IA0+l github.com/hashicorp/go-multierror v1.1.1/go.mod h1:iw975J/qwKPdAO1clOe2L8331t/9/fmwbPZ6JB6eMoM= github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2s0bqwp9tc8= github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw= -github.com/josharian/intern v1.0.0 h1:vlS4z54oSdjm0bgjRigI+G1HpF+tI+9rE5LLzOg8HmY= -github.com/josharian/intern v1.0.0/go.mod h1:5DoeVV0s6jJacbCEi61lwdGj/aVlrQvzHFFd8Hwg//Y= github.com/json-iterator/go v1.1.6/go.mod h1:+SdeFBvtyEkXs7REEP0seUULqWtbJapLOCVDaaPEHmU= github.com/json-iterator/go v1.1.8/go.mod h1:KdQUCv79m/52Kvf8AW2vK1V8akMuk1QjK/uOdHXbAo4= github.com/json-iterator/go v1.1.12 h1:PV8peI4a0ysnczrg+LtxykD8LfKY9ML6u2jnxaEnrnM= @@ -142,19 +161,16 @@ github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zt github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ= github.com/kr/logfmt v0.0.0-20140226030751-b84e30acd515/go.mod h1:+0opPa2QZZtGFBFZlji/RkVcI2GknAs/DXo4wKdlNEc= -github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= -github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= -github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= github.com/kylelemons/godebug v1.1.0 h1:RPNrshWIDI6G2gRW9EHilWtl7Z6Sb1BR0xunSBf0SNc= github.com/kylelemons/godebug v1.1.0/go.mod h1:9/0rRGxNHcop5bhtWyNeEfOS8JIWk580+fNqagV/RAw= github.com/lib/pq v1.10.9 h1:YXG7RB+JIjhP29X+OtkiDnYaXQwpS4JEWq7dtCCRUEw= github.com/lib/pq v1.10.9/go.mod h1:AlVN5x4E4T544tWzH6hKfbfQvm3HdbOxrmggDNAPY9o= -github.com/mailru/easyjson v0.7.7 h1:UGYAvKxe3sBsEDzO8ZeWOSlIQfWFlxbzLZe7hwFURr0= -github.com/mailru/easyjson v0.7.7/go.mod h1:xzfreul335JAWq5oZzymOObrkdz5UnU4kGfJJLY9Nlc= +github.com/majewsky/gg v1.3.0 h1:1bBuQ+S1u9wuD8YT2OMdngEUctwv+xx5D6bZTd1lAto= +github.com/majewsky/gg v1.3.0/go.mod h1:KC7qUlln1VBY90OE0jXMNjXW2b9B4jJ1heYQ08OzeAg= github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU= github.com/mattn/go-sqlite3 v1.14.32 h1:JD12Ag3oLy1zQA+BNn74xRgaBbdhbNIDYvQUEuuErjs= github.com/mattn/go-sqlite3 v1.14.32/go.mod h1:Uh1q+B4BYcTPb+yiD3kU8Ct7aC0hY9fxUwlHK0RXw+Y= @@ -218,25 +234,26 @@ github.com/prometheus/procfs v0.0.2/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsT github.com/prometheus/procfs v0.0.8/go.mod h1:7Qr8sr6344vo1JqZ6HhLceV9o3AJ1Ff+GxbHq6oeK9A= github.com/prometheus/procfs v0.17.0 h1:FuLQ+05u4ZI+SS/w9+BWEM2TXiHKsUQ9TADiRH7DuK0= github.com/prometheus/procfs v0.17.0/go.mod h1:oPQLaDAMRbA+u8H5Pbfq+dl3VDAvHxMUOVhe0wYB2zw= -github.com/rogpeppe/go-internal v1.13.1 h1:KvO1DLK/DRN07sQ1LQKScxyZJuNnedQ5/wKSR38lUII= -github.com/rogpeppe/go-internal v1.13.1/go.mod h1:uMEvuHeurkdAXX61udpOXGD/AzZDWNMNyH2VO9fmH0o= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sapcc/go-api-declarations v1.17.4 h1:F4smuE9x1NJ/7NAdytJ1wekeXT3QeRaYu3L/HyWKqqo= github.com/sapcc/go-api-declarations v1.17.4/go.mod h1:MWmLjmvjftgyAugNUfIhsDsHIzXH1pn32cWLZpiluKg= -github.com/sapcc/go-bits v0.0.0-20250918190459-d63422aef730 h1:JZ0b9IxW5A6XdbaTZWTXDD8Mf5blABivAOOwVtVQCSc= -github.com/sapcc/go-bits v0.0.0-20250918190459-d63422aef730/go.mod h1:YfKAF5oNv8UD/zkOjK+dOVft8DUZq5KphjPy2IEI+QU= +github.com/sapcc/go-bits v0.0.0-20250924092957-bcc75ecf4553 h1:CWbbQgtHq+RPAaPjPZC7z2uJJhaRGJMBymnnzXaWFj8= +github.com/sapcc/go-bits v0.0.0-20250924092957-bcc75ecf4553/go.mod h1:+hy4RXW/4ZnFl/Ct7vBl9cnLEA9Lt/BKYYGoxZkwLZY= github.com/sergi/go-diff v1.4.0 h1:n/SP9D5ad1fORl+llWyN+D6qoUETXNZARKjyY2/KVCw= github.com/sergi/go-diff v1.4.0/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo= github.com/sirupsen/logrus v1.4.2/go.mod h1:tLMulIdttU9McNUspp0xgXVQah82FyeX6MwdIuYE2rE= github.com/sirupsen/logrus v1.9.3 h1:dueUQJ1C2q9oE3F7wvmSGAaVtTmUizReu6fjN8uqzbQ= github.com/sirupsen/logrus v1.9.3/go.mod h1:naHLuLoDiP4jHNo9R0sCBMtWGeIprob74mVsIT4qYEQ= -github.com/spf13/cobra v1.9.1 h1:CXSaggrXdbHK9CF+8ywj8Amf7PBRmPCOJugH954Nnlo= -github.com/spf13/cobra v1.9.1/go.mod h1:nDyEzZ8ogv936Cinf6g1RU9MRY64Ir93oCnqb9wxYW0= -github.com/spf13/pflag v1.0.6 h1:jFzHGLGAlb3ruxLB8MhbI6A8+AQX/2eW4qeyNZXNp2o= -github.com/spf13/pflag v1.0.6/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= -github.com/stoewer/go-strcase v1.3.0 h1:g0eASXYtp+yvN9fK8sH94oCIk0fau9uV1/ZdJ0AVEzs= -github.com/stoewer/go-strcase v1.3.0/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= +github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= +github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= +github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +github.com/stoewer/go-strcase v1.3.1 h1:iS0MdW+kVTxgMoE1LAZyMiYJFKlOzLooE4MxjirtkAs= +github.com/stoewer/go-strcase v1.3.1/go.mod h1:fAH5hQ5pehh+j3nZfvwdk2RgEgQjAoM8wodgtPmh1xo= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.4.0/go.mod h1:YvHI0jy2hoMjB+UWwv71VJQ9isScKT/TqJzVSSt89Yw= @@ -256,42 +273,42 @@ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9de github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/ziutek/mymysql v1.5.4 h1:GB0qdRGsTwQSBVYuVShFBKaXSnSnYYC2d9knnE1LHFs= github.com/ziutek/mymysql v1.5.4/go.mod h1:LMSpPZ6DbqWFxNCHW77HeMg9I646SAhApZ/wKdgO/C0= -go.opentelemetry.io/auto/sdk v1.1.0 h1:cH53jehLUN6UFLY71z+NDOiNJqDdPRaXzTel0sJySYA= -go.opentelemetry.io/auto/sdk v1.1.0/go.mod h1:3wSPjt5PWp2RhlCcmmOial7AvC4DQqZb7a7wCow3W8A= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0 h1:sbiXRNDSWJOTobXh5HyQKjq6wUC5tNybqjIqDpAY4CU= -go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.60.0/go.mod h1:69uWxva0WgAA/4bu2Yy70SLDBwZXuQ6PbBpbsa5iZrQ= -go.opentelemetry.io/otel v1.37.0 h1:9zhNfelUvx0KBfu/gb+ZgeAfAgtWrfHJZcAqFC228wQ= -go.opentelemetry.io/otel v1.37.0/go.mod h1:ehE/umFRLnuLa/vSccNq9oS1ErUlkkK71gMcN34UG8I= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0 h1:OeNbIYk/2C15ckl7glBlOBp5+WlYsOElzTNmiPW/x60= -go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.34.0/go.mod h1:7Bept48yIeqxP2OZ9/AqIpYS94h2or0aB4FypJTc8ZM= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0 h1:tgJ0uaNS4c98WRNUEx5U3aDlrDOI5Rs+1Vifcw4DJ8U= -go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.34.0/go.mod h1:U7HYyW0zt/a9x5J1Kjs+r1f/d4ZHnYFclhYY2+YbeoE= -go.opentelemetry.io/otel/metric v1.37.0 h1:mvwbQS5m0tbmqML4NqK+e3aDiO02vsf/WgbsdpcPoZE= -go.opentelemetry.io/otel/metric v1.37.0/go.mod h1:04wGrZurHYKOc+RKeye86GwKiTb9FKm1WHtO+4EVr2E= -go.opentelemetry.io/otel/sdk v1.35.0 h1:iPctf8iprVySXSKJffSS79eOjl9pvxV9ZqOWT0QejKY= -go.opentelemetry.io/otel/sdk v1.35.0/go.mod h1:+ga1bZliga3DxJ3CQGg3updiaAJoNECOgJREo9KHGQg= -go.opentelemetry.io/otel/sdk/metric v1.35.0 h1:1RriWBmCKgkeHEhM7a2uMjMUfP7MsOF5JpUCaEqEI9o= -go.opentelemetry.io/otel/sdk/metric v1.35.0/go.mod h1:is6XYCUMpcKi+ZsOvfluY5YstFnhW0BidkR+gL+qN+w= -go.opentelemetry.io/otel/trace v1.37.0 h1:HLdcFNbRQBE2imdSEgm/kwqmQj1Or1l/7bW6mxVK7z4= -go.opentelemetry.io/otel/trace v1.37.0/go.mod h1:TlgrlQ+PtQO5XFerSPUYG0JSgGyryXewPGyayAWSBS0= -go.opentelemetry.io/proto/otlp v1.5.0 h1:xJvq7gMzB31/d406fB8U5CBdyQGw4P399D1aQWU/3i4= -go.opentelemetry.io/proto/otlp v1.5.0/go.mod h1:keN8WnHxOy8PG0rQZjJJ5A2ebUoafqWp0eVQ4yIXvJ4= +go.opentelemetry.io/auto/sdk v1.2.1 h1:jXsnJ4Lmnqd11kwkBV2LgLoFMZKizbCi5fNZ/ipaZ64= +go.opentelemetry.io/auto/sdk v1.2.1/go.mod h1:KRTj+aOaElaLi+wW1kO/DZRXwkF4C5xPbEe3ZiIhN7Y= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0 h1:RbKq8BG0FI8OiXhBfcRtqqHcZcka+gU3cskNuf05R18= +go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.63.0/go.mod h1:h06DGIukJOevXaj/xrNjhi/2098RZzcLTbc0jDAUbsg= +go.opentelemetry.io/otel v1.38.0 h1:RkfdswUDRimDg0m2Az18RKOsnI8UDzppJAtj01/Ymk8= +go.opentelemetry.io/otel v1.38.0/go.mod h1:zcmtmQ1+YmQM9wrNsTGV/q/uyusom3P8RxwExxkZhjM= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0 h1:GqRJVj7UmLjCVyVJ3ZFLdPRmhDUp2zFmQe3RHIOsw24= +go.opentelemetry.io/otel/exporters/otlp/otlptrace v1.38.0/go.mod h1:ri3aaHSmCTVYu2AWv44YMauwAQc0aqI9gHKIcSbI1pU= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0 h1:lwI4Dc5leUqENgGuQImwLo4WnuXFPetmPpkLi2IrX54= +go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc v1.38.0/go.mod h1:Kz/oCE7z5wuyhPxsXDuaPteSWqjSBD5YaSdbxZYGbGk= +go.opentelemetry.io/otel/metric v1.38.0 h1:Kl6lzIYGAh5M159u9NgiRkmoMKjvbsKtYRwgfrA6WpA= +go.opentelemetry.io/otel/metric v1.38.0/go.mod h1:kB5n/QoRM8YwmUahxvI3bO34eVtQf2i4utNVLr9gEmI= +go.opentelemetry.io/otel/sdk v1.38.0 h1:l48sr5YbNf2hpCUj/FoGhW9yDkl+Ma+LrVl8qaM5b+E= +go.opentelemetry.io/otel/sdk v1.38.0/go.mod h1:ghmNdGlVemJI3+ZB5iDEuk4bWA3GkTpW+DOoZMYBVVg= +go.opentelemetry.io/otel/sdk/metric v1.38.0 h1:aSH66iL0aZqo//xXzQLYozmWrXxyFkBJ6qT5wthqPoM= +go.opentelemetry.io/otel/sdk/metric v1.38.0/go.mod h1:dg9PBnW9XdQ1Hd6ZnRz689CbtrUp0wMMs9iPcgT9EZA= +go.opentelemetry.io/otel/trace v1.38.0 h1:Fxk5bKrDZJUH+AMyyIXGcFAPah0oRcT+LuNtJrmcNLE= +go.opentelemetry.io/otel/trace v1.38.0/go.mod h1:j1P9ivuFsTceSWe1oY+EeW3sc+Pp42sO++GHkg4wwhs= +go.opentelemetry.io/proto/otlp v1.8.0 h1:fRAZQDcAFHySxpJ1TwlA1cJ4tvcrw7nXl9xWWC8N5CE= +go.opentelemetry.io/proto/otlp v1.8.0/go.mod h1:tIeYOeNBU4cvmPqpaji1P+KbB4Oloai8wN4rWzRrFF0= go.uber.org/goleak v1.3.0 h1:2K3zAYmnTNqV73imy9J1T3WC+gmCePx2hEGkimedGto= go.uber.org/goleak v1.3.0/go.mod h1:CoHD4mav9JJNrW/WLlf7HGZPjdw8EucARQHekz1X6bE= go.uber.org/multierr v1.11.0 h1:blXXJkSxSSfBVBlC76pxqeO+LN3aDfLQo+309xJstO0= go.uber.org/multierr v1.11.0/go.mod h1:20+QtiLqy0Nd6FdQB9TLXag12DsQkrbs3htMFfDN80Y= go.uber.org/zap v1.27.0 h1:aJMhYGrd5QSmlpLMr2MftRKl7t8J8PTZPA732ud/XR8= go.uber.org/zap v1.27.0/go.mod h1:GB2qFLM7cTU87MWRP2mPIjqfIDnGu+VIO4V/SdhGo2E= -go.yaml.in/yaml/v2 v2.4.2 h1:DzmwEr2rDGHl7lsFgAHxmNz/1NlQ7xLIrlN2h5d1eGI= -go.yaml.in/yaml/v2 v2.4.2/go.mod h1:081UH+NErpNdqlCXm3TtEran0rJZGxAYx9hb/ELlsPU= +go.yaml.in/yaml/v2 v2.4.3 h1:6gvOSjQoTB3vt1l+CU+tSyi/HOjfOjRLJ4YwYZGwRO0= +go.yaml.in/yaml/v2 v2.4.3/go.mod h1:zSxWcmIDjOzPXpjlTTbAsKokqkDNAVtZO0WOMiT90s8= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI= golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56 h1:2dVuKD2vS7b0QIHQbpyTISPd0LeHDbnYEryqj5Q1ug8= -golang.org/x/exp v0.0.0-20240719175910-8a7402abbf56/go.mod h1:M4RDyNAINzryxdtnbRXRL/OHtkFuWGRjvuhBJpk2IlY= +golang.org/x/exp v0.0.0-20250911091902-df9299821621 h1:2id6c1/gto0kaHYyrixvknJ8tUK/Qs5IsmBtrc+FtgU= +golang.org/x/exp v0.0.0-20250911091902-df9299821621/go.mod h1:TwQYMMnGpvZyc+JpB/UAuTNIsVJifOlSkrZkhcvpVUk= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20181114220301-adae6a3d119a/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -302,8 +319,8 @@ golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20201021035429-f5854403a974/go.mod h1:sp8m0HH+o8qH0wwXwYZr8TS3Oi6o0r6Gce1SSxlDquU= golang.org/x/net v0.44.0 h1:evd8IRDyfNBMBTTY5XRF1vaZlD+EmWx6x8PkhR04H/I= golang.org/x/net v0.44.0/go.mod h1:ECOoLqd5U3Lhyeyo/QDCEVQ4sNgYsqvCZ722XogGieY= -golang.org/x/oauth2 v0.30.0 h1:dnDm7JmhM45NNpd8FDDeLhK6FwqbOf4MLCM9zb1BOHI= -golang.org/x/oauth2 v0.30.0/go.mod h1:B++QgG3ZKulg6sRPGD/mqlHQs5rB3Ml9erfeDY7xKlU= +golang.org/x/oauth2 v0.31.0 h1:8Fq0yVZLh4j4YA47vHKFTa9Ew5XIrCP8LC6UeNZnLxo= +golang.org/x/oauth2 v0.31.0/go.mod h1:lzm5WQJQwKZ3nwavOZ3IS5Aulzxi68dUSgRHujetwEA= golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -326,34 +343,36 @@ golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.29.0 h1:1neNs90w9YzJ9BocxfsQNHKuAT4pkghyXc4nhZ6sJvk= golang.org/x/text v0.29.0/go.mod h1:7MhJOA9CD2qZyOKYazxdYMF85OwPdEr9jTtBpO7ydH4= -golang.org/x/time v0.12.0 h1:ScB/8o8olJvc+CQPWrK3fPZNfh7qgwCrY0zJmoEQLSE= -golang.org/x/time v0.12.0/go.mod h1:CDIdPxbZBQxdj6cxyCIdrNogrJKMJ7pr37NYpMcMDSg= +golang.org/x/time v0.13.0 h1:eUlYslOIt32DgYD6utsuUeHs4d7AsEYLuIAdg7FlYgI= +golang.org/x/time v0.13.0/go.mod h1:eL/Oa2bBBK0TkX57Fyni+NgnyQQN4LitPmob2Hjnqw4= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= -golang.org/x/tools v0.36.0 h1:kWS0uv/zsvHEle1LbV5LE8QujrxB3wfQyxHfhOk0Qkg= -golang.org/x/tools v0.36.0/go.mod h1:WBDiHKJK8YgLHlcQPYQzNCkUxUypCaa5ZegCVutKm+s= +golang.org/x/tools v0.37.0 h1:DVSRzp7FwePZW356yEAChSdNcQo6Nsp+fex1SUW09lE= +golang.org/x/tools v0.37.0/go.mod h1:MBN5QPQtLMHVdvsbtarmTNukZDdgwdwlO5qGacAzF0w= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= -gomodules.xyz/jsonpatch/v2 v2.4.0 h1:Ci3iUJyx9UeRx7CeFN8ARgGbkESwJK+KB9lLcWxY/Zw= -gomodules.xyz/jsonpatch/v2 v2.4.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb h1:p31xT4yrYrSM/G4Sn2+TNUkVhFCbG9y8itM2S6Th950= -google.golang.org/genproto/googleapis/api v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:jbe3Bkdp+Dh2IrslsFCklNhweNTBgSYanP1UXhJDhKg= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb h1:TLPQVbx1GJ8VKZxz52VAxl1EBgKXXbTiU9Fc5fZeLn4= -google.golang.org/genproto/googleapis/rpc v0.0.0-20250303144028-a0af3efb3deb/go.mod h1:LuRYeWDFV6WOn90g357N17oMCaxpgCnbi/44qJvDn2I= -google.golang.org/grpc v1.72.1 h1:HR03wO6eyZ7lknl75XlxABNVLLFc2PAb6mHlYh756mA= -google.golang.org/grpc v1.72.1/go.mod h1:wH5Aktxcg25y1I3w7H69nHfXdOG3UiadoBtjh3izSDM= -google.golang.org/protobuf v1.36.8 h1:xHScyCOEuuwZEc6UtSOvPbAT4zRh0xcNRYekJwfqyMc= -google.golang.org/protobuf v1.36.8/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= +gomodules.xyz/jsonpatch/v2 v2.5.0 h1:JELs8RLM12qJGXU4u/TO3V25KW8GreMKl9pdkk14RM0= +gomodules.xyz/jsonpatch/v2 v2.5.0/go.mod h1:AH3dM2RI6uoBZxn3LVrfvJ3E0/9dG4cSrbuBJT4moAY= +gonum.org/v1/gonum v0.16.0 h1:5+ul4Swaf3ESvrOnidPp4GZbzf0mxVQpDCYUQE7OJfk= +gonum.org/v1/gonum v0.16.0/go.mod h1:fef3am4MQ93R2HHpKnLk4/Tbh/s0+wqD5nfa6Pnwy4E= +google.golang.org/genproto/googleapis/api v0.0.0-20250922171735-9219d122eba9 h1:jm6v6kMRpTYKxBRrDkYAitNJegUeO1Mf3Kt80obv0gg= +google.golang.org/genproto/googleapis/api v0.0.0-20250922171735-9219d122eba9/go.mod h1:LmwNphe5Afor5V3R5BppOULHOnt2mCIf+NxMd4XiygE= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250922171735-9219d122eba9 h1:V1jCN2HBa8sySkR5vLcCSqJSTMv093Rw9EJefhQGP7M= +google.golang.org/genproto/googleapis/rpc v0.0.0-20250922171735-9219d122eba9/go.mod h1:HSkG/KdJWusxU1F6CNrwNDjBMgisKxGnc5dAZfT0mjQ= +google.golang.org/grpc v1.75.1 h1:/ODCNEuf9VghjgO3rqLcfg8fiOP0nSluljWFlDxELLI= +google.golang.org/grpc v1.75.1/go.mod h1:JtPAzKiq4v1xcAB2hydNlWI2RnF85XXcV0mhKXr2ecQ= +google.golang.org/protobuf v1.36.9 h1:w2gp2mA27hUeUzj9Ex9FBjsBm40zfaDtEWow293U7Iw= +google.golang.org/protobuf v1.36.9/go.mod h1:fuxRtAxBytpl4zzqUh6/eyUujkJdNiuEkXntxiD/uRU= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= -gopkg.in/evanphx/json-patch.v4 v4.12.0 h1:n6jtcsulIzXPJaxegRbvFNNrZDjbij7ny3gmSPG+6V4= -gopkg.in/evanphx/json-patch.v4 v4.12.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= +gopkg.in/evanphx/json-patch.v4 v4.13.0 h1:czT3CmqEaQ1aanPc5SdlgQrrEIb8w/wwCvWWnfEbYzo= +gopkg.in/evanphx/json-patch.v4 v4.13.0/go.mod h1:p8EYWUEYMpynmqDbY58zCKCFZw8pRWMG4EsWvDvM72M= gopkg.in/inf.v0 v0.9.1 h1:73M5CoZyi3ZLMOyDlQh031Cx6N9NDJ2Vvfl76EDAgDc= gopkg.in/inf.v0 v0.9.1/go.mod h1:cWUDdTG/fYaXco+Dcufb5Vnc6Gp2YChqWtbxRZE0mXw= gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= @@ -363,28 +382,28 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= k8s.io/api v0.34.1 h1:jC+153630BMdlFukegoEL8E/yT7aLyQkIVuwhmwDgJM= k8s.io/api v0.34.1/go.mod h1:SB80FxFtXn5/gwzCoN6QCtPD7Vbu5w2n1S0J5gFfTYk= -k8s.io/apiextensions-apiserver v0.34.0 h1:B3hiB32jV7BcyKcMU5fDaDxk882YrJ1KU+ZSkA9Qxoc= -k8s.io/apiextensions-apiserver v0.34.0/go.mod h1:hLI4GxE1BDBy9adJKxUxCEHBGZtGfIg98Q+JmTD7+g0= +k8s.io/apiextensions-apiserver v0.34.1 h1:NNPBva8FNAPt1iSVwIE0FsdrVriRXMsaWFMqJbII2CI= +k8s.io/apiextensions-apiserver v0.34.1/go.mod h1:hP9Rld3zF5Ay2Of3BeEpLAToP+l4s5UlxiHfqRaRcMc= k8s.io/apimachinery v0.34.1 h1:dTlxFls/eikpJxmAC7MVE8oOeP1zryV7iRyIjB0gky4= k8s.io/apimachinery v0.34.1/go.mod h1:/GwIlEcWuTX9zKIg2mbw0LRFIsXwrfoVxn+ef0X13lw= -k8s.io/apiserver v0.34.0 h1:Z51fw1iGMqN7uJ1kEaynf2Aec1Y774PqU+FVWCFV3Jg= -k8s.io/apiserver v0.34.0/go.mod h1:52ti5YhxAvewmmpVRqlASvaqxt0gKJxvCeW7ZrwgazQ= +k8s.io/apiserver v0.34.1 h1:U3JBGdgANK3dfFcyknWde1G6X1F4bg7PXuvlqt8lITA= +k8s.io/apiserver v0.34.1/go.mod h1:eOOc9nrVqlBI1AFCvVzsob0OxtPZUCPiUJL45JOTBG0= k8s.io/client-go v0.34.1 h1:ZUPJKgXsnKwVwmKKdPfw4tB58+7/Ik3CrjOEhsiZ7mY= k8s.io/client-go v0.34.1/go.mod h1:kA8v0FP+tk6sZA0yKLRG67LWjqufAoSHA2xVGKw9Of8= -k8s.io/component-base v0.34.0 h1:bS8Ua3zlJzapklsB1dZgjEJuJEeHjj8yTu1gxE2zQX8= -k8s.io/component-base v0.34.0/go.mod h1:RSCqUdvIjjrEm81epPcjQ/DS+49fADvGSCkIP3IC6vg= +k8s.io/component-base v0.34.1 h1:v7xFgG+ONhytZNFpIz5/kecwD+sUhVE6HU7qQUiRM4A= +k8s.io/component-base v0.34.1/go.mod h1:mknCpLlTSKHzAQJJnnHVKqjxR7gBeHRv0rPXA7gdtQ0= k8s.io/klog/v2 v2.130.1 h1:n9Xl7H1Xvksem4KFG4PYbdQCQxqc/tTUyrgXaOhHSzk= k8s.io/klog/v2 v2.130.1/go.mod h1:3Jpz1GvMt720eyJH1ckRHK1EDfpxISzJ7I9OYgaDtPE= -k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b h1:MloQ9/bdJyIu9lb1PzujOPolHyvO06MXG5TUIj2mNAA= -k8s.io/kube-openapi v0.0.0-20250710124328-f3f2b991d03b/go.mod h1:UZ2yyWbFTpuhSbFhv24aGNOdoRdJZgsIObGBUaYVsts= -k8s.io/utils v0.0.0-20250604170112-4c0f3b243397 h1:hwvWFiBzdWw1FhfY1FooPn3kzWuJ8tmbZBHi4zVsl1Y= -k8s.io/utils v0.0.0-20250604170112-4c0f3b243397/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2 h1:jpcvIRr3GLoUoEKRkHKSmGjxb6lWwrBlJsXc+eUYQHM= -sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.31.2/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= +k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912 h1:Y3gxNAuB0OBLImH611+UDZcmKS3g6CthxToOb37KgwE= +k8s.io/kube-openapi v0.0.0-20250910181357-589584f1c912/go.mod h1:kdmbQkyfwUagLfXIad1y2TdrjPFWp2Q89B3qkRwf/pQ= +k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d h1:wAhiDyZ4Tdtt7e46e9M5ZSAJ/MnPGPs+Ki1gHw4w1R0= +k8s.io/utils v0.0.0-20250820121507-0af2bda4dd1d/go.mod h1:OLgZIPagt7ERELqWJFomSt595RzquPNLL48iOWgYOg0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0 h1:qPrZsv1cwQiFeieFlRqT627fVZ+tyfou/+S5S0H5ua0= +sigs.k8s.io/apiserver-network-proxy/konnectivity-client v0.33.0/go.mod h1:Ve9uj1L+deCXFrPOk1LpFXqTg7LCFzFso6PA48q/XZw= sigs.k8s.io/controller-runtime v0.22.1 h1:Ah1T7I+0A7ize291nJZdS1CabF/lB4E++WizgV24Eqg= sigs.k8s.io/controller-runtime v0.22.1/go.mod h1:FwiwRjkRPbiN+zp2QRp7wlTCzbUXxZ/D4OzuQUDwBHY= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 h1:gBQPwqORJ8d8/YNZWEjoZs7npUVDpVXUUOFfW6CgAqE= -sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730 h1:IpInykpT6ceI+QxKBbEflcR5EXP7sU1kvOlxwZh5txg= +sigs.k8s.io/json v0.0.0-20250730193827-2d320260d730/go.mod h1:mdzfpAEoE6DHQEN0uh9ZbOCuHbLK5wOm7dK4ctXE9Tg= sigs.k8s.io/randfill v1.0.0 h1:JfjMILfT8A6RbawdsK2JXGBR5AQVfd+9TbzrlneTyrU= sigs.k8s.io/randfill v1.0.0/go.mod h1:XeLlZ/jmk4i1HRopwe7/aU3H5n1zNUcX6TM94b3QxOY= sigs.k8s.io/structured-merge-diff/v6 v6.3.0 h1:jTijUJbW353oVOd9oTlifJqOGEkUw2jB/fXCbTiQEco= From d32ec8eebb23c0b817b922f5e06b5a70fb1cc25d Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 14:25:07 +0200 Subject: [PATCH 22/58] Add description printer column --- decisions/api/v1alpha1/schedulingdecision_types.go | 1 + .../config/crd/bases/decisions.cortex_schedulingdecisions.yaml | 3 +++ decisions/config/crd/decisions.cortex_schedulingdecisions.yaml | 3 +++ .../templates/crd/decisions.cortex_schedulingdecisions.yaml | 3 +++ 4 files changed, 10 insertions(+) diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index 6aaa2344..e3d21546 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -49,6 +49,7 @@ type SchedulingDecisionStatus struct { // +kubebuilder:printcolumn:name="State",type="string",JSONPath=".status.state" // +kubebuilder:printcolumn:name="Error",type="string",JSONPath=".status.error" // +kubebuilder:printcolumn:name="Created",type="date",JSONPath=".metadata.creationTimestamp" +// +kubebuilder:printcolumn:name="Description",type="string",JSONPath=".status.description" // SchedulingDecision is the Schema for the schedulingdecisions API type SchedulingDecision struct { diff --git a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index d815ebdd..7090714c 100644 --- a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -27,6 +27,9 @@ spec: - jsonPath: .metadata.creationTimestamp name: Created type: date + - jsonPath: .status.description + name: Description + type: string name: v1alpha1 schema: openAPIV3Schema: diff --git a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml index d815ebdd..7090714c 100644 --- a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml @@ -27,6 +27,9 @@ spec: - jsonPath: .metadata.creationTimestamp name: Created type: date + - jsonPath: .status.description + name: Description + type: string name: v1alpha1 schema: openAPIV3Schema: diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml index 7d8f6c84..195b43ad 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -33,6 +33,9 @@ spec: - jsonPath: .metadata.creationTimestamp name: Created type: date + - jsonPath: .status.description + name: Description + type: string name: v1alpha1 schema: openAPIV3Schema: From 1c1406c2fff2d803c26b396a8baadf19eb27c97d Mon Sep 17 00:00:00 2001 From: mblos <> Date: Thu, 25 Sep 2025 14:25:31 +0200 Subject: [PATCH 23/58] Update step impact --- decisions/internal/controller/controller.go | 268 +++++++++++++++++- .../internal/controller/controller_test.go | 14 +- 2 files changed, 262 insertions(+), 20 deletions(-) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 494071f0..8a341167 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -65,6 +65,9 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R // Calculate final scores with full pipeline finalScores, deletedHosts := r.calculateScores(res.Spec.Input, res.Spec.Pipeline.Outputs) + // Calculate step-by-step impact for the winner + stepImpacts := r.calculateStepImpacts(res.Spec.Input, res.Spec.Pipeline.Outputs, finalScores) + // Find minimal critical path criticalSteps, criticalStepCount := r.findCriticalSteps(res.Spec.Input, res.Spec.Pipeline.Outputs, finalScores) @@ -72,7 +75,7 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R res.Status.Error = "" // Sort finalScores by score (highest to lowest) and generate enhanced description - orderedScores, description := r.generateOrderedScoresAndDescription(finalScores, res.Spec.Input, criticalSteps, criticalStepCount, len(res.Spec.Pipeline.Outputs)) + orderedScores, description := r.generateOrderedScoresAndDescription(finalScores, res.Spec.Input, criticalSteps, criticalStepCount, len(res.Spec.Pipeline.Outputs), stepImpacts) res.Status.FinalScores = orderedScores res.Status.DeletedHosts = deletedHosts @@ -176,9 +179,112 @@ func (r *SchedulingDecisionReconciler) findCriticalSteps(input map[string]float6 return criticalSteps, len(criticalSteps) } +// StepImpact represents the impact of a single pipeline step on the winning host +type StepImpact struct { + Step string + ScoreBefore float64 + ScoreAfter float64 + ScoreDelta float64 + CompetitorsRemoved int + PromotedToFirst bool +} + +// calculateStepImpacts tracks how each pipeline step affects the final winner +func (r *SchedulingDecisionReconciler) calculateStepImpacts(input map[string]float64, outputs []v1alpha1.SchedulingDecisionPipelineOutputSpec, finalScores map[string]float64) []StepImpact { + if len(finalScores) == 0 || len(outputs) == 0 { + return []StepImpact{} + } + + // Find the final winner + finalWinner := "" + maxScore := float64(-999999) + for host, score := range finalScores { + if score > maxScore { + maxScore = score + finalWinner = host + } + } + + if finalWinner == "" { + return []StepImpact{} + } + + stepImpacts := make([]StepImpact, 0, len(outputs)) + currentScores := make(map[string]float64) + + // Start with input values as initial scores + for hostName, inputValue := range input { + currentScores[hostName] = inputValue + } + + // Track score before first step + scoreBefore := currentScores[finalWinner] + + // Process each pipeline step and track the winner's evolution + for _, output := range outputs { + // Count how many competitors will be removed in this step + competitorsRemoved := 0 + for hostName := range currentScores { + if hostName != finalWinner { + if _, exists := output.Activations[hostName]; !exists { + competitorsRemoved++ + } + } + } + + // Check if winner was #1 before this step + wasFirst := true + winnerScoreBefore := currentScores[finalWinner] + for host, score := range currentScores { + if host != finalWinner && score > winnerScoreBefore { + wasFirst = false + break + } + } + + // Apply activations and remove hosts not in this step + newScores := make(map[string]float64) + for hostName, score := range currentScores { + if activation, exists := output.Activations[hostName]; exists { + newScores[hostName] = score + activation + } + // Hosts not in activations are removed (don't copy to newScores) + } + + // Get winner's score after this step + scoreAfter := newScores[finalWinner] + + // Check if winner became #1 after this step + isFirstAfter := true + for host, score := range newScores { + if host != finalWinner && score > scoreAfter { + isFirstAfter = false + break + } + } + + promotedToFirst := !wasFirst && isFirstAfter + + stepImpacts = append(stepImpacts, StepImpact{ + Step: output.Step, + ScoreBefore: scoreBefore, + ScoreAfter: scoreAfter, + ScoreDelta: scoreAfter - scoreBefore, + CompetitorsRemoved: competitorsRemoved, + PromotedToFirst: promotedToFirst, + }) + + // Update for next iteration + currentScores = newScores + scoreBefore = scoreAfter + } + + return stepImpacts +} + // generateOrderedScoresAndDescription sorts final scores by value (highest to lowest) -// and generates a brief description with highest host, certainty, host count, input comparison, and critical path -func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(finalScores map[string]float64, inputScores map[string]float64, criticalSteps []string, criticalStepCount int, totalSteps int) (map[string]float64, string) { +// and generates a brief description with highest host, certainty, host count, input comparison, step impacts, and critical path +func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(finalScores map[string]float64, inputScores map[string]float64, criticalSteps []string, criticalStepCount int, totalSteps int, stepImpacts []StepImpact) (map[string]float64, string) { totalInputHosts := len(inputScores) if len(finalScores) == 0 { return finalScores, fmt.Sprintf("No hosts remaining after filtering, %d hosts evaluated", totalInputHosts) @@ -232,7 +338,7 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final // Generate main description var description string if len(sortedHosts) == 1 { - description = fmt.Sprintf("Selected: %s (score: %.2f), certainty: perfect, %d hosts evaluated", + description = fmt.Sprintf("Selected: %s (score: %.2f), certainty: perfect, %d hosts evaluated.", sortedHosts[0].host, sortedHosts[0].score, totalInputHosts) } else { // Calculate certainty based on gap between 1st and 2nd place @@ -246,7 +352,7 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final certainty = "low" } - description = fmt.Sprintf("Selected: %s (score: %.2f), certainty: %s (gap: %.2f), %d hosts evaluated", + description = fmt.Sprintf("Selected: %s (score: %.2f), certainty: %s (gap: %.2f), %d hosts evaluated.", sortedHosts[0].host, sortedHosts[0].score, certainty, gap, totalInputHosts) } @@ -254,7 +360,7 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final var comparison string if inputWinner == finalWinner { // Input choice confirmed - comparison = fmt.Sprintf("\nInput choice confirmed: %s (%.2f→%.2f, remained #1).", + comparison = fmt.Sprintf(" Input choice confirmed: %s (%.2f→%.2f, remained #1).", finalWinner, finalWinnerInputScore, sortedHosts[0].score) } else { // Input winner different from final winner @@ -263,7 +369,7 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final // Check if input winner was filtered out _, inputWinnerSurvived := finalScores[inputWinner] if !inputWinnerSurvived { - comparison = fmt.Sprintf("\nInput favored %s (score: %.2f, now filtered), final winner was #%d in input (%.2f→%.2f).", + comparison = fmt.Sprintf(" Input favored %s (score: %.2f, now filtered), final winner was #%d in input (%.2f→%.2f).", inputWinner, inputWinnerScore, finalWinnerInputPosition, finalWinnerInputScore, sortedHosts[0].score) } else { // Find input winner's position in final ranking @@ -274,22 +380,28 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final break } } - comparison = fmt.Sprintf("\nInput favored %s (score: %.2f, now #%d with %.2f), final winner was #%d in input (%.2f→%.2f).", + comparison = fmt.Sprintf(" Input favored %s (score: %.2f, now #%d with %.2f), final winner was #%d in input (%.2f→%.2f).", inputWinner, inputWinnerScore, inputWinnerFinalPosition, finalScores[inputWinner], finalWinnerInputPosition, finalWinnerInputScore, sortedHosts[0].score) } } + // Add step impact analysis for the winner using multi-line format + var stepImpactInfo string + if len(stepImpacts) > 0 { + stepImpactInfo = r.formatStepImpactsMultiLine(stepImpacts) + } + // Add critical path information var criticalPath string if totalSteps > 0 { if criticalStepCount == 0 { - criticalPath = fmt.Sprintf("\nDecision driven by input only (all %d steps are non-critical).", totalSteps) + criticalPath = fmt.Sprintf(" Decision driven by input only (all %d steps are non-critical).", totalSteps) } else if criticalStepCount == totalSteps { - criticalPath = fmt.Sprintf("\nDecision requires all %d pipeline steps.", totalSteps) + criticalPath = fmt.Sprintf(" Decision requires all %d pipeline steps.", totalSteps) } else { if criticalStepCount == 1 { - criticalPath = fmt.Sprintf("\nDecision driven by 1/%d pipeline step: %s.", totalSteps, criticalSteps[0]) + criticalPath = fmt.Sprintf(" Decision driven by 1/%d pipeline step: %s.", totalSteps, criticalSteps[0]) } else { // Join critical steps with commas stepList := "" @@ -302,15 +414,145 @@ func (r *SchedulingDecisionReconciler) generateOrderedScoresAndDescription(final stepList += step + ", " } } - criticalPath = fmt.Sprintf("\nDecision driven by %d/%d pipeline steps: %s.", criticalStepCount, totalSteps, stepList) + criticalPath = fmt.Sprintf(" Decision driven by %d/%d pipeline steps: %s.", criticalStepCount, totalSteps, stepList) } } } - description += comparison + criticalPath + description += comparison + criticalPath + stepImpactInfo return orderedScores, description } +// formatStepImpactsMultiLine formats step impacts in a simple delta-ordered format +// without confusing terminology, ordered by absolute impact magnitude +func (r *SchedulingDecisionReconciler) formatStepImpactsMultiLine(stepImpacts []StepImpact) string { + if len(stepImpacts) == 0 { + return "" + } + + // Create a copy of impacts for sorting + sortedImpacts := make([]StepImpact, len(stepImpacts)) + copy(sortedImpacts, stepImpacts) + + // Sort by absolute delta impact (highest first), with promotions taking priority for ties + sort.Slice(sortedImpacts, func(i, j int) bool { + absI := sortedImpacts[i].ScoreDelta + if absI < 0 { + absI = -absI + } + absJ := sortedImpacts[j].ScoreDelta + if absJ < 0 { + absJ = -absJ + } + + // First priority: higher absolute delta + if absI != absJ { + return absI > absJ + } + + // Tie-breaking: promotions come first + if sortedImpacts[i].PromotedToFirst != sortedImpacts[j].PromotedToFirst { + return sortedImpacts[i].PromotedToFirst + } + + // Final tie-breaking: maintain original pipeline order (use step name for consistency) + return sortedImpacts[i].Step < sortedImpacts[j].Step + }) + + var lines []string + + for _, impact := range sortedImpacts { + var stepDesc string + + if impact.PromotedToFirst { + // Step promoted winner to first place + if impact.ScoreDelta != 0 { + stepDesc = fmt.Sprintf("%s %+.2f→#1", impact.Step, impact.ScoreDelta) + } else { + // Zero delta but promoted (must have removed competitors) + stepDesc = fmt.Sprintf("%s +0.00→#1", impact.Step) + } + } else if impact.ScoreDelta != 0 { + // Step changed winner's score but didn't promote to #1 + stepDesc = fmt.Sprintf("%s %+.2f", impact.Step, impact.ScoreDelta) + } else if impact.CompetitorsRemoved > 0 { + // Step removed competitors but didn't change winner's score or promote + stepDesc = fmt.Sprintf("%s +0.00 (removed %d)", impact.Step, impact.CompetitorsRemoved) + } else { + // Step had no measurable impact + stepDesc = fmt.Sprintf("%s +0.00", impact.Step) + } + + lines = append(lines, fmt.Sprintf("• %s", stepDesc)) + } + + if len(lines) == 0 { + return "" + } + + // Join with newlines and add initial label + return fmt.Sprintf(" Step impacts:\n%s", joinLines(lines)) +} + +// joinStepList joins step descriptions with appropriate separators +func joinStepList(steps []string) string { + if len(steps) == 0 { + return "" + } + if len(steps) == 1 { + return steps[0] + } + if len(steps) == 2 { + return steps[0] + ", " + steps[1] + } + + result := "" + for i, step := range steps { + if i < len(steps)-1 { + result += step + ", " + } else { + result += step + } + } + return result +} + +// joinLines joins multiple lines with newlines and proper indentation +func joinLines(lines []string) string { + result := "" + for i, line := range lines { + if i < len(lines)-1 { + result += line + "\n" + } else { + result += line + } + } + return result + "." +} + +// joinImpacts joins step impact descriptions with appropriate separators (kept for compatibility) +func joinImpacts(impacts []string) string { + if len(impacts) == 0 { + return "" + } + if len(impacts) == 1 { + return impacts[0] + } + if len(impacts) == 2 { + return impacts[0] + ", " + impacts[1] + } + + result := "" + for i, impact := range impacts { + if i == len(impacts)-1 { + result += impact + } else { + result += impact + ", " + } + } + return result +} + // SetupWithManager sets up the controller with the Manager. func (r *SchedulingDecisionReconciler) SetupWithManager(mgr ctrl.Manager) error { return ctrl.NewControllerManagedBy(mgr). diff --git a/decisions/internal/controller/controller_test.go b/decisions/internal/controller/controller_test.go index 967b8088..7f2c579b 100644 --- a/decisions/internal/controller/controller_test.go +++ b/decisions/internal/controller/controller_test.go @@ -83,7 +83,7 @@ func TestReconcile(t *testing.T) { if updatedResource.Status.Error != "" { t.Errorf("Expected empty error, got '%s'", updatedResource.Status.Error) } - expectedDescription := "Selected: host1 (score: 1.50), certainty: perfect, 2 hosts evaluated\nInput favored host2 (score: 2.00, now filtered), final winner was #2 in input (1.00→1.50).\nDecision driven by 1/2 pipeline step: filter." + expectedDescription := "Selected: host1 (score: 1.50), certainty: perfect, 2 hosts evaluated. Input favored host2 (score: 2.00, now filtered), final winner was #2 in input (1.00→1.50). Decision driven by 1/2 pipeline step: filter. Step impacts:\n• weigher +0.50\n• filter +0.00→#1." if updatedResource.Status.Description != expectedDescription { t.Errorf("Expected description '%s', got '%s'", expectedDescription, updatedResource.Status.Description) } @@ -852,28 +852,28 @@ func TestReconcileCriticalStepElimination(t *testing.T) { name: "multiple-critical-steps", input: map[string]float64{ "host1": 1.0, - "host2": 2.0, // Would win without pipeline - "host3": 1.5, + "host2": 3.0, // Strong initial winner + "host3": 2.0, }, pipeline: []v1alpha1.SchedulingDecisionPipelineOutputSpec{ { Step: "critical-weigher1", Activations: map[string]float64{ - "host1": 1.5, // Gives host1 strong boost to overtake host2 - "host2": 0.0, + "host1": 1.0, // host1: 2.0, host2: 2.5, host3: 2.5 (ties host2 and host3) + "host2": -0.5, "host3": 0.5, }, }, { Step: "critical-weigher2", Activations: map[string]float64{ - "host1": 0.1, // Further secures host1's lead + "host1": 1.0, // host1: 3.0, host2: 2.5, host3: 2.5 (host1 becomes winner) "host2": 0.0, "host3": 0.0, }, }, }, - expectedCriticalMessage: "Decision driven by 1/2 pipeline step: critical-weigher1.", + expectedCriticalMessage: "Decision requires all 2 pipeline steps.", }, { name: "all-non-critical", From 2cffc96be394a5318a20625bb74ccfb90967cf9f Mon Sep 17 00:00:00 2001 From: Philipp Matthes Date: Thu, 25 Sep 2025 14:36:56 +0200 Subject: [PATCH 24/58] Don't reconcile in terminal states --- decisions/internal/controller/controller.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 8a341167..487057b0 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -43,6 +43,11 @@ func (r *SchedulingDecisionReconciler) Reconcile(ctx context.Context, req ctrl.R return ctrl.Result{}, err } + // If the decision is already resolved or in error state, do nothing. + if res.Status.State == v1alpha1.SchedulingDecisionStateResolved || res.Status.State == v1alpha1.SchedulingDecisionStateError { + return ctrl.Result{}, nil + } + // Validate that there is at least one host in the input if len(res.Spec.Input) == 0 { res.Status.State = v1alpha1.SchedulingDecisionStateError From 884381f8bdf5f5d2b31d8cec793a95bfd0e3b5a0 Mon Sep 17 00:00:00 2001 From: Markus Wieland Date: Thu, 25 Sep 2025 14:37:14 +0200 Subject: [PATCH 25/58] Add scheduling decisions endpoint to cortex nova scheduler --- internal/scheduler/nova/api/http/api.go | 73 +++++++++++++++++++++++++ 1 file changed, 73 insertions(+) diff --git a/internal/scheduler/nova/api/http/api.go b/internal/scheduler/nova/api/http/api.go index 14b5b027..5f160b15 100644 --- a/internal/scheduler/nova/api/http/api.go +++ b/internal/scheduler/nova/api/http/api.go @@ -15,6 +15,7 @@ import ( "strings" "time" + "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" "github.com/cobaltcore-dev/cortex/internal/conf" "github.com/cobaltcore-dev/cortex/internal/db" "github.com/cobaltcore-dev/cortex/internal/monitoring" @@ -26,6 +27,9 @@ import ( "github.com/majewsky/gg/option" "github.com/sapcc/go-api-declarations/liquid" "github.com/sapcc/go-bits/jobloop" + "sigs.k8s.io/controller-runtime/pkg/client" + + ctrl "sigs.k8s.io/controller-runtime" ) type HTTPAPI interface { @@ -40,6 +44,9 @@ type httpAPI struct { // Database connection to load specific objects during the scheduling process. DB db.DB + + // Kubernetes client + Client client.Client } func NewAPI(config conf.SchedulerConfig, registry *monitoring.Registry, db db.DB, mqttClient mqtt.Client) HTTPAPI { @@ -53,11 +60,26 @@ func NewAPI(config conf.SchedulerConfig, registry *monitoring.Registry, db db.DB pipelineConf, db, monitor.SubPipeline("nova-"+pipelineConf.Name), mqttClient, ) } + + scheme, err := v1alpha1.SchemeBuilder.Build() + if err != nil { + panic(err) + } + clientConfig, err := ctrl.GetConfig() + if err != nil { + panic(err) + } + cl, err := client.New(clientConfig, client.Options{Scheme: scheme}) + if err != nil { + panic(err) + } + return &httpAPI{ pipelines: pipelines, config: config, monitor: scheduler.NewSchedulerMonitor(registry), DB: db, + Client: cl, // TODO } } @@ -69,6 +91,7 @@ func (httpAPI *httpAPI) Init(mux *http.ServeMux) { } mux.HandleFunc("/scheduler/nova/external", httpAPI.NovaExternalScheduler) mux.HandleFunc("/scheduler/nova/commitments/change", httpAPI.HandleCommitmentChangeRequest) + mux.HandleFunc("/scheduler/nova/scheduling-decisions", httpAPI.HandleListSchedulingDecisions) } // Check if the scheduler can run based on the request data. @@ -408,3 +431,53 @@ func (httpAPI *httpAPI) HandleCommitmentChangeRequest(w http.ResponseWriter, r * } callback.Respond(http.StatusOK, nil, "") } + +// List all scheduling decisions. +func (httpAPI *httpAPI) HandleListSchedulingDecisions(w http.ResponseWriter, r *http.Request) { + callback := httpAPI.monitor.Callback(w, r, "/scheduler/nova/scheduling-decisions") + + // Exit early if the request method is not GET. + if r.Method != http.MethodGet { + internalErr := fmt.Errorf("invalid request method: %s", r.Method) + callback.Respond(http.StatusMethodNotAllowed, internalErr, "invalid request method") + return + } + + // Check if a specific vm id is requested. + vmID := r.URL.Query().Get("vm_id") + + // If no specific vm id is requested, list all scheduling decisions. + if vmID == "" { + var decisions v1alpha1.SchedulingDecisionList + if err := httpAPI.Client.List(r.Context(), &decisions); err != nil { + callback.Respond(http.StatusInternalServerError, err, "failed to list scheduling decisions") + return + } + + w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(decisions); err != nil { + callback.Respond(http.StatusInternalServerError, err, "failed to encode response") + return + } + return + } + + var decision v1alpha1.SchedulingDecision + nn := client.ObjectKey{Name: vmID} + if err := httpAPI.Client.Get(r.Context(), nn, &decision); err != nil { + if client.IgnoreNotFound(err) != nil { + callback.Respond(http.StatusInternalServerError, err, "failed to get scheduling decision") + return + } + // Not found + callback.Respond(http.StatusNotFound, err, "scheduling decision not found") + return + } + + w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(decision); err != nil { + callback.Respond(http.StatusInternalServerError, err, "failed to encode response") + return + } + callback.Respond(http.StatusOK, nil, "Success") +} From bb411c9d6db701bccdb672f897e8b8f2de1d78e4 Mon Sep 17 00:00:00 2001 From: mblos <> Date: Fri, 26 Sep 2025 08:57:19 +0200 Subject: [PATCH 26/58] Fix reconcile loop --- decisions/internal/controller/controller.go | 2 ++ 1 file changed, 2 insertions(+) diff --git a/decisions/internal/controller/controller.go b/decisions/internal/controller/controller.go index 487057b0..2efe587f 100644 --- a/decisions/internal/controller/controller.go +++ b/decisions/internal/controller/controller.go @@ -13,6 +13,7 @@ import ( "sigs.k8s.io/controller-runtime/pkg/client" "sigs.k8s.io/controller-runtime/pkg/controller" logf "sigs.k8s.io/controller-runtime/pkg/log" + "sigs.k8s.io/controller-runtime/pkg/predicate" "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" decisionsv1alpha1 "github.com/cobaltcore-dev/cortex/decisions/api/v1alpha1" @@ -566,5 +567,6 @@ func (r *SchedulingDecisionReconciler) SetupWithManager(mgr ctrl.Manager) error WithOptions(controller.Options{ MaxConcurrentReconciles: 1, // Default }). + WithEventFilter(predicate.GenerationChangedPredicate{}). Complete(r) } From abbc95c0114b4f2c82e439c429bb830ce0c171af Mon Sep 17 00:00:00 2001 From: Markus Wieland Date: Fri, 26 Sep 2025 09:00:33 +0200 Subject: [PATCH 27/58] Enhance scheduling decision functionality with new Flavor type and update CRDs --- .../api/v1alpha1/schedulingdecision_types.go | 15 +- .../api/v1alpha1/zz_generated.deepcopy.go | 16 + .../decisions.cortex_schedulingdecisions.yaml | 25 ++ .../decisions.cortex_schedulingdecisions.yaml | 25 ++ .../decisions.cortex_schedulingdecisions.yaml | 25 ++ internal/scheduler/nova/api/http/api.go | 13 +- internal/scheduler/pipeline.go | 18 +- visualizer/Dockerfile | 2 + visualizer/favicon.ico | Bin 0 -> 15406 bytes visualizer/manila.html | 337 +++++++++--------- visualizer/nova.html | 42 ++- visualizer/scheduling-decisions.html | 239 +++++++++++++ 12 files changed, 580 insertions(+), 177 deletions(-) create mode 100644 visualizer/favicon.ico create mode 100644 visualizer/scheduling-decisions.html diff --git a/decisions/api/v1alpha1/schedulingdecision_types.go b/decisions/api/v1alpha1/schedulingdecision_types.go index e3d21546..9c08b819 100644 --- a/decisions/api/v1alpha1/schedulingdecision_types.go +++ b/decisions/api/v1alpha1/schedulingdecision_types.go @@ -18,9 +18,22 @@ type SchedulingDecisionPipelineSpec struct { Outputs []SchedulingDecisionPipelineOutputSpec `json:"outputs,omitempty"` } +type Flavor struct { + Name string `json:"name"` + VCPUs int `json:"vcpus"` + RAM int `json:"memory_mb"` + Disk int `json:"disk"` +} + // SchedulingDecisionSpec defines the desired state of SchedulingDecision. type SchedulingDecisionSpec struct { - Input map[string]float64 `json:"input,omitempty"` + Input map[string]float64 `json:"input,omitempty"` + AvailabilityZone string `json:"availbility_zone,omitempty"` + VMware bool `json:"vmware,omitempty"` + Live bool `json:"live,omitempty"` + Resize bool `json:"resize,omitempty"` + Flavor Flavor `json:"flavor"` + Pipeline SchedulingDecisionPipelineSpec `json:"pipeline"` } diff --git a/decisions/api/v1alpha1/zz_generated.deepcopy.go b/decisions/api/v1alpha1/zz_generated.deepcopy.go index e846dcb0..c7f73fd4 100644 --- a/decisions/api/v1alpha1/zz_generated.deepcopy.go +++ b/decisions/api/v1alpha1/zz_generated.deepcopy.go @@ -11,6 +11,21 @@ import ( runtime "k8s.io/apimachinery/pkg/runtime" ) +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Flavor) DeepCopyInto(out *Flavor) { + *out = *in +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Flavor. +func (in *Flavor) DeepCopy() *Flavor { + if in == nil { + return nil + } + out := new(Flavor) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *SchedulingDecision) DeepCopyInto(out *SchedulingDecision) { *out = *in @@ -124,6 +139,7 @@ func (in *SchedulingDecisionSpec) DeepCopyInto(out *SchedulingDecisionSpec) { (*out)[key] = val } } + out.Flavor = in.Flavor in.Pipeline.DeepCopyInto(&out.Pipeline) } diff --git a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml index 7090714c..7e1b876d 100644 --- a/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/bases/decisions.cortex_schedulingdecisions.yaml @@ -56,10 +56,30 @@ spec: spec: description: spec defines the desired state of SchedulingDecision properties: + availbility_zone: + type: string + flavor: + properties: + disk: + type: integer + memory_mb: + type: integer + name: + type: string + vcpus: + type: integer + required: + - disk + - memory_mb + - name + - vcpus + type: object input: additionalProperties: type: number type: object + live: + type: boolean pipeline: properties: name: @@ -82,7 +102,12 @@ spec: required: - name type: object + resize: + type: boolean + vmware: + type: boolean required: + - flavor - pipeline type: object status: diff --git a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml index 7090714c..7e1b876d 100644 --- a/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/config/crd/decisions.cortex_schedulingdecisions.yaml @@ -56,10 +56,30 @@ spec: spec: description: spec defines the desired state of SchedulingDecision properties: + availbility_zone: + type: string + flavor: + properties: + disk: + type: integer + memory_mb: + type: integer + name: + type: string + vcpus: + type: integer + required: + - disk + - memory_mb + - name + - vcpus + type: object input: additionalProperties: type: number type: object + live: + type: boolean pipeline: properties: name: @@ -82,7 +102,12 @@ spec: required: - name type: object + resize: + type: boolean + vmware: + type: boolean required: + - flavor - pipeline type: object status: diff --git a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml index 195b43ad..7b6cc994 100644 --- a/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml +++ b/decisions/dist/chart/templates/crd/decisions.cortex_schedulingdecisions.yaml @@ -62,10 +62,30 @@ spec: spec: description: spec defines the desired state of SchedulingDecision properties: + availbility_zone: + type: string + flavor: + properties: + disk: + type: integer + memory_mb: + type: integer + name: + type: string + vcpus: + type: integer + required: + - disk + - memory_mb + - name + - vcpus + type: object input: additionalProperties: type: number type: object + live: + type: boolean pipeline: properties: name: @@ -88,7 +108,12 @@ spec: required: - name type: object + resize: + type: boolean + vmware: + type: boolean required: + - flavor - pipeline type: object status: diff --git a/internal/scheduler/nova/api/http/api.go b/internal/scheduler/nova/api/http/api.go index 5f160b15..14986bdb 100644 --- a/internal/scheduler/nova/api/http/api.go +++ b/internal/scheduler/nova/api/http/api.go @@ -434,6 +434,16 @@ func (httpAPI *httpAPI) HandleCommitmentChangeRequest(w http.ResponseWriter, r * // List all scheduling decisions. func (httpAPI *httpAPI) HandleListSchedulingDecisions(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "http://localhost:4000") + w.Header().Set("Access-Control-Allow-Methods", "GET, POST, OPTIONS") + w.Header().Set("Access-Control-Allow-Headers", "Content-Type") + + // Handle preflight OPTIONS request + if r.Method == http.MethodOptions { + w.WriteHeader(http.StatusOK) + return + } + callback := httpAPI.monitor.Callback(w, r, "/scheduler/nova/scheduling-decisions") // Exit early if the request method is not GET. @@ -453,8 +463,8 @@ func (httpAPI *httpAPI) HandleListSchedulingDecisions(w http.ResponseWriter, r * callback.Respond(http.StatusInternalServerError, err, "failed to list scheduling decisions") return } - w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(decisions); err != nil { callback.Respond(http.StatusInternalServerError, err, "failed to encode response") return @@ -475,6 +485,7 @@ func (httpAPI *httpAPI) HandleListSchedulingDecisions(w http.ResponseWriter, r * } w.Header().Set("Content-Type", "application/json") + if err := json.NewEncoder(w).Encode(decision); err != nil { callback.Respond(http.StatusInternalServerError, err, "failed to encode response") return diff --git a/internal/scheduler/pipeline.go b/internal/scheduler/pipeline.go index cffee1e2..7dd4f7d5 100644 --- a/internal/scheduler/pipeline.go +++ b/internal/scheduler/pipeline.go @@ -283,10 +283,26 @@ func (p *pipeline[RequestType]) Run(request RequestType) ([]string, error) { Activations: activations, }) } + + // Need to check if nova request -> circular dependency + // Move to nova pipeline? + // -> Missing data + // omit? + decision := &v1alpha1.SchedulingDecision{ ObjectMeta: ctrl.ObjectMeta{Name: request.GetResourceID()}, Spec: v1alpha1.SchedulingDecisionSpec{ - Input: inWeights, + Input: inWeights, + AvailabilityZone: "TODO", + Flavor: v1alpha1.Flavor{ + Name: "TODO", + VCPUs: 0, + RAM: 0, + Disk: 0, + }, + VMware: false, + Live: false, + Resize: false, Pipeline: v1alpha1.SchedulingDecisionPipelineSpec{ Name: request.GetPipeline(), Outputs: outputs, diff --git a/visualizer/Dockerfile b/visualizer/Dockerfile index 5ab7a8ee..ab76e720 100644 --- a/visualizer/Dockerfile +++ b/visualizer/Dockerfile @@ -4,5 +4,7 @@ FROM nginx COPY vendor/mqtt.min.js /usr/share/nginx/html/mqtt.min.js COPY nova.html /usr/share/nginx/html/nova.html +COPY scheduling-decisions.html /usr/share/nginx/html/scheduling-decisions.html COPY manila.html /usr/share/nginx/html/manila.html COPY shared.css /usr/share/nginx/html/shared.css +COPY favicon.ico /usr/share/nginx/html/favicon.ico diff --git a/visualizer/favicon.ico b/visualizer/favicon.ico new file mode 100644 index 0000000000000000000000000000000000000000..b4f9d5fb8c202c1528e8458073ffeffdb530c143 GIT binary patch literal 15406 zcmeI21&~xn6UP^KcR%by3kgo}0)l&RmjVi>un^o`f kfyMDL@cXti${k>o3 zo2z$wyLar}?g2%n>g{{`-bhbRPxrsO$KeR)h~S7D*J0iL9Bm>x9Qhp%ho9d+|1-yP zIA&Y#a^?E}_y0H?|4rm@WVY&9O{^CGyti&Hi- i2M->UBS((t_ #M&mf^#P%g~`i<)@#1(tb{!Jn3K0)dRd5 zJb17?d-hB})1K?psZ&DRUcGt=JaSiR*RCyN$Bqru9$J`3xpL*CUAuPfnoHZZZIwU8 zix-!L3m59xbLY;L>eZ{u*|TTm!Gj0Ewx{#kw{I(*)2C0D(W6I8-@bjNVZ(;ne{kbN zf77N-<^1{cI+szSMyU)OKYm=`Pf+a{W81cEa{c;sog=(M4*T`%r#!iL@187Lw8-uJ znPZCiS>a!P``eCY1y)+@*O$azI}U8O#*#; z^X84LUcFlP!@GCy0)4l=cw~F_^zorfrQpF!^o*Z%m9Q@Kle=OOw$)SOyjb78((&RT zA?=F&a`oy}ZT|T2V>xr?j6UDJdsmP>zQ20)O7FC-q>u%n>sj~X_-+#-a zN1ltq?%lhE{a(3pWtH241q(`(CQW4Ez=66C(V_YC=T|zaRjVdfu3V7;0|sdQ@4ov^ zX3m_cdbw=bvi@{?!Uyy^Ivt(+`|rQ&UPa#X <$ zI>Wj=dGbV%v7SA9O8@@-)gFX|$DY!S{9*T!Cr>W1W5`9Xm?r&YdMnlqixZQznn_ zfTv^c+O rYW9?88fDoFJE3Ufv5eutAFj eLb|RxIUTu3Wi-#5OKFw_Y+nZPEM4)QJ-(0#tQ3{?@HqRZh~T zO{ )!DCvoG(mFCTxD;;M1i4!ME=FFL8)v8rOea1&G;ZvYDLp#2i zG`N@b$d@l)fbsdm-bCKmBj{;+@z(h80b7Gz$8W;sp!>iD%a<<~bYiJer6f+AIEtsi znd}2^jnACG$>8jC>C&l8Llf(fEn7C})Txv5AD;+1vS-gO_#L4gpZTFnx^?R&DO09Y z`}+L(bHzO98e|>0Krfs1KX&Yx;_LnU_lJ6X>^yTpw}Np@LFX}^-R_w2Ou`o&Wv& z_tkI2ceWSC$M#UrHTY7gQl$!{Cy|q&d>eb8_Gj=Hyxna1-L8rmAD@Q3$@=35+RGn* z{2};f_}-ot ~Rv-*x#)k(}rc4RY{o%uhr9_DmDi_Xt3sCU`{(zlo z)~qSfqD7PMzyDr&O*8xWJX64Cty{NN`^TOC-YQ_q9654GiWDg{?t%Sh?p$E)apT76 ze3>`%_eH_3fi TiwM4zLfXGNvsg9qp5WT6DR3rt<#f_xK<$@`mxop>t{;4nKN_vA_|xe zJOS=9x{W*kP5hZUU@+_f-*|6-HtncGUtH87R>egz?Mz*7Fc%t#hY%+Q{}PiyM`J7b z4_4(n@iS}(J`Hg!unRZ~oPu33cm@1HUtGN3yLYdQ88b$CK`w!Kmow%G%{=g*iD^xm zG)a~%Tc$B*Vqa;}q)}fIybl%y3xK)sO?&j{A$981QT~%-03R6p4=yLh3`WB*0>73n zU0OD7+^86x__rOuhK6?9!cY896SG84;8E7BS#`ZxdvF7I4f=~)F+4CPem-mGihg{5 z>XWCTzge?psULtZX2;{9rJeTVQoj1?EA1D0kYBJxmMmG6PsnkC1PK%aK|k?6Xit(P ziN-ix(a(AkgJcb$fAQkQI`_PJ^L|jy$&-1J$0}O1sM3WDk@vtahUSqYM@swl?IlBo z44Mmp{_fqoD}KU%A|Hah^UR&NA@e3TL|=0(jLW|H=9_OczF4thMUA_`CvO$_gTGO- zWJ!TP_}uvN aN)wK zu4S(q8x|J4{LnFw74o>mk0L~fpn8+I3i(Xv$Jgf~evBO oxZjK74q! zS;R-kzcUv@KRT6|8~NRY2@~pi5EB9`7~B(<^MT*UHF^-c3r!t5bWnPb@rzcj(3yVT zfeBa-bS7~R;!4;G;%eyVuqfav;(o|@#E20!22GwHn{0|Z`ptK8pV$Rti9XV&Pp|T4 z@59vf)*YOTjR&(K$Jkr)c<3AF5)}P*K9h3+Yk=+8H-!rq)^#OD=I!#=Uw>)Nl6Vf- z?b4-7Zifhpey}XDaQI;gSQ`ui9w9%$`i3MoZTfS*6K@0WfP (LpU`|))D8ef3;Grli4lsGBt0mk(u z{rD{C4`=|tGbX%5mvfH6oOQGFpR)txj<8)|Ap9-bnD{xm20z;5*L+RC+1tc*p#j>- zL)!DHcKXpH_$lam>@fZTzKo&Y^k?p2ML*-A3puw!?w$*qOtI6?e{3@OcFy`?ufcQZ zNLR8Kmh>Y_U}Z25SQ%Yt&hjB!U?b`fLxFziHGU`hjCDhY;**ijW=+GAet2sNa!l@+ zvpY$XCe>Uu_5zu&RH>5W%$ZYtWv~YFPizI<$vFh_9_SzPS|5XcXu>yUpK|sRAJ$+Q z&O@Rf$-Sbph#NsaJjbpOXUUi`qv9#f&ia~u 4#3%o7^RKf5eCp8cQ*>aEFiRO3tS^`@F8`x3~2*{n$)=4t$S7 zg$e~ae`2Q}U&RzK6aF!0#L@rAnybRu1YhAFd~*tZBeb9^T@}NB=trlrPl*+>CSZJG zop$_e?*skHxomWow+iFqU!c?R6Aeyq*T0>9 `o^!Svx|ox5A;!u%c=Qu{!CCH{ z>wEGayMwQV9%RpQCx*Z{=p*N1r=K;zHZu?B!aU#wXN{ - - Cortex Manila Visualizer - - - - - - - - - - - -- - - - -Waiting for mqtt data to arrive...-- - - - - - + + ++ + + + +Waiting for mqtt data to arrive...++ + + + + + -