Skip to content

Latest commit

 

History

History
525 lines (281 loc) · 20.2 KB

File metadata and controls

525 lines (281 loc) · 20.2 KB

API Reference

Packages

pacto.trianalab.io/v1alpha1

Package v1alpha1 contains API Schema definitions for the pacto v1alpha1 API group.

Resource Types

CheckSummary

CheckSummary provides precomputed check counts.

Appears in:

Field Description Default Validation
total integer Total is the number of checks performed.
passed integer Passed is the number of checks that passed.
failed integer Failed is the number of checks that failed.

ConfigurationInfo

ConfigurationInfo describes the contract's configuration section.

Appears in:

Field Description Default Validation
hasSchema boolean HasSchema indicates whether a JSON Schema file is bundled.
ref string Ref is the external OCI reference for the configuration schema, if used. Optional: {}
valueKeys string array ValueKeys lists the declared configuration value keys. Optional: {}
secretKeys string array SecretKeys lists configuration keys whose values reference secrets. Optional: {}

ContractInfo

ContractInfo exposes parsed contract metadata.

Appears in:

Field Description Default Validation
serviceName string ServiceName is the service name declared in the contract.
version string Version is the semver version from the contract.
owner string Owner is the team/individual owning this service. Optional: {}
imageRef string ImageRef is the container image reference from the contract. Optional: {}
resolvedRef string ResolvedRef is the fully-resolved OCI reference (with tag/digest).
Empty for inline contracts.
Optional: {}

ContractRef

ContractRef specifies where to find the Pacto contract.

Appears in:

Field Description Default Validation
oci string OCI is the OCI registry reference for the contract bundle (without tag).
The operator automatically resolves the latest semver tag from the registry.
Example: ghcr.io/org/service-pacto
Optional: {}
inline string Inline allows specifying the contract YAML directly (for testing/dev). Optional: {}

DependencyInfo

DependencyInfo describes a declared dependency.

Appears in:

Field Description Default Validation
ref string Ref is the dependency reference (OCI URI).
required boolean Required indicates whether this dependency is mandatory.
compatibility string Compatibility is the semver constraint for the dependency. Optional: {}

EndpointCheckResult

EndpointCheckResult describes the result of probing a single HTTP endpoint.

Appears in:

Field Description Default Validation
url string URL is the fully-constructed endpoint URL that was probed.
reachable boolean Reachable indicates whether the HTTP request completed (no connection error).
statusCode integer StatusCode is the HTTP status code returned. Zero if unreachable. Optional: {}
latencyMs integer LatencyMs is the request round-trip time in milliseconds. Optional: {}
error string Error is the error message if the probe failed. Empty on success. Optional: {}

EndpointsStatus

EndpointsStatus describes the runtime probe results for declared endpoints.

Appears in:

Field Description Default Validation
health EndpointCheckResult Health describes the result of probing the declared health endpoint. Optional: {}
metrics EndpointCheckResult Metrics describes the result of probing the declared metrics endpoint. Optional: {}

InterfaceInfo

InterfaceInfo describes a single interface declared in the contract.

Appears in:

Field Description Default Validation
name string Name is the interface name.
type string Type is the interface type: http, grpc, or event. Enum: [http grpc event]
port integer Port is the declared port number. Optional: {}
visibility string Visibility is the declared visibility: public or internal. Optional: {}
hasContractFile boolean HasContractFile indicates whether a contract file (OpenAPI, protobuf, AsyncAPI)
is present in the bundle for this interface.

ObservedRuntime

ObservedRuntime describes the actual runtime state observed from the cluster. This complements RuntimeInfo (contract-declared) to enable contract-vs-runtime comparison.

Appears in:

Field Description Default Validation
workloadKind string WorkloadKind is the actual Kubernetes resource kind (Deployment, StatefulSet, Job, CronJob). Optional: {}
deploymentStrategy string DeploymentStrategy is the observed strategy (RollingUpdate, Recreate). Empty for non-Deployments. Optional: {}
podManagementPolicy string PodManagementPolicy is the observed pod management policy (OrderedReady, Parallel). Empty for non-StatefulSets. Optional: {}
terminationGracePeriodSeconds integer TerminationGracePeriodSeconds is the observed terminationGracePeriodSeconds from the pod spec. Optional: {}
containerImages string array ContainerImages lists the container images from the pod spec. Optional: {}
hasPVC boolean HasPVC indicates whether the workload uses PersistentVolumeClaims.
hasEmptyDir boolean HasEmptyDir indicates whether the workload uses emptyDir volumes.
healthProbeInitialDelaySeconds integer HealthProbeInitialDelaySeconds is the observed initialDelaySeconds from the first container's probe. Optional: {}

Pacto

Pacto is the Schema for the pactos API.

Field Description Default Validation
apiVersion string pacto.trianalab.io/v1alpha1
kind string Pacto
metadata ObjectMeta Refer to Kubernetes API documentation for fields of metadata. Optional: {}
spec PactoSpec spec defines the desired state of Pacto. Required: {}
status PactoStatus status defines the observed state of Pacto. Optional: {}

PactoRevision

PactoRevision is the Schema for the pactorevisions API. It represents an immutable snapshot of a resolved contract version.

Field Description Default Validation
apiVersion string pacto.trianalab.io/v1alpha1
kind string PactoRevision
metadata ObjectMeta Refer to Kubernetes API documentation for fields of metadata. Optional: {}
spec PactoRevisionSpec spec defines the desired state of PactoRevision. Required: {}
status PactoRevisionStatus status defines the observed state of PactoRevision. Optional: {}

PactoRevisionSpec

PactoRevisionSpec defines the desired state of PactoRevision. A PactoRevision is an immutable snapshot of a resolved contract version.

Appears in:

Field Description Default Validation
version string Version is the contract version (from contract.service.version). MinLength: 1
source RevisionSource Source specifies where this revision's contract was loaded from. Required: {}
pactoRef string PactoRef is the name of the parent Pacto resource that owns this revision. MinLength: 1
serviceName string ServiceName is the service name from the contract. Optional: {}

PactoRevisionStatus

PactoRevisionStatus defines the observed state of PactoRevision.

Appears in:

Field Description Default Validation
resolved boolean Resolved indicates whether this revision has been successfully resolved and parsed.
contractHash string ContractHash is the SHA-256 hash of the raw contract YAML.
Used to detect content changes across versions.
Optional: {}
createdAt Time CreatedAt is the timestamp when this revision was first resolved. Optional: {}
conditions Condition array conditions represent the current state of the PactoRevision resource. Optional: {}

PactoSpec

PactoSpec defines the desired state of Pacto.

Appears in:

Field Description Default Validation
contractRef ContractRef ContractRef specifies where to find the Pacto contract. Required: {}
target TargetRef Target specifies which Kubernetes resources to observe.
When omitted, the Pacto acts as a reference-only contract (no runtime validation).
Optional: {}
checkIntervalSeconds integer CheckIntervalSeconds controls how often the reconciler re-checks compliance.
Defaults to 300 (5 minutes).
300 Minimum: 30
Optional: {}

PactoStatus

PactoStatus defines the observed state of Pacto. All contract data is exposed as structured fields so external consumers can read the CR status directly without parsing contracts themselves.

Appears in:

Field Description Default Validation
phase string Phase is the high-level compliance state. Enum: [Healthy Degraded Invalid Reference Unknown]
Optional: {}
summary CheckSummary Summary provides precomputed check counts. Optional: {}
contractVersion string ContractVersion is the version from the parsed contract.
Kept for backward compatibility and simple access via JSONPath.
Optional: {}
contract ContractInfo Contract exposes parsed contract metadata. Optional: {}
validation ValidationResult Validation describes the structural validation outcome of the contract. Optional: {}
resources ResourcesStatus Resources describes the existence of target Kubernetes resources. Optional: {}
ports PortStatus Ports describes the port comparison between contract and runtime. Optional: {}
endpoints EndpointsStatus Endpoints describes the runtime probe results for declared health and metrics endpoints.
Only populated when the service exists and the contract declares health/metrics.
Optional: {}
interfaces InterfaceInfo array Interfaces lists the parsed interfaces from the contract. Optional: {}
configuration ConfigurationInfo Configuration describes the contract's configuration section. Optional: {}
dependencies DependencyInfo array Dependencies lists the declared dependencies from the contract. Optional: {}
policy PolicyInfo Policy describes the contract's policy section. Optional: {}
runtime RuntimeInfo Runtime describes the contract's runtime section (declared). Optional: {}
observedRuntime ObservedRuntime ObservedRuntime describes the actual runtime state observed from the cluster.
Only populated when a target workload exists.
Optional: {}
scaling ScalingInfo Scaling describes the contract's scaling section. Optional: {}
metadata object (keys:string, values:string) Refer to Kubernetes API documentation for fields of metadata. Optional: {}
conditions Condition array Conditions represent individual validation checks. Optional: {}
currentRevision string CurrentRevision is the name of the active PactoRevision. Optional: {}
lastReconciledAt Time LastReconciledAt is when the last reconciliation completed. Optional: {}
observedGeneration integer ObservedGeneration is the most recent generation observed by the controller. Optional: {}

PolicyInfo

PolicyInfo describes the contract's policy section.

Appears in:

Field Description Default Validation
hasSchema boolean HasSchema indicates whether a policy schema file is bundled.
ref string Ref is the external OCI reference for the policy schema, if used. Optional: {}

PortStatus

PortStatus describes the port comparison between contract and runtime.

Appears in:

Field Description Default Validation
expected integer array Expected lists ports declared in the contract.
observed integer array Observed lists ports found on the Kubernetes Service.
missing integer array Missing lists contract ports not found on the Service.
unexpected integer array Unexpected lists Service ports not declared in the contract.

ResourceStatus

ResourceStatus describes the observed state of a Kubernetes resource.

Appears in:

Field Description Default Validation
name string Name of the resource.
kind string Kind of the resource (only set for workloads). Optional: {}
exists boolean Exists indicates whether the resource was found in the cluster.

ResourcesStatus

ResourcesStatus groups the status of target resources.

Appears in:

Field Description Default Validation
service ResourceStatus Service describes the target Service. Optional: {}
workload ResourceStatus Workload describes the target workload (Deployment/StatefulSet/ReplicaSet). Optional: {}

RevisionSource

RevisionSource specifies where the contract for this revision was loaded from.

Appears in:

Field Description Default Validation
oci string OCI is the fully resolved OCI reference (including tag/digest).
Example: ghcr.io/org/service-pacto:1.2.0
Optional: {}
inline boolean Inline indicates the contract was provided inline (no external source). Optional: {}

RuntimeInfo

RuntimeInfo describes the contract's runtime section.

Appears in:

Field Description Default Validation
workload string Workload is the workload type: service, job, or scheduled. Optional: {}
stateType string StateType is the state semantics: stateless, stateful, or hybrid. Optional: {}
persistenceScope string PersistenceScope is the persistence scope: local or shared. Optional: {}
persistenceDurability string PersistenceDurability is the durability: ephemeral or persistent. Optional: {}
dataCriticality string DataCriticality is the data criticality level: low, medium, or high. Optional: {}
upgradeStrategy string UpgradeStrategy is the declared upgrade strategy: rolling, recreate, or ordered. Optional: {}
gracefulShutdownSeconds integer GracefulShutdownSeconds is the declared graceful shutdown period. Optional: {}
healthInterface string HealthInterface is the interface used for health checks. Optional: {}
healthPath string HealthPath is the HTTP path for health checks. Optional: {}
metricsInterface string MetricsInterface is the interface used for metrics. Optional: {}
metricsPath string MetricsPath is the HTTP path for metrics. Optional: {}
healthInitialDelaySeconds integer HealthInitialDelaySeconds is the declared initial delay before health checks start. Optional: {}

ScalingInfo

ScalingInfo describes the contract's scaling section.

Appears in:

Field Description Default Validation
replicas integer Replicas is the exact replica count (mutually exclusive with Min/Max). Optional: {}
min integer Min is the minimum replica count for autoscaling. Optional: {}
max integer Max is the maximum replica count for autoscaling. Optional: {}

TargetRef

TargetRef specifies which Kubernetes resources to observe.

Appears in:

Field Description Default Validation
serviceName string ServiceName is the name of the Kubernetes Service to observe. Optional: {}
workloadRef WorkloadRef WorkloadRef identifies the workload (Deployment, StatefulSet, or ReplicaSet).
If omitted, defaults to name=serviceName, kind=Deployment.
Optional: {}

ValidationIssue

ValidationIssue describes a single validation error or warning.

Appears in:

Field Description Default Validation
code string Code is a machine-readable error code. Optional: {}
path string Path is the JSON path to the invalid field. Optional: {}
message string Message is a human-readable description of the issue.

ValidationResult

ValidationResult describes the structural validation outcome of the contract.

Appears in:

Field Description Default Validation
valid boolean Valid indicates whether the contract passed structural validation.
errors ValidationIssue array Errors lists structural validation errors. Optional: {}
warnings ValidationIssue array Warnings lists structural validation warnings. Optional: {}

WorkloadRef

WorkloadRef identifies a workload resource by name and kind.

Appears in:

Field Description Default Validation
name string Name of the workload resource. Required: {}
kind string Kind of the workload resource. Deployment Enum: [Deployment StatefulSet ReplicaSet]
Optional: {}