diff --git a/charts/tekton-operator/templates/kubernetes-crds.yaml b/charts/tekton-operator/templates/kubernetes-crds.yaml index e86f097ba4..f33c474863 100644 --- a/charts/tekton-operator/templates/kubernetes-crds.yaml +++ b/charts/tekton-operator/templates/kubernetes-crds.yaml @@ -54,6 +54,9 @@ spec: type: object spec: properties: + disabled: + description: enable or disable manual approval gate feature + type: boolean networkPolicy: description: |- NetworkPolicy configures NetworkPolicy creation for the controller @@ -2873,6 +2876,125 @@ spec: type: object type: array type: object + kueue: + description: To enable Pipeline queueing on Single Cluster or Multiple + Clusters + properties: + config.yaml: + description: |- + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of + side effects a webhook may have. + type: string + timeoutSeconds: + type: integer + type: object + type: object + type: object + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object + manualApproval: + description: ManualApproval holds the customizable options for the + ManualApprovalGate component + properties: + disabled: + description: enable or disable manual approval gate feature + type: boolean + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of + side effects a webhook may have. + type: string + timeoutSeconds: + type: integer + type: object + type: object + type: object + type: object multiclusterProxyAAE: description: MulticlusterProxyAAE holds the customizable options for the multicluster-proxy-aae component @@ -2915,7 +3037,7 @@ spec: NetworkPolicy configures NetworkPolicy resources for the operand namespace. This field is propagated to TektonPipeline, TektonTrigger, TektonChain, TektonPruner, TektonResult, Pipelines-as-Code, and MultiCluster components - (TektonScheduler, TektonMulticlusterProxyAAE, SyncerService). + (TektonKueue, TektonMulticlusterProxyAAE, SyncerService). Other components (Dashboard) do not yet act on this field. properties: disabled: @@ -3714,6 +3836,22 @@ spec: Set to false to opt out and manage TLS settings manually. Default: true (opt-out) type: boolean + enableMetricsMTLS: + description: |- + EnableMetricsMTLS controls whether Prometheus metrics endpoints use mTLS. + When enabled the operator: + - annotates metric Services for automatic TLS certificate provisioning + via the OpenShift service-serving-cert controller + - renames the metrics port from "http-metrics" to "https-metrics" + - mounts the serving-cert Secret and client-CA ConfigMap into Tekton pods + - enforces client certificate verification (RequireAndVerifyClientCert) + + Requires the OpenShift Cluster Monitoring Operator (CMO) to be present, + because the client CA bundle is read from + kube-system/extension-apiserver-authentication. + + Default: false (opt-in). Set to true to activate metrics mTLS. + type: boolean pipelinesAsCode: description: PipelinesAsCode allows configuring PipelinesAsCode configurations @@ -4074,15 +4212,17 @@ spec: - is_external_db type: object scheduler: - description: To enable Pipeline Scheduling on Single Cluster or Multiple - Clusters + description: |- + Scheduler is the deprecated predecessor of Kueue. Pre-upgrade migration + copies this configuration to Kueue and clears the field. properties: config.yaml: - description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + description: This holds the config data loaded by tekton-kueue + as config.yaml. properties: cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. properties: expressions: items: @@ -4090,8 +4230,15 @@ spec: type: array type: object multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. type: boolean queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. type: string type: object x-kubernetes-preserve-unknown-fields: true @@ -8062,17 +8209,17 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.18.0 - name: tektonschedulers.operator.tekton.dev + name: tektonkueues.operator.tekton.dev labels: version: {{ .Chart.AppVersion | quote }} operator.tekton.dev/release: {{ .Chart.AppVersion | quote }} spec: group: operator.tekton.dev names: - kind: TektonScheduler - listKind: TektonSchedulerList - plural: tektonschedulers - singular: tektonscheduler + kind: TektonKueue + listKind: TektonKueueList + plural: tektonkueues + singular: tektonkueue scope: Cluster versions: - additionalPrinterColumns: @@ -8088,7 +8235,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: TektonScheduler is the Schema for the TektonScheduler API + description: TektonKueue is the Schema for the TektonKueue API properties: apiVersion: description: |- @@ -8111,10 +8258,12 @@ spec: properties: config.yaml: description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. properties: cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. properties: expressions: items: @@ -8122,8 +8271,703 @@ spec: type: array type: object multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. type: boolean queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + networkPolicy: + description: NetworkPolicyConfig configures NetworkPolicy creation + for a Tekton component. + properties: + disabled: + description: |- + Disabled disables all NetworkPolicy creation for this component. + Existing policies are removed on the next reconcile. + type: boolean + policies: + additionalProperties: + description: NetworkPolicySpec provides the specification of + a NetworkPolicy + properties: + egress: + description: |- + egress is a list of egress rules to be applied to the selected pods. Outgoing traffic + is allowed if there are no NetworkPolicies selecting the pod (and cluster policy + otherwise allows the traffic), OR if the traffic matches at least one egress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy limits all outgoing traffic (and serves + solely to ensure that the pods it selects are isolated by default). + This field is beta-level in 1.8 + items: + description: |- + NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. + This type is beta-level in 1.8 + properties: + ports: + description: |- + ports is a list of destination ports for outgoing traffic. + Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + to: + description: |- + to is a list of destinations for outgoing traffic of pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all destinations (traffic not restricted by + destination). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the to list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ingress: + description: |- + ingress is a list of ingress rules to be applied to the selected pods. + Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod + (and cluster policy otherwise allows the traffic), OR if the traffic source is + the pod's local node, OR if the traffic matches at least one ingress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy does not allow any traffic (and serves + solely to ensure that the pods it selects are isolated by default) + items: + description: |- + NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. + properties: + from: + description: |- + from is a list of sources which should be able to access the pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all sources (traffic not restricted by + source). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the from list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ports: + description: |- + ports is a list of ports which should be made accessible on the pods selected for + this rule. Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + podSelector: + description: |- + podSelector selects the pods to which this NetworkPolicy object applies. + The array of rules is applied to any pods selected by this field. An empty + selector matches all pods in the policy's namespace. + Multiple network policies can select the same set of pods. In this case, + the ingress rules for each are combined additively. + This field is optional. If it is not specified, it defaults to an empty selector. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + policyTypes: + description: |- + policyTypes is a list of rule types that the NetworkPolicy relates to. + Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. + If this field is not specified, it will default based on the existence of ingress or egress rules; + policies that contain an egress section are assumed to affect egress, and all policies + (whether or not they contain an ingress section) are assumed to affect ingress. + If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. + Likewise, if you want to write a policy that specifies that no egress is allowed, + you must specify a policyTypes value that include "Egress" (since such a policy would not include + an egress section and would otherwise default to just [ "Ingress" ]). + This field is beta-level in 1.8 + items: + description: |- + PolicyType string describes the NetworkPolicy type + This type is beta-level in 1.8 + type: string + type: array + x-kubernetes-list-type: atomic + type: object + description: |- + Policies merges with the operator's default NetworkPolicies by name. + A key matching a default policy name replaces that default entirely. + A key not matching any default is added alongside the defaults. + If nil or empty, all operator defaults are applied unchanged. + type: object + x-kubernetes-preserve-unknown-fields: true + type: object + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of side + effects a webhook may have. + type: string + timeoutSeconds: + type: integer + type: object + type: object + type: object + targetNamespace: + description: TargetNamespace is where resources will be installed + type: string + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object + status: + description: TektonKueueStatus defines the observed state of TektonKueue + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations is additional Status fields for the Resource to save some + additional State as well as convey more information to the user. This is + roughly akin to Annotations on any k8s resource, just the reconciler conveying + richer information outwards. + type: object + conditions: + description: Conditions the latest available observations of a resource's + current state. + items: + description: |- + Condition defines a readiness condition for a Knative resource. + See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time the condition transitioned from one status to another. + We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic + differences (all other things held constant). + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + severity: + description: |- + Severity with which to treat failures of this type of condition. + When this is not specified, it defaults to Error. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + description: |- + ObservedGeneration is the 'Generation' of the Service that + was last processed by the controller. + type: integer + tekton-kueue: + description: The current installer set name for TektonKueue + type: string + version: + description: The version of the installed release + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.18.0 + name: tektonschedulers.operator.tekton.dev + labels: + version: {{ .Chart.AppVersion | quote }} + operator.tekton.dev/release: {{ .Chart.AppVersion | quote }} +spec: + group: operator.tekton.dev + names: + kind: TektonScheduler + listKind: TektonSchedulerList + plural: tektonschedulers + singular: tektonscheduler + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.version + name: Version + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].message + name: Reason + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + TektonScheduler is the deprecated predecessor of TektonKueue. It is retained + temporarily so existing resources remain readable while pre-upgrade migration + copies their configuration to TektonKueue. + 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: TektonSchedulerSpec defines the desired state of the deprecated + TektonScheduler API. + properties: + config.yaml: + description: This holds the config data loaded by tekton-kueue as + config.yaml. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. type: string type: object x-kubernetes-preserve-unknown-fields: true @@ -8666,7 +9510,8 @@ spec: - multi-cluster-role type: object status: - description: TektonSchedulerStatus defines the observed state of TektonScheduler + description: TektonSchedulerStatus defines the observed state of the deprecated + TektonScheduler API. properties: annotations: additionalProperties: diff --git a/charts/tekton-operator/templates/openshift-crds.yaml b/charts/tekton-operator/templates/openshift-crds.yaml index ad10854a47..8d5ad24230 100644 --- a/charts/tekton-operator/templates/openshift-crds.yaml +++ b/charts/tekton-operator/templates/openshift-crds.yaml @@ -54,6 +54,9 @@ spec: type: object spec: properties: + disabled: + description: enable or disable manual approval gate feature + type: boolean networkPolicy: description: |- NetworkPolicy configures NetworkPolicy creation for the controller @@ -3067,6 +3070,125 @@ spec: type: object type: array type: object + kueue: + description: To enable Pipeline queueing on Single Cluster or Multiple + Clusters + properties: + config.yaml: + description: |- + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of + side effects a webhook may have. + type: string + timeoutSeconds: + type: integer + type: object + type: object + type: object + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object + manualApproval: + description: ManualApproval holds the customizable options for the + ManualApprovalGate component + properties: + disabled: + description: enable or disable manual approval gate feature + type: boolean + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of + side effects a webhook may have. + type: string + timeoutSeconds: + type: integer + type: object + type: object + type: object + type: object multiclusterProxyAAE: description: MulticlusterProxyAAE holds the customizable options for the multicluster-proxy-aae component @@ -3109,7 +3231,7 @@ spec: NetworkPolicy configures NetworkPolicy resources for the operand namespace. This field is propagated to TektonPipeline, TektonTrigger, TektonChain, TektonPruner, TektonResult, Pipelines-as-Code, and MultiCluster components - (TektonScheduler, TektonMulticlusterProxyAAE, SyncerService). + (TektonKueue, TektonMulticlusterProxyAAE, SyncerService). Other components (Dashboard) do not yet act on this field. properties: disabled: @@ -3908,6 +4030,22 @@ spec: Set to false to opt out and manage TLS settings manually. Default: true (opt-out) type: boolean + enableMetricsMTLS: + description: |- + EnableMetricsMTLS controls whether Prometheus metrics endpoints use mTLS. + When enabled the operator: + - annotates metric Services for automatic TLS certificate provisioning + via the OpenShift service-serving-cert controller + - renames the metrics port from "http-metrics" to "https-metrics" + - mounts the serving-cert Secret and client-CA ConfigMap into Tekton pods + - enforces client certificate verification (RequireAndVerifyClientCert) + + Requires the OpenShift Cluster Monitoring Operator (CMO) to be present, + because the client CA bundle is read from + kube-system/extension-apiserver-authentication. + + Default: false (opt-in). Set to true to activate metrics mTLS. + type: boolean pipelinesAsCode: description: PipelinesAsCode allows configuring PipelinesAsCode configurations @@ -4268,15 +4406,17 @@ spec: - is_external_db type: object scheduler: - description: To enable Pipeline Scheduling on Single Cluster or Multiple - Clusters + description: |- + Scheduler is the deprecated predecessor of Kueue. Pre-upgrade migration + copies this configuration to Kueue and clears the field. properties: config.yaml: - description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + description: This holds the config data loaded by tekton-kueue + as config.yaml. properties: cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. properties: expressions: items: @@ -4284,8 +4424,15 @@ spec: type: array type: object multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. type: boolean queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. type: string type: object x-kubernetes-preserve-unknown-fields: true @@ -8041,17 +8188,17 @@ kind: CustomResourceDefinition metadata: annotations: controller-gen.kubebuilder.io/version: v0.18.0 - name: tektonschedulers.operator.tekton.dev + name: tektonkueues.operator.tekton.dev labels: version: {{ .Chart.AppVersion | quote }} operator.tekton.dev/release: {{ .Chart.AppVersion | quote }} spec: group: operator.tekton.dev names: - kind: TektonScheduler - listKind: TektonSchedulerList - plural: tektonschedulers - singular: tektonscheduler + kind: TektonKueue + listKind: TektonKueueList + plural: tektonkueues + singular: tektonkueue scope: Cluster versions: - additionalPrinterColumns: @@ -8067,7 +8214,7 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: TektonScheduler is the Schema for the TektonScheduler API + description: TektonKueue is the Schema for the TektonKueue API properties: apiVersion: description: |- @@ -8090,10 +8237,12 @@ spec: properties: config.yaml: description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. properties: cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. properties: expressions: items: @@ -8101,8 +8250,703 @@ spec: type: array type: object multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. type: boolean queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + networkPolicy: + description: NetworkPolicyConfig configures NetworkPolicy creation + for a Tekton component. + properties: + disabled: + description: |- + Disabled disables all NetworkPolicy creation for this component. + Existing policies are removed on the next reconcile. + type: boolean + policies: + additionalProperties: + description: NetworkPolicySpec provides the specification of + a NetworkPolicy + properties: + egress: + description: |- + egress is a list of egress rules to be applied to the selected pods. Outgoing traffic + is allowed if there are no NetworkPolicies selecting the pod (and cluster policy + otherwise allows the traffic), OR if the traffic matches at least one egress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy limits all outgoing traffic (and serves + solely to ensure that the pods it selects are isolated by default). + This field is beta-level in 1.8 + items: + description: |- + NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. + This type is beta-level in 1.8 + properties: + ports: + description: |- + ports is a list of destination ports for outgoing traffic. + Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + to: + description: |- + to is a list of destinations for outgoing traffic of pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all destinations (traffic not restricted by + destination). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the to list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ingress: + description: |- + ingress is a list of ingress rules to be applied to the selected pods. + Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod + (and cluster policy otherwise allows the traffic), OR if the traffic source is + the pod's local node, OR if the traffic matches at least one ingress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy does not allow any traffic (and serves + solely to ensure that the pods it selects are isolated by default) + items: + description: |- + NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. + properties: + from: + description: |- + from is a list of sources which should be able to access the pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all sources (traffic not restricted by + source). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the from list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ports: + description: |- + ports is a list of ports which should be made accessible on the pods selected for + this rule. Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + podSelector: + description: |- + podSelector selects the pods to which this NetworkPolicy object applies. + The array of rules is applied to any pods selected by this field. An empty + selector matches all pods in the policy's namespace. + Multiple network policies can select the same set of pods. In this case, + the ingress rules for each are combined additively. + This field is optional. If it is not specified, it defaults to an empty selector. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + policyTypes: + description: |- + policyTypes is a list of rule types that the NetworkPolicy relates to. + Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. + If this field is not specified, it will default based on the existence of ingress or egress rules; + policies that contain an egress section are assumed to affect egress, and all policies + (whether or not they contain an ingress section) are assumed to affect ingress. + If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. + Likewise, if you want to write a policy that specifies that no egress is allowed, + you must specify a policyTypes value that include "Egress" (since such a policy would not include + an egress section and would otherwise default to just [ "Ingress" ]). + This field is beta-level in 1.8 + items: + description: |- + PolicyType string describes the NetworkPolicy type + This type is beta-level in 1.8 + type: string + type: array + x-kubernetes-list-type: atomic + type: object + description: |- + Policies merges with the operator's default NetworkPolicies by name. + A key matching a default policy name replaces that default entirely. + A key not matching any default is added alongside the defaults. + If nil or empty, all operator defaults are applied unchanged. + type: object + x-kubernetes-preserve-unknown-fields: true + type: object + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of side + effects a webhook may have. + type: string + timeoutSeconds: + type: integer + type: object + type: object + type: object + targetNamespace: + description: TargetNamespace is where resources will be installed + type: string + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object + status: + description: TektonKueueStatus defines the observed state of TektonKueue + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations is additional Status fields for the Resource to save some + additional State as well as convey more information to the user. This is + roughly akin to Annotations on any k8s resource, just the reconciler conveying + richer information outwards. + type: object + conditions: + description: Conditions the latest available observations of a resource's + current state. + items: + description: |- + Condition defines a readiness condition for a Knative resource. + See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time the condition transitioned from one status to another. + We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic + differences (all other things held constant). + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + severity: + description: |- + Severity with which to treat failures of this type of condition. + When this is not specified, it defaults to Error. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + description: |- + ObservedGeneration is the 'Generation' of the Service that + was last processed by the controller. + type: integer + tekton-kueue: + description: The current installer set name for TektonKueue + type: string + version: + description: The version of the installed release + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.18.0 + name: tektonschedulers.operator.tekton.dev + labels: + version: {{ .Chart.AppVersion | quote }} + operator.tekton.dev/release: {{ .Chart.AppVersion | quote }} +spec: + group: operator.tekton.dev + names: + kind: TektonScheduler + listKind: TektonSchedulerList + plural: tektonschedulers + singular: tektonscheduler + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.version + name: Version + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].message + name: Reason + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: |- + TektonScheduler is the deprecated predecessor of TektonKueue. It is retained + temporarily so existing resources remain readable while pre-upgrade migration + copies their configuration to TektonKueue. + 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: TektonSchedulerSpec defines the desired state of the deprecated + TektonScheduler API. + properties: + config.yaml: + description: This holds the config data loaded by tekton-kueue as + config.yaml. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. type: string type: object x-kubernetes-preserve-unknown-fields: true @@ -8645,7 +9489,8 @@ spec: - multi-cluster-role type: object status: - description: TektonSchedulerStatus defines the observed state of TektonScheduler + description: TektonSchedulerStatus defines the observed state of the deprecated + TektonScheduler API. properties: annotations: additionalProperties: diff --git a/components.yaml b/components.yaml index b292d72ce4..e7486b9f06 100644 --- a/components.yaml +++ b/components.yaml @@ -22,8 +22,8 @@ pruner: results: github: tektoncd/results version: v0.20.0 -scheduler: - github: konflux-ci/tekton-kueue +kueue: + github: tektoncd/tekton-kueue version: v0.4.0 syncer-service: github: openshift-pipelines/syncer-service diff --git a/config/base/generated-crds/operator.tekton.dev_tektonconfigs.yaml b/config/base/generated-crds/operator.tekton.dev_tektonconfigs.yaml index 8c94fba948..2bf0202259 100644 --- a/config/base/generated-crds/operator.tekton.dev_tektonconfigs.yaml +++ b/config/base/generated-crds/operator.tekton.dev_tektonconfigs.yaml @@ -534,6 +534,86 @@ spec: type: object type: array type: object + kueue: + description: To enable Pipeline queueing on Single Cluster or Multiple + Clusters + properties: + config.yaml: + description: |- + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of + side effects a webhook may have. + type: string + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: object + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object manualApproval: description: ManualApproval holds the customizable options for the ManualApprovalGate component @@ -618,7 +698,7 @@ spec: NetworkPolicy configures NetworkPolicy resources for the operand namespace. This field is propagated to TektonPipeline, TektonTrigger, TektonChain, TektonPruner, TektonResult, Pipelines-as-Code, and MultiCluster components - (TektonScheduler, TektonMulticlusterProxyAAE, SyncerService). + (TektonKueue, TektonMulticlusterProxyAAE, SyncerService). Other components (Dashboard) do not yet act on this field. properties: disabled: @@ -1807,13 +1887,13 @@ spec: - is_external_db type: object scheduler: - description: To enable Pipeline Scheduling on Single Cluster or Multiple - Clusters + description: |- + Scheduler is the deprecated predecessor of Kueue. Pre-upgrade migration + copies this configuration to Kueue and clears the field. properties: config.yaml: - description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + description: This holds the config data loaded by tekton-kueue + as config.yaml. properties: cel: description: CEL contains optional CEL expressions for dynamic diff --git a/config/base/generated-crds/operator.tekton.dev_tektonkueues.yaml b/config/base/generated-crds/operator.tekton.dev_tektonkueues.yaml new file mode 100644 index 0000000000..86e2740bbf --- /dev/null +++ b/config/base/generated-crds/operator.tekton.dev_tektonkueues.yaml @@ -0,0 +1,685 @@ +--- +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.18.0 + name: tektonkueues.operator.tekton.dev +spec: + group: operator.tekton.dev + names: + kind: TektonKueue + listKind: TektonKueueList + plural: tektonkueues + singular: tektonkueue + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.version + name: Version + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].message + name: Reason + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: TektonKueue is the Schema for the TektonKueue 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: + properties: + config.yaml: + description: |- + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + networkPolicy: + description: NetworkPolicyConfig configures NetworkPolicy creation + for a Tekton component. + properties: + disabled: + description: |- + Disabled disables all NetworkPolicy creation for this component. + Existing policies are removed on the next reconcile. + type: boolean + policies: + additionalProperties: + description: NetworkPolicySpec provides the specification of + a NetworkPolicy + properties: + egress: + description: |- + egress is a list of egress rules to be applied to the selected pods. Outgoing traffic + is allowed if there are no NetworkPolicies selecting the pod (and cluster policy + otherwise allows the traffic), OR if the traffic matches at least one egress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy limits all outgoing traffic (and serves + solely to ensure that the pods it selects are isolated by default). + This field is beta-level in 1.8 + items: + description: |- + NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. + This type is beta-level in 1.8 + properties: + ports: + description: |- + ports is a list of destination ports for outgoing traffic. + Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + format: int32 + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + to: + description: |- + to is a list of destinations for outgoing traffic of pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all destinations (traffic not restricted by + destination). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the to list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ingress: + description: |- + ingress is a list of ingress rules to be applied to the selected pods. + Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod + (and cluster policy otherwise allows the traffic), OR if the traffic source is + the pod's local node, OR if the traffic matches at least one ingress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy does not allow any traffic (and serves + solely to ensure that the pods it selects are isolated by default) + items: + description: |- + NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. + properties: + from: + description: |- + from is a list of sources which should be able to access the pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all sources (traffic not restricted by + source). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the from list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ports: + description: |- + ports is a list of ports which should be made accessible on the pods selected for + this rule. Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + format: int32 + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + podSelector: + description: |- + podSelector selects the pods to which this NetworkPolicy object applies. + The array of rules is applied to any pods selected by this field. An empty + selector matches all pods in the policy's namespace. + Multiple network policies can select the same set of pods. In this case, + the ingress rules for each are combined additively. + This field is optional. If it is not specified, it defaults to an empty selector. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + policyTypes: + description: |- + policyTypes is a list of rule types that the NetworkPolicy relates to. + Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. + If this field is not specified, it will default based on the existence of ingress or egress rules; + policies that contain an egress section are assumed to affect egress, and all policies + (whether or not they contain an ingress section) are assumed to affect ingress. + If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. + Likewise, if you want to write a policy that specifies that no egress is allowed, + you must specify a policyTypes value that include "Egress" (since such a policy would not include + an egress section and would otherwise default to just [ "Ingress" ]). + This field is beta-level in 1.8 + items: + description: |- + PolicyType string describes the NetworkPolicy type + This type is beta-level in 1.8 + type: string + type: array + x-kubernetes-list-type: atomic + type: object + description: |- + Policies merges with the operator's default NetworkPolicies by name. + A key matching a default policy name replaces that default entirely. + A key not matching any default is added alongside the defaults. + If nil or empty, all operator defaults are applied unchanged. + type: object + x-kubernetes-preserve-unknown-fields: true + type: object + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of side + effects a webhook may have. + type: string + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: object + targetNamespace: + description: TargetNamespace is where resources will be installed + type: string + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object + status: + description: TektonKueueStatus defines the observed state of TektonKueue + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations is additional Status fields for the Resource to save some + additional State as well as convey more information to the user. This is + roughly akin to Annotations on any k8s resource, just the reconciler conveying + richer information outwards. + type: object + conditions: + description: Conditions the latest available observations of a resource's + current state. + items: + description: |- + Condition defines a readiness condition for a Knative resource. + See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time the condition transitioned from one status to another. + We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic + differences (all other things held constant). + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + severity: + description: |- + Severity with which to treat failures of this type of condition. + When this is not specified, it defaults to Error. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + description: |- + ObservedGeneration is the 'Generation' of the Service that + was last processed by the controller. + format: int64 + type: integer + tekton-kueue: + description: The current installer set name for TektonKueue + type: string + version: + description: The version of the installed release + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} diff --git a/config/base/generated-crds/operator.tekton.dev_tektonschedulers.yaml b/config/base/generated-crds/operator.tekton.dev_tektonschedulers.yaml index 7a04086c26..55235763d8 100644 --- a/config/base/generated-crds/operator.tekton.dev_tektonschedulers.yaml +++ b/config/base/generated-crds/operator.tekton.dev_tektonschedulers.yaml @@ -27,7 +27,10 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: TektonScheduler is the Schema for the TektonScheduler API + description: |- + TektonScheduler is the deprecated predecessor of TektonKueue. It is retained + temporarily so existing resources remain readable while pre-upgrade migration + copies their configuration to TektonKueue. properties: apiVersion: description: |- @@ -47,11 +50,12 @@ spec: metadata: type: object spec: + description: TektonSchedulerSpec defines the desired state of the deprecated + TektonScheduler API. properties: config.yaml: - description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + description: This holds the config data loaded by tekton-kueue as + config.yaml. properties: cel: description: CEL contains optional CEL expressions for dynamic @@ -617,7 +621,8 @@ spec: - multi-cluster-role type: object status: - description: TektonSchedulerStatus defines the observed state of TektonScheduler + description: TektonSchedulerStatus defines the observed state of the deprecated + TektonScheduler API. properties: annotations: additionalProperties: diff --git a/config/base/kustomization.yaml b/config/base/kustomization.yaml index 51fde84bd3..45849841ef 100644 --- a/config/base/kustomization.yaml +++ b/config/base/kustomization.yaml @@ -29,8 +29,8 @@ resources: - config-leader-election.yaml - tekton_result_role.yaml - tekton_result_role_binding.yaml -- tekton_scheduler_role.yaml -- tekton_scheduler_role_binding.yaml +- tekton_kueue_role.yaml +- tekton_kueue_role_binding.yaml # Generated CRDs - generated-crds/operator.tekton.dev_manualapprovalgates.yaml @@ -43,6 +43,7 @@ resources: - generated-crds/operator.tekton.dev_tektonpipelines.yaml - generated-crds/operator.tekton.dev_tektonpruners.yaml - generated-crds/operator.tekton.dev_tektonresults.yaml +- generated-crds/operator.tekton.dev_tektonkueues.yaml - generated-crds/operator.tekton.dev_tektonschedulers.yaml - generated-crds/operator.tekton.dev_tektondashboards.yaml - generated-crds/operator.tekton.dev_tektonaddons.yaml diff --git a/config/base/tekton_scheduler_role.yaml b/config/base/tekton_kueue_role.yaml similarity index 96% rename from config/base/tekton_scheduler_role.yaml rename to config/base/tekton_kueue_role.yaml index 726c99bd4c..fcc7524c72 100644 --- a/config/base/tekton_scheduler_role.yaml +++ b/config/base/tekton_kueue_role.yaml @@ -15,7 +15,7 @@ apiVersion: rbac.authorization.k8s.io/v1 kind: ClusterRole metadata: - name: tekton-scheduler-role + name: tekton-kueue-role rules: - apiGroups: - kueue.x-k8s.io @@ -51,6 +51,7 @@ rules: - get - create - update + - delete - list - nonResourceURLs: - /metrics diff --git a/config/base/tekton_scheduler_role_binding.yaml b/config/base/tekton_kueue_role_binding.yaml similarity index 92% rename from config/base/tekton_scheduler_role_binding.yaml rename to config/base/tekton_kueue_role_binding.yaml index 4a2043c36b..d3a2eb06f9 100644 --- a/config/base/tekton_scheduler_role_binding.yaml +++ b/config/base/tekton_kueue_role_binding.yaml @@ -15,7 +15,7 @@ kind: ClusterRoleBinding apiVersion: rbac.authorization.k8s.io/v1 metadata: - name: tekton-scheduler-rolebinding + name: tekton-kueue-rolebinding subjects: - kind: ServiceAccount name: tekton-operator @@ -23,4 +23,4 @@ subjects: roleRef: apiGroup: rbac.authorization.k8s.io kind: ClusterRole - name: tekton-scheduler-role + name: tekton-kueue-role diff --git a/config/crs/kubernetes/scheduler/operator_v1alpha1_scheduler_cr.yaml b/config/crs/kubernetes/kueue/operator_v1alpha1_kueue_cr.yaml similarity index 83% rename from config/crs/kubernetes/scheduler/operator_v1alpha1_scheduler_cr.yaml rename to config/crs/kubernetes/kueue/operator_v1alpha1_kueue_cr.yaml index e33741b52d..102162636f 100644 --- a/config/crs/kubernetes/scheduler/operator_v1alpha1_scheduler_cr.yaml +++ b/config/crs/kubernetes/kueue/operator_v1alpha1_kueue_cr.yaml @@ -13,10 +13,13 @@ # limitations under the License. apiVersion: operator.tekton.dev/v1alpha1 -kind: TektonScheduler +kind: TektonKueue metadata: - name: tektonscheduler + name: kueue spec: targetNamespace: tekton-pipelines disabled: false - multi-cluster: {} + multi-cluster-disabled: true + multi-cluster-role: "" + config.yaml: + queueName: pipelines-queue diff --git a/config/crs/kubernetes/kustomization.yaml b/config/crs/kubernetes/kustomization.yaml index 2c170d9577..781cd3b031 100644 --- a/config/crs/kubernetes/kustomization.yaml +++ b/config/crs/kubernetes/kustomization.yaml @@ -10,6 +10,6 @@ resources: - chain/operator_v1alpha1_chain_cr.yaml - manualapprovalgate/operator_v1alpha1_manualapprovalgate_cr.yaml - pruner/operator_v1alpha1_pruner_cr.yaml -- scheduler/operator_v1alpha1_scheduler_cr.yaml +- kueue/operator_v1alpha1_kueue_cr.yaml - multicluster-proxy-aae/operator_v1alpha1_multiclusterproxyaae_cr.yaml - pipelinesascode/operator_v1alpha1_pipelinesascode_cr.yaml diff --git a/config/kubernetes/base/operator.yaml b/config/kubernetes/base/operator.yaml index 14cf1cbc3e..e18658c071 100644 --- a/config/kubernetes/base/operator.yaml +++ b/config/kubernetes/base/operator.yaml @@ -33,7 +33,7 @@ spec: image: ko://github.com/tektoncd/operator/cmd/kubernetes/operator args: - "-controllers" - - "tektonconfig,tektonpipeline,tektontrigger,tektonchain,tektonresult,tektondashboard,manualapprovalgate,tektonpruner,tektonscheduler,tektonmulticlusterproxyaae,openshiftpipelinesascode" + - "tektonconfig,tektonpipeline,tektontrigger,tektonchain,tektonresult,tektondashboard,manualapprovalgate,tektonpruner,tektonkueue,tektonmulticlusterproxyaae,openshiftpipelinesascode" - "-unique-process-name" - "tekton-operator-lifecycle" imagePullPolicy: IfNotPresent diff --git a/config/openshift/base/kustomization.yaml b/config/openshift/base/kustomization.yaml index e077ce22b3..5b8464f3a6 100644 --- a/config/openshift/base/kustomization.yaml +++ b/config/openshift/base/kustomization.yaml @@ -24,7 +24,7 @@ patches: value: "true" - target: kind: ClusterRoleBinding - name: tekton-scheduler-rolebinding + name: tekton-kueue-rolebinding patch: |- - op: replace path: /subjects diff --git a/config/openshift/base/operator.yaml b/config/openshift/base/operator.yaml index 2492e88a76..6b6a8c7b0c 100644 --- a/config/openshift/base/operator.yaml +++ b/config/openshift/base/operator.yaml @@ -38,7 +38,7 @@ spec: image: ko://github.com/tektoncd/operator/cmd/openshift/operator args: - "-controllers" - - "tektonconfig,tektonpipeline,tektontrigger,tektonchain,tektonaddon,tektonresult,openshiftpipelinesascode,manualapprovalgate,tektonpruner,tektonscheduler,tektonmulticlusterproxyaae,syncerservice" + - "tektonconfig,tektonpipeline,tektontrigger,tektonchain,tektonaddon,tektonresult,openshiftpipelinesascode,manualapprovalgate,tektonpruner,tektonkueue,tektonmulticlusterproxyaae,syncerservice" - "-unique-process-name" - "tekton-operator-lifecycle" imagePullPolicy: Always diff --git a/docs/AirGapImageConfiguration.md b/docs/AirGapImageConfiguration.md index 951c929711..fa4866ce35 100644 --- a/docs/AirGapImageConfiguration.md +++ b/docs/AirGapImageConfiguration.md @@ -95,8 +95,8 @@ kubectl delete tektoninstallerset | Pruner CronJob | image used in pruner cronJob | `IMAGE_JOB_PRUNER_TKN` | | Tekton Pruner | image used by pruner controller | `IMAGE_PRUNER_CONTROLLER` | | Tekton Pruner | image used by pruner webhook | `IMAGE_PRUNER_WEBHOOK` | -| Tekton Scheduler | image used by scheduler controller | `IMAGE_SCHEDULER_MANAGER` | -| Tekton Scheduler | image used by scheduler webhook | `IMAGE_SCHEDULER_WEBHOOK` | +| Tekton Kueue | controller | `IMAGE_KUEUE_MANAGER` | +| Tekton Kueue | webhook | `IMAGE_KUEUE_WEBHOOK` | | Multicluster Proxy AAE | proxy-aae | `IMAGE_MULTICLUSTERPROXYAAE_PROXY_AAE` | | Syncer Service | workload-controller | `IMAGE_SYNCER_SERVICE_WORKLOAD_CONTROLLER` | diff --git a/docs/NetworkPolicy.md b/docs/NetworkPolicy.md index 41f1c5b656..bfa9d423dd 100644 --- a/docs/NetworkPolicy.md +++ b/docs/NetworkPolicy.md @@ -9,7 +9,7 @@ weight: 15 The operator can manage [NetworkPolicy][np] resources for Tekton component workloads. TektonPipeline (core controllers, resolvers, and proxy-webhook), TektonTrigger, TektonChain, Pipelines-as-Code, ManualApprovalGate, TektonPruner, TektonResult, -and MultiCluster components (TektonScheduler, TektonMulticlusterProxyAAE, +and MultiCluster components (TektonKueue, TektonMulticlusterProxyAAE, SyncerService) are supported; other components will be added later. Configuration is available via `TektonConfig`: @@ -257,14 +257,15 @@ user's browser via the OpenShift Console's proxy, not on this pod. These are static manifests shipped with the TektonConfig console plugin resources, not reconciled via `spec.networkPolicy`. -### TektonScheduler +### TektonKueue Policies are applied to the operand namespace (`tekton-pipelines` or `openshift-pipelines`). +Policy names retain the `scheduler-` prefix for compatibility. | Policy | Direction | Port | Source / Destination | |---|---|---|---| -| `scheduler-controller-default-deny` | deny all | — | Scheduler controller pods | -| `scheduler-webhook-default-deny` | deny all | — | Scheduler webhook pods | +| `scheduler-controller-default-deny` | deny all | — | Tekton Kueue controller pods | +| `scheduler-webhook-default-deny` | deny all | — | Tekton Kueue webhook pods | | `scheduler-controller` | ingress | TCP/8443 | Prometheus namespace | | | egress | UDP+TCP/53 (K8s) or 5353 (OpenShift) | DNS resolver pods | | | egress | all | API server (all egress allowed — NP cannot select host-network endpoints) | @@ -276,7 +277,7 @@ Policies are applied to the operand namespace (`tekton-pipelines` or `openshift- ### TektonMulticlusterProxyAAE Policies are applied to the operand namespace (`tekton-pipelines` or `openshift-pipelines`). -Deployed only when the scheduler is enabled with multi-cluster role = Hub. +Deployed only when Tekton Kueue is enabled with multi-cluster role = Hub. | Policy | Direction | Port | Source / Destination | |---|---|---|---| @@ -288,7 +289,7 @@ Deployed only when the scheduler is enabled with multi-cluster role = Hub. ### SyncerService (OpenShift only) Policies are applied to the operand namespace (`openshift-pipelines`). -Deployed only when the scheduler is enabled with multi-cluster role = Hub. +Deployed only when Tekton Kueue is enabled with multi-cluster role = Hub. | Policy | Direction | Port | Source / Destination | |---|---|---|---| @@ -296,7 +297,7 @@ Deployed only when the scheduler is enabled with multi-cluster role = Hub. | `syncer-service-controller` | egress | UDP+TCP/5353 | DNS resolver pods (OpenShift) | | | egress | all | API server (all egress allowed — NP cannot select host-network endpoints) | -All component policies (TektonPipeline, TektonTrigger, TektonScheduler, +All component policies (TektonPipeline, TektonTrigger, TektonKueue, TektonMulticlusterProxyAAE, SyncerService, and Console Plugin) are applied to the operand namespace (e.g. `tekton-pipelines` or `openshift-pipelines`). diff --git a/docs/SyncerService.md b/docs/SyncerService.md index 475496745f..4647f94f7c 100644 --- a/docs/SyncerService.md +++ b/docs/SyncerService.md @@ -26,7 +26,7 @@ SyncerService is automatically installed when **both** of the following conditio ### Installation via TektonConfig -Configure your TektonConfig with the scheduler settings to automatically deploy SyncerService: +Configure your TektonConfig with the Tekton Kueue settings to automatically deploy SyncerService: ```yaml apiVersion: operator.tekton.dev/v1alpha1 @@ -36,31 +36,18 @@ metadata: spec: profile: all targetNamespace: openshift-pipelines - scheduler: + kueue: disabled: false multi-cluster-disabled: false multi-cluster-role: Hub + config.yaml: + queueName: pipelines-queue ``` When this configuration is applied, the operator will: -1. Deploy TektonScheduler component +1. Deploy TektonKueue component 2. Automatically deploy SyncerService component (because `multi-cluster-role: Hub`) -### Installation via TektonScheduler CR - -Alternatively, you can configure via TektonScheduler CR directly: - -```yaml -apiVersion: operator.tekton.dev/v1alpha1 -kind: TektonScheduler -metadata: - name: scheduler -spec: - disabled: false - multi-cluster-disabled: false - multi-cluster-role: Hub -``` - ## Uninstallation ### Automatic Uninstallation Conditions @@ -81,7 +68,7 @@ kind: TektonConfig metadata: name: config spec: - scheduler: + kueue: multi-cluster-disabled: true ``` @@ -92,14 +79,14 @@ kind: TektonConfig metadata: name: config spec: - scheduler: + kueue: multi-cluster-disabled: false multi-cluster-role: Spoke ``` ## Pre-Requisites -SyncerService has the same pre-requisites as TektonScheduler: +SyncerService has the same pre-requisites as TektonKueue: * [Kueue](https://kueue.sigs.k8s.io) must be installed * [cert-manager](https://github.com/cert-manager/cert-manager) CRDs must be installed @@ -109,7 +96,7 @@ SyncerService has the same pre-requisites as TektonScheduler: * **Automatic Secret Syncing**: Syncs Git authentication secrets from hub to spoke clusters * **Multi-Cluster Support**: Works with Kueue's MultiKueue for distributed workload execution * **Selective Processing**: Only handles Workloads owned by Tekton PipelineRuns -* **Lifecycle Management**: Automatically managed by the Tekton Operator based on scheduler configuration +* **Lifecycle Management**: Automatically managed by the Tekton Operator based on Tekton Kueue configuration ## SyncerService CR @@ -124,7 +111,7 @@ spec: targetNamespace: openshift-pipelines ``` -> **Note:** Users should not create or modify SyncerService CR directly. It is managed automatically by the operator based on TektonScheduler configuration. +> **Note:** Users should not create or modify SyncerService CR directly. It is managed automatically by the operator based on TektonKueue configuration. ## Troubleshooting @@ -136,10 +123,10 @@ kubectl get syncerservice syncer-service -o yaml ### Check if SyncerService Should Be Installed -Verify your scheduler configuration: +Verify your Tekton Kueue configuration: ```bash -kubectl get tektonconfig config -o jsonpath='{.spec.scheduler}' +kubectl get tektonconfig config -o jsonpath='{.spec.kueue}' ``` For SyncerService to be deployed, you should see: @@ -158,6 +145,6 @@ kubectl logs -n openshift-pipelines -l app=syncer-service -f * [Kueue Documentation](https://kueue.sigs.k8s.io) * [Kueue MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/) * [Tekton Pipelines](https://tekton.dev) -* [TektonScheduler Documentation](./TektonScheduler.md) +* [TektonKueue Documentation](./TektonKueue.md) [SyncerService]: https://github.com/openshift-pipelines/syncer-service diff --git a/docs/TektonConfig.md b/docs/TektonConfig.md index a992cb045d..61d5f937de 100644 --- a/docs/TektonConfig.md +++ b/docs/TektonConfig.md @@ -26,7 +26,7 @@ Other than the above components depending on the platform operator also provides - On OpenShift - [TektonAddon](./TektonAddon.md) - [OpenShiftPipelinesAsCode](./OpenShiftPipelinesAsCode.md) -- When scheduler multi-cluster is enabled with Hub role (both Kubernetes and OpenShift) +- When Tekton Kueue multi-cluster is enabled with Hub role (both Kubernetes and OpenShift) - [TektonMulticlusterProxyAAE](./TektonMulticlusterProxyAAE.md) The TektonConfig CR provides the following features @@ -486,33 +486,39 @@ By default pruner job will be created from the global pruner config (`spec.prune > > if a global value is not present the following values will be consider as default value
> `resources: pipelinerun`
> `keep: 100`
-### Scheduler +### Tekton Kueue -Scheduler section allows you to install and manage the [Tekton Scheduler](./TektonScheduler.md) through TektonConfig. The Scheduler component uses [Kueue](https://kueue.sigs.k8s.io) and [cert-manager](https://github.com/cert-manager/cert-manager); you must install Kueue and cert-manager CRDs before enabling the scheduler. For full pre-requisites and multi-cluster configuration details, see [Tekton Scheduler](./TektonScheduler.md). +The `spec.kueue` section allows you to install and manage the [Tekton Kueue](./TektonKueue.md) through TektonConfig. The Tekton Kueue component uses [Kueue](https://kueue.sigs.k8s.io) and [cert-manager](https://github.com/cert-manager/cert-manager); you must install Kueue and cert-manager CRDs before enabling Tekton Kueue. For full pre-requisites and multi-cluster configuration details, see [Tekton Kueue](./TektonKueue.md). -Scheduler can be enabled by setting `disabled` to `false` in the scheduler section. If you are working with multi-cluster pipelines, you can enable multi-cluster from the scheduler config. In a multi-cluster environment a cluster can play the role of **Hub** or **Spoke**. The TektonConfig settings for Scheduler for Hub and Spoke are defined below. +The deprecated `spec.scheduler` field is migrated automatically to `spec.kueue` during pre-upgrade reconciliation. If both fields are configured, `spec.kueue` takes precedence. + +Tekton Kueue can be enabled by setting `disabled` to `false` in the kueue section. If you are working with multi-cluster pipelines, you can enable multi-cluster from the kueue config. In a multi-cluster environment a cluster can play the role of **Hub** or **Spoke**. The TektonConfig settings for Tekton Kueue for Hub and Spoke are defined below. #### Hub cluster ```yaml -scheduler: +kueue: disabled: false multi-cluster-disabled: false multi-cluster-role: Hub + config.yaml: + queueName: pipelines-queue options: {} ``` #### Spoke cluster ```yaml -scheduler: +kueue: disabled: false multi-cluster-disabled: false multi-cluster-role: Spoke + config.yaml: + queueName: pipelines-queue options: {} ``` -- `disabled`: set to `false` to enable the Scheduler component (default is `true`). +- `disabled`: set to `false` to enable the Tekton Kueue component (default is `true`). - `multi-cluster-disabled`: when `false`, multi-cluster features are enabled (default is `true`). - `multi-cluster-role`: `Hub` or `Spoke`. When set to **Hub**, TektonConfig also creates and manages the [TektonMulticlusterProxyAAE](./TektonMulticlusterProxyAAE.md) component automatically (the proxy is used to communicate with spoke clusters, e.g. for [Kueue MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/)). On spoke clusters use `Spoke`; the proxy is not installed there. diff --git a/docs/TektonKueue.md b/docs/TektonKueue.md new file mode 100644 index 0000000000..7d1db84d32 --- /dev/null +++ b/docs/TektonKueue.md @@ -0,0 +1,107 @@ +# Tekton Kueue + +The cluster-scoped `TektonKueue` custom resource installs and manages +[Tekton Kueue](https://github.com/tektoncd/tekton-kueue). Using +[`TektonConfig`](./TektonConfig.md) is recommended. + +## Prerequisites + +Install these APIs before enabling Tekton Kueue: + +- [Kueue](https://kueue.sigs.k8s.io/) +- [cert-manager](https://cert-manager.io/docs/installation/) + +## Configuration + +Enable Tekton Kueue through `TektonConfig`: + +```yaml +apiVersion: operator.tekton.dev/v1alpha1 +kind: TektonConfig +metadata: + name: config +spec: + kueue: + disabled: false + multi-cluster-disabled: true + multi-cluster-role: "" + config.yaml: + queueName: pipelines-queue +``` + +Alternatively, create the component resource directly: + +```yaml +apiVersion: operator.tekton.dev/v1alpha1 +kind: TektonKueue +metadata: + name: kueue +spec: + disabled: false + multi-cluster-disabled: true + multi-cluster-role: "" + config.yaml: + queueName: pipelines-queue +``` + +## Multi-cluster configuration + +A multi-cluster installation can configure the cluster as a Hub or Spoke. + +Hub: + +```yaml +apiVersion: operator.tekton.dev/v1alpha1 +kind: TektonKueue +metadata: + name: kueue +spec: + disabled: false + multi-cluster-disabled: false + multi-cluster-role: Hub + config.yaml: + queueName: pipelines-queue +``` + +When the Hub role is configured through `TektonConfig`, the operator also +manages the [Syncer Service](./SyncerService.md) and +[Tekton Multicluster Proxy AAE](./TektonMulticlusterProxyAAE.md). + +Spoke: + +```yaml +apiVersion: operator.tekton.dev/v1alpha1 +kind: TektonKueue +metadata: + name: kueue +spec: + disabled: false + multi-cluster-disabled: false + multi-cluster-role: Spoke + config.yaml: + queueName: pipelines-queue +``` + +## Upgrade compatibility + +`TektonKueue` replaces the former `TektonScheduler` API. The deprecated +`TektonScheduler` CRD and `TektonConfig.spec.scheduler` field remain available +during the compatibility window. + +During pre-upgrade reconciliation, the operator: + +1. Copies `TektonConfig.spec.scheduler` to `TektonConfig.spec.kueue` and clears + the deprecated field. If both fields are configured, `spec.kueue` wins. +2. Removes InstallerSets owned by the old component. +3. Removes the deprecated `tekton-scheduler-role` and + `tekton-scheduler-rolebinding` resources. +4. Creates `TektonKueue/kueue` from an existing `TektonScheduler/scheduler` + resource when a `TektonKueue` resource does not already exist. +5. Removes the old operator finalizer, preserves other finalizers, and requests + deletion of the migrated legacy resource. + +The deprecated API is retained only for migration and does not reconcile +operand resources. Use `TektonKueue` and `spec.kueue` for new configuration. + +Rename `IMAGE_SCHEDULER_MANAGER` and `IMAGE_SCHEDULER_WEBHOOK` overrides to +`IMAGE_KUEUE_MANAGER` and `IMAGE_KUEUE_WEBHOOK`. diff --git a/docs/TektonMulticlusterProxyAAE.md b/docs/TektonMulticlusterProxyAAE.md index a7774977d2..92dd87084d 100644 --- a/docs/TektonMulticlusterProxyAAE.md +++ b/docs/TektonMulticlusterProxyAAE.md @@ -6,23 +6,23 @@ weight: 12 --> # Tekton Multicluster Proxy AAE -TektonMulticlusterProxyAAE deploys the **multicluster-proxy-aae** component used in multi-cluster setups with [Tekton Scheduler](./TektonScheduler.md) and [Kueue](https://kueue.sigs.k8s.io/). The proxy runs on the **Hub** cluster and communicates with **Spoke** clusters (e.g. via [MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/)). +TektonMulticlusterProxyAAE deploys the **multicluster-proxy-aae** component used in multi-cluster setups with [Tekton Kueue](./TektonKueue.md) and [Kueue](https://kueue.sigs.k8s.io/). The proxy runs on the **Hub** cluster and communicates with **Spoke** clusters (e.g. via [MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/)). -It is recommended to install this component through [TektonConfig](./TektonConfig.md) by enabling the scheduler with multi-cluster and setting the cluster role to **Hub**. TektonConfig will create and reconcile the TektonMulticlusterProxyAAE CR automatically; you do not need to create it manually when using TektonConfig. +It is recommended to install this component through [TektonConfig](./TektonConfig.md) by enabling Tekton Kueue with multi-cluster and setting the cluster role to **Hub**. TektonConfig will create and reconcile the TektonMulticlusterProxyAAE CR automatically; you do not need to create it manually when using TektonConfig. ## When is TektonMulticlusterProxyAAE installed? TektonConfig creates and manages TektonMulticlusterProxyAAE only when all of the following are true: -- Scheduler is **not** disabled (`spec.scheduler.disabled` is not `true`). -- Multi-cluster is **enabled** (`spec.scheduler.multi-cluster-disabled` is `false`). -- Cluster role is **Hub** (`spec.scheduler.multi-cluster-role` is `Hub`). +- Tekton Kueue is **not** disabled (`spec.kueue.disabled` is not `true`). +- Multi-cluster is **enabled** (`spec.kueue.multi-cluster-disabled` is `false`). +- Cluster role is **Hub** (`spec.kueue.multi-cluster-role` is `Hub`). On **Spoke** clusters, leave `multi-cluster-role` as `Spoke`; the proxy is not installed there. ## Prerequisites -The proxy is only installed when the [Tekton Scheduler](./TektonScheduler.md) is enabled with multi-cluster (Hub role). **cert-manager** and **Kueue** (and **MultiKueue** for the proxy) are required for the Scheduler and multi-cluster in general; you must install them before enabling the scheduler. For full prerequisites and multi-cluster configuration, see [Tekton Scheduler](./TektonScheduler.md). [TektonConfig](./TektonConfig.md) (Scheduler section) also summarizes this and points to Tekton Scheduler. +The proxy is only installed when the [Tekton Kueue](./TektonKueue.md) is enabled with multi-cluster (Hub role). **cert-manager** and **Kueue** (and **MultiKueue** for the proxy) are required for Tekton Kueue and multi-cluster in general; you must install them before enabling Tekton Kueue. For full prerequisites and multi-cluster configuration, see [Tekton Kueue](./TektonKueue.md). [TektonConfig](./TektonConfig.md) (Tekton Kueue section) also summarizes this and points to Tekton Kueue. If you see a config status error such as: @@ -30,7 +30,7 @@ If you see a config status error such as: Components not in ready state: Please install cert-manager (cert-manager.io/v1) First, the server could not find the requested resource ``` -cert-manager is not installed or its APIs are not available. Install [cert-manager](https://cert-manager.io/docs/installation/) (v1 API) and ensure [Kueue](https://kueue.sigs.k8s.io/) (and for the proxy, MultiKueue) are installed as described in [Tekton Scheduler](./TektonScheduler.md), then re-apply or reconcile TektonConfig. +cert-manager is not installed or its APIs are not available. Install [cert-manager](https://cert-manager.io/docs/installation/) (v1 API) and ensure [Kueue](https://kueue.sigs.k8s.io/) (and for the proxy, MultiKueue) are installed as described in [Tekton Kueue](./TektonKueue.md), then re-apply or reconcile TektonConfig. - The proxy’s readiness endpoint returns ready only when at least one worker cluster is registered; ensure you have at least one valid `MultiKueueCluster` (and corresponding kubeconfig secret in `kueue-system`) if you want the proxy to report Ready. @@ -38,7 +38,7 @@ cert-manager is not installed or its APIs are not available. Install [cert-manag The TektonMulticlusterProxyAAE CR is cluster-scoped. When managed by TektonConfig, the operator creates a single instance named `multicluster-proxy-aae`. -Example (for reference; TektonConfig creates this when scheduler multi-cluster Hub is enabled): +Example (for reference; TektonConfig creates this when kueue multi-cluster Hub is enabled): ```yaml apiVersion: operator.tekton.dev/v1alpha1 @@ -72,10 +72,10 @@ kubectl get pods -n -l app.kubernetes.io/component=proxy-aae ## Standalone installation -If you are not using TektonConfig (e.g. you manage scheduler and multi-cluster yourself), you can create a TektonMulticlusterProxyAAE CR manually. Ensure the cluster has Kueue and MultiKueue APIs and that the operator is installed; the operator will reconcile the CR and deploy the proxy in the specified `targetNamespace`. +If you are not using TektonConfig (e.g. you manage kueue and multi-cluster yourself), you can create a TektonMulticlusterProxyAAE CR manually. Ensure the cluster has Kueue and MultiKueue APIs and that the operator is installed; the operator will reconcile the CR and deploy the proxy in the specified `targetNamespace`. ## Related -- [TektonConfig](./TektonConfig.md) – Scheduler and TektonMulticlusterProxyAAE section -- [Tekton Scheduler](./TektonScheduler.md) – Multi-cluster configuration (Hub / Spoke) +- [TektonConfig](./TektonConfig.md) – Tekton Kueue and TektonMulticlusterProxyAAE section +- [Tekton Kueue](./TektonKueue.md) – Multi-cluster configuration (Hub / Spoke) - [Kueue](https://kueue.sigs.k8s.io/) and [MultiKueue](https://kueue.sigs.k8s.io/docs/concepts/multikueue/) diff --git a/docs/TektonScheduler.md b/docs/TektonScheduler.md index 33d7c7caa7..3ff77c00ac 100644 --- a/docs/TektonScheduler.md +++ b/docs/TektonScheduler.md @@ -1,72 +1,6 @@ -# Tekton Scheduler +# Tekton Scheduler (deprecated) -TektonScheduler custom resource allows user to install and manage [Tekton Scheduler][Scheduler]. - -It is recommended to install the components through [TektonConfig](./TektonConfig.md). - -The TektonScheduler CR is as below: -```yaml -apiVersion: operator.tekton.dev/v1alpha1 -kind: TektonScheduler -metadata: - name: Scheduler -spec: - disabled: true -``` - -### Pre-Requisite - -* Scheduler component internally uses [Kueue](:https://kueue.sigs.k8s.io) for its functioning so it is required to have kueue installed before we can enable the tekton-scheduler. -* Scheduler component also uses [cert-manager](:https://github.com/cert-manager/cert-manager) so you must install the cert-manager CRDs before scheduler can be enabled. - -### Enable Scheduler - -Scheduler component can be enabled by setting the disabled to false in TektonConfig - -```yaml -apiVersion: operator.tekton.dev/v1alpha1 -kind: TektonScheduler -metadata: - name: Scheduler -spec: - disabled: false -``` - -# Multi Cluster Configuration - -If you are working with multi-cluster pipelines then you can enable the same from tekton scheduler config. - -in multi-cluster environment a cluster can play the role of Hub or Spoke. The TektonConfig settings for Scheduler for Hub and Spoke is defined as below - - -### Hub Cluster - -```yaml -apiVersion: operator.tekton.dev/v1alpha1 -kind: TektonScheduler -metadata: - name: Scheduler -spec: - disabled: false - multi-cluster-disabled: false - multi-cluster-role: Hub -``` - -> **Note:** When `multi-cluster-role: Hub` is configured, the operator automatically deploys the [syncer-service](https://github.com/openshift-pipelines/syncer-service) component for multi-cluster synchronization. - -### Spoke Cluster - -```yaml -apiVersion: operator.tekton.dev/v1alpha1 -kind: TektonScheduler -metadata: - name: Scheduler -spec: - disabled: false - multi-cluster-disabled: false - multi-cluster-role: Spoke -``` - -You can install this component using [TektonConfig](./TektonConfig.md) by choosing appropriate `profile`. - -[Scheduler](:https://github.com/konflux-ci/tekton-kueue) +`TektonScheduler` has been replaced by [`TektonKueue`](./TektonKueue.md). +The legacy CRD and `TektonConfig.spec.scheduler` field are retained temporarily +for automatic upgrade migration. Use `TektonKueue` and +`TektonConfig.spec.kueue` for new configuration. diff --git a/go.mod b/go.mod index 8d8a649753..ce8f0dfd34 100644 --- a/go.mod +++ b/go.mod @@ -8,7 +8,6 @@ require ( github.com/cli/go-gh/v2 v2.13.0 github.com/go-logr/zapr v1.3.0 github.com/google/go-cmp v0.7.0 - github.com/konflux-ci/tekton-kueue v0.4.0 github.com/manifestival/client-go-client v0.6.0 github.com/manifestival/manifestival v0.7.2 github.com/markbates/inflect v1.0.4 @@ -23,6 +22,7 @@ require ( github.com/tektoncd/pipeline v1.16.0 github.com/tektoncd/plumbing v0.0.0-20250805154627-25448098dea2 github.com/tektoncd/pruner v0.4.3 + github.com/tektoncd/tekton-kueue v0.4.0 github.com/tektoncd/triggers v0.37.0 go.uber.org/zap v1.28.0 golang.org/x/exp v0.0.0-20260718201538-764159d718ef @@ -41,6 +41,8 @@ require ( sigs.k8s.io/yaml v1.6.0 ) +replace github.com/tektoncd/tekton-kueue => github.com/konflux-ci/tekton-kueue v0.4.0 + replace k8s.io/client-go => k8s.io/client-go v0.35.2 require ( diff --git a/hack/fetch-releases.sh b/hack/fetch-releases.sh index e3d98c649d..a3ff0f4c61 100755 --- a/hack/fetch-releases.sh +++ b/hack/fetch-releases.sh @@ -382,8 +382,8 @@ main() { pruner_version=$(go run ./cmd/tool component-version ${CONFIG} pruner) release_yaml pruner release 00-pruner ${pruner_version} - # Tekton Scheduler - release_yaml_github scheduler + # Tekton Kueue + release_yaml_github kueue # Tekton Multicluster Proxy AAE release_yaml_github multicluster-proxy-aae diff --git a/hack/sync-helm-crds.sh b/hack/sync-helm-crds.sh index f909a4d70c..7a8e39123c 100755 --- a/hack/sync-helm-crds.sh +++ b/hack/sync-helm-crds.sh @@ -98,6 +98,7 @@ assemble_helm_crds \ "operator.tekton.dev_tektonresults.yaml" \ "operator.tekton.dev_tektontriggers.yaml" \ "operator.tekton.dev_tektonpruners.yaml" \ + "operator.tekton.dev_tektonkueues.yaml" \ "operator.tekton.dev_tektonschedulers.yaml" \ "operator.tekton.dev_tektonmulticlusterproxyaaes.yaml" \ "operator.tekton.dev_syncerservices.yaml" @@ -115,6 +116,7 @@ assemble_helm_crds \ "operator.tekton.dev_tektonresults.yaml" \ "operator.tekton.dev_tektontriggers.yaml" \ "operator.tekton.dev_tektonpruners.yaml" \ + "operator.tekton.dev_tektonkueues.yaml" \ "operator.tekton.dev_tektonschedulers.yaml" \ "operator.tekton.dev_tektonmulticlusterproxyaaes.yaml" \ "operator.tekton.dev_syncerservices.yaml" diff --git a/operatorhub/openshift/config.yaml b/operatorhub/openshift/config.yaml index 8ed347aa27..4d25bf5f4d 100644 --- a/operatorhub/openshift/config.yaml +++ b/operatorhub/openshift/config.yaml @@ -238,8 +238,8 @@ image-substitutions: - deploymentName: openshift-pipelines-operator containerName: openshift-pipelines-operator-lifecycle envKeys: - - IMAGE_SCHEDULER_MANAGER - - IMAGE_SCHEDULER_WEBHOOK + - IMAGE_KUEUE_MANAGER + - IMAGE_KUEUE_WEBHOOK - image: registry.redhat.io/openshift-pipelines/pipelines-multicluster-proxy-aae-rhel9@ replaceLocations: envTargets: diff --git a/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml b/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml index 8193199ad6..4b9950d1f4 100644 --- a/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml +++ b/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml @@ -22,7 +22,7 @@ metadata: features.operators.openshift.io/cnf: "false" features.operators.openshift.io/cni: "false" features.operators.openshift.io/csi: "false" - operators.operatorframework.io/internal-objects: '["tektoninstallersets.operator.tekton.dev", "tektonconfigs.operator.tekton.dev","tektonpipelines.operator.tekton.dev","tektontriggers.operator.tekton.dev","tektonaddons.operator.tekton.dev", "tektonresults.operator.tekton.dev", "tektonchains.operator.tekton.dev", "openshiftpipelinesascodes.operator.tekton.dev", "manualapprovalgates.operator.tekton.dev","tektonpruners.operator.tekton.dev","tektonschedulers.operator.tekton.dev","tektonmulticlusterproxyaaes.operator.tekton.dev","syncerservices.operator.tekton.dev","tektondashboards.operator.tekton.dev"]' + operators.operatorframework.io/internal-objects: '["tektoninstallersets.operator.tekton.dev", "tektonconfigs.operator.tekton.dev","tektonpipelines.operator.tekton.dev","tektontriggers.operator.tekton.dev","tektonaddons.operator.tekton.dev", "tektonresults.operator.tekton.dev", "tektonchains.operator.tekton.dev", "openshiftpipelinesascodes.operator.tekton.dev", "manualapprovalgates.operator.tekton.dev","tektonpruners.operator.tekton.dev","tektonkueues.operator.tekton.dev","tektonschedulers.operator.tekton.dev","tektonmulticlusterproxyaaes.operator.tekton.dev","syncerservices.operator.tekton.dev","tektondashboards.operator.tekton.dev"]' repository: https://github.com/tektoncd/operator support: Red Hat labels: @@ -242,8 +242,29 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:label version: v1alpha1 - - description: Represents an installation of latest version of Tekton Scheduler - displayName: Tekton Scheduler + - description: Represents an installation of latest version of Tekton Kueue + displayName: Tekton Kueue + kind: TektonKueue + name: tektonkueues.operator.tekton.dev + resources: + - kind: tektoninstallersets + name: '' + version: v1alpha1 + specDescriptors: + - description: Namespace where Tekton Kueue installed + displayName: Target Namespace + path: targetNamespace + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:label + statusDescriptors: + - description: The version of Tekton Kueue installed + displayName: Version + path: version + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:label + version: v1alpha1 + - description: Deprecated compatibility API; configuration is migrated to TektonKueue + displayName: Tekton Scheduler (deprecated) kind: TektonScheduler name: tektonschedulers.operator.tekton.dev resources: @@ -251,13 +272,13 @@ spec: name: '' version: v1alpha1 specDescriptors: - - description: Namespace where Tekton Scheduler installed + - description: Namespace where Tekton Scheduler was installed displayName: Target Namespace path: targetNamespace x-descriptors: - urn:alm:descriptor:com.tectonic.ui:label statusDescriptors: - - description: The version of Tekton Scheduler installed + - description: The version of Tekton Scheduler previously installed displayName: Version path: version x-descriptors: @@ -384,7 +405,7 @@ spec: - Tekton Results (tech-preview): v0.20.0 - Manual Approval Gate (tech-preview): v0.9.0 - Tekton Pruner: v0.4.3 - - Tekton Scheduler (tech-preview): v0.4.0 + - Tekton Kueue (tech-preview): v0.4.0 - Multicluster Proxy AAE (tech-preview): v0.1.1 ## Getting Started diff --git a/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml.tmpl b/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml.tmpl index 96d3ad5c28..89d9d8c4dc 100644 --- a/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml.tmpl +++ b/operatorhub/openshift/manifests/bases/openshift-pipelines-operator-rh.clusterserviceversion.template.yaml.tmpl @@ -21,7 +21,7 @@ metadata: features.operators.openshift.io/cnf: "false" features.operators.openshift.io/cni: "false" features.operators.openshift.io/csi: "false" - operators.operatorframework.io/internal-objects: '["tektoninstallersets.operator.tekton.dev", "tektonconfigs.operator.tekton.dev","tektonpipelines.operator.tekton.dev","tektontriggers.operator.tekton.dev","tektonaddons.operator.tekton.dev", "tektonresults.operator.tekton.dev", "tektonchains.operator.tekton.dev", "openshiftpipelinesascodes.operator.tekton.dev", "manualapprovalgates.operator.tekton.dev","tektonpruners.operator.tekton.dev","tektonschedulers.operator.tekton.dev","tektonmulticlusterproxyaaes.operator.tekton.dev","syncerservices.operator.tekton.dev","tektondashboards.operator.tekton.dev"]' + operators.operatorframework.io/internal-objects: '["tektoninstallersets.operator.tekton.dev", "tektonconfigs.operator.tekton.dev","tektonpipelines.operator.tekton.dev","tektontriggers.operator.tekton.dev","tektonaddons.operator.tekton.dev", "tektonresults.operator.tekton.dev", "tektonchains.operator.tekton.dev", "openshiftpipelinesascodes.operator.tekton.dev", "manualapprovalgates.operator.tekton.dev","tektonpruners.operator.tekton.dev","tektonkueues.operator.tekton.dev","tektonschedulers.operator.tekton.dev","tektonmulticlusterproxyaaes.operator.tekton.dev","syncerservices.operator.tekton.dev","tektondashboards.operator.tekton.dev"]' repository: https://github.com/tektoncd/operator support: Red Hat labels: @@ -241,8 +241,29 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:label version: v1alpha1 - - description: Represents an installation of latest version of Tekton Scheduler - displayName: Tekton Scheduler + - description: Represents an installation of latest version of Tekton Kueue + displayName: Tekton Kueue + kind: TektonKueue + name: tektonkueues.operator.tekton.dev + resources: + - kind: tektoninstallersets + name: '' + version: v1alpha1 + specDescriptors: + - description: Namespace where Tekton Kueue installed + displayName: Target Namespace + path: targetNamespace + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:label + statusDescriptors: + - description: The version of Tekton Kueue installed + displayName: Version + path: version + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:label + version: v1alpha1 + - description: Deprecated compatibility API; configuration is migrated to TektonKueue + displayName: Tekton Scheduler (deprecated) kind: TektonScheduler name: tektonschedulers.operator.tekton.dev resources: @@ -250,13 +271,13 @@ spec: name: '' version: v1alpha1 specDescriptors: - - description: Namespace where Tekton Scheduler installed + - description: Namespace where Tekton Scheduler was installed displayName: Target Namespace path: targetNamespace x-descriptors: - urn:alm:descriptor:com.tectonic.ui:label statusDescriptors: - - description: The version of Tekton Scheduler installed + - description: The version of Tekton Scheduler previously installed displayName: Version path: version x-descriptors: @@ -383,7 +404,7 @@ spec: - Tekton Results (tech-preview): {{ with index .Versions "results"}}{{ .Version }}{{end}} - Manual Approval Gate (tech-preview): {{ with index .Versions "manual-approval-gate"}}{{ .Version }}{{end}} - Tekton Pruner: {{ with index .Versions "pruner"}}{{ .Version }}{{end}} - - Tekton Scheduler (tech-preview): {{ with index .Versions "scheduler"}}{{ .Version }}{{end}} + - Tekton Kueue (tech-preview): {{ with index .Versions "kueue"}}{{ .Version }}{{end}} - Multicluster Proxy AAE (tech-preview): {{ with index .Versions "multicluster-proxy-aae"}}{{ .Version }}{{end}} ## Getting Started diff --git a/operatorhub/openshift/release-artifacts/bundle/manifests/openshift-pipelines-operator-rh.clusterserviceversion.yaml b/operatorhub/openshift/release-artifacts/bundle/manifests/openshift-pipelines-operator-rh.clusterserviceversion.yaml index ddf4c64be2..b43654de1b 100644 --- a/operatorhub/openshift/release-artifacts/bundle/manifests/openshift-pipelines-operator-rh.clusterserviceversion.yaml +++ b/operatorhub/openshift/release-artifacts/bundle/manifests/openshift-pipelines-operator-rh.clusterserviceversion.yaml @@ -57,7 +57,7 @@ metadata: certified: 'false' console.openshift.io/plugins: '["pipelines-console-plugin"]' containerImage: registry.redhat.io/openshift-pipelines/pipelines-rhel9-operator@ - createdAt: '2026-09-07T10:58:53Z' + createdAt: '2026-09-10T18:48:22Z' description: Red Hat OpenShift Pipelines is a cloud-native CI/CD solution for building pipelines using Tekton concepts which run natively on OpenShift and Kubernetes. @@ -77,7 +77,7 @@ metadata: operators.operatorframework.io/internal-objects: '["tektoninstallersets.operator.tekton.dev", "tektonconfigs.operator.tekton.dev","tektonpipelines.operator.tekton.dev","tektontriggers.operator.tekton.dev","tektonaddons.operator.tekton.dev", "tektonresults.operator.tekton.dev", "tektonchains.operator.tekton.dev", "openshiftpipelinesascodes.operator.tekton.dev", - "manualapprovalgates.operator.tekton.dev","tektonpruners.operator.tekton.dev","tektonschedulers.operator.tekton.dev","tektonmulticlusterproxyaaes.operator.tekton.dev","syncerservices.operator.tekton.dev","tektondashboards.operator.tekton.dev"]' + "manualapprovalgates.operator.tekton.dev","tektonpruners.operator.tekton.dev","tektonkueues.operator.tekton.dev","tektonschedulers.operator.tekton.dev","tektonmulticlusterproxyaaes.operator.tekton.dev","syncerservices.operator.tekton.dev","tektondashboards.operator.tekton.dev"]' operators.operatorframework.io/project_layout: unknown repository: https://github.com/tektoncd/operator support: Red Hat @@ -290,6 +290,27 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:label version: v1alpha1 + - description: Represents an installation of latest version of Tekton Kueue + displayName: Tekton Kueue + kind: TektonKueue + name: tektonkueues.operator.tekton.dev + resources: + - kind: tektoninstallersets + name: '' + version: v1alpha1 + specDescriptors: + - description: Namespace where Tekton Kueue installed + displayName: Target Namespace + path: targetNamespace + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:label + statusDescriptors: + - description: The version of Tekton Kueue installed + displayName: Version + path: version + x-descriptors: + - urn:alm:descriptor:com.tectonic.ui:label + version: v1alpha1 - description: Represents an installation of the multicluster-proxy-aae component for multi-cluster displayName: Tekton Multicluster Proxy AAE @@ -375,8 +396,8 @@ spec: x-descriptors: - urn:alm:descriptor:com.tectonic.ui:label version: v1alpha1 - - description: Represents an installation of latest version of Tekton Scheduler - displayName: Tekton Scheduler + - description: Deprecated compatibility API; configuration is migrated to TektonKueue + displayName: Tekton Scheduler (deprecated) kind: TektonScheduler name: tektonschedulers.operator.tekton.dev resources: @@ -384,13 +405,13 @@ spec: name: '' version: v1alpha1 specDescriptors: - - description: Namespace where Tekton Scheduler installed + - description: Namespace where Tekton Scheduler was installed displayName: Target Namespace path: targetNamespace x-descriptors: - urn:alm:descriptor:com.tectonic.ui:label statusDescriptors: - - description: The version of Tekton Scheduler installed + - description: The version of Tekton Scheduler previously installed displayName: Version path: version x-descriptors: @@ -477,7 +498,7 @@ spec: - Tekton Pruner: v0.4.3 - - Tekton Scheduler (tech-preview): v0.4.0 + - Tekton Kueue (tech-preview): v0.4.0 - Multicluster Proxy AAE (tech-preview): v0.1.1 @@ -910,6 +931,46 @@ spec: spec: clusterPermissions: - rules: + - apiGroups: + - kueue.x-k8s.io + resources: + - resourceflavors + - workloads + - workloads/finalizers + - workloads/status + - workloadpriorityclasses + - multikueueclusters + verbs: + - get + - list + - create + - update + - delete + - patch + - watch + - apiGroups: + - scheduling.k8s.io + resources: + - priorityclasses + verbs: + - get + - list + - watch + - apiGroups: + - cert-manager.io + resources: + - certificates + - issuers + verbs: + - get + - create + - update + - delete + - list + - nonResourceURLs: + - /metrics + verbs: + - get - apiGroups: - '' resources: @@ -1307,45 +1368,6 @@ spec: - get - list - watch - - apiGroups: - - kueue.x-k8s.io - resources: - - resourceflavors - - workloads - - workloads/finalizers - - workloads/status - - workloadpriorityclasses - - multikueueclusters - verbs: - - get - - list - - create - - update - - delete - - patch - - watch - - apiGroups: - - scheduling.k8s.io - resources: - - priorityclasses - verbs: - - get - - list - - watch - - apiGroups: - - cert-manager.io - resources: - - certificates - - issuers - verbs: - - get - - create - - update - - list - - nonResourceURLs: - - /metrics - verbs: - - get serviceAccountName: openshift-pipelines-operator deployments: - label: @@ -1368,7 +1390,7 @@ spec: containers: - args: - -controllers - - tektonconfig,tektonpipeline,tektontrigger,tektonchain,tektonaddon,tektonresult,openshiftpipelinesascode,manualapprovalgate,tektonpruner,tektonscheduler,tektonmulticlusterproxyaae,syncerservice + - tektonconfig,tektonpipeline,tektontrigger,tektonchain,tektonaddon,tektonresult,openshiftpipelinesascode,manualapprovalgate,tektonpruner,tektonkueue,tektonmulticlusterproxyaae,syncerservice - -unique-process-name - tekton-operator-lifecycle env: @@ -1502,9 +1524,9 @@ spec: value: registry.redhat.io/openshift-pipelines/pipelines-manual-approval-gate-rhel9@ - name: IMAGE_PRUNER_CONTROLLER value: registry.redhat.io/openshift-pipelines/pipelines-pruner-controller-rhel9@ - - name: IMAGE_SCHEDULER_MANAGER + - name: IMAGE_KUEUE_MANAGER value: registry.redhat.io/openshift-pipelines/pipelines-scheduler-controller-rhel9@ - - name: IMAGE_SCHEDULER_WEBHOOK + - name: IMAGE_KUEUE_WEBHOOK value: registry.redhat.io/openshift-pipelines/pipelines-scheduler-controller-rhel9@ - name: IMAGE_MULTICLUSTERPROXYAAE_PROXY_AAE value: registry.redhat.io/openshift-pipelines/pipelines-multicluster-proxy-aae-rhel9@ @@ -1777,9 +1799,9 @@ spec: - image: registry.redhat.io/openshift-pipelines/pipelines-pruner-controller-rhel9@ name: IMAGE_PRUNER_CONTROLLER - image: registry.redhat.io/openshift-pipelines/pipelines-scheduler-controller-rhel9@ - name: IMAGE_SCHEDULER_MANAGER + name: IMAGE_KUEUE_MANAGER - image: registry.redhat.io/openshift-pipelines/pipelines-scheduler-controller-rhel9@ - name: IMAGE_SCHEDULER_WEBHOOK + name: IMAGE_KUEUE_WEBHOOK - image: registry.redhat.io/openshift-pipelines/pipelines-multicluster-proxy-aae-rhel9@ name: IMAGE_MULTICLUSTERPROXYAAE_PROXY_AAE - image: registry.redhat.io/openshift-pipelines/pipelines-syncer-service-rhel9@ @@ -1808,4 +1830,5 @@ spec: name: IMAGE_PIPELINES_CONSOLE_PLUGIN - image: registry.redhat.io/openshift-pipelines/pipelines-console-plugin-pf5-rhel9@ name: IMAGE_PIPELINES_CONSOLE_PLUGIN_LEGACY + replaces: 1.6.0 version: 1.7.0 diff --git a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_manualapprovalgates.yaml b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_manualapprovalgates.yaml index 073726bc5a..914a6d990b 100644 --- a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_manualapprovalgates.yaml +++ b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_manualapprovalgates.yaml @@ -50,6 +50,9 @@ spec: type: object spec: properties: + disabled: + description: enable or disable manual approval gate feature + type: boolean networkPolicy: description: |- NetworkPolicy configures NetworkPolicy creation for the controller diff --git a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_multiclusterproxyaaes.yaml b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_multiclusterproxyaaes.yaml deleted file mode 100644 index 4f0b671bbe..0000000000 --- a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_multiclusterproxyaaes.yaml +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2026 The Tekton Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -apiVersion: apiextensions.k8s.io/v1 -kind: CustomResourceDefinition -metadata: - name: tektonmulticlusterproxyaaes.operator.tekton.dev - labels: - version: "devel" - operator.tekton.dev/release: "devel" -spec: - group: operator.tekton.dev - names: - kind: TektonMulticlusterProxyAAE - listKind: TektonMulticlusterProxyAAEList - plural: tektonmulticlusterproxyaaes - singular: tektonmulticlusterproxyaae - preserveUnknownFields: false - scope: Cluster - versions: - - name: v1alpha1 - served: true - storage: true - subresources: - status: {} - additionalPrinterColumns: - - jsonPath: .status.version - name: Version - type: string - - jsonPath: .status.conditions[?(@.type=="Ready")].status - name: Ready - type: string - - jsonPath: .status.conditions[?(@.type=="Ready")].message - name: Reason - type: string - schema: - openAPIV3Schema: - type: object - description: | - TektonMulticlusterProxyAAE configures the Proxy AAE (Aggregated API Extension) from - https://github.com/openshift-pipelines/multicluster-proxy-aae. It provides a unified - Kubernetes API for accessing Tekton resources (TaskRuns, Pods, logs) across multiple - worker clusters managed by MultiKueue. - x-kubernetes-preserve-unknown-fields: true diff --git a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonconfigs.yaml b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonconfigs.yaml index 52f7197b3d..45bf0d907f 100644 --- a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonconfigs.yaml +++ b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonconfigs.yaml @@ -534,6 +534,127 @@ spec: type: object type: array type: object + kueue: + description: To enable Pipeline queueing on Single Cluster or Multiple + Clusters + properties: + config.yaml: + description: |- + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of + side effects a webhook may have. + type: string + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: object + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object + manualApproval: + description: ManualApproval holds the customizable options for the + ManualApprovalGate component + properties: + disabled: + description: enable or disable manual approval gate feature + type: boolean + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of + side effects a webhook may have. + type: string + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: object + type: object multiclusterProxyAAE: description: MulticlusterProxyAAE holds the customizable options for the multicluster-proxy-aae component @@ -577,7 +698,7 @@ spec: NetworkPolicy configures NetworkPolicy resources for the operand namespace. This field is propagated to TektonPipeline, TektonTrigger, TektonChain, TektonPruner, TektonResult, Pipelines-as-Code, and MultiCluster components - (TektonScheduler, TektonMulticlusterProxyAAE, SyncerService). + (TektonKueue, TektonMulticlusterProxyAAE, SyncerService). Other components (Dashboard) do not yet act on this field. properties: disabled: @@ -1383,13 +1504,20 @@ spec: Default: true (opt-out) type: boolean enableMetricsMTLS: - description: | + description: |- EnableMetricsMTLS controls whether Prometheus metrics endpoints use mTLS. - When enabled the operator annotates metric Services for TLS certificate - provisioning, renames ports from http-metrics to https-metrics, mounts - the serving-cert Secret and client-CA ConfigMap into pods, and enforces - client certificate verification. Requires the OpenShift Cluster Monitoring - Operator (CMO). Default: false (opt-in). + When enabled the operator: + - annotates metric Services for automatic TLS certificate provisioning + via the OpenShift service-serving-cert controller + - renames the metrics port from "http-metrics" to "https-metrics" + - mounts the serving-cert Secret and client-CA ConfigMap into Tekton pods + - enforces client certificate verification (RequireAndVerifyClientCert) + + Requires the OpenShift Cluster Monitoring Operator (CMO) to be present, + because the client CA bundle is read from + kube-system/extension-apiserver-authentication. + + Default: false (opt-in). Set to true to activate metrics mTLS. type: boolean pipelinesAsCode: description: PipelinesAsCode allows configuring PipelinesAsCode @@ -1759,15 +1887,17 @@ spec: - is_external_db type: object scheduler: - description: To enable Pipeline Scheduling on Single Cluster or Multiple - Clusters + description: |- + Scheduler is the deprecated predecessor of Kueue. Pre-upgrade migration + copies this configuration to Kueue and clears the field. properties: config.yaml: - description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + description: This holds the config data loaded by tekton-kueue + as config.yaml. properties: cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. properties: expressions: items: @@ -1775,8 +1905,15 @@ spec: type: array type: object multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. type: boolean queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. type: string type: object x-kubernetes-preserve-unknown-fields: true diff --git a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonkueues.yaml b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonkueues.yaml new file mode 100644 index 0000000000..4e6b2c6d3b --- /dev/null +++ b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonkueues.yaml @@ -0,0 +1,691 @@ +apiVersion: apiextensions.k8s.io/v1 +kind: CustomResourceDefinition +metadata: + annotations: + controller-gen.kubebuilder.io/version: v0.18.0 + creationTimestamp: null + name: tektonkueues.operator.tekton.dev +spec: + group: operator.tekton.dev + names: + kind: TektonKueue + listKind: TektonKueueList + plural: tektonkueues + singular: tektonkueue + scope: Cluster + versions: + - additionalPrinterColumns: + - jsonPath: .status.version + name: Version + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].status + name: Ready + type: string + - jsonPath: .status.conditions[?(@.type=="Ready")].message + name: Reason + type: string + name: v1alpha1 + schema: + openAPIV3Schema: + description: TektonKueue is the Schema for the TektonKueue 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: + properties: + config.yaml: + description: |- + This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + match the key here. + properties: + cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. + properties: + expressions: + items: + type: string + type: array + type: object + multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. + type: boolean + queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. + type: string + type: object + x-kubernetes-preserve-unknown-fields: true + disabled: + description: enable or disable TektonKueue Component + type: boolean + multi-cluster-disabled: + type: boolean + multi-cluster-role: + description: |- + MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole + can be one of Hub or Spoke + type: string + networkPolicy: + description: NetworkPolicyConfig configures NetworkPolicy creation + for a Tekton component. + properties: + disabled: + description: |- + Disabled disables all NetworkPolicy creation for this component. + Existing policies are removed on the next reconcile. + type: boolean + policies: + additionalProperties: + description: NetworkPolicySpec provides the specification of + a NetworkPolicy + properties: + egress: + description: |- + egress is a list of egress rules to be applied to the selected pods. Outgoing traffic + is allowed if there are no NetworkPolicies selecting the pod (and cluster policy + otherwise allows the traffic), OR if the traffic matches at least one egress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy limits all outgoing traffic (and serves + solely to ensure that the pods it selects are isolated by default). + This field is beta-level in 1.8 + items: + description: |- + NetworkPolicyEgressRule describes a particular set of traffic that is allowed out of pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and to. + This type is beta-level in 1.8 + properties: + ports: + description: |- + ports is a list of destination ports for outgoing traffic. + Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + format: int32 + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + to: + description: |- + to is a list of destinations for outgoing traffic of pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all destinations (traffic not restricted by + destination). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the to list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ingress: + description: |- + ingress is a list of ingress rules to be applied to the selected pods. + Traffic is allowed to a pod if there are no NetworkPolicies selecting the pod + (and cluster policy otherwise allows the traffic), OR if the traffic source is + the pod's local node, OR if the traffic matches at least one ingress rule + across all of the NetworkPolicy objects whose podSelector matches the pod. If + this field is empty then this NetworkPolicy does not allow any traffic (and serves + solely to ensure that the pods it selects are isolated by default) + items: + description: |- + NetworkPolicyIngressRule describes a particular set of traffic that is allowed to the pods + matched by a NetworkPolicySpec's podSelector. The traffic must match both ports and from. + properties: + from: + description: |- + from is a list of sources which should be able to access the pods selected for this rule. + Items in this list are combined using a logical OR operation. If this field is + empty or missing, this rule matches all sources (traffic not restricted by + source). If this field is present and contains at least one item, this rule + allows traffic only if the traffic matches at least one item in the from list. + items: + description: |- + NetworkPolicyPeer describes a peer to allow traffic to/from. Only certain combinations of + fields are allowed + properties: + ipBlock: + description: |- + ipBlock defines policy on a particular IPBlock. If this field is set then + neither of the other fields can be. + properties: + cidr: + description: |- + cidr is a string representing the IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + type: string + except: + description: |- + except is a slice of CIDRs that should not be included within an IPBlock + Valid examples are "192.168.1.0/24" or "2001:db8::/64" + Except values will be rejected if they are outside the cidr range + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - cidr + type: object + namespaceSelector: + description: |- + namespaceSelector selects namespaces using cluster-scoped labels. This field follows + standard label selector semantics; if present but empty, it selects all namespaces. + + If podSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the namespaces selected by namespaceSelector. + Otherwise it selects all pods in the namespaces selected by namespaceSelector. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + podSelector: + description: |- + podSelector is a label selector which selects pods. This field follows standard label + selector semantics; if present but empty, it selects all pods. + + If namespaceSelector is also set, then the NetworkPolicyPeer as a whole selects + the pods matching podSelector in the Namespaces selected by NamespaceSelector. + Otherwise it selects the pods matching podSelector in the policy's own namespace. + properties: + matchExpressions: + description: matchExpressions is a list + of label selector requirements. The requirements + are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key + that the selector applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + ports: + description: |- + ports is a list of ports which should be made accessible on the pods selected for + this rule. Each item in this list is combined using a logical OR. If this field is + empty or missing, this rule matches all ports (traffic not restricted by port). + If this field is present and contains at least one item, then this rule allows + traffic only if the traffic matches at least one port in the list. + items: + description: NetworkPolicyPort describes a port + to allow traffic on + properties: + endPort: + description: |- + endPort indicates that the range of ports from port to endPort if set, inclusive, + should be allowed by the policy. This field cannot be defined if the port field + is not defined or if the port field is defined as a named (string) port. + The endPort must be equal or greater than port. + format: int32 + type: integer + port: + anyOf: + - type: integer + - type: string + description: |- + port represents the port on the given protocol. This can either be a numerical or named + port on a pod. If this field is not provided, this matches all port names and + numbers. + If present, only traffic on the specified protocol AND port will be matched. + x-kubernetes-int-or-string: true + protocol: + description: |- + protocol represents the protocol (TCP, UDP, or SCTP) which traffic must match. + If not specified, this field defaults to TCP. + type: string + type: object + type: array + x-kubernetes-list-type: atomic + type: object + type: array + x-kubernetes-list-type: atomic + podSelector: + description: |- + podSelector selects the pods to which this NetworkPolicy object applies. + The array of rules is applied to any pods selected by this field. An empty + selector matches all pods in the policy's namespace. + Multiple network policies can select the same set of pods. In this case, + the ingress rules for each are combined additively. + This field is optional. If it is not specified, it defaults to an empty selector. + properties: + matchExpressions: + description: matchExpressions is a list of label selector + requirements. The requirements are ANDed. + items: + description: |- + A label selector requirement is a selector that contains values, a key, and an operator that + relates the key and values. + properties: + key: + description: key is the label key that the selector + applies to. + type: string + operator: + description: |- + operator represents a key's relationship to a set of values. + Valid operators are In, NotIn, Exists and DoesNotExist. + type: string + values: + description: |- + values is an array of string values. If the operator is In or NotIn, + the values array must be non-empty. If the operator is Exists or DoesNotExist, + the values array must be empty. This array is replaced during a strategic + merge patch. + items: + type: string + type: array + x-kubernetes-list-type: atomic + required: + - key + - operator + type: object + type: array + x-kubernetes-list-type: atomic + matchLabels: + additionalProperties: + type: string + description: |- + matchLabels is a map of {key,value} pairs. A single {key,value} in the matchLabels + map is equivalent to an element of matchExpressions, whose key field is "key", the + operator is "In", and the values array contains only "value". The requirements are ANDed. + type: object + type: object + x-kubernetes-map-type: atomic + policyTypes: + description: |- + policyTypes is a list of rule types that the NetworkPolicy relates to. + Valid options are ["Ingress"], ["Egress"], or ["Ingress", "Egress"]. + If this field is not specified, it will default based on the existence of ingress or egress rules; + policies that contain an egress section are assumed to affect egress, and all policies + (whether or not they contain an ingress section) are assumed to affect ingress. + If you want to write an egress-only policy, you must explicitly specify policyTypes [ "Egress" ]. + Likewise, if you want to write a policy that specifies that no egress is allowed, + you must specify a policyTypes value that include "Egress" (since such a policy would not include + an egress section and would otherwise default to just [ "Ingress" ]). + This field is beta-level in 1.8 + items: + description: |- + PolicyType string describes the NetworkPolicy type + This type is beta-level in 1.8 + type: string + type: array + x-kubernetes-list-type: atomic + type: object + description: |- + Policies merges with the operator's default NetworkPolicies by name. + A key matching a default policy name replaces that default entirely. + A key not matching any default is added alongside the defaults. + If nil or empty, all operator defaults are applied unchanged. + type: object + x-kubernetes-preserve-unknown-fields: true + type: object + options: + description: options holds additions fields and these fields will + be updated on the manifests + properties: + configMaps: + x-kubernetes-preserve-unknown-fields: true + deployments: + x-kubernetes-preserve-unknown-fields: true + disabled: + type: boolean + horizontalPodAutoscalers: + x-kubernetes-preserve-unknown-fields: true + statefulSets: + x-kubernetes-preserve-unknown-fields: true + webhookConfigurationOptions: + additionalProperties: + description: WebhookOptions defines options for webhooks + properties: + failurePolicy: + description: FailurePolicyType specifies a failure policy + that defines how unrecognized errors from the admission + endpoint are handled. + type: string + sideEffects: + description: SideEffectClass specifies the types of side + effects a webhook may have. + type: string + timeoutSeconds: + format: int32 + type: integer + type: object + type: object + type: object + targetNamespace: + description: TargetNamespace is where resources will be installed + type: string + required: + - config.yaml + - disabled + - multi-cluster-disabled + - multi-cluster-role + type: object + status: + description: TektonKueueStatus defines the observed state of TektonKueue + properties: + annotations: + additionalProperties: + type: string + description: |- + Annotations is additional Status fields for the Resource to save some + additional State as well as convey more information to the user. This is + roughly akin to Annotations on any k8s resource, just the reconciler conveying + richer information outwards. + type: object + conditions: + description: Conditions the latest available observations of a resource's + current state. + items: + description: |- + Condition defines a readiness condition for a Knative resource. + See: https://github.com/kubernetes/community/blob/master/contributors/devel/sig-architecture/api-conventions.md#typical-status-properties + properties: + lastTransitionTime: + description: |- + LastTransitionTime is the last time the condition transitioned from one status to another. + We use VolatileTime in place of metav1.Time to exclude this from creating equality.Semantic + differences (all other things held constant). + type: string + message: + description: A human readable message indicating details about + the transition. + type: string + reason: + description: The reason for the condition's last transition. + type: string + severity: + description: |- + Severity with which to treat failures of this type of condition. + When this is not specified, it defaults to Error. + type: string + status: + description: Status of the condition, one of True, False, Unknown. + type: string + type: + description: Type of condition. + type: string + required: + - status + - type + type: object + type: array + observedGeneration: + description: |- + ObservedGeneration is the 'Generation' of the Service that + was last processed by the controller. + format: int64 + type: integer + tekton-kueue: + description: The current installer set name for TektonKueue + type: string + version: + description: The version of the installed release + type: string + type: object + type: object + served: true + storage: true + subresources: + status: {} +status: + acceptedNames: + kind: "" + plural: "" + conditions: null + storedVersions: null diff --git a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonschedulers.yaml b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonschedulers.yaml index e6680ac007..a72e892b33 100644 --- a/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonschedulers.yaml +++ b/operatorhub/openshift/release-artifacts/bundle/manifests/operator.tekton.dev_tektonschedulers.yaml @@ -27,7 +27,10 @@ spec: name: v1alpha1 schema: openAPIV3Schema: - description: TektonScheduler is the Schema for the TektonScheduler API + description: |- + TektonScheduler is the deprecated predecessor of TektonKueue. It is retained + temporarily so existing resources remain readable while pre-upgrade migration + copies their configuration to TektonKueue. properties: apiVersion: description: |- @@ -47,13 +50,16 @@ spec: metadata: type: object spec: + description: TektonSchedulerSpec defines the desired state of the deprecated + TektonScheduler API. properties: config.yaml: - description: |- - This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - match the key here + description: This holds the config data loaded by tekton-kueue as + config.yaml. properties: cel: + description: CEL contains optional CEL expressions for dynamic + PipelineRun mutation. properties: expressions: items: @@ -61,8 +67,15 @@ spec: type: array type: object multiKueueOverride: + description: |- + MultiKueueOverride, when true, sets the PipelineRun's managedBy field + to "kueue.x-k8s.io/multikueue", enabling Kueue to dispatch the + PipelineRun to a remote worker cluster. type: boolean queueName: + description: |- + QueueName is the Kueue LocalQueue that PipelineRuns are assigned to. + This is set as the "kueue.x-k8s.io/queue-name" label on each PipelineRun. type: string type: object x-kubernetes-preserve-unknown-fields: true @@ -608,7 +621,8 @@ spec: - multi-cluster-role type: object status: - description: TektonSchedulerStatus defines the observed state of TektonScheduler + description: TektonSchedulerStatus defines the observed state of the deprecated + TektonScheduler API. properties: annotations: additionalProperties: diff --git a/pkg/apis/operator/v1alpha1/const.go b/pkg/apis/operator/v1alpha1/const.go index 9266323011..cd3d613c1a 100644 --- a/pkg/apis/operator/v1alpha1/const.go +++ b/pkg/apis/operator/v1alpha1/const.go @@ -119,22 +119,24 @@ var ( ) const ( - ConfigResourceName = "config" - PipelineResourceName = "pipeline" - OperandTektoncdPipeline = "tektoncd-pipelines" - TriggerResourceName = "trigger" - OperandTektoncdTriggers = "tektoncd-triggers" - DashboardResourceName = "dashboard" - OperandTektoncdDashboard = "tektoncd-dashboard" - AddonResourceName = "addon" - ResultResourceName = "result" - OperandTektoncdResults = "tektoncd-results" - ChainResourceName = "chain" - OperandTektoncdChains = "tektoncd-chains" - OpenShiftPipelinesAsCodeName = "pipelines-as-code" - ManualApprovalGates = "manual-approval-gate" - PrunerResourceName = "tektoncd-pruner" - TektonPrunerResourceName = "pruner" + ConfigResourceName = "config" + PipelineResourceName = "pipeline" + OperandTektoncdPipeline = "tektoncd-pipelines" + TriggerResourceName = "trigger" + OperandTektoncdTriggers = "tektoncd-triggers" + DashboardResourceName = "dashboard" + OperandTektoncdDashboard = "tektoncd-dashboard" + AddonResourceName = "addon" + ResultResourceName = "result" + OperandTektoncdResults = "tektoncd-results" + ChainResourceName = "chain" + OperandTektoncdChains = "tektoncd-chains" + OpenShiftPipelinesAsCodeName = "pipelines-as-code" + ManualApprovalGates = "manual-approval-gate" + PrunerResourceName = "tektoncd-pruner" + TektonPrunerResourceName = "pruner" + TektonKueueResourceName = "kueue" + // TektonSchedulerResourceName is retained for deprecated API compatibility. TektonSchedulerResourceName = "scheduler" MultiClusterProxyAAEResourceName = "multicluster-proxy-aae" SyncerServiceResourceName = "syncer-service" diff --git a/pkg/apis/operator/v1alpha1/register.go b/pkg/apis/operator/v1alpha1/register.go index a04659ef00..6fd4da8b1c 100644 --- a/pkg/apis/operator/v1alpha1/register.go +++ b/pkg/apis/operator/v1alpha1/register.go @@ -62,7 +62,10 @@ const ( // KindTektonPruner is the Kind of TektonPruner in a GVK context. KindTektonPruner = "TektonPruner" - // KindTektonScheduler is the Kind of TektonScheduler in a GVK context. + // KindTektonKueue is the Kind of TektonKueue in a GVK context. + KindTektonKueue = "TektonKueue" + + // KindTektonScheduler is retained for deprecated API compatibility. KindTektonScheduler = "TektonScheduler" // KindTektonMulticlusterProxyAAE is the Kind of TektonMulticlusterProxyAAE in a GVK context. @@ -103,6 +106,8 @@ func addKnownTypes(s *runtime.Scheme) error { &ManualApprovalGateList{}, &TektonPruner{}, &TektonPrunerList{}, + &TektonKueue{}, + &TektonKueueList{}, &TektonScheduler{}, &TektonSchedulerList{}, &TektonMulticlusterProxyAAE{}, diff --git a/pkg/apis/operator/v1alpha1/tektonconfig_default_test.go b/pkg/apis/operator/v1alpha1/tektonconfig_default_test.go index 13388b8b97..4cb05da2db 100644 --- a/pkg/apis/operator/v1alpha1/tektonconfig_default_test.go +++ b/pkg/apis/operator/v1alpha1/tektonconfig_default_test.go @@ -18,9 +18,11 @@ package v1alpha1 import ( "context" + "encoding/json" "testing" "github.com/google/go-cmp/cmp" + "github.com/tektoncd/tekton-kueue/pkg/config" "gotest.tools/v3/assert" "knative.dev/pkg/ptr" @@ -53,6 +55,70 @@ func Test_SetDefaults_OpenShift_MigratesKubernetesPipelinesAsCode(t *testing.T) } } +func Test_SetDefaults_MigratesDeprecatedScheduler(t *testing.T) { + legacy := Scheduler{ + Disabled: ptr.Bool(false), + SchedulerConfig: SchedulerConfig{Config: config.Config{ + QueueName: "legacy-queue", + }}, + } + tc := &TektonConfig{Spec: TektonConfigSpec{Scheduler: legacy}} + + tc.SetDefaults(context.TODO()) + + if diff := cmp.Diff(legacy.ToKueue(), tc.Spec.Kueue); diff != "" { + t.Fatalf("migrated kueue config differs (-want, +got): %s", diff) + } + if diff := cmp.Diff(Scheduler{}, tc.Spec.Scheduler); diff != "" { + t.Fatalf("deprecated scheduler field was not cleared (-want, +got): %s", diff) + } + data, err := json.Marshal(tc.Spec) + if err != nil { + t.Fatal(err) + } + var raw map[string]json.RawMessage + if err := json.Unmarshal(data, &raw); err != nil { + t.Fatal(err) + } + if _, ok := raw["scheduler"]; ok { + t.Fatalf("deprecated scheduler field remains in serialized spec: %s", data) + } +} + +func Test_SetDefaults_MigratesEnabledSchedulerWithoutQueue(t *testing.T) { + tc := &TektonConfig{Spec: TektonConfigSpec{Scheduler: Scheduler{ + Disabled: ptr.Bool(false), + }}} + + tc.SetDefaults(context.TODO()) + + if tc.Spec.Kueue.IsDisabled() { + t.Fatal("migrated kueue was disabled") + } + if tc.Spec.Kueue.QueueName != "" { + t.Fatalf("queue name = %q, want empty", tc.Spec.Kueue.QueueName) + } + if diff := cmp.Diff(Scheduler{}, tc.Spec.Scheduler); diff != "" { + t.Fatalf("deprecated scheduler field was not cleared (-want, +got): %s", diff) + } +} + +func TestMigrateSchedulerKeepsExplicitKueue(t *testing.T) { + legacy := Scheduler{Disabled: ptr.Bool(false)} + explicit := Kueue{Disabled: ptr.Bool(true)} + spec := TektonConfigSpec{Scheduler: legacy, Kueue: explicit} + + if !spec.MigrateScheduler() { + t.Fatal("expected deprecated scheduler field to be migrated") + } + if diff := cmp.Diff(explicit, spec.Kueue); diff != "" { + t.Fatalf("explicit kueue config was overwritten (-want, +got): %s", diff) + } + if diff := cmp.Diff(Scheduler{}, spec.Scheduler); diff != "" { + t.Fatalf("deprecated scheduler field was not cleared (-want, +got): %s", diff) + } +} + func Test_SetDefaults_Profile(t *testing.T) { tc := &TektonConfig{ diff --git a/pkg/apis/operator/v1alpha1/tektonconfig_defaults.go b/pkg/apis/operator/v1alpha1/tektonconfig_defaults.go index 06a55bde56..906e414a3d 100644 --- a/pkg/apis/operator/v1alpha1/tektonconfig_defaults.go +++ b/pkg/apis/operator/v1alpha1/tektonconfig_defaults.go @@ -18,12 +18,26 @@ package v1alpha1 import ( "context" + "reflect" "strings" "knative.dev/pkg/logging" "knative.dev/pkg/ptr" ) +// MigrateScheduler copies the deprecated scheduler configuration to kueue. +// An explicitly configured kueue field takes precedence. +func (spec *TektonConfigSpec) MigrateScheduler() bool { + if reflect.DeepEqual(spec.Scheduler, Scheduler{}) { + return false + } + if reflect.DeepEqual(spec.Kueue, Kueue{}) { + spec.Kueue = spec.Scheduler.ToKueue() + } + spec.Scheduler = Scheduler{} + return true +} + func (tc *TektonConfig) SetDefaults(ctx context.Context) { if tc.Spec.Profile == "" { tc.Spec.Profile = ProfileBasic @@ -33,7 +47,8 @@ func (tc *TektonConfig) SetDefaults(ctx context.Context) { tc.Spec.Chain.setDefaults() tc.Spec.Result.setDefaults() tc.Spec.TektonPruner.SetDefaults() - tc.Spec.Scheduler.SetDefaults() + tc.Spec.MigrateScheduler() + tc.Spec.Kueue.SetDefaults() tc.Spec.ManualApproval.setDefaults() if IsOpenShiftPlatform() { diff --git a/pkg/apis/operator/v1alpha1/tektonconfig_types.go b/pkg/apis/operator/v1alpha1/tektonconfig_types.go index 892f2f7393..1eff2360e2 100644 --- a/pkg/apis/operator/v1alpha1/tektonconfig_types.go +++ b/pkg/apis/operator/v1alpha1/tektonconfig_types.go @@ -97,9 +97,13 @@ type TektonConfigSpec struct { Pruner Prune `json:"pruner,omitempty"` // New EventBasedPruner which provides more granular control over TaskRun and PipelineRuns TektonPruner Pruner `json:"tektonpruner,omitempty"` - // To enable Pipeline Scheduling on Single Cluster or Multiple Clusters + // To enable Pipeline queueing on Single Cluster or Multiple Clusters // +optional - Scheduler Scheduler `json:"scheduler,omitempty"` + Kueue Kueue `json:"kueue,omitempty"` + // Scheduler is the deprecated predecessor of Kueue. Pre-upgrade migration + // copies this configuration to Kueue and clears the field. + // +optional + Scheduler Scheduler `json:"scheduler,omitempty,omitzero"` CommonSpec `json:",inline"` // Addon holds the addons config // +optional @@ -140,7 +144,7 @@ type TektonConfigSpec struct { // NetworkPolicy configures NetworkPolicy resources for the operand namespace. // This field is propagated to TektonPipeline, TektonTrigger, TektonChain, // TektonPruner, TektonResult, Pipelines-as-Code, and MultiCluster components - // (TektonScheduler, TektonMulticlusterProxyAAE, SyncerService). + // (TektonKueue, TektonMulticlusterProxyAAE, SyncerService). // Other components (Dashboard) do not yet act on this field. // +optional NetworkPolicy NetworkPolicyConfig `json:"networkPolicy,omitempty"` diff --git a/pkg/apis/operator/v1alpha1/tektonkueue_defaults.go b/pkg/apis/operator/v1alpha1/tektonkueue_defaults.go new file mode 100644 index 0000000000..5c75c1dfa2 --- /dev/null +++ b/pkg/apis/operator/v1alpha1/tektonkueue_defaults.go @@ -0,0 +1,47 @@ +/* +Copyright 2026 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "context" + + "github.com/tektoncd/tekton-kueue/pkg/common" + "k8s.io/utils/ptr" +) + +const ( + KueueConfigMapName = common.ConfigMapName + KueueConfigInstallerSet = "kueue-config" + DefaultQueueName = "pipelines-queue" + DefaultMultiClusterDisabled = true + DefaultKueueDisabled = true + KueueCreatedByValue = "TektonKueue" + MultiClusterRoleSpoke MultiClusterRole = "Spoke" + MultiClusterRoleHub MultiClusterRole = "Hub" +) + +func (tp *TektonKueue) SetDefaults(_ context.Context) { + tp.Spec.Kueue.SetDefaults() +} + +func (s *Kueue) SetDefaults() { + if s.Disabled == nil { + s.Disabled = ptr.To(DefaultKueueDisabled) + s.MultiClusterDisabled = DefaultMultiClusterDisabled + s.QueueName = DefaultQueueName + } +} diff --git a/pkg/apis/operator/v1alpha1/tektonkueue_lifecycle.go b/pkg/apis/operator/v1alpha1/tektonkueue_lifecycle.go new file mode 100644 index 0000000000..016c1bd6c3 --- /dev/null +++ b/pkg/apis/operator/v1alpha1/tektonkueue_lifecycle.go @@ -0,0 +1,148 @@ +/* +Copyright 2026 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "k8s.io/apimachinery/pkg/runtime/schema" + "knative.dev/pkg/apis" +) + +var ( + _ TektonComponentStatus = (*TektonKueueStatus)(nil) +) + +// GroupVersionKind returns SchemeGroupVersion of a TektonKueue +func (Kueue *TektonKueue) GroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind(KindTektonKueue) +} + +func (Kueue *TektonKueue) GetGroupVersionKind() schema.GroupVersionKind { + return SchemeGroupVersion.WithKind(KindTektonKueue) +} + +// GetCondition returns the current condition of a given condition type +func (Kueue *TektonKueueStatus) GetCondition(t apis.ConditionType) *apis.Condition { + return condSet.Manage(Kueue).GetCondition(t) +} + +// InitializeConditions initializes conditions of an TektonKueueStatus +func (Kueue *TektonKueueStatus) InitializeConditions() { + condSet.Manage(Kueue).InitializeConditions() +} + +// IsReady looks at the conditions returns true if they are all true. +func (Kueue *TektonKueueStatus) IsReady() bool { + return condSet.Manage(Kueue).IsHappy() +} + +func (Kueue *TektonKueueStatus) MarkPreReconcilerComplete() { + condSet.Manage(Kueue).MarkTrue(PreReconciler) +} + +func (Kueue *TektonKueueStatus) MarkInstallerSetAvailable() { + condSet.Manage(Kueue).MarkTrue(InstallerSetAvailable) +} + +func (Kueue *TektonKueueStatus) MarkInstallerSetReady() { + condSet.Manage(Kueue).MarkTrue(InstallerSetReady) +} + +func (Kueue *TektonKueueStatus) MarkPostReconcilerComplete() { + condSet.Manage(Kueue).MarkTrue(PostReconciler) +} + +// MarkDependenciesInstalled marks the DependenciesInstalled status as true. +func (Kueue *TektonKueueStatus) MarkDependenciesInstalled() { + condSet.Manage(Kueue).MarkTrue(DependenciesInstalled) +} + +func (Kueue *TektonKueueStatus) MarkNotReady(msg string) { + condSet.Manage(Kueue).MarkFalse( + apis.ConditionReady, + "Error", + "Ready: %s", msg) +} + +func (Kueue *TektonKueueStatus) MarkPreReconcilerFailed(msg string) { + Kueue.MarkNotReady("PreReconciliation failed") + condSet.Manage(Kueue).MarkFalse( + PreReconciler, + "Error", + "PreReconciliation failed with message: %s", msg) +} + +func (Kueue *TektonKueueStatus) MarkInstallerSetNotAvailable(msg string) { + Kueue.MarkNotReady("TektonKueue not ready") + condSet.Manage(Kueue).MarkFalse( + InstallerSetAvailable, + "Error", + "Installer set not ready: %s", msg) +} + +func (Kueue *TektonKueueStatus) MarkInstallerSetNotReady(msg string) { + Kueue.MarkNotReady("TektonKueue not ready") + condSet.Manage(Kueue).MarkFalse( + InstallerSetReady, + "Error", + "Installer set not ready: %s", msg) +} + +func (Kueue *TektonKueueStatus) MarkPostReconcilerFailed(msg string) { + Kueue.MarkNotReady("PostReconciliation failed") + condSet.Manage(Kueue).MarkFalse( + PostReconciler, + "Error", + "PostReconciliation failed with message: %s", msg) +} + +// MarkDependencyInstalling marks the DependenciesInstalled status as false with the +// given message. +func (Kueue *TektonKueueStatus) MarkDependencyInstalling(msg string) { + Kueue.MarkNotReady("Dependencies installing") + condSet.Manage(Kueue).MarkFalse( + DependenciesInstalled, + "Error", + "Dependency installing: %s", msg) +} + +// MarkDependencyMissing marks the DependenciesInstalled status as false with the +// given message. +func (Kueue *TektonKueueStatus) MarkDependencyMissing(msg string) { + Kueue.MarkNotReady("Missing Dependencies for TektonKueue") + condSet.Manage(Kueue).MarkFalse( + DependenciesInstalled, + "Error", + "Dependency missing: %s", msg) +} + +func (Kueue *TektonKueueStatus) GetTektonKueue() string { + return Kueue.TektonKueue +} + +func (Kueue *TektonKueueStatus) SetTektonKueue(installerSet string) { + Kueue.TektonKueue = installerSet +} + +// GetVersion gets the currently installed version of the component. +func (Kueue *TektonKueueStatus) GetVersion() string { + return Kueue.Version +} + +// SetVersion sets the currently installed version of the component. +func (Kueue *TektonKueueStatus) SetVersion(version string) { + Kueue.Version = version +} diff --git a/pkg/apis/operator/v1alpha1/tektonkueue_lifecycle_test.go b/pkg/apis/operator/v1alpha1/tektonkueue_lifecycle_test.go new file mode 100644 index 0000000000..90208c7532 --- /dev/null +++ b/pkg/apis/operator/v1alpha1/tektonkueue_lifecycle_test.go @@ -0,0 +1,90 @@ +/* +Copyright 2026 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "testing" + + "knative.dev/pkg/apis" + apistest "knative.dev/pkg/apis/testing" +) + +func TestTektonKueueStatus_SuccessConditions(t *testing.T) { + tt := &TektonKueueStatus{} + tt.InitializeConditions() + + apistest.CheckConditionOngoing(tt, DependenciesInstalled, t) + apistest.CheckConditionOngoing(tt, PreReconciler, t) + apistest.CheckConditionOngoing(tt, InstallerSetAvailable, t) + apistest.CheckConditionOngoing(tt, InstallerSetReady, t) + apistest.CheckConditionOngoing(tt, PostReconciler, t) + + // Dependencies installed + tt.MarkDependenciesInstalled() + apistest.CheckConditionSucceeded(tt, DependenciesInstalled, t) + + // Pre reconciler completes execution + tt.MarkPreReconcilerComplete() + apistest.CheckConditionSucceeded(tt, PreReconciler, t) + + // Installer set created + tt.MarkInstallerSetAvailable() + apistest.CheckConditionSucceeded(tt, InstallerSetAvailable, t) + + // InstallerSet and then PostReconciler become ready and we're good. + tt.MarkInstallerSetReady() + apistest.CheckConditionSucceeded(tt, InstallerSetReady, t) + + tt.MarkPostReconcilerComplete() + apistest.CheckConditionSucceeded(tt, PostReconciler, t) + + if ready := tt.IsReady(); !ready { + t.Errorf("tt.IsReady() = %v, want true", ready) + } +} + +func TestTektonKueueStatus_ErrorConditions(t *testing.T) { + // Given + tps := &TektonKueueStatus{} + + tps.MarkPreReconcilerFailed("Reconciliation Failed for Kueue") + apistest.CheckConditionFailed(tps, PreReconciler, t) + + // Not Ready Condition + tps.MarkNotReady("Kueue Not Ready") + apistest.CheckConditionFailed(tps, apis.ConditionReady, t) + + // PostReconciler Failed Condition + tps.MarkPostReconcilerFailed("Kueue PostReconciler Failed") + apistest.CheckConditionFailed(tps, PostReconciler, t) + + // InstallerSetNotAvailable Condition + tps.MarkInstallerSetNotAvailable("Kueue InstallerSetNotAvailable ") + apistest.CheckConditionFailed(tps, InstallerSetAvailable, t) + + // InstallerSetNotAvailable Condition + tps.MarkInstallerSetNotReady("Kueue InstallerSetNotReady ") + apistest.CheckConditionFailed(tps, InstallerSetReady, t) + + // DependencyInstalling Condition + tps.MarkDependencyInstalling("Kueue Dependencies are installing ") + apistest.CheckConditionFailed(tps, DependenciesInstalled, t) + + // DependencyMissing Condition + tps.MarkDependencyMissing("Kueue Dependencies are Missing ") + apistest.CheckConditionFailed(tps, DependenciesInstalled, t) +} diff --git a/pkg/apis/operator/v1alpha1/tektonkueue_types.go b/pkg/apis/operator/v1alpha1/tektonkueue_types.go new file mode 100644 index 0000000000..77aac58024 --- /dev/null +++ b/pkg/apis/operator/v1alpha1/tektonkueue_types.go @@ -0,0 +1,121 @@ +/* +Copyright 2026 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "github.com/tektoncd/tekton-kueue/pkg/config" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + duckv1 "knative.dev/pkg/apis/duck/v1" +) + +var ( + _ TektonComponent = (*TektonKueue)(nil) + _ TektonComponentSpec = (*TektonKueueSpec)(nil) +) + +// TektonKueue is the Schema for the TektonKueue API +// +genclient +// +genreconciler:krshapedlogic=false +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +// +genclient:nonNamespaced +// +kubebuilder:object:root=true +// +kubebuilder:resource:scope=Cluster +// +kubebuilder:subresource:status +// +kubebuilder:printcolumn:name="Version",type=string,JSONPath=`.status.version` +// +kubebuilder:printcolumn:name="Ready",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].status` +// +kubebuilder:printcolumn:name="Reason",type=string,JSONPath=`.status.conditions[?(@.type=="Ready")].message` +type TektonKueue struct { + metav1.TypeMeta `json:",inline"` + metav1.ObjectMeta `json:"metadata,omitempty"` + Spec TektonKueueSpec `json:"spec,omitempty"` + Status TektonKueueStatus `json:"status,omitempty"` +} + +// Kueue Configuration to manage Kueue Configuration. +type Kueue struct { + // enable or disable TektonKueue Component + Disabled *bool `json:"disabled"` + KueueConfig `json:",inline"` + MultiClusterConfig `json:",inline"` + // options holds additions fields and these fields will be updated on the manifests + // +optional + Options AdditionalOptions `json:"options"` +} + +type KueueConfig struct { + // This holds the config data from tekton-kueue. ConfigMap in tekton-kueue is loaded as config.yaml so we need to + // match the key here. + // +kubebuilder:pruning:PreserveUnknownFields + config.Config `json:"config.yaml"` +} + +// MultiClusterConfig Configuration to enable/disable MultiCluster Configuration +type MultiClusterConfig struct { + MultiClusterDisabled bool `json:"multi-cluster-disabled"` + MultiClusterRole MultiClusterRole `json:"multi-cluster-role"` +} + +// MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole +// can be one of Hub or Spoke +type MultiClusterRole string + +// TektonKueueList contains a list of TektonKueue +// +kubebuilder:object:root=true +// +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object +type TektonKueueList struct { + metav1.TypeMeta `json:",inline"` + metav1.ListMeta `json:"metadata,omitempty"` + Items []TektonKueue `json:"items"` +} + +type TektonKueueSpec struct { + CommonSpec `json:",inline"` + Kueue `json:",inline"` + // +optional + NetworkPolicy NetworkPolicyConfig `json:"networkPolicy,omitempty"` +} + +// TektonKueueStatus defines the observed state of TektonKueue +type TektonKueueStatus struct { + duckv1.Status `json:",inline"` + + // The version of the installed release + // +optional + Version string `json:"version,omitempty"` + + // The current installer set name for TektonKueue + // +optional + TektonKueue string `json:"tekton-kueue,omitempty"` +} + +// GetSpec implements TektonComponent +func (tp *TektonKueue) GetSpec() TektonComponentSpec { + return &tp.Spec +} + +func (tp *TektonKueue) GetStatus() TektonComponentStatus { + return &tp.Status +} + +// IsDisabled returns true if the TektonKueue is disabled +func (p *Kueue) IsDisabled() bool { + if p == nil || p.Disabled == nil { + // When the Kueue is nil or Disabled is nil, we assume it is the default state. + return DefaultKueueDisabled + } + return *p.Disabled +} diff --git a/pkg/apis/operator/v1alpha1/tektonkueue_validation.go b/pkg/apis/operator/v1alpha1/tektonkueue_validation.go new file mode 100644 index 0000000000..f742036963 --- /dev/null +++ b/pkg/apis/operator/v1alpha1/tektonkueue_validation.go @@ -0,0 +1,54 @@ +/* +Copyright 2026 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "context" + "fmt" + "strings" + + "knative.dev/pkg/apis" +) + +func (ts *TektonKueue) Validate(ctx context.Context) (errs *apis.FieldError) { + + if apis.IsInDelete(ctx) { + return nil + } + + if ts.GetName() != TektonKueueResourceName { + errMsg := fmt.Sprintf("metadata.name, Only one instance of TektonKueue is allowed by name, %s", TektonKueueResourceName) + errs = errs.Also(apis.ErrInvalidValue(ts.GetName(), errMsg)) + } + + // execute common spec validations + errs = errs.Also(ts.Spec.CommonSpec.validate("spec")) + errs = errs.Also(ts.Spec.MultiClusterConfig.validate()) + errs = errs.Also(ts.Spec.NetworkPolicy.validate("spec.networkPolicy")) + return errs +} + +func (mcc *MultiClusterConfig) validate() (errs *apis.FieldError) { + if mcc.MultiClusterDisabled && mcc.MultiClusterRole != "" { + errs = errs.Also(apis.ErrInvalidValue("MultiClusterConfig", "multicluster-role", + "multicluster-role should be blank when MultiClusterConfig.MultiClusterDisabled is true")) + } else if !mcc.MultiClusterDisabled && !(strings.EqualFold(string(mcc.MultiClusterRole), string(MultiClusterRoleHub)) || strings.EqualFold(string(mcc.MultiClusterRole), string(MultiClusterRoleSpoke))) { + errs = errs.Also(apis.ErrInvalidValue("MultiClusterConfig", "multicluster-role", + "multicluster-role should be 'Hub' or 'Spoke' (case-insensitive) when MultiClusterConfig.MultiClusterDisabled is false")) + } + return errs +} diff --git a/pkg/apis/operator/v1alpha1/tektonkueue_validation_test.go b/pkg/apis/operator/v1alpha1/tektonkueue_validation_test.go new file mode 100644 index 0000000000..1c431c90c7 --- /dev/null +++ b/pkg/apis/operator/v1alpha1/tektonkueue_validation_test.go @@ -0,0 +1,155 @@ +/* +Copyright 2023 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +package v1alpha1 + +import ( + "testing" + + "gotest.tools/v3/assert" + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "knative.dev/pkg/ptr" +) + +func TestTektonKueue_Validate(t *testing.T) { + ts := &TektonKueue{ + ObjectMeta: metav1.ObjectMeta{ + Name: "wrong-name", + Namespace: "namespace", + }, + Spec: TektonKueueSpec{ + CommonSpec: CommonSpec{TargetNamespace: "tekton-pipelines"}, + }, + } + ts.SetDefaults(t.Context()) + + err := ts.Validate(t.Context()) + assert.Equal(t, "invalid value: wrong-name: metadata.name, Only one instance of TektonKueue is allowed by name, kueue", err.Error()) +} + +func TestTektonKueue_ValidateMultiClusterDisabled(t *testing.T) { + ts := &TektonKueue{ + ObjectMeta: metav1.ObjectMeta{ + Name: "kueue", + }, + Spec: TektonKueueSpec{ + CommonSpec: CommonSpec{TargetNamespace: "tekton-pipelines"}, + Kueue: Kueue{ + Disabled: ptr.Bool(false), + MultiClusterConfig: MultiClusterConfig{ + MultiClusterDisabled: true, + MultiClusterRole: "Hub", + }, + }, + }, + } + + err := ts.Validate(t.Context()) + assert.ErrorContains(t, err, "invalid value: MultiClusterConfig: multicluster-role") + assert.ErrorContains(t, err, "multicluster-role should be blank when MultiClusterConfig.MultiClusterDisabled is true") + + ts.Spec.MultiClusterRole = "" + err = ts.Validate(t.Context()) + + assert.Equal(t, err.Error(), "") + +} + +func TestTektonKueue_ValidateMultiClusterEnabled(t *testing.T) { + ts := &TektonKueue{ + ObjectMeta: metav1.ObjectMeta{ + Name: "kueue", + }, + Spec: TektonKueueSpec{ + CommonSpec: CommonSpec{TargetNamespace: "tekton-pipelines"}, + Kueue: Kueue{ + Disabled: ptr.Bool(false), + MultiClusterConfig: MultiClusterConfig{ + MultiClusterDisabled: false, + MultiClusterRole: "", + }, + }, + }, + } + + err := ts.Validate(t.Context()) + assert.ErrorContains(t, err, "invalid value: MultiClusterConfig: multicluster-role") + assert.ErrorContains(t, err, "multicluster-role should be 'Hub' or 'Spoke' (case-insensitive) when MultiClusterConfig.MultiClusterDisabled is false") + + ts.Spec.MultiClusterRole = MultiClusterRoleSpoke + err = ts.Validate(t.Context()) + + assert.Equal(t, err.Error(), "") + +} + +func TestTektonKueue_ValidateCommonSpec(t *testing.T) { + ts := &TektonKueue{ + ObjectMeta: metav1.ObjectMeta{Name: "kueue"}, + Spec: TektonKueueSpec{ + CommonSpec: CommonSpec{TargetNamespace: "kube-system"}, + Kueue: Kueue{ + Disabled: ptr.Bool(false), + MultiClusterConfig: MultiClusterConfig{ + MultiClusterDisabled: true, + }, + }, + }, + } + + err := ts.Validate(t.Context()) + assert.ErrorContains(t, err, "spec.targetNamespace") + assert.ErrorContains(t, err, "reserved system namespace") +} + +func TestTektonKueue_ValidateMultiClusterRoleCaseInsensitive(t *testing.T) { + testCases := []struct { + name string + role MultiClusterRole + }{ + {"lowercase hub", "hub"}, + {"uppercase HUB", "HUB"}, + {"mixed case Hub", "Hub"}, + {"lowercase spoke", "spoke"}, + {"uppercase SPOKE", "SPOKE"}, + {"mixed case Spoke", "Spoke"}, + } + + for _, tc := range testCases { + t.Run(tc.name, func(t *testing.T) { + ts := &TektonKueue{ + ObjectMeta: metav1.ObjectMeta{ + Name: "kueue", + }, + Spec: TektonKueueSpec{ + CommonSpec: CommonSpec{TargetNamespace: "tekton-pipelines"}, + Kueue: Kueue{ + Disabled: ptr.Bool(false), + MultiClusterConfig: MultiClusterConfig{ + MultiClusterDisabled: false, + MultiClusterRole: tc.role, + }, + }, + }, + } + + err := ts.Validate(t.Context()) + if err != nil { + t.Fatalf("role %q should be accepted (case-insensitive) but got error: %v", tc.role, err) + } + }) + } +} diff --git a/pkg/apis/operator/v1alpha1/tektonmulticlusterproxyaae_defaults.go b/pkg/apis/operator/v1alpha1/tektonmulticlusterproxyaae_defaults.go index c91191327e..ef805515bc 100644 --- a/pkg/apis/operator/v1alpha1/tektonmulticlusterproxyaae_defaults.go +++ b/pkg/apis/operator/v1alpha1/tektonmulticlusterproxyaae_defaults.go @@ -20,6 +20,6 @@ import ( "context" ) -// No fields are defaulted here as the enablement is driven by TektonScheduler +// No fields are defaulted here as the enablement is driven by TektonKueue // which is multi-cluster-disabled: false and multi-cluster-role: Hub func (t *TektonMulticlusterProxyAAE) SetDefaults(_ context.Context) {} diff --git a/pkg/apis/operator/v1alpha1/tektonscheduler_defaults.go b/pkg/apis/operator/v1alpha1/tektonscheduler_defaults.go index 04cc6851ae..2fe6329344 100644 --- a/pkg/apis/operator/v1alpha1/tektonscheduler_defaults.go +++ b/pkg/apis/operator/v1alpha1/tektonscheduler_defaults.go @@ -5,7 +5,7 @@ Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at - http://www.apache.org/licenses/LICENSE-2.0 + http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, @@ -19,23 +19,19 @@ package v1alpha1 import ( "context" - "github.com/konflux-ci/tekton-kueue/pkg/common" "k8s.io/utils/ptr" ) const ( - SchedulerConfigMapName = common.ConfigMapName - SchedulerConfigInstallerSet = "scheduler-config" - DefaultQueueName = "pipelines-queue" - DefaultMultiClusterDisabled = true - DefaultSchedulerDisabled = true - SchedulerCreatedByValue = "TektonScheduler" - MultiClusterRoleSpoke MultiClusterRole = "Spoke" - MultiClusterRoleHub MultiClusterRole = "Hub" + SchedulerConfigMapName = KueueConfigMapName + SchedulerConfigInstallerSet = "scheduler-config" + DefaultSchedulerDisabled = DefaultKueueDisabled + SchedulerCreatedByValue = "TektonScheduler" ) -func (tp *TektonScheduler) SetDefaults(_ context.Context) { - tp.Spec.Scheduler.SetDefaults() +// SetDefaults retains admission compatibility for the deprecated API. +func (ts *TektonScheduler) SetDefaults(_ context.Context) { + ts.Spec.Scheduler.SetDefaults() } func (s *Scheduler) SetDefaults() { @@ -45,3 +41,11 @@ func (s *Scheduler) SetDefaults() { s.QueueName = DefaultQueueName } } + +// IsDisabled returns true if the deprecated TektonScheduler is disabled. +func (s *Scheduler) IsDisabled() bool { + if s == nil || s.Disabled == nil { + return DefaultSchedulerDisabled + } + return *s.Disabled +} diff --git a/pkg/apis/operator/v1alpha1/tektonscheduler_types.go b/pkg/apis/operator/v1alpha1/tektonscheduler_types.go index 25426d882b..7d72c5965a 100644 --- a/pkg/apis/operator/v1alpha1/tektonscheduler_types.go +++ b/pkg/apis/operator/v1alpha1/tektonscheduler_types.go @@ -17,7 +17,7 @@ limitations under the License. package v1alpha1 import ( - "github.com/konflux-ci/tekton-kueue/pkg/config" + "github.com/tektoncd/tekton-kueue/pkg/config" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" duckv1 "knative.dev/pkg/apis/duck/v1" ) @@ -27,9 +27,10 @@ var ( _ TektonComponentSpec = (*TektonSchedulerSpec)(nil) ) -// TektonScheduler is the Schema for the TektonScheduler API +// TektonScheduler is the deprecated predecessor of TektonKueue. It is retained +// temporarily so existing resources remain readable while pre-upgrade migration +// copies their configuration to TektonKueue. // +genclient -// +genreconciler:krshapedlogic=false // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object // +genclient:nonNamespaced // +kubebuilder:object:root=true @@ -45,7 +46,7 @@ type TektonScheduler struct { Status TektonSchedulerStatus `json:"status,omitempty"` } -// Scheduler Configuration to manage Scheduler Configuration. +// Scheduler defines the deprecated TektonScheduler configuration. type Scheduler struct { // enable or disable TektonScheduler Component Disabled *bool `json:"disabled"` @@ -56,24 +57,26 @@ type Scheduler struct { Options AdditionalOptions `json:"options"` } +// SchedulerConfig contains the deprecated TektonScheduler operand configuration. type SchedulerConfig struct { - // This hold the config data from tekton-kueue. ConfigMap in tekton kueue is loaded as config.yaml so we need to - // match the key here + // This holds the config data loaded by tekton-kueue as config.yaml. // +kubebuilder:pruning:PreserveUnknownFields config.Config `json:"config.yaml"` } -// MultiClusterConfig Configuration to enable/disable MultiCluster Configuration -type MultiClusterConfig struct { - MultiClusterDisabled bool `json:"multi-cluster-disabled"` - MultiClusterRole MultiClusterRole `json:"multi-cluster-role"` +// ToKueue converts deprecated scheduler configuration to its replacement. +func (s Scheduler) ToKueue() Kueue { + return Kueue{ + Disabled: s.Disabled, + KueueConfig: KueueConfig{ + Config: s.Config, + }, + MultiClusterConfig: s.MultiClusterConfig, + Options: s.Options, + } } -// MultiClusterRole Define the role of current cluster in multi-cluster environment. The MultiClusterRole -// can be one of Hub or Spoke -type MultiClusterRole string - -// TektonSchedulerList contains a list of TektonScheduler +// TektonSchedulerList contains a list of deprecated TektonScheduler resources. // +kubebuilder:object:root=true // +k8s:deepcopy-gen:interfaces=k8s.io/apimachinery/pkg/runtime.Object type TektonSchedulerList struct { @@ -82,6 +85,7 @@ type TektonSchedulerList struct { Items []TektonScheduler `json:"items"` } +// TektonSchedulerSpec defines the desired state of the deprecated TektonScheduler API. type TektonSchedulerSpec struct { CommonSpec `json:",inline"` Scheduler `json:",inline"` @@ -89,7 +93,7 @@ type TektonSchedulerSpec struct { NetworkPolicy NetworkPolicyConfig `json:"networkPolicy,omitempty"` } -// TektonSchedulerStatus defines the observed state of TektonScheduler +// TektonSchedulerStatus defines the observed state of the deprecated TektonScheduler API. type TektonSchedulerStatus struct { duckv1.Status `json:",inline"` @@ -102,20 +106,12 @@ type TektonSchedulerStatus struct { TektonScheduler string `json:"tekton-scheduler,omitempty"` } -// GetSpec implements TektonComponent -func (tp *TektonScheduler) GetSpec() TektonComponentSpec { - return &tp.Spec +// GetSpec implements TektonComponent. +func (ts *TektonScheduler) GetSpec() TektonComponentSpec { + return &ts.Spec } -func (tp *TektonScheduler) GetStatus() TektonComponentStatus { - return &tp.Status -} - -// IsDisabled returns true if the TektonScheduler is disabled -func (p *Scheduler) IsDisabled() bool { - if p == nil || p.Disabled == nil { - // When the Scheduler is nil or Disabled is nil, we assume it is the default state. - return DefaultSchedulerDisabled - } - return *p.Disabled +// GetStatus implements TektonComponent. +func (ts *TektonScheduler) GetStatus() TektonComponentStatus { + return &ts.Status } diff --git a/pkg/apis/operator/v1alpha1/tektonscheduler_validation.go b/pkg/apis/operator/v1alpha1/tektonscheduler_validation.go index 083789bfcd..6bbac02b3c 100644 --- a/pkg/apis/operator/v1alpha1/tektonscheduler_validation.go +++ b/pkg/apis/operator/v1alpha1/tektonscheduler_validation.go @@ -19,11 +19,11 @@ package v1alpha1 import ( "context" "fmt" - "strings" "knative.dev/pkg/apis" ) +// Validate retains admission compatibility for the deprecated API. func (ts *TektonScheduler) Validate(ctx context.Context) (errs *apis.FieldError) { if apis.IsInDelete(ctx) { return nil @@ -40,14 +40,3 @@ func (ts *TektonScheduler) Validate(ctx context.Context) (errs *apis.FieldError) errs = errs.Also(ts.Spec.NetworkPolicy.validate("spec.networkPolicy")) return errs } - -func (mcc *MultiClusterConfig) validate() (errs *apis.FieldError) { - if mcc.MultiClusterDisabled && mcc.MultiClusterRole != "" { - errs = errs.Also(apis.ErrInvalidValue("MultiClusterConfig", "multicluster-role", - "multicluster-role should be blank when MultiClusterConfig.MultiClusterDisabled is true")) - } else if !mcc.MultiClusterDisabled && !(strings.EqualFold(string(mcc.MultiClusterRole), string(MultiClusterRoleHub)) || strings.EqualFold(string(mcc.MultiClusterRole), string(MultiClusterRoleSpoke))) { - errs = errs.Also(apis.ErrInvalidValue("MultiClusterConfig", "multicluster-role", - "multicluster-role should be 'Hub' or 'Spoke' (case-insensitive) when MultiClusterConfig.MultiClusterDisabled is false")) - } - return errs -} diff --git a/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go b/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go index 07cf51965c..5513b6fda1 100644 --- a/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go +++ b/pkg/apis/operator/v1alpha1/zz_generated.deepcopy.go @@ -363,6 +363,47 @@ func (in *Kubernetes) DeepCopy() *Kubernetes { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *Kueue) DeepCopyInto(out *Kueue) { + *out = *in + if in.Disabled != nil { + in, out := &in.Disabled, &out.Disabled + *out = new(bool) + **out = **in + } + in.KueueConfig.DeepCopyInto(&out.KueueConfig) + out.MultiClusterConfig = in.MultiClusterConfig + in.Options.DeepCopyInto(&out.Options) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new Kueue. +func (in *Kueue) DeepCopy() *Kueue { + if in == nil { + return nil + } + out := new(Kueue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *KueueConfig) DeepCopyInto(out *KueueConfig) { + *out = *in + in.Config.DeepCopyInto(&out.Config) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new KueueConfig. +func (in *KueueConfig) DeepCopy() *KueueConfig { + if in == nil { + return nil + } + out := new(KueueConfig) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *LokiStackProperties) DeepCopyInto(out *LokiStackProperties) { *out = *in @@ -1843,6 +1884,7 @@ func (in *TektonConfigSpec) DeepCopyInto(out *TektonConfigSpec) { in.Config.DeepCopyInto(&out.Config) in.Pruner.DeepCopyInto(&out.Pruner) in.TektonPruner.DeepCopyInto(&out.TektonPruner) + in.Kueue.DeepCopyInto(&out.Kueue) in.Scheduler.DeepCopyInto(&out.Scheduler) out.CommonSpec = in.CommonSpec in.Addon.DeepCopyInto(&out.Addon) @@ -2101,6 +2143,103 @@ func (in *TektonInstallerSetStatus) DeepCopy() *TektonInstallerSetStatus { return out } +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TektonKueue) DeepCopyInto(out *TektonKueue) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ObjectMeta.DeepCopyInto(&out.ObjectMeta) + in.Spec.DeepCopyInto(&out.Spec) + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TektonKueue. +func (in *TektonKueue) DeepCopy() *TektonKueue { + if in == nil { + return nil + } + out := new(TektonKueue) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TektonKueue) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TektonKueueList) DeepCopyInto(out *TektonKueueList) { + *out = *in + out.TypeMeta = in.TypeMeta + in.ListMeta.DeepCopyInto(&out.ListMeta) + if in.Items != nil { + in, out := &in.Items, &out.Items + *out = make([]TektonKueue, len(*in)) + for i := range *in { + (*in)[i].DeepCopyInto(&(*out)[i]) + } + } + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TektonKueueList. +func (in *TektonKueueList) DeepCopy() *TektonKueueList { + if in == nil { + return nil + } + out := new(TektonKueueList) + in.DeepCopyInto(out) + return out +} + +// DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object. +func (in *TektonKueueList) DeepCopyObject() runtime.Object { + if c := in.DeepCopy(); c != nil { + return c + } + return nil +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TektonKueueSpec) DeepCopyInto(out *TektonKueueSpec) { + *out = *in + out.CommonSpec = in.CommonSpec + in.Kueue.DeepCopyInto(&out.Kueue) + in.NetworkPolicy.DeepCopyInto(&out.NetworkPolicy) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TektonKueueSpec. +func (in *TektonKueueSpec) DeepCopy() *TektonKueueSpec { + if in == nil { + return nil + } + out := new(TektonKueueSpec) + in.DeepCopyInto(out) + return out +} + +// DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. +func (in *TektonKueueStatus) DeepCopyInto(out *TektonKueueStatus) { + *out = *in + in.Status.DeepCopyInto(&out.Status) + return +} + +// DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new TektonKueueStatus. +func (in *TektonKueueStatus) DeepCopy() *TektonKueueStatus { + if in == nil { + return nil + } + out := new(TektonKueueStatus) + in.DeepCopyInto(out) + return out +} + // DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil. func (in *TektonMulticlusterProxyAAE) DeepCopyInto(out *TektonMulticlusterProxyAAE) { *out = *in diff --git a/pkg/client/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go b/pkg/client/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go index 9abb83086d..acb899dad1 100644 --- a/pkg/client/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go +++ b/pkg/client/clientset/versioned/typed/operator/v1alpha1/fake/fake_operator_client.go @@ -60,6 +60,10 @@ func (c *FakeOperatorV1alpha1) TektonInstallerSets() v1alpha1.TektonInstallerSet return newFakeTektonInstallerSets(c) } +func (c *FakeOperatorV1alpha1) TektonKueues() v1alpha1.TektonKueueInterface { + return newFakeTektonKueues(c) +} + func (c *FakeOperatorV1alpha1) TektonMulticlusterProxyAAEs() v1alpha1.TektonMulticlusterProxyAAEInterface { return newFakeTektonMulticlusterProxyAAEs(c) } diff --git a/pkg/client/clientset/versioned/typed/operator/v1alpha1/fake/fake_tektonkueue.go b/pkg/client/clientset/versioned/typed/operator/v1alpha1/fake/fake_tektonkueue.go new file mode 100644 index 0000000000..1a84bd04c3 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/operator/v1alpha1/fake/fake_tektonkueue.go @@ -0,0 +1,52 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package fake + +import ( + v1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" + operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/clientset/versioned/typed/operator/v1alpha1" + gentype "k8s.io/client-go/gentype" +) + +// fakeTektonKueues implements TektonKueueInterface +type fakeTektonKueues struct { + *gentype.FakeClientWithList[*v1alpha1.TektonKueue, *v1alpha1.TektonKueueList] + Fake *FakeOperatorV1alpha1 +} + +func newFakeTektonKueues(fake *FakeOperatorV1alpha1) operatorv1alpha1.TektonKueueInterface { + return &fakeTektonKueues{ + gentype.NewFakeClientWithList[*v1alpha1.TektonKueue, *v1alpha1.TektonKueueList]( + fake.Fake, + "", + v1alpha1.SchemeGroupVersion.WithResource("tektonkueues"), + v1alpha1.SchemeGroupVersion.WithKind("TektonKueue"), + func() *v1alpha1.TektonKueue { return &v1alpha1.TektonKueue{} }, + func() *v1alpha1.TektonKueueList { return &v1alpha1.TektonKueueList{} }, + func(dst, src *v1alpha1.TektonKueueList) { dst.ListMeta = src.ListMeta }, + func(list *v1alpha1.TektonKueueList) []*v1alpha1.TektonKueue { + return gentype.ToPointerSlice(list.Items) + }, + func(list *v1alpha1.TektonKueueList, items []*v1alpha1.TektonKueue) { + list.Items = gentype.FromPointerSlice(items) + }, + ), + fake, + } +} diff --git a/pkg/client/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go b/pkg/client/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go index 6f2d6cbe1f..507d7a05b3 100644 --- a/pkg/client/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go +++ b/pkg/client/clientset/versioned/typed/operator/v1alpha1/generated_expansion.go @@ -34,6 +34,8 @@ type TektonDashboardExpansion interface{} type TektonInstallerSetExpansion interface{} +type TektonKueueExpansion interface{} + type TektonMulticlusterProxyAAEExpansion interface{} type TektonPipelineExpansion interface{} diff --git a/pkg/client/clientset/versioned/typed/operator/v1alpha1/operator_client.go b/pkg/client/clientset/versioned/typed/operator/v1alpha1/operator_client.go index 8cb0b4bfbe..ece2591830 100644 --- a/pkg/client/clientset/versioned/typed/operator/v1alpha1/operator_client.go +++ b/pkg/client/clientset/versioned/typed/operator/v1alpha1/operator_client.go @@ -36,6 +36,7 @@ type OperatorV1alpha1Interface interface { TektonConfigsGetter TektonDashboardsGetter TektonInstallerSetsGetter + TektonKueuesGetter TektonMulticlusterProxyAAEsGetter TektonPipelinesGetter TektonPrunersGetter @@ -81,6 +82,10 @@ func (c *OperatorV1alpha1Client) TektonInstallerSets() TektonInstallerSetInterfa return newTektonInstallerSets(c) } +func (c *OperatorV1alpha1Client) TektonKueues() TektonKueueInterface { + return newTektonKueues(c) +} + func (c *OperatorV1alpha1Client) TektonMulticlusterProxyAAEs() TektonMulticlusterProxyAAEInterface { return newTektonMulticlusterProxyAAEs(c) } diff --git a/pkg/client/clientset/versioned/typed/operator/v1alpha1/tektonkueue.go b/pkg/client/clientset/versioned/typed/operator/v1alpha1/tektonkueue.go new file mode 100644 index 0000000000..27bf6eecb6 --- /dev/null +++ b/pkg/client/clientset/versioned/typed/operator/v1alpha1/tektonkueue.go @@ -0,0 +1,70 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by client-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + + operatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" + scheme "github.com/tektoncd/operator/pkg/client/clientset/versioned/scheme" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + types "k8s.io/apimachinery/pkg/types" + watch "k8s.io/apimachinery/pkg/watch" + gentype "k8s.io/client-go/gentype" +) + +// TektonKueuesGetter has a method to return a TektonKueueInterface. +// A group's client should implement this interface. +type TektonKueuesGetter interface { + TektonKueues() TektonKueueInterface +} + +// TektonKueueInterface has methods to work with TektonKueue resources. +type TektonKueueInterface interface { + Create(ctx context.Context, tektonKueue *operatorv1alpha1.TektonKueue, opts v1.CreateOptions) (*operatorv1alpha1.TektonKueue, error) + Update(ctx context.Context, tektonKueue *operatorv1alpha1.TektonKueue, opts v1.UpdateOptions) (*operatorv1alpha1.TektonKueue, error) + // Add a +genclient:noStatus comment above the type to avoid generating UpdateStatus(). + UpdateStatus(ctx context.Context, tektonKueue *operatorv1alpha1.TektonKueue, opts v1.UpdateOptions) (*operatorv1alpha1.TektonKueue, error) + Delete(ctx context.Context, name string, opts v1.DeleteOptions) error + DeleteCollection(ctx context.Context, opts v1.DeleteOptions, listOpts v1.ListOptions) error + Get(ctx context.Context, name string, opts v1.GetOptions) (*operatorv1alpha1.TektonKueue, error) + List(ctx context.Context, opts v1.ListOptions) (*operatorv1alpha1.TektonKueueList, error) + Watch(ctx context.Context, opts v1.ListOptions) (watch.Interface, error) + Patch(ctx context.Context, name string, pt types.PatchType, data []byte, opts v1.PatchOptions, subresources ...string) (result *operatorv1alpha1.TektonKueue, err error) + TektonKueueExpansion +} + +// tektonKueues implements TektonKueueInterface +type tektonKueues struct { + *gentype.ClientWithList[*operatorv1alpha1.TektonKueue, *operatorv1alpha1.TektonKueueList] +} + +// newTektonKueues returns a TektonKueues +func newTektonKueues(c *OperatorV1alpha1Client) *tektonKueues { + return &tektonKueues{ + gentype.NewClientWithList[*operatorv1alpha1.TektonKueue, *operatorv1alpha1.TektonKueueList]( + "tektonkueues", + c.RESTClient(), + scheme.ParameterCodec, + "", + func() *operatorv1alpha1.TektonKueue { return &operatorv1alpha1.TektonKueue{} }, + func() *operatorv1alpha1.TektonKueueList { return &operatorv1alpha1.TektonKueueList{} }, + ), + } +} diff --git a/pkg/client/informers/externalversions/generic.go b/pkg/client/informers/externalversions/generic.go index 3ebcf96979..1f63463961 100644 --- a/pkg/client/informers/externalversions/generic.go +++ b/pkg/client/informers/externalversions/generic.go @@ -69,6 +69,8 @@ func (f *sharedInformerFactory) ForResource(resource schema.GroupVersionResource return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1alpha1().TektonDashboards().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("tektoninstallersets"): return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1alpha1().TektonInstallerSets().Informer()}, nil + case v1alpha1.SchemeGroupVersion.WithResource("tektonkueues"): + return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1alpha1().TektonKueues().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("tektonmulticlusterproxyaaes"): return &genericInformer{resource: resource.GroupResource(), informer: f.Operator().V1alpha1().TektonMulticlusterProxyAAEs().Informer()}, nil case v1alpha1.SchemeGroupVersion.WithResource("tektonpipelines"): diff --git a/pkg/client/informers/externalversions/operator/v1alpha1/interface.go b/pkg/client/informers/externalversions/operator/v1alpha1/interface.go index a14d9973a1..bec4a99d7f 100644 --- a/pkg/client/informers/externalversions/operator/v1alpha1/interface.go +++ b/pkg/client/informers/externalversions/operator/v1alpha1/interface.go @@ -40,6 +40,8 @@ type Interface interface { TektonDashboards() TektonDashboardInformer // TektonInstallerSets returns a TektonInstallerSetInformer. TektonInstallerSets() TektonInstallerSetInformer + // TektonKueues returns a TektonKueueInformer. + TektonKueues() TektonKueueInformer // TektonMulticlusterProxyAAEs returns a TektonMulticlusterProxyAAEInformer. TektonMulticlusterProxyAAEs() TektonMulticlusterProxyAAEInformer // TektonPipelines returns a TektonPipelineInformer. @@ -105,6 +107,11 @@ func (v *version) TektonInstallerSets() TektonInstallerSetInformer { return &tektonInstallerSetInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} } +// TektonKueues returns a TektonKueueInformer. +func (v *version) TektonKueues() TektonKueueInformer { + return &tektonKueueInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} +} + // TektonMulticlusterProxyAAEs returns a TektonMulticlusterProxyAAEInformer. func (v *version) TektonMulticlusterProxyAAEs() TektonMulticlusterProxyAAEInformer { return &tektonMulticlusterProxyAAEInformer{factory: v.factory, tweakListOptions: v.tweakListOptions} diff --git a/pkg/client/informers/externalversions/operator/v1alpha1/tektonkueue.go b/pkg/client/informers/externalversions/operator/v1alpha1/tektonkueue.go new file mode 100644 index 0000000000..b879467351 --- /dev/null +++ b/pkg/client/informers/externalversions/operator/v1alpha1/tektonkueue.go @@ -0,0 +1,101 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by informer-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + context "context" + time "time" + + apisoperatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" + versioned "github.com/tektoncd/operator/pkg/client/clientset/versioned" + internalinterfaces "github.com/tektoncd/operator/pkg/client/informers/externalversions/internalinterfaces" + operatorv1alpha1 "github.com/tektoncd/operator/pkg/client/listers/operator/v1alpha1" + v1 "k8s.io/apimachinery/pkg/apis/meta/v1" + runtime "k8s.io/apimachinery/pkg/runtime" + watch "k8s.io/apimachinery/pkg/watch" + cache "k8s.io/client-go/tools/cache" +) + +// TektonKueueInformer provides access to a shared informer and lister for +// TektonKueues. +type TektonKueueInformer interface { + Informer() cache.SharedIndexInformer + Lister() operatorv1alpha1.TektonKueueLister +} + +type tektonKueueInformer struct { + factory internalinterfaces.SharedInformerFactory + tweakListOptions internalinterfaces.TweakListOptionsFunc +} + +// NewTektonKueueInformer constructs a new informer for TektonKueue type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewTektonKueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers) cache.SharedIndexInformer { + return NewFilteredTektonKueueInformer(client, resyncPeriod, indexers, nil) +} + +// NewFilteredTektonKueueInformer constructs a new informer for TektonKueue type. +// Always prefer using an informer factory to get a shared informer instead of getting an independent +// one. This reduces memory footprint and number of connections to the server. +func NewFilteredTektonKueueInformer(client versioned.Interface, resyncPeriod time.Duration, indexers cache.Indexers, tweakListOptions internalinterfaces.TweakListOptionsFunc) cache.SharedIndexInformer { + return cache.NewSharedIndexInformer( + cache.ToListWatcherWithWatchListSemantics(&cache.ListWatch{ + ListFunc: func(options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorV1alpha1().TektonKueues().List(context.Background(), options) + }, + WatchFunc: func(options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorV1alpha1().TektonKueues().Watch(context.Background(), options) + }, + ListWithContextFunc: func(ctx context.Context, options v1.ListOptions) (runtime.Object, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorV1alpha1().TektonKueues().List(ctx, options) + }, + WatchFuncWithContext: func(ctx context.Context, options v1.ListOptions) (watch.Interface, error) { + if tweakListOptions != nil { + tweakListOptions(&options) + } + return client.OperatorV1alpha1().TektonKueues().Watch(ctx, options) + }, + }, client), + &apisoperatorv1alpha1.TektonKueue{}, + resyncPeriod, + indexers, + ) +} + +func (f *tektonKueueInformer) defaultInformer(client versioned.Interface, resyncPeriod time.Duration) cache.SharedIndexInformer { + return NewFilteredTektonKueueInformer(client, resyncPeriod, cache.Indexers{cache.NamespaceIndex: cache.MetaNamespaceIndexFunc}, f.tweakListOptions) +} + +func (f *tektonKueueInformer) Informer() cache.SharedIndexInformer { + return f.factory.InformerFor(&apisoperatorv1alpha1.TektonKueue{}, f.defaultInformer) +} + +func (f *tektonKueueInformer) Lister() operatorv1alpha1.TektonKueueLister { + return operatorv1alpha1.NewTektonKueueLister(f.Informer().GetIndexer()) +} diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/fake/fake.go b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/fake/fake.go index 98654bad69..17f7fea0c9 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/fake/fake.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/fake/fake.go @@ -22,12 +22,12 @@ import ( context "context" fake "github.com/tektoncd/operator/pkg/client/injection/informers/factory/fake" - TektonScheduler "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonscheduler" + tektonkueue "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonkueue" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" ) -var Get = TektonScheduler.Get +var Get = tektonkueue.Get func init() { injection.Fake.RegisterInformer(withInformer) @@ -35,6 +35,6 @@ func init() { func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := fake.Get(ctx) - inf := f.Operator().V1alpha1().TektonSchedulers() - return context.WithValue(ctx, TektonScheduler.Key{}, inf), inf.Informer() + inf := f.Operator().V1alpha1().TektonKueues() + return context.WithValue(ctx, tektonkueue.Key{}, inf), inf.Informer() } diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/fake/fake.go b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/fake/fake.go index 9a29765062..d85cf11b15 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/fake/fake.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/fake/fake.go @@ -22,7 +22,7 @@ import ( context "context" factoryfiltered "github.com/tektoncd/operator/pkg/client/injection/informers/factory/filtered" - filtered "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonscheduler/filtered" + filtered "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered" controller "knative.dev/pkg/controller" injection "knative.dev/pkg/injection" logging "knative.dev/pkg/logging" @@ -44,7 +44,7 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) infs := []controller.Informer{} for _, selector := range labelSelectors { f := factoryfiltered.Get(ctx, selector) - inf := f.Operator().V1alpha1().TektonSchedulers() + inf := f.Operator().V1alpha1().TektonKueues() ctx = context.WithValue(ctx, filtered.Key{Selector: selector}, inf) infs = append(infs, inf.Informer()) } diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/tektonkueue.go b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/tektonkueue.go index 3ceb15bdf3..3961d2c666 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/tektonkueue.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/filtered/tektonkueue.go @@ -47,7 +47,7 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) infs := []controller.Informer{} for _, selector := range labelSelectors { f := filtered.Get(ctx, selector) - inf := f.Operator().V1alpha1().TektonSchedulers() + inf := f.Operator().V1alpha1().TektonKueues() ctx = context.WithValue(ctx, Key{Selector: selector}, inf) infs = append(infs, inf.Informer()) } @@ -55,11 +55,11 @@ func withInformer(ctx context.Context) (context.Context, []controller.Informer) } // Get extracts the typed informer from the context. -func Get(ctx context.Context, selector string) v1alpha1.TektonSchedulerInformer { +func Get(ctx context.Context, selector string) v1alpha1.TektonKueueInformer { untyped := ctx.Value(Key{Selector: selector}) if untyped == nil { logging.FromContext(ctx).Panicf( - "Unable to fetch github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1.TektonSchedulerInformer with selector %s from context.", selector) + "Unable to fetch github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1.TektonKueueInformer with selector %s from context.", selector) } - return untyped.(v1alpha1.TektonSchedulerInformer) + return untyped.(v1alpha1.TektonKueueInformer) } diff --git a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/tektonkueue.go b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/tektonkueue.go index bfc8de7962..09433103c5 100644 --- a/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/tektonkueue.go +++ b/pkg/client/injection/informers/operator/v1alpha1/tektonkueue/tektonkueue.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by injection-gen. DO NOT EDIT. -package TektonScheduler +package tektonkueue import ( context "context" @@ -37,16 +37,16 @@ type Key struct{} func withInformer(ctx context.Context) (context.Context, controller.Informer) { f := factory.Get(ctx) - inf := f.Operator().V1alpha1().TektonSchedulers() + inf := f.Operator().V1alpha1().TektonKueues() return context.WithValue(ctx, Key{}, inf), inf.Informer() } // Get extracts the typed informer from the context. -func Get(ctx context.Context) v1alpha1.TektonSchedulerInformer { +func Get(ctx context.Context) v1alpha1.TektonKueueInformer { untyped := ctx.Value(Key{}) if untyped == nil { logging.FromContext(ctx).Panic( - "Unable to fetch github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1.TektonSchedulerInformer from context.") + "Unable to fetch github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1.TektonKueueInformer from context.") } - return untyped.(v1alpha1.TektonSchedulerInformer) + return untyped.(v1alpha1.TektonKueueInformer) } diff --git a/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/controller.go b/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/controller.go similarity index 92% rename from pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/controller.go rename to pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/controller.go index eb933ad32b..4cde24622a 100644 --- a/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/controller.go +++ b/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/controller.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by injection-gen. DO NOT EDIT. -package tektonscheduler +package tektonkueue import ( context "context" @@ -26,7 +26,7 @@ import ( versionedscheme "github.com/tektoncd/operator/pkg/client/clientset/versioned/scheme" client "github.com/tektoncd/operator/pkg/client/injection/client" - tektonscheduler "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonscheduler" + tektonkueue "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonkueue" zap "go.uber.org/zap" corev1 "k8s.io/api/core/v1" labels "k8s.io/apimachinery/pkg/labels" @@ -43,8 +43,8 @@ import ( ) const ( - defaultControllerAgentName = "tektonscheduler-controller" - defaultFinalizerName = "tektonschedulers.operator.tekton.dev" + defaultControllerAgentName = "tektonkueue-controller" + defaultFinalizerName = "tektonkueues.operator.tekton.dev" ) // NewImpl returns a controller.Impl that handles queuing and feeding work from @@ -59,9 +59,9 @@ func NewImpl(ctx context.Context, r Interface, optionsFns ...controller.OptionsF logger.Fatal("Up to one options function is supported, found: ", len(optionsFns)) } - tektonschedulerInformer := tektonscheduler.Get(ctx) + tektonkueueInformer := tektonkueue.Get(ctx) - lister := tektonschedulerInformer.Lister() + lister := tektonkueueInformer.Lister() var promoteFilterFunc func(obj interface{}) bool var promoteFunc = func(bkt reconciler.Bucket) {} @@ -103,7 +103,7 @@ func NewImpl(ctx context.Context, r Interface, optionsFns ...controller.OptionsF logger = logger.With( zap.String(logkey.ControllerType, ctrTypeName), - zap.String(logkey.Kind, "operator.tekton.dev.TektonScheduler"), + zap.String(logkey.Kind, "operator.tekton.dev.TektonKueue"), ) impl := controller.NewContext(ctx, rec, controller.ControllerOptions{WorkQueueName: ctrTypeName, Logger: logger}) diff --git a/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/reconciler.go b/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/reconciler.go similarity index 90% rename from pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/reconciler.go rename to pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/reconciler.go index c35d38f71d..5e01677fb9 100644 --- a/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/reconciler.go +++ b/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/reconciler.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by injection-gen. DO NOT EDIT. -package tektonscheduler +package tektonkueue import ( context "context" @@ -44,40 +44,40 @@ import ( ) // Interface defines the strongly typed interfaces to be implemented by a -// controller reconciling v1alpha1.TektonScheduler. +// controller reconciling v1alpha1.TektonKueue. type Interface interface { - // ReconcileKind implements custom logic to reconcile v1alpha1.TektonScheduler. Any changes + // ReconcileKind implements custom logic to reconcile v1alpha1.TektonKueue. Any changes // to the objects .Status or .Finalizers will be propagated to the stored // object. It is recommended that implementors do not call any update calls // for the Kind inside of ReconcileKind, it is the responsibility of the calling // controller to propagate those properties. The resource passed to ReconcileKind // will always have an empty deletion timestamp. - ReconcileKind(ctx context.Context, o *v1alpha1.TektonScheduler) reconciler.Event + ReconcileKind(ctx context.Context, o *v1alpha1.TektonKueue) reconciler.Event } // Finalizer defines the strongly typed interfaces to be implemented by a -// controller finalizing v1alpha1.TektonScheduler. +// controller finalizing v1alpha1.TektonKueue. type Finalizer interface { - // FinalizeKind implements custom logic to finalize v1alpha1.TektonScheduler. Any changes + // FinalizeKind implements custom logic to finalize v1alpha1.TektonKueue. Any changes // to the objects .Status or .Finalizers will be ignored. Returning a nil or // Normal type reconciler.Event will allow the finalizer to be deleted on // the resource. The resource passed to FinalizeKind will always have a set // deletion timestamp. - FinalizeKind(ctx context.Context, o *v1alpha1.TektonScheduler) reconciler.Event + FinalizeKind(ctx context.Context, o *v1alpha1.TektonKueue) reconciler.Event } // ReadOnlyInterface defines the strongly typed interfaces to be implemented by a -// controller reconciling v1alpha1.TektonScheduler if they want to process resources for which +// controller reconciling v1alpha1.TektonKueue if they want to process resources for which // they are not the leader. type ReadOnlyInterface interface { - // ObserveKind implements logic to observe v1alpha1.TektonScheduler. + // ObserveKind implements logic to observe v1alpha1.TektonKueue. // This method should not write to the API. - ObserveKind(ctx context.Context, o *v1alpha1.TektonScheduler) reconciler.Event + ObserveKind(ctx context.Context, o *v1alpha1.TektonKueue) reconciler.Event } -type doReconcile func(ctx context.Context, o *v1alpha1.TektonScheduler) reconciler.Event +type doReconcile func(ctx context.Context, o *v1alpha1.TektonKueue) reconciler.Event -// reconcilerImpl implements controller.Reconciler for v1alpha1.TektonScheduler resources. +// reconcilerImpl implements controller.Reconciler for v1alpha1.TektonKueue resources. type reconcilerImpl struct { // LeaderAwareFuncs is inlined to help us implement reconciler.LeaderAware. reconciler.LeaderAwareFuncs @@ -86,7 +86,7 @@ type reconcilerImpl struct { Client versioned.Interface // Listers index properties about resources. - Lister operatorv1alpha1.TektonSchedulerLister + Lister operatorv1alpha1.TektonKueueLister // Recorder is an event recorder for recording Event resources to the // Kubernetes API. @@ -122,7 +122,7 @@ var _ controller.Reconciler = (*reconcilerImpl)(nil) // Check that our generated Reconciler is always LeaderAware. var _ reconciler.LeaderAware = (*reconcilerImpl)(nil) -func NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client versioned.Interface, lister operatorv1alpha1.TektonSchedulerLister, recorder record.EventRecorder, r Interface, options ...controller.Options) controller.Reconciler { +func NewReconciler(ctx context.Context, logger *zap.SugaredLogger, client versioned.Interface, lister operatorv1alpha1.TektonKueueLister, recorder record.EventRecorder, r Interface, options ...controller.Options) controller.Reconciler { // Check the options function input. It should be 0 or 1. if len(options) > 1 { logger.Fatal("Up to one options struct is supported, found: ", len(options)) @@ -321,13 +321,13 @@ func (r *reconcilerImpl) Reconcile(ctx context.Context, key string) error { return nil } -func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLogger, existing *v1alpha1.TektonScheduler, desired *v1alpha1.TektonScheduler) error { +func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLogger, existing *v1alpha1.TektonKueue, desired *v1alpha1.TektonKueue) error { existing = existing.DeepCopy() return reconciler.RetryUpdateConflicts(func(attempts int) (err error) { // The first iteration tries to use the injectionInformer's state, subsequent attempts fetch the latest state via API. if attempts > 0 { - getter := r.Client.OperatorV1alpha1().TektonSchedulers() + getter := r.Client.OperatorV1alpha1().TektonKueues() existing, err = getter.Get(ctx, desired.Name, metav1.GetOptions{}) if err != nil { @@ -348,7 +348,7 @@ func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLo existing.Status = desired.Status - updater := r.Client.OperatorV1alpha1().TektonSchedulers() + updater := r.Client.OperatorV1alpha1().TektonKueues() _, err = updater.UpdateStatus(ctx, existing, metav1.UpdateOptions{}) return err @@ -358,7 +358,7 @@ func (r *reconcilerImpl) updateStatus(ctx context.Context, logger *zap.SugaredLo // updateFinalizersFiltered will update the Finalizers of the resource. // TODO: this method could be generic and sync all finalizers. For now it only // updates defaultFinalizerName or its override. -func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.TektonScheduler, desiredFinalizers sets.Set[string]) (*v1alpha1.TektonScheduler, error) { +func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource *v1alpha1.TektonKueue, desiredFinalizers sets.Set[string]) (*v1alpha1.TektonKueue, error) { if r.useServerSideApplyForFinalizers { return r.updateFinalizersFilteredServerSideApply(ctx, resource, desiredFinalizers) } @@ -366,7 +366,7 @@ func (r *reconcilerImpl) updateFinalizersFiltered(ctx context.Context, resource } // updateFinalizersFilteredServerSideApply uses server-side apply to manage only this controller's finalizer. -func (r *reconcilerImpl) updateFinalizersFilteredServerSideApply(ctx context.Context, resource *v1alpha1.TektonScheduler, desiredFinalizers sets.Set[string]) (*v1alpha1.TektonScheduler, error) { +func (r *reconcilerImpl) updateFinalizersFilteredServerSideApply(ctx context.Context, resource *v1alpha1.TektonKueue, desiredFinalizers sets.Set[string]) (*v1alpha1.TektonKueue, error) { // Check if we need to do anything existingFinalizers := sets.New[string](resource.Finalizers...) @@ -411,7 +411,7 @@ func (r *reconcilerImpl) updateFinalizersFilteredServerSideApply(ctx context.Con return resource, err } - patcher := r.Client.OperatorV1alpha1().TektonSchedulers() + patcher := r.Client.OperatorV1alpha1().TektonKueues() patchOpts := metav1.PatchOptions{ FieldManager: r.finalizerFieldManager, @@ -432,7 +432,7 @@ func (r *reconcilerImpl) updateFinalizersFilteredServerSideApply(ctx context.Con } // updateFinalizersFilteredMergePatch uses merge patch to manage finalizers (legacy behavior). -func (r *reconcilerImpl) updateFinalizersFilteredMergePatch(ctx context.Context, resource *v1alpha1.TektonScheduler, desiredFinalizers sets.Set[string]) (*v1alpha1.TektonScheduler, error) { +func (r *reconcilerImpl) updateFinalizersFilteredMergePatch(ctx context.Context, resource *v1alpha1.TektonKueue, desiredFinalizers sets.Set[string]) (*v1alpha1.TektonKueue, error) { // Don't modify the informers copy. existing := resource.DeepCopy() @@ -470,7 +470,7 @@ func (r *reconcilerImpl) updateFinalizersFilteredMergePatch(ctx context.Context, return resource, err } - patcher := r.Client.OperatorV1alpha1().TektonSchedulers() + patcher := r.Client.OperatorV1alpha1().TektonKueues() resourceName := resource.Name updated, err := patcher.Patch(ctx, resourceName, types.MergePatchType, patch, metav1.PatchOptions{}) @@ -486,7 +486,7 @@ func (r *reconcilerImpl) updateFinalizersFilteredMergePatch(ctx context.Context, return updated, err } -func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource *v1alpha1.TektonScheduler) (*v1alpha1.TektonScheduler, error) { +func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource *v1alpha1.TektonKueue) (*v1alpha1.TektonKueue, error) { if _, ok := r.reconciler.(Finalizer); !ok { return resource, nil } @@ -502,7 +502,7 @@ func (r *reconcilerImpl) setFinalizerIfFinalizer(ctx context.Context, resource * return r.updateFinalizersFiltered(ctx, resource, finalizers) } -func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1.TektonScheduler, reconcileEvent reconciler.Event) (*v1alpha1.TektonScheduler, error) { +func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1.TektonKueue, reconcileEvent reconciler.Event) (*v1alpha1.TektonKueue, error) { if _, ok := r.reconciler.(Finalizer); !ok { return resource, nil } @@ -530,7 +530,7 @@ func (r *reconcilerImpl) clearFinalizer(ctx context.Context, resource *v1alpha1. // when reconciling stale object from cache while the object is actually deleted. logger := logging.FromContext(ctx) - getter := r.Client.OperatorV1alpha1().TektonSchedulers() + getter := r.Client.OperatorV1alpha1().TektonKueues() _, getErr := getter.Get(ctx, resource.Name, metav1.GetOptions{}) if errors.IsNotFound(getErr) { diff --git a/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/state.go b/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/state.go similarity index 96% rename from pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/state.go rename to pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/state.go index e46cd70005..fd731df5b8 100644 --- a/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler/state.go +++ b/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue/state.go @@ -16,7 +16,7 @@ limitations under the License. // Code generated by injection-gen. DO NOT EDIT. -package tektonscheduler +package tektonkueue import ( fmt "fmt" @@ -83,7 +83,7 @@ func (s *state) isNotLeaderNorObserver() bool { return false } -func (s *state) reconcileMethodFor(o *v1alpha1.TektonScheduler) (string, doReconcile) { +func (s *state) reconcileMethodFor(o *v1alpha1.TektonKueue) (string, doReconcile) { if o.GetDeletionTimestamp().IsZero() { if s.isLeader { return reconciler.DoReconcileKind, s.reconciler.ReconcileKind diff --git a/pkg/client/listers/operator/v1alpha1/expansion_generated.go b/pkg/client/listers/operator/v1alpha1/expansion_generated.go index bcbe8a4570..7375a12249 100644 --- a/pkg/client/listers/operator/v1alpha1/expansion_generated.go +++ b/pkg/client/listers/operator/v1alpha1/expansion_generated.go @@ -50,6 +50,10 @@ type TektonDashboardListerExpansion interface{} // TektonInstallerSetLister. type TektonInstallerSetListerExpansion interface{} +// TektonKueueListerExpansion allows custom methods to be added to +// TektonKueueLister. +type TektonKueueListerExpansion interface{} + // TektonMulticlusterProxyAAEListerExpansion allows custom methods to be added to // TektonMulticlusterProxyAAELister. type TektonMulticlusterProxyAAEListerExpansion interface{} diff --git a/pkg/client/listers/operator/v1alpha1/tektonkueue.go b/pkg/client/listers/operator/v1alpha1/tektonkueue.go new file mode 100644 index 0000000000..eca45d2573 --- /dev/null +++ b/pkg/client/listers/operator/v1alpha1/tektonkueue.go @@ -0,0 +1,48 @@ +/* +Copyright 2020 The Tekton Authors + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. +*/ + +// Code generated by lister-gen. DO NOT EDIT. + +package v1alpha1 + +import ( + operatorv1alpha1 "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" + labels "k8s.io/apimachinery/pkg/labels" + listers "k8s.io/client-go/listers" + cache "k8s.io/client-go/tools/cache" +) + +// TektonKueueLister helps list TektonKueues. +// All objects returned here must be treated as read-only. +type TektonKueueLister interface { + // List lists all TektonKueues in the indexer. + // Objects returned here must be treated as read-only. + List(selector labels.Selector) (ret []*operatorv1alpha1.TektonKueue, err error) + // Get retrieves the TektonKueue from the index for a given name. + // Objects returned here must be treated as read-only. + Get(name string) (*operatorv1alpha1.TektonKueue, error) + TektonKueueListerExpansion +} + +// tektonKueueLister implements the TektonKueueLister interface. +type tektonKueueLister struct { + listers.ResourceIndexer[*operatorv1alpha1.TektonKueue] +} + +// NewTektonKueueLister returns a new TektonKueueLister. +func NewTektonKueueLister(indexer cache.Indexer) TektonKueueLister { + return &tektonKueueLister{listers.New[*operatorv1alpha1.TektonKueue](indexer, operatorv1alpha1.Resource("tektonkueue"))} +} diff --git a/pkg/reconciler/common/initcontroller.go b/pkg/reconciler/common/initcontroller.go index 325c6e274a..f480dc2eb9 100644 --- a/pkg/reconciler/common/initcontroller.go +++ b/pkg/reconciler/common/initcontroller.go @@ -126,9 +126,9 @@ func (ctrl Controller) fetchSourceManifests(ctx context.Context, opts PayloadOpt case v1alpha1.TektonPrunerResourceName: var pruner v1alpha1.TektonPruner return AppendTarget(ctx, ctrl.Manifest, &pruner) - case v1alpha1.TektonSchedulerResourceName: - var scheduler v1alpha1.TektonScheduler - return AppendTarget(ctx, ctrl.Manifest, &scheduler) + case v1alpha1.TektonKueueResourceName: + var kueue v1alpha1.TektonKueue + return AppendTarget(ctx, ctrl.Manifest, &kueue) case v1alpha1.MultiClusterProxyAAEResourceName: var proxyAAE v1alpha1.TektonMulticlusterProxyAAE return AppendTarget(ctx, ctrl.Manifest, &proxyAAE) diff --git a/pkg/reconciler/common/releases.go b/pkg/reconciler/common/releases.go index 2dbb44b72b..10e2a668ea 100644 --- a/pkg/reconciler/common/releases.go +++ b/pkg/reconciler/common/releases.go @@ -104,8 +104,8 @@ func ComponentDir(instance v1alpha1.TektonComponent) string { // Event-based pruner uses "pruner" directory (not "tekton-pruner") // to avoid conflicts with job-based pruner in "tekton-pruner" directory return filepath.Join(koDataDir, "pruner") - case *v1alpha1.TektonScheduler: - return filepath.Join(koDataDir, "tekton-scheduler") + case *v1alpha1.TektonKueue: + return filepath.Join(koDataDir, "tekton-kueue") case *v1alpha1.TektonMulticlusterProxyAAE: return filepath.Join(koDataDir, "tekton-multicluster-proxy-aae") case *v1alpha1.SyncerService: diff --git a/pkg/reconciler/common/transformers.go b/pkg/reconciler/common/transformers.go index c1d8836f7a..8341cc77e5 100644 --- a/pkg/reconciler/common/transformers.go +++ b/pkg/reconciler/common/transformers.go @@ -53,7 +53,7 @@ const ( ChainsImagePrefix = "IMAGE_CHAINS_" ManualApprovalGatePrefix = "IMAGE_MAG_" PrunerImagePrefix = "IMAGE_PRUNER_" - SchedulerImagePrefix = "IMAGE_SCHEDULER_" + KueueImagePrefix = "IMAGE_KUEUE_" MulticlusterProxyAAEImagePrefix = "IMAGE_MULTICLUSTERPROXYAAE_" SyncerServiceImagePrefix = "IMAGE_SYNCER_SERVICE_WORKLOAD_" ResultsImagePrefix = "IMAGE_RESULTS_" diff --git a/pkg/reconciler/kubernetes/kubernetesplatform/config.go b/pkg/reconciler/kubernetes/kubernetesplatform/config.go index 68b2b0a14a..7259fee899 100644 --- a/pkg/reconciler/kubernetes/kubernetesplatform/config.go +++ b/pkg/reconciler/kubernetes/kubernetesplatform/config.go @@ -23,11 +23,11 @@ import ( k8sConfig "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonconfig" k8sDashboard "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektondashboard" k8sInstallerSet "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektoninstallerset" + k8stektonkueue "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonkueue" k8sMulticlusterProxyAAE "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonmulticlusterproxyaae" k8sPipeline "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonpipeline" k8sTektonPruner "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonpruner" k8sResult "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonresult" - k8stektonscheduler "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonscheduler" k8sTrigger "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektontrigger" "github.com/tektoncd/operator/pkg/reconciler/platform" "knative.dev/pkg/injection" @@ -61,9 +61,9 @@ var ( platform.ControllerManualApprovalGate: injection.NamedControllerConstructor{ Name: string(platform.ControllerManualApprovalGate), ControllerConstructor: k8sManualApprovalGate.NewController}, - platform.ControllerTektonScheduler: injection.NamedControllerConstructor{ - Name: string(platform.ControllerTektonScheduler), - ControllerConstructor: k8stektonscheduler.NewController}, + platform.ControllerTektonKueue: injection.NamedControllerConstructor{ + Name: string(platform.ControllerTektonKueue), + ControllerConstructor: k8stektonkueue.NewController}, platform.ControllerMulticlusterProxyAAE: injection.NamedControllerConstructor{ Name: string(platform.ControllerMulticlusterProxyAAE), ControllerConstructor: k8sMulticlusterProxyAAE.NewController}, diff --git a/pkg/reconciler/kubernetes/tektonscheduler/controller.go b/pkg/reconciler/kubernetes/tektonkueue/controller.go similarity index 67% rename from pkg/reconciler/kubernetes/tektonscheduler/controller.go rename to pkg/reconciler/kubernetes/tektonkueue/controller.go index a02b394e21..1b7cd9400e 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/controller.go +++ b/pkg/reconciler/kubernetes/tektonkueue/controller.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" @@ -28,8 +28,8 @@ import ( "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" operatorclient "github.com/tektoncd/operator/pkg/client/injection/client" - tektonschedulerinformer "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonscheduler" - tektonschedulerreconciler "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler" + tektonkueueinformer "github.com/tektoncd/operator/pkg/client/injection/informers/operator/v1alpha1/tektonkueue" + tektonkueuereconciler "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue" "github.com/tektoncd/operator/pkg/reconciler/common" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" @@ -37,7 +37,7 @@ import ( "knative.dev/pkg/logging" ) -const versionConfigMap = v1alpha1.TektonSchedulerResourceName + "-info" +const versionConfigMap = v1alpha1.TektonKueueResourceName + "-info" // NewController initializes the controller and is called by the generated code // Registers eventhandlers to enqueue events @@ -53,7 +53,7 @@ func NewExtendedController(generator common.ExtensionGenerator) injection.Contro Logger: logger, VersionConfigMap: versionConfigMap, } - manifest, schedulerVer := ctrl.InitController(ctx, common.PayloadOptions{}) + manifest, kueueVer := ctrl.InitController(ctx, common.PayloadOptions{}) operatorVer, err := common.OperatorVersion(ctx) if err != nil { logger.Fatal("Error while getting operator version", err) @@ -67,26 +67,26 @@ func NewExtendedController(generator common.ExtensionGenerator) injection.Contro tisClient := operatorclient.Get(ctx).OperatorV1alpha1().TektonInstallerSets() metrics, _ := NewRecorder() c := &Reconciler{ - operatorClientSet: operatorclient.Get(ctx), - kubeClientSet: kubeclient.Get(ctx), - pipelineInformer: tektonPipelineinformer.Get(ctx), - installerSetClient: client.NewInstallerSetClient(tisClient, operatorVer, schedulerVer, v1alpha1.KindTektonScheduler, metrics), - extension: generator(ctx), - manifest: manifest, - platformParams: params, - tektonSchedulerVersion: schedulerVer, - operatorVersion: operatorVer, + operatorClientSet: operatorclient.Get(ctx), + kubeClientSet: kubeclient.Get(ctx), + pipelineInformer: tektonPipelineinformer.Get(ctx), + installerSetClient: client.NewInstallerSetClient(tisClient, operatorVer, kueueVer, v1alpha1.KindTektonKueue, metrics), + extension: generator(ctx), + manifest: manifest, + platformParams: params, + tektonKueueVersion: kueueVer, + operatorVersion: operatorVer, } - impl := tektonschedulerreconciler.NewImpl(ctx, c) + impl := tektonkueuereconciler.NewImpl(ctx, c) - logger.Debug("Setting up event handlers for TektonScheduler") + logger.Debug("Setting up event handlers for TektonKueue") - if _, err := tektonschedulerinformer.Get(ctx).Informer().AddEventHandler(controller.HandleAll(impl.Enqueue)); err != nil { - logger.Panicf("Couldn't register TektonScheduler informer event handler: %w", err) + if _, err := tektonkueueinformer.Get(ctx).Informer().AddEventHandler(controller.HandleAll(impl.Enqueue)); err != nil { + logger.Panicf("Couldn't register TektonKueue informer event handler: %w", err) } if _, err := tektonInstallerinformer.Get(ctx).Informer().AddEventHandler(cache.FilteringResourceEventHandler{ - FilterFunc: controller.FilterController(&v1alpha1.TektonScheduler{}), + FilterFunc: controller.FilterController(&v1alpha1.TektonKueue{}), Handler: controller.HandleAll(impl.EnqueueControllerOf), }); err != nil { logger.Panicf("Couldn't register TektonInstallerSet informer event handler: %w", err) diff --git a/pkg/reconciler/kubernetes/tektonscheduler/finalize.go b/pkg/reconciler/kubernetes/tektonkueue/finalize.go similarity index 83% rename from pkg/reconciler/kubernetes/tektonscheduler/finalize.go rename to pkg/reconciler/kubernetes/tektonkueue/finalize.go index 7b23314225..a74f65a834 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/finalize.go +++ b/pkg/reconciler/kubernetes/tektonkueue/finalize.go @@ -14,29 +14,29 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" mf "github.com/manifestival/manifestival" "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" - "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler" + "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue" "knative.dev/pkg/logging" pkgreconciler "knative.dev/pkg/reconciler" ) -var _ tektonscheduler.Finalizer = (*Reconciler)(nil) +var _ tektonkueue.Finalizer = (*Reconciler)(nil) -// FinalizeKind removes all resources after deletion of a TektonScheduler CR. -func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1alpha1.TektonScheduler) pkgreconciler.Event { +// FinalizeKind removes all resources after deletion of a TektonKueue CR. +func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1alpha1.TektonKueue) pkgreconciler.Event { logger := logging.FromContext(ctx) // Delete CRDs before deleting rest of resources so that any instance // of CRDs which has finalizer set will get deleted before we remove // the controller;s deployment for it if err := r.manifest.Filter(mf.CRDs).Delete(); err != nil { - logger.Error("Failed to deleted CRDs for TektonScheduler") + logger.Error("Failed to deleted CRDs for TektonKueue") return err } @@ -45,7 +45,7 @@ func (r *Reconciler) FinalizeKind(ctx context.Context, original *v1alpha1.Tekton return err } - if err := r.installerSetClient.CleanupCustomSet(ctx, schedulerCustomSet); err != nil { + if err := r.installerSetClient.CleanupCustomSet(ctx, kueueCustomSet); err != nil { logger.Error("failed to cleanup network policy installerset: ", err) return err } diff --git a/pkg/reconciler/kubernetes/tektonscheduler/installerset.go b/pkg/reconciler/kubernetes/tektonkueue/installerset.go similarity index 72% rename from pkg/reconciler/kubernetes/tektonscheduler/installerset.go rename to pkg/reconciler/kubernetes/tektonkueue/installerset.go index 87d5f0e5e4..d784e3bb5b 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/installerset.go +++ b/pkg/reconciler/kubernetes/tektonkueue/installerset.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" @@ -31,41 +31,41 @@ import ( "knative.dev/pkg/logging" ) -func (r *Reconciler) ensureInstallerSets(ctx context.Context, tektonScheduler *v1alpha1.TektonScheduler) error { +func (r *Reconciler) ensureInstallerSets(ctx context.Context, tektonKueue *v1alpha1.TektonKueue) error { logger := logging.FromContext(ctx) // Create Config Installset Before Main Set - if err := r.ensureConfigInstallerSet(ctx, tektonScheduler); err != nil { + if err := r.ensureConfigInstallerSet(ctx, tektonKueue); err != nil { msg := fmt.Sprintf("Config InstallerSet Reconcilation failed: %s", err.Error()) logger.Error(msg) if errors.Is(err, v1alpha1.REQUEUE_EVENT_AFTER) { return err } - tektonScheduler.Status.MarkInstallerSetNotReady(msg) + tektonKueue.Status.MarkInstallerSetNotReady(msg) return err } // Main Installerset Should not contain the configMap as it is already created by config installerset - filteredManifest := r.manifest.Filter(mf.Not(mf.All(mf.ByKind("ConfigMap"), mf.ByName(v1alpha1.SchedulerConfigMapName)))) - if err := r.installerSetClient.MainSet(ctx, tektonScheduler, &filteredManifest, filterAndTransform(r.extension)); err != nil { + filteredManifest := r.manifest.Filter(mf.Not(mf.All(mf.ByKind("ConfigMap"), mf.ByName(v1alpha1.KueueConfigMapName)))) + if err := r.installerSetClient.MainSet(ctx, tektonKueue, &filteredManifest, filterAndTransform(r.extension)); err != nil { msg := fmt.Sprintf("Main Reconcilation failed: %s", err.Error()) logger.Error(msg) if errors.Is(err, v1alpha1.REQUEUE_EVENT_AFTER) { return err } - tektonScheduler.Status.MarkInstallerSetNotReady(msg) + tektonKueue.Status.MarkInstallerSetNotReady(msg) } return nil } -func (r *Reconciler) ensureConfigInstallerSet(ctx context.Context, tektonScheduler *v1alpha1.TektonScheduler) error { +func (r *Reconciler) ensureConfigInstallerSet(ctx context.Context, tektonKueue *v1alpha1.TektonKueue) error { logger := logging.FromContext(ctx) labelSelector := metav1.LabelSelector{ MatchLabels: getLabels(), } configLabelSector, err := common.LabelSelector(labelSelector) if err != nil { - logger.Errorw("Invalid Scheduler config label selector", "error", err) + logger.Errorw("Invalid Kueue config label selector", "error", err) return err } existingConfigInstallerSet, err := tektoninstallerset.CurrentInstallerSetName(ctx, r.operatorClientSet, configLabelSector) @@ -74,17 +74,17 @@ func (r *Reconciler) ensureConfigInstallerSet(ctx context.Context, tektonSchedul return err } if existingConfigInstallerSet == "" { - tektonScheduler.Status.MarkInstallerSetNotAvailable(v1alpha1.SchedulerConfigInstallerSet + " InstallerSet not available") - logger.Infow("Creating new InstallerSet", v1alpha1.SchedulerConfigInstallerSet, "targetNamespace", tektonScheduler.Spec.TargetNamespace) + tektonKueue.Status.MarkInstallerSetNotAvailable(v1alpha1.KueueConfigInstallerSet + " InstallerSet not available") + logger.Infow("Creating new InstallerSet", v1alpha1.KueueConfigInstallerSet, "targetNamespace", tektonKueue.Spec.TargetNamespace) - _, err := r.createConfigInstallerSet(ctx, tektonScheduler) + _, err := r.createConfigInstallerSet(ctx, tektonKueue) if err != nil { logger.Errorw("Failed to create Config InstallerSet", "error", err) return err } } else { - // If exists, then fetch the Tekton Scheduler Config InstallerSet + // If exists, then fetch the Tekton Kueue Config InstallerSet installedConfigTIS, err := r.operatorClientSet.OperatorV1alpha1().TektonInstallerSets(). Get(ctx, existingConfigInstallerSet, metav1.GetOptions{}) if err != nil { @@ -96,15 +96,15 @@ func (r *Reconciler) ensureConfigInstallerSet(ctx context.Context, tektonSchedul configInstallerSetTargetNamespace := installedConfigTIS.Annotations[v1alpha1.TargetNamespaceKey] configInstallerSetReleaseVersion := installedConfigTIS.Labels[v1alpha1.ReleaseVersionKey] - if configInstallerSetTargetNamespace != tektonScheduler.Spec.TargetNamespace || configInstallerSetReleaseVersion != r.operatorVersion { + if configInstallerSetTargetNamespace != tektonKueue.Spec.TargetNamespace || configInstallerSetReleaseVersion != r.operatorVersion { logger.Infow("Config InstallerSet needs update", "name", existingConfigInstallerSet, "currentNamespace", configInstallerSetTargetNamespace, - "expectedNamespace", tektonScheduler.Spec.TargetNamespace, + "expectedNamespace", tektonKueue.Spec.TargetNamespace, "currentVersion", configInstallerSetReleaseVersion, "expectedVersion", r.operatorVersion) - // Delete the existing Tekton Scheduler InstallerSet + // Delete the existing Tekton Kueue InstallerSet err := r.operatorClientSet.OperatorV1alpha1().TektonInstallerSets(). Delete(ctx, existingConfigInstallerSet, metav1.DeleteOptions{}) if err != nil { @@ -112,11 +112,11 @@ func (r *Reconciler) ensureConfigInstallerSet(ctx context.Context, tektonSchedul return err } - // Make sure the Tekton Scheduler Config InstallerSet is deleted + // Make sure the Tekton Kueue Config InstallerSet is deleted _, err = r.operatorClientSet.OperatorV1alpha1().TektonInstallerSets(). Get(ctx, existingConfigInstallerSet, metav1.GetOptions{}) if err == nil { - tektonScheduler.Status.MarkNotReady("Waiting for previous installer set to get deleted") + tektonKueue.Status.MarkNotReady("Waiting for previous installer set to get deleted") logger.Debugw("Config InstallerSet deletion pending", "name", existingConfigInstallerSet) return v1alpha1.REQUEUE_EVENT_AFTER } @@ -127,12 +127,12 @@ func (r *Reconciler) ensureConfigInstallerSet(ctx context.Context, tektonSchedul return nil } else { - // If target namespace and version are not changed then check if Scheduler + // If target namespace and version are not changed then check if Kueue // spec is changed by checking hash stored as annotation on - // Tekton Scheduler InstallerSet with computing new hash of TektonScheduler Spec + // Tekton Kueue InstallerSet with computing new hash of TektonKueue Spec - // Hash of TektonScheduler Spec - expectedSpecHash, err := hash.Compute(tektonScheduler.Spec) + // Hash of TektonKueue Spec + expectedSpecHash, err := hash.Compute(tektonKueue.Spec) if err != nil { logger.Errorw("Failed to compute spec hash", "error", err) return err @@ -162,27 +162,27 @@ func (r *Reconciler) ensureConfigInstallerSet(ctx context.Context, tektonSchedul return nil } -func (r *Reconciler) createConfigInstallerSet(ctx context.Context, tektonScheduler *v1alpha1.TektonScheduler) (*v1alpha1.TektonInstallerSet, error) { +func (r *Reconciler) createConfigInstallerSet(ctx context.Context, tektonKueue *v1alpha1.TektonKueue) (*v1alpha1.TektonInstallerSet, error) { logger := logging.FromContext(ctx) manifest := r.manifest - manifest = manifest.Filter(mf.ByKind("ConfigMap"), mf.ByName(v1alpha1.SchedulerConfigMapName)) + manifest = manifest.Filter(mf.ByKind("ConfigMap"), mf.ByName(v1alpha1.KueueConfigMapName)) - logger.Infow("Creating a new SchedulerConfigInstallerSet", "manifest", manifest.Resources()) + logger.Infow("Creating a new KueueConfigInstallerSet", "manifest", manifest.Resources()) transformer := filterAndTransform(r.extension) - if _, err := transformer(ctx, &manifest, tektonScheduler); err != nil { - tektonScheduler.Status.MarkNotReady("transformation failed: " + err.Error()) + if _, err := transformer(ctx, &manifest, tektonKueue); err != nil { + tektonKueue.Status.MarkNotReady("transformation failed: " + err.Error()) return nil, err } // generate installer set - tis := r.makeInstallerSet(tektonScheduler, manifest, v1alpha1.SchedulerConfigInstallerSet) + tis := r.makeInstallerSet(tektonKueue, manifest, v1alpha1.KueueConfigInstallerSet) // compute the hash of spec and store as an annotation - // in further reconciliation we compute hash of tektonScheduler spec and check with + // in further reconciliation we compute hash of tektonKueue spec and check with // annotation, if they are same then we skip updating the object // otherwise we update the manifest - specHash, err := hash.Compute(tektonScheduler.Spec) + specHash, err := hash.Compute(tektonKueue.Spec) if err != nil { return nil, err } @@ -197,7 +197,7 @@ func (r *Reconciler) createConfigInstallerSet(ctx context.Context, tektonSchedul return createdIs, nil } -func (r *Reconciler) makeInstallerSet(tc *v1alpha1.TektonScheduler, manifest mf.Manifest, installerSetType string) *v1alpha1.TektonInstallerSet { +func (r *Reconciler) makeInstallerSet(tc *v1alpha1.TektonKueue, manifest mf.Manifest, installerSetType string) *v1alpha1.TektonInstallerSet { ownerRef := *metav1.NewControllerRef(tc, tc.GetGroupVersionKind()) labels := getLabels() @@ -220,8 +220,8 @@ func (r *Reconciler) makeInstallerSet(tc *v1alpha1.TektonScheduler, manifest mf. func getLabels() map[string]string { labels := map[string]string{ - v1alpha1.CreatedByKey: v1alpha1.SchedulerCreatedByValue, - v1alpha1.InstallerSetType: v1alpha1.SchedulerConfigInstallerSet, + v1alpha1.CreatedByKey: v1alpha1.KueueCreatedByValue, + v1alpha1.InstallerSetType: v1alpha1.KueueConfigInstallerSet, } return labels } diff --git a/pkg/reconciler/kubernetes/tektonscheduler/metrics.go b/pkg/reconciler/kubernetes/tektonkueue/metrics.go similarity index 97% rename from pkg/reconciler/kubernetes/tektonscheduler/metrics.go rename to pkg/reconciler/kubernetes/tektonkueue/metrics.go index 4c860344cf..40697a2427 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/metrics.go +++ b/pkg/reconciler/kubernetes/tektonkueue/metrics.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import "go.uber.org/zap" diff --git a/pkg/reconciler/kubernetes/tektonscheduler/networkpolicies.go b/pkg/reconciler/kubernetes/tektonkueue/networkpolicies.go similarity index 72% rename from pkg/reconciler/kubernetes/tektonscheduler/networkpolicies.go rename to pkg/reconciler/kubernetes/tektonkueue/networkpolicies.go index 45fae2f3a1..107892e418 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/networkpolicies.go +++ b/pkg/reconciler/kubernetes/tektonkueue/networkpolicies.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" @@ -28,16 +28,16 @@ import ( "k8s.io/apimachinery/pkg/util/intstr" ) -const schedulerCustomSet = "scheduler-network-policies" +const kueueCustomSet = "scheduler-network-policies" -func schedulerControllerDefaultPolicies(params networkpolicy.PlatformParams) []networkingv1.NetworkPolicy { +func kueueControllerDefaultPolicies(params networkpolicy.PlatformParams) []networkingv1.NetworkPolicy { metricsPort := intstr.FromInt32(8443) return []networkingv1.NetworkPolicy{ { ObjectMeta: metav1.ObjectMeta{Name: "scheduler-controller"}, Spec: networkingv1.NetworkPolicySpec{ - PodSelector: schedulerControllerSelector, + PodSelector: kueueControllerSelector, PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress, networkingv1.PolicyTypeEgress}, Ingress: []networkingv1.NetworkPolicyIngressRule{ networkpolicy.PrometheusIngressRule(params, metricsPort), @@ -51,7 +51,7 @@ func schedulerControllerDefaultPolicies(params networkpolicy.PlatformParams) []n } } -func schedulerWebhookDefaultPolicies(params networkpolicy.PlatformParams) []networkingv1.NetworkPolicy { +func kueueWebhookDefaultPolicies(params networkpolicy.PlatformParams) []networkingv1.NetworkPolicy { webhookPort := intstr.FromInt32(9443) metricsPort := intstr.FromInt32(8443) @@ -59,7 +59,7 @@ func schedulerWebhookDefaultPolicies(params networkpolicy.PlatformParams) []netw { ObjectMeta: metav1.ObjectMeta{Name: "scheduler-webhook"}, Spec: networkingv1.NetworkPolicySpec{ - PodSelector: schedulerWebhookSelector, + PodSelector: kueueWebhookSelector, PolicyTypes: []networkingv1.PolicyType{networkingv1.PolicyTypeIngress, networkingv1.PolicyTypeEgress}, Ingress: []networkingv1.NetworkPolicyIngressRule{ networkpolicy.WebhookIngressRule("", webhookPort), @@ -74,44 +74,44 @@ func schedulerWebhookDefaultPolicies(params networkpolicy.PlatformParams) []netw } } -var schedulerControllerSelector = metav1.LabelSelector{ +var kueueControllerSelector = metav1.LabelSelector{ MatchLabels: map[string]string{ "app.kubernetes.io/name": "tekton-kueue", "control-plane": "controller-manager", }, } -var schedulerWebhookSelector = metav1.LabelSelector{ +var kueueWebhookSelector = metav1.LabelSelector{ MatchLabels: map[string]string{ "app.kubernetes.io/name": "tekton-kueue-webhook", "control-plane": "controller-manager", }, } -func schedulerDefaultDenyPolicies() []networkingv1.NetworkPolicy { +func kueueDefaultDenyPolicies() []networkingv1.NetworkPolicy { return []networkingv1.NetworkPolicy{ - networkpolicy.DefaultDenyPolicy("scheduler-controller-default-deny", schedulerControllerSelector), - networkpolicy.DefaultDenyPolicy("scheduler-webhook-default-deny", schedulerWebhookSelector), + networkpolicy.DefaultDenyPolicy("scheduler-controller-default-deny", kueueControllerSelector), + networkpolicy.DefaultDenyPolicy("scheduler-webhook-default-deny", kueueWebhookSelector), } } -func (r *Reconciler) reconcileNetworkPolicies(ctx context.Context, ts *v1alpha1.TektonScheduler) error { - if ts.Spec.NetworkPolicy.Disabled { - return r.installerSetClient.CleanupCustomSet(ctx, schedulerCustomSet) +func (r *Reconciler) reconcileNetworkPolicies(ctx context.Context, tk *v1alpha1.TektonKueue) error { + if tk.Spec.NetworkPolicy.Disabled { + return r.installerSetClient.CleanupCustomSet(ctx, kueueCustomSet) } - defaults := schedulerDefaultDenyPolicies() - defaults = append(defaults, schedulerControllerDefaultPolicies(r.platformParams)...) - defaults = append(defaults, schedulerWebhookDefaultPolicies(r.platformParams)...) + defaults := kueueDefaultDenyPolicies() + defaults = append(defaults, kueueControllerDefaultPolicies(r.platformParams)...) + defaults = append(defaults, kueueWebhookDefaultPolicies(r.platformParams)...) manifest, err := networkpolicy.Generate( - ts.Spec.NetworkPolicy, - ts.Spec.GetTargetNamespace(), + tk.Spec.NetworkPolicy, + tk.Spec.GetTargetNamespace(), defaults, ) if err != nil { return err } - return r.installerSetClient.CustomSet(ctx, ts, schedulerCustomSet, &manifest, passthroughTransform, nil) + return r.installerSetClient.CustomSet(ctx, tk, kueueCustomSet, &manifest, passthroughTransform, nil) } func passthroughTransform(_ context.Context, m *mf.Manifest, _ v1alpha1.TektonComponent) (*mf.Manifest, error) { diff --git a/pkg/reconciler/kubernetes/tektonscheduler/networkpolicies_test.go b/pkg/reconciler/kubernetes/tektonkueue/networkpolicies_test.go similarity index 89% rename from pkg/reconciler/kubernetes/tektonscheduler/networkpolicies_test.go rename to pkg/reconciler/kubernetes/tektonkueue/networkpolicies_test.go index 0e9fe754a4..3867fde3f0 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/networkpolicies_test.go +++ b/pkg/reconciler/kubernetes/tektonkueue/networkpolicies_test.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "testing" @@ -24,14 +24,14 @@ import ( ) func TestConstants(t *testing.T) { - if schedulerCustomSet != "scheduler-network-policies" { - t.Errorf("expected custom set scheduler-network-policies, got %q", schedulerCustomSet) + if kueueCustomSet != "scheduler-network-policies" { + t.Errorf("expected custom set scheduler-network-policies, got %q", kueueCustomSet) } } -func TestSchedulerControllerDefaultPolicies(t *testing.T) { +func TestKueueControllerDefaultPolicies(t *testing.T) { params := networkpolicy.KubernetesPlatformDefaults() - policies := schedulerControllerDefaultPolicies(params) + policies := kueueControllerDefaultPolicies(params) if len(policies) != 1 { t.Fatalf("expected 1 policy, got %d", len(policies)) @@ -69,9 +69,9 @@ func TestSchedulerControllerDefaultPolicies(t *testing.T) { } } -func TestSchedulerWebhookDefaultPolicies(t *testing.T) { +func TestKueueWebhookDefaultPolicies(t *testing.T) { params := networkpolicy.KubernetesPlatformDefaults() - policies := schedulerWebhookDefaultPolicies(params) + policies := kueueWebhookDefaultPolicies(params) if len(policies) != 1 { t.Fatalf("expected 1 policy, got %d", len(policies)) @@ -105,8 +105,8 @@ func TestSchedulerWebhookDefaultPolicies(t *testing.T) { } } -func TestSchedulerDefaultDenyPolicies(t *testing.T) { - policies := schedulerDefaultDenyPolicies() +func TestKueueDefaultDenyPolicies(t *testing.T) { + policies := kueueDefaultDenyPolicies() if len(policies) != 2 { t.Fatalf("expected 2 default-deny policies, got %d", len(policies)) @@ -129,9 +129,9 @@ func TestSchedulerDefaultDenyPolicies(t *testing.T) { } } -func TestSchedulerControllerPolicies_OpenShift(t *testing.T) { +func TestKueueControllerPolicies_OpenShift(t *testing.T) { params := networkpolicy.OpenShiftPlatformDefaults() - policies := schedulerControllerDefaultPolicies(params) + policies := kueueControllerDefaultPolicies(params) if len(policies) != 1 { t.Fatalf("expected 1 policy, got %d", len(policies)) diff --git a/pkg/reconciler/kubernetes/tektonscheduler/reconcile.go b/pkg/reconciler/kubernetes/tektonkueue/reconcile.go similarity index 64% rename from pkg/reconciler/kubernetes/tektonscheduler/reconcile.go rename to pkg/reconciler/kubernetes/tektonkueue/reconcile.go index 47ce68d5ed..7768b3a9d5 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/reconcile.go +++ b/pkg/reconciler/kubernetes/tektonkueue/reconcile.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" @@ -25,7 +25,7 @@ import ( "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" operatorclient "github.com/tektoncd/operator/pkg/client/clientset/versioned" pipelineinformer "github.com/tektoncd/operator/pkg/client/informers/externalversions/operator/v1alpha1" - TektonSchedulerreconciler "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonscheduler" + TektonKueuereconciler "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonkueue" "github.com/tektoncd/operator/pkg/reconciler/common" "github.com/tektoncd/operator/pkg/reconciler/common/networkpolicy" "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektoninstallerset/client" @@ -34,7 +34,7 @@ import ( pkgreconciler "knative.dev/pkg/reconciler" ) -// Reconciler implements controller.Reconciler for TektonScheduler resources. +// Reconciler implements controller.Reconciler for TektonKueue resources. type Reconciler struct { // operator client to interact with operator resources operatorClientSet operatorclient.Interface @@ -44,115 +44,115 @@ type Reconciler struct { installerSetClient *client.InstallerSetClient // pipelineInformer to query for TektonPipeline pipelineInformer pipelineinformer.TektonPipelineInformer - // manifest has the source manifest of Tekton schedulers for a + // manifest has the source manifest of Tekton kueues for a // particular version manifest mf.Manifest // Platform-specific behavior to affect the transform extension common.Extension // platformParams holds platform-specific values for building NetworkPolicy rules platformParams networkpolicy.PlatformParams - // version of scheduler which we are installing - tektonSchedulerVersion string - operatorVersion string + // version of kueue which we are installing + tektonKueueVersion string + operatorVersion string } // Check that our Reconciler implements controller.Reconciler -var _ TektonSchedulerreconciler.Interface = (*Reconciler)(nil) +var _ TektonKueuereconciler.Interface = (*Reconciler)(nil) // ReconcileKind compares the actual state with the desired, and attempts to // converge the two. -func (r *Reconciler) ReconcileKind(ctx context.Context, TektonScheduler *v1alpha1.TektonScheduler) pkgreconciler.Event { - logger := logging.FromContext(ctx).With("name", TektonScheduler.GetName()) - TektonScheduler.Status.InitializeConditions() - TektonScheduler.Status.SetVersion(r.tektonSchedulerVersion) +func (r *Reconciler) ReconcileKind(ctx context.Context, TektonKueue *v1alpha1.TektonKueue) pkgreconciler.Event { + logger := logging.FromContext(ctx).With("name", TektonKueue.GetName()) + TektonKueue.Status.InitializeConditions() + TektonKueue.Status.SetVersion(r.tektonKueueVersion) - if TektonScheduler.GetName() != v1alpha1.TektonSchedulerResourceName { + if TektonKueue.GetName() != v1alpha1.TektonKueueResourceName { msg := fmt.Sprintf( "Resource ignored, Expected Name: %s, Got Name: %s", - v1alpha1.TektonSchedulerResourceName, - TektonScheduler.GetName(), + v1alpha1.TektonKueueResourceName, + TektonKueue.GetName(), ) logger.Error(msg) - TektonScheduler.Status.MarkNotReady(msg) + TektonKueue.Status.MarkNotReady(msg) return nil } // reconcile target namespace - if err := common.ReconcileTargetNamespace(ctx, nil, nil, TektonScheduler, r.kubeClientSet); err != nil { + if err := common.ReconcileTargetNamespace(ctx, nil, nil, TektonKueue, r.kubeClientSet); err != nil { return err } // Make sure TektonPipeline is installed before proceeding with - err := r.ensureDependenciesInstalled(TektonScheduler) + err := r.ensureDependenciesInstalled(TektonKueue) if err != nil { return v1alpha1.REQUEUE_EVENT_AFTER } - TektonScheduler.Status.MarkDependenciesInstalled() + TektonKueue.Status.MarkDependenciesInstalled() if err := r.installerSetClient.RemoveObsoleteSets(ctx); err != nil { logger.Error("failed to remove obsolete installer sets: %v", err) return err } - if err := r.extension.PreReconcile(ctx, TektonScheduler); err != nil { + if err := r.extension.PreReconcile(ctx, TektonKueue); err != nil { msg := fmt.Sprintf("PreReconciliation failed: %s", err.Error()) logger.Error(msg) if err == v1alpha1.REQUEUE_EVENT_AFTER { return err } - TektonScheduler.Status.MarkPreReconcilerFailed(msg) + TektonKueue.Status.MarkPreReconcilerFailed(msg) return nil } // Mark PreReconcile Complete - TektonScheduler.Status.MarkPreReconcilerComplete() + TektonKueue.Status.MarkPreReconcilerComplete() // Create/Update Required TektonInstallerSets - if err := r.ensureInstallerSets(ctx, TektonScheduler); err != nil { + if err := r.ensureInstallerSets(ctx, TektonKueue); err != nil { return err } - if err := r.reconcileNetworkPolicies(ctx, TektonScheduler); err != nil { + if err := r.reconcileNetworkPolicies(ctx, TektonKueue); err != nil { if err == v1alpha1.REQUEUE_EVENT_AFTER { return err } msg := fmt.Sprintf("NetworkPolicy reconciliation failed: %s", err.Error()) logger.Errorw("NetworkPolicy reconciliation failed", "error", err) - TektonScheduler.Status.MarkInstallerSetNotReady(msg) + TektonKueue.Status.MarkInstallerSetNotReady(msg) return nil } - if err := r.extension.PostReconcile(ctx, TektonScheduler); err != nil { + if err := r.extension.PostReconcile(ctx, TektonKueue); err != nil { msg := fmt.Sprintf("PostReconciliation failed: %s", err.Error()) logger.Error(msg) if err == v1alpha1.REQUEUE_EVENT_AFTER { return err } - TektonScheduler.Status.MarkPostReconcilerFailed(msg) + TektonKueue.Status.MarkPostReconcilerFailed(msg) return nil } // Mark PostReconcile Complete - TektonScheduler.Status.MarkPostReconcilerComplete() + TektonKueue.Status.MarkPostReconcilerComplete() return nil } -func (r *Reconciler) ensureDependenciesInstalled(TektonScheduler *v1alpha1.TektonScheduler) error { +func (r *Reconciler) ensureDependenciesInstalled(TektonKueue *v1alpha1.TektonKueue) error { if _, err := common.PipelineReady(r.pipelineInformer); err != nil { if err.Error() == common.PipelineNotReady || errors.Is(err, v1alpha1.DEPENDENCY_UPGRADE_PENDING_ERR) { - TektonScheduler.Status.MarkDependencyInstalling("tekton-pipelines is still installing") + TektonKueue.Status.MarkDependencyInstalling("tekton-pipelines is still installing") // wait for pipeline status to change return v1alpha1.REQUEUE_EVENT_AFTER } // (tektonpipeline.operator.tekton.dev instance not available yet) - TektonScheduler.Status.MarkDependencyMissing("tekton-pipelines does not exist") + TektonKueue.Status.MarkDependencyMissing("tekton-pipelines does not exist") return err } discoveryClient := r.kubeClientSet.Discovery() _, err := discoveryClient.ServerResourcesForGroupVersion("kueue.x-k8s.io/v1beta1") if err != nil { - TektonScheduler.Status.MarkDependencyMissing("API kueue.x-k8s.io/v1beta1 does not exist. Please install kueue.x-k8s.io/v1beta1") + TektonKueue.Status.MarkDependencyMissing("API kueue.x-k8s.io/v1beta1 does not exist. Please install kueue.x-k8s.io/v1beta1") return err } diff --git a/pkg/reconciler/kubernetes/tektonscheduler/transformer.go b/pkg/reconciler/kubernetes/tektonkueue/transformer.go similarity index 80% rename from pkg/reconciler/kubernetes/tektonscheduler/transformer.go rename to pkg/reconciler/kubernetes/tektonkueue/transformer.go index 12ed26d774..60eba4f410 100644 --- a/pkg/reconciler/kubernetes/tektonscheduler/transformer.go +++ b/pkg/reconciler/kubernetes/tektonkueue/transformer.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" @@ -35,32 +35,32 @@ const ( func filterAndTransform(extension common.Extension) client.FilterAndTransform { return func(ctx context.Context, manifest *mf.Manifest, comp v1alpha1.TektonComponent) (*mf.Manifest, error) { - schedulerCR := comp.(*v1alpha1.TektonScheduler) + kueueCR := comp.(*v1alpha1.TektonKueue) - imagesRaw := common.ToLowerCaseKeys(common.ImagesFromEnv(common.SchedulerImagePrefix)) - schedulerImages := common.ImageRegistryDomainOverride(imagesRaw) + imagesRaw := common.ToLowerCaseKeys(common.ImagesFromEnv(common.KueueImagePrefix)) + kueueImages := common.ImageRegistryDomainOverride(imagesRaw) extra := []mf.Transformer{ - common.InjectOperandNameLabelOverwriteExisting(v1alpha1.TektonSchedulerResourceName), - common.DeploymentImages(schedulerImages), + common.InjectOperandNameLabelOverwriteExisting(v1alpha1.TektonKueueResourceName), + common.DeploymentImages(kueueImages), common.AddDeploymentRestrictedPSA(), - common.AddConfigMapValues(v1alpha1.SchedulerConfigMapName, schedulerCR.Spec.SchedulerConfig), - CertificateTransformer(schedulerCR.GetSpec().GetTargetNamespace()), - MutatingWebhookConfigurationTransformer(ctx, schedulerCR.GetSpec().GetTargetNamespace()), + common.AddConfigMapValues(v1alpha1.KueueConfigMapName, kueueCR.Spec.KueueConfig), + CertificateTransformer(kueueCR.GetSpec().GetTargetNamespace()), + MutatingWebhookConfigurationTransformer(ctx, kueueCR.GetSpec().GetTargetNamespace()), } - extra = append(extra, extension.Transformers(schedulerCR)...) - err := common.Transform(ctx, manifest, schedulerCR, extra...) + extra = append(extra, extension.Transformers(kueueCR)...) + err := common.Transform(ctx, manifest, kueueCR, extra...) if err != nil { return &mf.Manifest{}, err } // additional options transformer // always execute as last transformer, so that the values in options will be final update values on the manifests - if err := common.ExecuteAdditionalOptionsTransformer(ctx, manifest, schedulerCR.Spec.GetTargetNamespace(), schedulerCR.Spec.Options); err != nil { + if err := common.ExecuteAdditionalOptionsTransformer(ctx, manifest, kueueCR.Spec.GetTargetNamespace(), kueueCR.Spec.Options); err != nil { return &mf.Manifest{}, err } - // Now Remove the TargetNamespace from manifest as same is not owned by Scheduler. - filteredManifest := manifest.Filter(mf.Not(mf.ByKind("Namespace")), mf.Not(mf.ByName(schedulerCR.GetSpec().GetTargetNamespace()))) + // Now Remove the TargetNamespace from manifest as same is not owned by Kueue. + filteredManifest := manifest.Filter(mf.Not(mf.ByKind("Namespace")), mf.Not(mf.ByName(kueueCR.GetSpec().GetTargetNamespace()))) return &filteredManifest, nil } diff --git a/pkg/reconciler/openshift/openshiftplatform/config.go b/pkg/reconciler/openshift/openshiftplatform/config.go index 8a9c558bb0..1ba3277659 100644 --- a/pkg/reconciler/openshift/openshiftplatform/config.go +++ b/pkg/reconciler/openshift/openshiftplatform/config.go @@ -24,11 +24,11 @@ import ( openshiftAddon "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonaddon" openshiftChain "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonchain" openshiftConfig "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonconfig" + openshiftKueue "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonkueue" openshiftMulticlusterProxyAAE "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonmulticlusterproxyaae" openshiftPipeline "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonpipeline" openshiftPruner "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonpruner" openshiftResult "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonresult" - openshiftScheduler "github.com/tektoncd/operator/pkg/reconciler/openshift/tektonscheduler" openshiftTrigger "github.com/tektoncd/operator/pkg/reconciler/openshift/tektontrigger" "github.com/tektoncd/operator/pkg/reconciler/platform" "knative.dev/pkg/injection" @@ -84,9 +84,9 @@ var ( Name: string(platform.ControllerTektonPruner), ControllerConstructor: openshiftPruner.NewController, }, - platform.ControllerTektonScheduler: injection.NamedControllerConstructor{ - Name: string(platform.ControllerTektonScheduler), - ControllerConstructor: openshiftScheduler.NewController, + platform.ControllerTektonKueue: injection.NamedControllerConstructor{ + Name: string(platform.ControllerTektonKueue), + ControllerConstructor: openshiftKueue.NewController, }, platform.ControllerMulticlusterProxyAAE: injection.NamedControllerConstructor{ Name: string(platform.ControllerMulticlusterProxyAAE), diff --git a/pkg/reconciler/openshift/tektonscheduler/controller.go b/pkg/reconciler/openshift/tektonkueue/controller.go similarity index 95% rename from pkg/reconciler/openshift/tektonscheduler/controller.go rename to pkg/reconciler/openshift/tektonkueue/controller.go index df2d94100a..b51667beb8 100644 --- a/pkg/reconciler/openshift/tektonscheduler/controller.go +++ b/pkg/reconciler/openshift/tektonkueue/controller.go @@ -14,12 +14,12 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" - k8sctrl "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonscheduler" + k8sctrl "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonkueue" "knative.dev/pkg/configmap" "knative.dev/pkg/controller" diff --git a/pkg/reconciler/openshift/tektonscheduler/extension.go b/pkg/reconciler/openshift/tektonkueue/extension.go similarity index 98% rename from pkg/reconciler/openshift/tektonscheduler/extension.go rename to pkg/reconciler/openshift/tektonkueue/extension.go index b5554ff801..c57bda3ba2 100644 --- a/pkg/reconciler/openshift/tektonscheduler/extension.go +++ b/pkg/reconciler/openshift/tektonkueue/extension.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package tektonscheduler +package tektonkueue import ( "context" diff --git a/pkg/reconciler/platform/const.go b/pkg/reconciler/platform/const.go index 30b1d732e5..2ba92d5c91 100644 --- a/pkg/reconciler/platform/const.go +++ b/pkg/reconciler/platform/const.go @@ -26,7 +26,7 @@ const ( ControllerTektonResult ControllerName = "tektonresult" ControllerManualApprovalGate ControllerName = "manualapprovalgate" ControllerTektonPruner ControllerName = "tektonpruner" - ControllerTektonScheduler ControllerName = "tektonscheduler" + ControllerTektonKueue ControllerName = "tektonkueue" ControllerMulticlusterProxyAAE ControllerName = "tektonmulticlusterproxyaae" ControllerSyncerService ControllerName = "syncerservice" // ControllerOpenShiftPipelinesAsCode is the operand reconciler for OpenShiftPipelinesAsCode; diff --git a/pkg/reconciler/shared/tektonconfig/scheduler/scheduler.go b/pkg/reconciler/shared/tektonconfig/kueue/kueue.go similarity index 61% rename from pkg/reconciler/shared/tektonconfig/scheduler/scheduler.go rename to pkg/reconciler/shared/tektonconfig/kueue/kueue.go index 726f6ef08c..971911b488 100644 --- a/pkg/reconciler/shared/tektonconfig/scheduler/scheduler.go +++ b/pkg/reconciler/shared/tektonconfig/kueue/kueue.go @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and limitations under the License. */ -package scheduler +package kueue import ( "context" @@ -35,27 +35,28 @@ const ( CERT_GVK = "cert-manager.io/v1" ) -func EnsureTektonSchedulerExists(ctx context.Context, clients op.TektonSchedulerInterface, newScheduler *v1alpha1.TektonScheduler) (*v1alpha1.TektonScheduler, error) { +func EnsureTektonKueueExists(ctx context.Context, clients op.TektonKueueInterface, newKueue *v1alpha1.TektonKueue) (*v1alpha1.TektonKueue, error) { + // Update MultiKueueOverride // If MultiCluster is enabled and MultiClusterRole=Hub then MultiKueueOverride should be true - newScheduler.Spec.Config.MultiKueueOverride = !newScheduler.Spec.MultiClusterDisabled && strings.EqualFold(string(newScheduler.Spec.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) - TektonScheduler, err := GetTektonScheduler(ctx, clients, v1alpha1.TektonSchedulerResourceName) + newKueue.Spec.Config.MultiKueueOverride = !newKueue.Spec.MultiClusterDisabled && strings.EqualFold(string(newKueue.Spec.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) + TektonKueue, err := GetTektonKueue(ctx, clients, v1alpha1.TektonKueueResourceName) if err != nil { if !apierrs.IsNotFound(err) { return nil, err } - if err := CreateScheduler(ctx, clients, newScheduler); err != nil { + if err := CreateKueue(ctx, clients, newKueue); err != nil { return nil, err } return nil, v1alpha1.RECONCILE_AGAIN_ERR } - TektonScheduler, err = UpdateScheduler(ctx, TektonScheduler, newScheduler, clients) + TektonKueue, err = UpdateKueue(ctx, TektonKueue, newKueue, clients) if err != nil { return nil, err } - ok, err := isTektonSchedulerReady(TektonScheduler, err) + ok, err := isTektonKueueReady(TektonKueue, err) if err != nil { return nil, err } @@ -64,40 +65,40 @@ func EnsureTektonSchedulerExists(ctx context.Context, clients op.TektonScheduler return nil, v1alpha1.RECONCILE_AGAIN_ERR } - return TektonScheduler, err + return TektonKueue, err } -func GetTektonScheduler(ctx context.Context, clients op.TektonSchedulerInterface, name string) (*v1alpha1.TektonScheduler, error) { +func GetTektonKueue(ctx context.Context, clients op.TektonKueueInterface, name string) (*v1alpha1.TektonKueue, error) { return clients.Get(ctx, name, metav1.GetOptions{}) } -func GetTektonSchedulerCR(config *v1alpha1.TektonConfig, operatorVersion string) *v1alpha1.TektonScheduler { +func GetTektonKueueCR(config *v1alpha1.TektonConfig, operatorVersion string) *v1alpha1.TektonKueue { ownerRef := *metav1.NewControllerRef(config, config.GroupVersionKind()) - return &v1alpha1.TektonScheduler{ + return &v1alpha1.TektonKueue{ ObjectMeta: metav1.ObjectMeta{ - Name: v1alpha1.TektonSchedulerResourceName, + Name: v1alpha1.TektonKueueResourceName, OwnerReferences: []metav1.OwnerReference{ownerRef}, Labels: map[string]string{ v1alpha1.ReleaseVersionKey: operatorVersion, }, }, - Spec: v1alpha1.TektonSchedulerSpec{ + Spec: v1alpha1.TektonKueueSpec{ CommonSpec: v1alpha1.CommonSpec{ TargetNamespace: config.Spec.TargetNamespace, }, - Scheduler: config.Spec.Scheduler, + Kueue: config.Spec.Kueue, NetworkPolicy: config.Spec.NetworkPolicy, }, } } -func CreateScheduler(ctx context.Context, clients op.TektonSchedulerInterface, scheduler *v1alpha1.TektonScheduler) error { - _, err := clients.Create(ctx, scheduler, metav1.CreateOptions{}) +func CreateKueue(ctx context.Context, clients op.TektonKueueInterface, kueue *v1alpha1.TektonKueue) error { + _, err := clients.Create(ctx, kueue, metav1.CreateOptions{}) return err } -func UpdateScheduler(ctx context.Context, old *v1alpha1.TektonScheduler, new *v1alpha1.TektonScheduler, clients op.TektonSchedulerInterface) (*v1alpha1.TektonScheduler, error) { - // if the scheduler spec is changed then update the instance +func UpdateKueue(ctx context.Context, old *v1alpha1.TektonKueue, new *v1alpha1.TektonKueue, clients op.TektonKueueInterface) (*v1alpha1.TektonKueue, error) { + // if the kueue spec is changed then update the instance updated := false // initialize labels(map) object if old.ObjectMeta.Labels == nil { @@ -114,13 +115,13 @@ func UpdateScheduler(ctx context.Context, old *v1alpha1.TektonScheduler, new *v1 updated = true } - if !reflect.DeepEqual(old.Spec.Scheduler, new.Spec.Scheduler) { - old.Spec.Scheduler = new.Spec.Scheduler + if !reflect.DeepEqual(old.Spec.Kueue, new.Spec.Kueue) { + old.Spec.Kueue = new.Spec.Kueue updated = true } - if !reflect.DeepEqual(old.Spec.SchedulerConfig, new.Spec.SchedulerConfig) { - old.Spec.SchedulerConfig = new.Spec.SchedulerConfig + if !reflect.DeepEqual(old.Spec.KueueConfig, new.Spec.KueueConfig) { + old.Spec.KueueConfig = new.Spec.KueueConfig updated = true } @@ -156,7 +157,7 @@ func UpdateScheduler(ctx context.Context, old *v1alpha1.TektonScheduler, new *v1 return old, nil } -func isTektonSchedulerReady(s *v1alpha1.TektonScheduler, err error) (bool, error) { +func isTektonKueueReady(s *v1alpha1.TektonKueue, err error) (bool, error) { if s.GetStatus() != nil && s.GetStatus().GetCondition(apis.ConditionReady) != nil { if strings.Contains(s.GetStatus().GetCondition(apis.ConditionReady).Message, v1alpha1.UpgradePending) { return false, v1alpha1.DEPENDENCY_UPGRADE_PENDING_ERR @@ -165,21 +166,21 @@ func isTektonSchedulerReady(s *v1alpha1.TektonScheduler, err error) (bool, error return s.Status.IsReady(), err } -func EnsureTektonSchedulerCRNotExists(ctx context.Context, clients op.TektonSchedulerInterface) error { - if _, err := GetTektonScheduler(ctx, clients, v1alpha1.TektonSchedulerResourceName); err != nil { +func EnsureTektonKueueCRNotExists(ctx context.Context, clients op.TektonKueueInterface) error { + if _, err := GetTektonKueue(ctx, clients, v1alpha1.TektonKueueResourceName); err != nil { if apierrs.IsNotFound(err) { - // TektonScheduler CR is gone, hence return nil + // TektonKueue CR is gone, hence return nil return nil } return err } // if the Get was successful, try deleting the CR - if err := clients.Delete(ctx, v1alpha1.TektonSchedulerResourceName, metav1.DeleteOptions{}); err != nil { + if err := clients.Delete(ctx, v1alpha1.TektonKueueResourceName, metav1.DeleteOptions{}); err != nil { if apierrs.IsNotFound(err) { - // TektonScheduler CR is gone, hence return nil + // TektonKueue CR is gone, hence return nil return nil } - return fmt.Errorf("TektonScheduler %q failed to delete: %v", v1alpha1.TektonSchedulerResourceName, err) + return fmt.Errorf("TektonKueue %q failed to delete: %v", v1alpha1.TektonKueueResourceName, err) } // if the Delete API call was success, // then return requeue_event @@ -189,9 +190,9 @@ func EnsureTektonSchedulerCRNotExists(ctx context.Context, clients op.TektonSche // EnsureTektonComponent validates that specific component is deployed on cluster func EnsureTektonComponent(ctx context.Context, tc *v1alpha1.TektonConfig, operatorClientSet clientset.Interface, operatorVersion string) error { - if tc.Spec.Scheduler.IsDisabled() { - // If TektonScheduler is disabled then uninstall the components - return EnsureTektonSchedulerCRNotExists(ctx, operatorClientSet.OperatorV1alpha1().TektonSchedulers()) + if tc.Spec.Kueue.IsDisabled() { + // If TektonKueue is disabled then uninstall the components + return EnsureTektonKueueCRNotExists(ctx, operatorClientSet.OperatorV1alpha1().TektonKueues()) } // Cert-Manager should also be pre-installed _, err := operatorClientSet.Discovery().ServerResourcesForGroupVersion(CERT_GVK) @@ -200,17 +201,17 @@ func EnsureTektonComponent(ctx context.Context, tc *v1alpha1.TektonConfig, opera return v1alpha1.REQUEUE_EVENT_AFTER } - // Before Installing Scheduler, Make sure that Upstream Kueue is installed + // Before Installing Kueue, Make sure that Upstream Kueue is installed _, err = operatorClientSet.Discovery().ServerResourcesForGroupVersion(KUEUE_GVK) if err != nil { tc.Status.MarkComponentNotReady(fmt.Sprintf("Please install kueue (%s) First, %s ", KUEUE_GVK, err.Error())) return v1alpha1.REQUEUE_EVENT_AFTER } - // If Scheduler is installed then create TektonScheduler CR - TektonScheduler := GetTektonSchedulerCR(tc, operatorVersion) - if _, err := EnsureTektonSchedulerExists(ctx, operatorClientSet.OperatorV1alpha1().TektonSchedulers(), TektonScheduler); err != nil { - tc.Status.MarkComponentNotReady(fmt.Sprintf("TektonScheduler : %s", err.Error())) + // If Kueue is installed then create TektonKueue CR + TektonKueue := GetTektonKueueCR(tc, operatorVersion) + if _, err := EnsureTektonKueueExists(ctx, operatorClientSet.OperatorV1alpha1().TektonKueues(), TektonKueue); err != nil { + tc.Status.MarkComponentNotReady(fmt.Sprintf("TektonKueue : %s", err.Error())) return v1alpha1.REQUEUE_EVENT_AFTER } return nil diff --git a/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae.go b/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae.go index 29724d94b7..c52773dd20 100644 --- a/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae.go +++ b/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae.go @@ -30,17 +30,17 @@ import ( ) // IsMulticlusterProxyAAEEnabled returns true when TektonMulticlusterProxyAAE should be deployed: -// scheduler is not disabled, multi-cluster is enabled, and role is Hub. +// Tekton Kueue is not disabled, multi-cluster is enabled, and role is Hub. func IsMulticlusterProxyAAEEnabled(tc *v1alpha1.TektonConfig) bool { - if tc.Spec.Scheduler.IsDisabled() { + if tc.Spec.Kueue.IsDisabled() { return false } - return !tc.Spec.Scheduler.MultiClusterDisabled && - strings.EqualFold(string(tc.Spec.Scheduler.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) + return !tc.Spec.Kueue.MultiClusterDisabled && + strings.EqualFold(string(tc.Spec.Kueue.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) } // EnsureTektonMulticlusterProxyAAEComponent ensures TektonMulticlusterProxyAAE CR exists or is removed -// based on TektonConfig scheduler spec (multi-cluster enabled + Hub role). +// based on TektonConfig Tekton Kueue spec (multi-cluster enabled + Hub role). func EnsureTektonMulticlusterProxyAAEComponent(ctx context.Context, tc *v1alpha1.TektonConfig, clients op.TektonMulticlusterProxyAAEInterface, operatorVersion string) error { if !IsMulticlusterProxyAAEEnabled(tc) { return EnsureTektonMulticlusterProxyAAECRNotExists(ctx, clients) diff --git a/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae_test.go b/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae_test.go index 43fb76c17f..63c7d7aa5f 100644 --- a/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae_test.go +++ b/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae/multiclusterproxyaae_test.go @@ -92,11 +92,11 @@ func TestIsMulticlusterProxyAAEEnabled(t *testing.T) { want bool }{ { - name: "scheduler disabled returns false", + name: "Tekton Kueue disabled returns false", tc: &v1alpha1.TektonConfig{ ObjectMeta: metav1.ObjectMeta{Name: "config"}, Spec: v1alpha1.TektonConfigSpec{ - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.Bool(true), }, }, @@ -104,11 +104,11 @@ func TestIsMulticlusterProxyAAEEnabled(t *testing.T) { want: false, }, { - name: "scheduler enabled but multi-cluster disabled returns false", + name: "Tekton Kueue enabled but multi-cluster disabled returns false", tc: &v1alpha1.TektonConfig{ ObjectMeta: metav1.ObjectMeta{Name: "config"}, Spec: v1alpha1.TektonConfigSpec{ - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.Bool(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: true, @@ -120,11 +120,11 @@ func TestIsMulticlusterProxyAAEEnabled(t *testing.T) { want: false, }, { - name: "scheduler enabled, multi-cluster enabled, role Spoke returns false", + name: "Tekton Kueue enabled, multi-cluster enabled, role Spoke returns false", tc: &v1alpha1.TektonConfig{ ObjectMeta: metav1.ObjectMeta{Name: "config"}, Spec: v1alpha1.TektonConfigSpec{ - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.Bool(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, @@ -136,11 +136,11 @@ func TestIsMulticlusterProxyAAEEnabled(t *testing.T) { want: false, }, { - name: "scheduler enabled, multi-cluster enabled, role Hub returns true", + name: "Tekton Kueue enabled, multi-cluster enabled, role Hub returns true", tc: &v1alpha1.TektonConfig{ ObjectMeta: metav1.ObjectMeta{Name: "config"}, Spec: v1alpha1.TektonConfigSpec{ - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.Bool(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, @@ -152,11 +152,11 @@ func TestIsMulticlusterProxyAAEEnabled(t *testing.T) { want: true, }, { - name: "scheduler enabled, multi-cluster enabled, role hub (lowercase) returns true", + name: "Tekton Kueue enabled, multi-cluster enabled, role hub (lowercase) returns true", tc: &v1alpha1.TektonConfig{ ObjectMeta: metav1.ObjectMeta{Name: "config"}, Spec: v1alpha1.TektonConfigSpec{ - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.Bool(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, diff --git a/pkg/reconciler/shared/tektonconfig/result/result.go b/pkg/reconciler/shared/tektonconfig/result/result.go index 125d348d16..c4caacd0b3 100644 --- a/pkg/reconciler/shared/tektonconfig/result/result.go +++ b/pkg/reconciler/shared/tektonconfig/result/result.go @@ -195,8 +195,8 @@ func GetTektonResultCR(config *v1alpha1.TektonConfig, operatorVersion string) *v // For Hub clusters (multicluster enabled AND role is Hub), set replicas to 0 // for watcher and retention-policy-agent deployments - if !config.Spec.Scheduler.MultiClusterDisabled && - strings.EqualFold(string(config.Spec.Scheduler.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) { + if !config.Spec.Kueue.MultiClusterDisabled && + strings.EqualFold(string(config.Spec.Kueue.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) { result = disableWatcherAndRetentionAgentOnHubCluster(result) } diff --git a/pkg/reconciler/shared/tektonconfig/result/result_test.go b/pkg/reconciler/shared/tektonconfig/result/result_test.go index d49fe670ad..6d01436ce7 100644 --- a/pkg/reconciler/shared/tektonconfig/result/result_test.go +++ b/pkg/reconciler/shared/tektonconfig/result/result_test.go @@ -198,7 +198,7 @@ func TestGetTektonResultCR_HubClusterConfig(t *testing.T) { CommonSpec: v1alpha1.CommonSpec{ TargetNamespace: "tekton-pipelines", }, - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: tt.multiClusterDisabled, MultiClusterRole: tt.multiClusterRole, diff --git a/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice.go b/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice.go index f4230e5a4f..26f2eb288c 100644 --- a/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice.go +++ b/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice.go @@ -29,16 +29,16 @@ import ( "knative.dev/pkg/apis" ) -// IsSyncerServiceEnabled checks if syncer-service should be deployed based on scheduler config +// IsSyncerServiceEnabled checks if syncer-service should be deployed based on Tekton Kueue config // Syncer-service is enabled when: // 1. Multi-cluster is NOT disabled (i.e., multi-cluster is enabled) // 2. The role is Hub -func IsSyncerServiceEnabled(scheduler *v1alpha1.Scheduler) bool { - if scheduler == nil { +func IsSyncerServiceEnabled(kueue *v1alpha1.Kueue) bool { + if kueue == nil { return false } - return !scheduler.MultiClusterDisabled && - strings.EqualFold(string(scheduler.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) + return !kueue.MultiClusterDisabled && + strings.EqualFold(string(kueue.MultiClusterRole), string(v1alpha1.MultiClusterRoleHub)) } // EnsureSyncerServiceExists ensures the SyncerService CR exists if conditions are met diff --git a/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice_test.go b/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice_test.go index 6a663f6984..6e33100474 100644 --- a/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice_test.go +++ b/pkg/reconciler/shared/tektonconfig/syncerservice/syncerservice_test.go @@ -27,18 +27,18 @@ import ( func TestIsSyncerServiceEnabled(t *testing.T) { tests := []struct { - name string - scheduler *v1alpha1.Scheduler - expected bool + name string + kueue *v1alpha1.Kueue + expected bool }{ { - name: "nil scheduler returns false", - scheduler: nil, - expected: false, + name: "nil kueue returns false", + kueue: nil, + expected: false, }, { name: "multi-cluster enabled with Hub role returns true", - scheduler: &v1alpha1.Scheduler{ + kueue: &v1alpha1.Kueue{ MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, MultiClusterRole: v1alpha1.MultiClusterRoleHub, @@ -48,7 +48,7 @@ func TestIsSyncerServiceEnabled(t *testing.T) { }, { name: "multi-cluster enabled with Spoke role returns false", - scheduler: &v1alpha1.Scheduler{ + kueue: &v1alpha1.Kueue{ MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, MultiClusterRole: v1alpha1.MultiClusterRoleSpoke, @@ -58,7 +58,7 @@ func TestIsSyncerServiceEnabled(t *testing.T) { }, { name: "multi-cluster disabled with Hub role returns false", - scheduler: &v1alpha1.Scheduler{ + kueue: &v1alpha1.Kueue{ MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: true, MultiClusterRole: v1alpha1.MultiClusterRoleHub, @@ -68,7 +68,7 @@ func TestIsSyncerServiceEnabled(t *testing.T) { }, { name: "multi-cluster disabled with Spoke role returns false", - scheduler: &v1alpha1.Scheduler{ + kueue: &v1alpha1.Kueue{ MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: true, MultiClusterRole: v1alpha1.MultiClusterRoleSpoke, @@ -78,7 +78,7 @@ func TestIsSyncerServiceEnabled(t *testing.T) { }, { name: "multi-cluster enabled with empty role returns false", - scheduler: &v1alpha1.Scheduler{ + kueue: &v1alpha1.Kueue{ MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, MultiClusterRole: "", @@ -88,7 +88,7 @@ func TestIsSyncerServiceEnabled(t *testing.T) { }, { name: "multi-cluster disabled with empty role returns false", - scheduler: &v1alpha1.Scheduler{ + kueue: &v1alpha1.Kueue{ MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: true, MultiClusterRole: "", @@ -97,15 +97,15 @@ func TestIsSyncerServiceEnabled(t *testing.T) { expected: false, }, { - name: "empty scheduler (zero values) returns false", - scheduler: &v1alpha1.Scheduler{}, - expected: false, + name: "empty kueue (zero values) returns false", + kueue: &v1alpha1.Kueue{}, + expected: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - result := IsSyncerServiceEnabled(tt.scheduler) + result := IsSyncerServiceEnabled(tt.kueue) if result != tt.expected { t.Errorf("IsSyncerServiceEnabled() = %v, expected %v", result, tt.expected) } diff --git a/pkg/reconciler/shared/tektonconfig/tektonconfig.go b/pkg/reconciler/shared/tektonconfig/tektonconfig.go index ee94258410..e77a15a10f 100644 --- a/pkg/reconciler/shared/tektonconfig/tektonconfig.go +++ b/pkg/reconciler/shared/tektonconfig/tektonconfig.go @@ -18,6 +18,7 @@ package tektonconfig import ( "context" + "errors" "fmt" mf "github.com/manifestival/manifestival" @@ -26,12 +27,12 @@ import ( tektonConfigreconciler "github.com/tektoncd/operator/pkg/client/injection/reconciler/operator/v1alpha1/tektonconfig" "github.com/tektoncd/operator/pkg/reconciler/common" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/chain" + "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/kueue" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/manualapprovalgate" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/multiclusterproxyaae" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/pipeline" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/pruner" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/result" - "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/scheduler" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/syncerservice" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/trigger" "github.com/tektoncd/operator/pkg/reconciler/shared/tektonconfig/upgrade" @@ -141,6 +142,10 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi // run pre upgrade if err := r.upgrade.RunPreUpgrade(ctx); err != nil { + if errors.Is(err, v1alpha1.REQUEUE_EVENT_AFTER) { + logger.Infow("Pre-upgrade requested requeue", "error", err) + return err + } logger.Errorw("Pre-upgrade failed", "error", err) return err } @@ -230,18 +235,18 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi } } - // Ensure TektonMulticlusterProxyAAE CR (conditional based on scheduler multi-cluster config). - // Run before EnsureSchedulerComponent so the CR is created even when scheduler component + // Ensure TektonMulticlusterProxyAAE CR (conditional based on kueue multi-cluster config). + // Run before EnsureKueueComponent so the CR is created even when kueue component // is blocked (e.g. cert-manager or Kueue not installed). Multicluster-proxy-aae is deployed only when: - // - Scheduler is enabled (not disabled) + // - Kueue is enabled (not disabled) // - multi-cluster-disabled: false // - multi-cluster-role: Hub proxyAAEEnabled := multiclusterproxyaae.IsMulticlusterProxyAAEEnabled(tc) logger.Infow("TektonMulticlusterProxyAAE enablement", "enabled", proxyAAEEnabled, - "schedulerDisabled", tc.Spec.Scheduler.IsDisabled(), - "multiClusterDisabled", tc.Spec.Scheduler.MultiClusterDisabled, - "multiClusterRole", tc.Spec.Scheduler.MultiClusterRole) + "kueueDisabled", tc.Spec.Kueue.IsDisabled(), + "multiClusterDisabled", tc.Spec.Kueue.MultiClusterDisabled, + "multiClusterRole", tc.Spec.Kueue.MultiClusterRole) if proxyAAEEnabled { proxyCR := multiclusterproxyaae.GetTektonMulticlusterProxyAAECR(tc, r.operatorVersion) logger.Debug("Ensuring TektonMulticlusterProxyAAE CR exists (multi-cluster enabled with Hub role)") @@ -257,9 +262,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi logger.Debug("TektonMulticlusterProxyAAE CR reconciled successfully") } else { logger.Debugw("Ensuring TektonMulticlusterProxyAAE CR doesn't exist", - "schedulerDisabled", tc.Spec.Scheduler.IsDisabled(), - "multiClusterDisabled", tc.Spec.Scheduler.MultiClusterDisabled, - "multiClusterRole", tc.Spec.Scheduler.MultiClusterRole) + "kueueDisabled", tc.Spec.Kueue.IsDisabled(), + "multiClusterDisabled", tc.Spec.Kueue.MultiClusterDisabled, + "multiClusterRole", tc.Spec.Kueue.MultiClusterRole) if err := multiclusterproxyaae.EnsureTektonMulticlusterProxyAAECRNotExists(ctx, r.operatorClientSet.OperatorV1alpha1().TektonMulticlusterProxyAAEs()); err != nil { if err == v1alpha1.RECONCILE_AGAIN_ERR { return v1alpha1.REQUEUE_EVENT_AFTER @@ -272,7 +277,7 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi logger.Debug("TektonMulticlusterProxyAAE CR removal reconciled successfully") } - if err := r.EnsureSchedulerComponent(ctx, tc); err != nil { + if err := r.EnsureKueueComponent(ctx, tc); err != nil { return err } @@ -412,12 +417,12 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi logger.Debug("TektonResult CR removal reconciled successfully") } - // Ensure SyncerService CR (conditional based on scheduler multi-cluster config) + // Ensure SyncerService CR (conditional based on kueue multi-cluster config) // Syncer-service is deployed only when: - // - Scheduler is enabled (not disabled) + // - Kueue is enabled (not disabled) // - multi-cluster-disabled: false // - multi-cluster-role: Hub - if syncerservice.IsSyncerServiceEnabled(&tc.Spec.Scheduler) { + if syncerservice.IsSyncerServiceEnabled(&tc.Spec.Kueue) { syncerServiceCR := syncerservice.GetSyncerServiceCR(tc, r.operatorVersion) logger.Debug("Ensuring SyncerService CR exists (multi-cluster enabled with Hub role)") if _, err := syncerservice.EnsureSyncerServiceExists(ctx, r.operatorClientSet.OperatorV1alpha1().SyncerServices(), syncerServiceCR); err != nil { @@ -429,9 +434,9 @@ func (r *Reconciler) ReconcileKind(ctx context.Context, tc *v1alpha1.TektonConfi logger.Debug("SyncerService CR reconciled successfully") } else { logger.Debugw("Ensuring SyncerService CR doesn't exist", - "schedulerDisabled", tc.Spec.Scheduler.IsDisabled(), - "multiClusterDisabled", tc.Spec.Scheduler.MultiClusterDisabled, - "multiClusterRole", tc.Spec.Scheduler.MultiClusterRole) + "kueueDisabled", tc.Spec.Kueue.IsDisabled(), + "multiClusterDisabled", tc.Spec.Kueue.MultiClusterDisabled, + "multiClusterRole", tc.Spec.Kueue.MultiClusterRole) if err := syncerservice.EnsureSyncerServiceCRNotExists(ctx, r.operatorClientSet.OperatorV1alpha1().SyncerServices()); err != nil { errMsg := fmt.Sprintf("SyncerService: %s", err.Error()) logger.Errorw("Failed to ensure SyncerService has been deleted", "error", err) @@ -522,6 +527,6 @@ func (r *Reconciler) markUpgrade(ctx context.Context, tc *v1alpha1.TektonConfig) return v1alpha1.RECONCILE_AGAIN_ERR } -func (r *Reconciler) EnsureSchedulerComponent(ctx context.Context, tc *v1alpha1.TektonConfig) error { - return scheduler.EnsureTektonComponent(ctx, tc, r.operatorClientSet, r.operatorVersion) +func (r *Reconciler) EnsureKueueComponent(ctx context.Context, tc *v1alpha1.TektonConfig) error { + return kueue.EnsureTektonComponent(ctx, tc, r.operatorClientSet, r.operatorVersion) } diff --git a/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade.go b/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade.go index 2726508e8b..22b6a4dc57 100644 --- a/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade.go +++ b/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade.go @@ -36,6 +36,12 @@ import ( "knative.dev/pkg/ptr" ) +const ( + deprecatedTektonSchedulerFinalizer = "tektonschedulers.operator.tekton.dev" + deprecatedTektonSchedulerClusterRole = "tekton-scheduler-role" + deprecatedTektonSchedulerClusterRoleBinding = "tekton-scheduler-rolebinding" +) + // previous version of tekton operator uses a condition type called "InstallSucceeded" in status // but in the recent version we do not have that field, hence "InstallSucceeded" condition never updated. // for some reason, if it was in failed state, tektonConfig CR always in failed state @@ -59,6 +65,117 @@ func resetTektonConfigConditions(ctx context.Context, logger *zap.SugaredLogger, return err } +// migrateTektonSchedulerToTektonKueue preserves the deprecated API long enough +// to migrate existing configuration. The old CRD remains served, but no longer +// reconciles operand resources. +func migrateTektonSchedulerToTektonKueue(ctx context.Context, logger *zap.SugaredLogger, k8sClient kubernetes.Interface, operatorClient versioned.Interface, restConfig *rest.Config) error { + tc, err := operatorClient.OperatorV1alpha1().TektonConfigs().Get(ctx, v1alpha1.ConfigResourceName, metav1.GetOptions{}) + if err != nil && !apierrs.IsNotFound(err) { + return err + } + if err == nil && tc.Spec.MigrateScheduler() { + if _, err := operatorClient.OperatorV1alpha1().TektonConfigs().Update(ctx, tc, metav1.UpdateOptions{}); err != nil { + return err + } + logger.Info("Migrated TektonConfig spec.scheduler to spec.kueue") + return v1alpha1.REQUEUE_EVENT_AFTER + } + + legacySelector := metav1.FormatLabelSelector(&metav1.LabelSelector{MatchLabels: map[string]string{ + v1alpha1.CreatedByKey: v1alpha1.SchedulerCreatedByValue, + }}) + legacyInstallerSets, err := operatorClient.OperatorV1alpha1().TektonInstallerSets().List(ctx, metav1.ListOptions{LabelSelector: legacySelector}) + if err != nil { + return err + } + if len(legacyInstallerSets.Items) > 0 { + for _, installerSet := range legacyInstallerSets.Items { + if err := operatorClient.OperatorV1alpha1().TektonInstallerSets().Delete(ctx, installerSet.Name, metav1.DeleteOptions{}); err != nil && !apierrs.IsNotFound(err) { + return err + } + } + logger.Infof("Removed %d deprecated TektonScheduler InstallerSets", len(legacyInstallerSets.Items)) + return v1alpha1.REQUEUE_EVENT_AFTER + } + + deletedLegacyRBAC := false + if k8sClient != nil { + if err := k8sClient.RbacV1().ClusterRoleBindings().Delete(ctx, deprecatedTektonSchedulerClusterRoleBinding, metav1.DeleteOptions{}); err == nil { + deletedLegacyRBAC = true + } else if !apierrs.IsNotFound(err) { + return err + } + if err := k8sClient.RbacV1().ClusterRoles().Delete(ctx, deprecatedTektonSchedulerClusterRole, metav1.DeleteOptions{}); err == nil { + deletedLegacyRBAC = true + } else if !apierrs.IsNotFound(err) { + return err + } + } + if deletedLegacyRBAC { + logger.Info("Removed deprecated TektonScheduler RBAC") + return v1alpha1.REQUEUE_EVENT_AFTER + } + + legacy, err := operatorClient.OperatorV1alpha1().TektonSchedulers().Get(ctx, v1alpha1.TektonSchedulerResourceName, metav1.GetOptions{}) + if err != nil { + if apierrs.IsNotFound(err) { + return nil + } + return err + } + + if _, err := operatorClient.OperatorV1alpha1().TektonKueues().Get(ctx, v1alpha1.TektonKueueResourceName, metav1.GetOptions{}); apierrs.IsNotFound(err) { + kueue := &v1alpha1.TektonKueue{ + TypeMeta: metav1.TypeMeta{ + APIVersion: v1alpha1.SchemeGroupVersion.String(), + Kind: v1alpha1.KindTektonKueue, + }, + ObjectMeta: metav1.ObjectMeta{ + Name: v1alpha1.TektonKueueResourceName, + Labels: legacy.Labels, + Annotations: legacy.Annotations, + OwnerReferences: legacy.OwnerReferences, + }, + Spec: v1alpha1.TektonKueueSpec{ + CommonSpec: legacy.Spec.CommonSpec, + Kueue: legacy.Spec.Scheduler.ToKueue(), + NetworkPolicy: legacy.Spec.NetworkPolicy, + }, + } + if _, err := operatorClient.OperatorV1alpha1().TektonKueues().Create(ctx, kueue, metav1.CreateOptions{}); err != nil { + return err + } + logger.Info("Migrated TektonScheduler resource to TektonKueue") + return v1alpha1.REQUEUE_EVENT_AFTER + } else if err != nil { + return err + } + + finalizers := make([]string, 0, len(legacy.Finalizers)) + for _, finalizer := range legacy.Finalizers { + if finalizer != deprecatedTektonSchedulerFinalizer { + finalizers = append(finalizers, finalizer) + } + } + if len(finalizers) != len(legacy.Finalizers) { + patch, err := json.Marshal(map[string]interface{}{"metadata": map[string]interface{}{"finalizers": finalizers}}) + if err != nil { + return err + } + if _, err := operatorClient.OperatorV1alpha1().TektonSchedulers().Patch(ctx, legacy.Name, types.MergePatchType, patch, metav1.PatchOptions{}); err != nil { + return err + } + logger.Info("Removed the operator finalizer from migrated TektonScheduler resource") + return v1alpha1.REQUEUE_EVENT_AFTER + } + + if err := operatorClient.OperatorV1alpha1().TektonSchedulers().Delete(ctx, legacy.Name, metav1.DeleteOptions{}); err != nil && !apierrs.IsNotFound(err) { + return err + } + logger.Info("Requested deletion of migrated TektonScheduler resource") + return v1alpha1.REQUEUE_EVENT_AFTER +} + // previous version of the tekton operator uses default value which is false for enable-step-actions. // In the new version, we are shipping stepAction, allowing users to create tasks using stepAction. // Therefore, we are changing the enable-step-actions setting from false to true. diff --git a/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade_test.go b/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade_test.go index c3c331869c..0d740a1b1d 100644 --- a/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade_test.go +++ b/pkg/reconciler/shared/tektonconfig/upgrade/pre_upgrade_test.go @@ -23,11 +23,14 @@ import ( "github.com/tektoncd/operator/pkg/reconciler/kubernetes/tektonpruner" v1 "k8s.io/api/core/v1" + rbacv1 "k8s.io/api/rbac/v1" k8sFake "k8s.io/client-go/kubernetes/fake" "github.com/stretchr/testify/assert" "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" operatorFake "github.com/tektoncd/operator/pkg/client/clientset/versioned/fake" + "github.com/tektoncd/tekton-kueue/pkg/config" + apierrs "k8s.io/apimachinery/pkg/api/errors" metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" duckv1 "knative.dev/pkg/apis/duck/v1" "knative.dev/pkg/logging" @@ -70,6 +73,141 @@ func TestResetTektonConfigConditions(t *testing.T) { assert.Empty(t, _tc.Status.Conditions) } +func TestMigrateTektonSchedulerToTektonKueue(t *testing.T) { + ctx := context.TODO() + k8sClient := k8sFake.NewSimpleClientset( + &rbacv1.ClusterRole{ObjectMeta: metav1.ObjectMeta{Name: deprecatedTektonSchedulerClusterRole}}, + &rbacv1.ClusterRoleBinding{ObjectMeta: metav1.ObjectMeta{Name: deprecatedTektonSchedulerClusterRoleBinding}}, + ) + operatorClient := operatorFake.NewSimpleClientset( + &v1alpha1.TektonConfig{ + ObjectMeta: metav1.ObjectMeta{Name: v1alpha1.ConfigResourceName}, + Spec: v1alpha1.TektonConfigSpec{ + Scheduler: v1alpha1.Scheduler{ + Disabled: ptr.Bool(false), + SchedulerConfig: v1alpha1.SchedulerConfig{Config: config.Config{ + QueueName: "migration-test-queue", + }}, + MultiClusterConfig: v1alpha1.MultiClusterConfig{ + MultiClusterDisabled: true, + }, + }, + }, + }, + &v1alpha1.TektonScheduler{ + ObjectMeta: metav1.ObjectMeta{ + Name: v1alpha1.TektonSchedulerResourceName, + Finalizers: []string{deprecatedTektonSchedulerFinalizer, "example.dev/preserve"}, + }, + Spec: v1alpha1.TektonSchedulerSpec{ + CommonSpec: v1alpha1.CommonSpec{TargetNamespace: "tekton-pipelines"}, + Scheduler: v1alpha1.Scheduler{ + Disabled: ptr.Bool(false), + SchedulerConfig: v1alpha1.SchedulerConfig{Config: config.Config{ + QueueName: "migration-test-queue", + }}, + MultiClusterConfig: v1alpha1.MultiClusterConfig{ + MultiClusterDisabled: true, + }, + }, + NetworkPolicy: v1alpha1.NetworkPolicyConfig{Disabled: true}, + }, + }, + &v1alpha1.TektonInstallerSet{ObjectMeta: metav1.ObjectMeta{ + Name: "scheduler-main", + Labels: map[string]string{ + v1alpha1.CreatedByKey: v1alpha1.SchedulerCreatedByValue, + }, + }}, + ) + logger := logging.FromContext(ctx).Named("unit-test") + + // The migration advances one durable API operation per scheduled reconciliation. + for range 5 { + err := migrateTektonSchedulerToTektonKueue(ctx, logger, k8sClient, operatorClient, nil) + assert.ErrorIs(t, err, v1alpha1.REQUEUE_EVENT_AFTER) + } + legacy, err := operatorClient.OperatorV1alpha1().TektonSchedulers().Get(ctx, v1alpha1.TektonSchedulerResourceName, metav1.GetOptions{}) + assert.NoError(t, err) + assert.Equal(t, []string{"example.dev/preserve"}, legacy.Finalizers) + + // Deletion schedules a final reconciliation so pre-upgrade does not complete + // while a legacy resource is still terminating on a preserved finalizer. + assert.ErrorIs(t, migrateTektonSchedulerToTektonKueue(ctx, logger, k8sClient, operatorClient, nil), v1alpha1.REQUEUE_EVENT_AFTER) + assert.NoError(t, migrateTektonSchedulerToTektonKueue(ctx, logger, k8sClient, operatorClient, nil)) + + tc, err := operatorClient.OperatorV1alpha1().TektonConfigs().Get(ctx, v1alpha1.ConfigResourceName, metav1.GetOptions{}) + assert.NoError(t, err) + assert.Equal(t, false, tc.Spec.Kueue.IsDisabled()) + assert.Equal(t, "migration-test-queue", tc.Spec.Kueue.QueueName) + assert.Equal(t, v1alpha1.Scheduler{}, tc.Spec.Scheduler) + + installerSets, err := operatorClient.OperatorV1alpha1().TektonInstallerSets().List(ctx, metav1.ListOptions{}) + assert.NoError(t, err) + assert.Empty(t, installerSets.Items) + + kueue, err := operatorClient.OperatorV1alpha1().TektonKueues().Get(ctx, v1alpha1.TektonKueueResourceName, metav1.GetOptions{}) + assert.NoError(t, err) + assert.Equal(t, "tekton-pipelines", kueue.Spec.TargetNamespace) + assert.Equal(t, false, kueue.Spec.Kueue.IsDisabled()) + assert.Equal(t, "migration-test-queue", kueue.Spec.Kueue.QueueName) + assert.True(t, kueue.Spec.NetworkPolicy.Disabled) + + _, err = operatorClient.OperatorV1alpha1().TektonSchedulers().Get(ctx, v1alpha1.TektonSchedulerResourceName, metav1.GetOptions{}) + assert.True(t, apierrs.IsNotFound(err)) + _, err = k8sClient.RbacV1().ClusterRoles().Get(ctx, deprecatedTektonSchedulerClusterRole, metav1.GetOptions{}) + assert.True(t, apierrs.IsNotFound(err)) + _, err = k8sClient.RbacV1().ClusterRoleBindings().Get(ctx, deprecatedTektonSchedulerClusterRoleBinding, metav1.GetOptions{}) + assert.True(t, apierrs.IsNotFound(err)) +} + +func TestMigrateTektonSchedulerToTektonKueueDisabled(t *testing.T) { + ctx := context.TODO() + operatorClient := operatorFake.NewSimpleClientset(&v1alpha1.TektonConfig{ + ObjectMeta: metav1.ObjectMeta{Name: v1alpha1.ConfigResourceName}, + Spec: v1alpha1.TektonConfigSpec{Scheduler: v1alpha1.Scheduler{ + Disabled: ptr.Bool(true), + }}, + }) + logger := logging.FromContext(ctx).Named("unit-test") + + assert.ErrorIs(t, migrateTektonSchedulerToTektonKueue(ctx, logger, nil, operatorClient, nil), v1alpha1.REQUEUE_EVENT_AFTER) + assert.NoError(t, migrateTektonSchedulerToTektonKueue(ctx, logger, nil, operatorClient, nil)) + + tc, err := operatorClient.OperatorV1alpha1().TektonConfigs().Get(ctx, v1alpha1.ConfigResourceName, metav1.GetOptions{}) + assert.NoError(t, err) + assert.True(t, tc.Spec.Kueue.IsDisabled()) + assert.Equal(t, v1alpha1.Scheduler{}, tc.Spec.Scheduler) + + _, err = operatorClient.OperatorV1alpha1().TektonKueues().Get(ctx, v1alpha1.TektonKueueResourceName, metav1.GetOptions{}) + assert.True(t, apierrs.IsNotFound(err)) +} + +func TestMigrateTektonSchedulerToTektonKueueKueueTakesPrecedence(t *testing.T) { + ctx := context.TODO() + operatorClient := operatorFake.NewSimpleClientset(&v1alpha1.TektonConfig{ + ObjectMeta: metav1.ObjectMeta{Name: v1alpha1.ConfigResourceName}, + Spec: v1alpha1.TektonConfigSpec{ + Scheduler: v1alpha1.Scheduler{ + Disabled: ptr.Bool(false), + SchedulerConfig: v1alpha1.SchedulerConfig{Config: config.Config{ + QueueName: "legacy-queue", + }}, + }, + Kueue: v1alpha1.Kueue{Disabled: ptr.Bool(true)}, + }, + }) + logger := logging.FromContext(ctx).Named("unit-test") + + assert.ErrorIs(t, migrateTektonSchedulerToTektonKueue(ctx, logger, nil, operatorClient, nil), v1alpha1.REQUEUE_EVENT_AFTER) + + tc, err := operatorClient.OperatorV1alpha1().TektonConfigs().Get(ctx, v1alpha1.ConfigResourceName, metav1.GetOptions{}) + assert.NoError(t, err) + assert.Equal(t, ptr.Bool(true), tc.Spec.Kueue.Disabled) + assert.Empty(t, tc.Spec.Kueue.QueueName) + assert.Equal(t, v1alpha1.Scheduler{}, tc.Spec.Scheduler) +} + func TestUpgradePipelineProperties(t *testing.T) { tests := []struct { name string diff --git a/pkg/reconciler/shared/tektonconfig/upgrade/upgrade.go b/pkg/reconciler/shared/tektonconfig/upgrade/upgrade.go index 23ca548ab2..441e556a76 100644 --- a/pkg/reconciler/shared/tektonconfig/upgrade/upgrade.go +++ b/pkg/reconciler/shared/tektonconfig/upgrade/upgrade.go @@ -18,6 +18,7 @@ package upgrade import ( "context" + "errors" "github.com/tektoncd/operator/pkg/apis/operator/v1alpha1" "github.com/tektoncd/operator/pkg/client/clientset/versioned" @@ -32,8 +33,9 @@ import ( var ( // pre upgrade functions preUpgradeFunctions = []upgradeFunc{ - resetTektonConfigConditions, // upgrade #1: removes conditions from TektonConfig CR, clears outdated conditions - upgradePipelineProperties, // upgrade #2: update default value of enable-step-actions from false to true + resetTektonConfigConditions, // upgrade #1: removes conditions from TektonConfig CR, clears outdated conditions + migrateTektonSchedulerToTektonKueue, // upgrade #2: migrates the deprecated scheduler API and TektonConfig field + upgradePipelineProperties, // upgrade #3: update default value of enable-step-actions from false to true // Todo: Remove the deleteTektonResultsTLSSecret upgrade function in next operator release deleteTektonResultsTLSSecret, // upgrade #5: deletes default tekton results tls certificate // TODO: Remove the preUpgradeTektonPruner upgrade function in next operator release @@ -107,6 +109,10 @@ func (ug *Upgrade) executeUpgrade(ctx context.Context, upgradeFunctions []upgrad // execute upgrade functions for _, _upgradeFunc := range upgradeFunctions { if err := _upgradeFunc(ctx, ug.logger, ug.k8sClient, ug.operatorClient, ug.restConfig); err != nil { + if errors.Is(err, v1alpha1.REQUEUE_EVENT_AFTER) { + ug.logger.Debugw("upgrade requested requeue", "error", err) + return err + } ug.logger.Error("error on upgrade", err) return err } diff --git a/test/e2e/common/10_hubcluster_result_config_test.go b/test/e2e/common/10_hubcluster_result_config_test.go index 80de5280f4..2157173093 100644 --- a/test/e2e/common/10_hubcluster_result_config_test.go +++ b/test/e2e/common/10_hubcluster_result_config_test.go @@ -111,8 +111,8 @@ func (s *HubClusterResultConfigTestSuite) Test01_HubClusterResultConfig() { tc, err = s.clients.TektonConfig().Get(context.TODO(), s.resourceNames.TektonConfig, metav1.GetOptions{}) require.NoError(t, err, "failed to get TektonConfig") - tc.Spec.Scheduler.MultiClusterDisabled = false - tc.Spec.Scheduler.MultiClusterRole = v1alpha1.MultiClusterRoleHub + tc.Spec.Kueue.MultiClusterDisabled = false + tc.Spec.Kueue.MultiClusterRole = v1alpha1.MultiClusterRoleHub _, err = s.clients.TektonConfig().Update(context.TODO(), tc, metav1.UpdateOptions{}) require.NoError(t, err, "failed to update TektonConfig with Hub role") @@ -151,8 +151,8 @@ func (s *HubClusterResultConfigTestSuite) Test02_SpokeClusterResultConfig() { tc, err = s.clients.TektonConfig().Get(context.TODO(), s.resourceNames.TektonConfig, metav1.GetOptions{}) require.NoError(t, err, "failed to get TektonConfig") - tc.Spec.Scheduler.MultiClusterDisabled = false - tc.Spec.Scheduler.MultiClusterRole = v1alpha1.MultiClusterRoleSpoke + tc.Spec.Kueue.MultiClusterDisabled = false + tc.Spec.Kueue.MultiClusterRole = v1alpha1.MultiClusterRoleSpoke _, err = s.clients.TektonConfig().Update(context.TODO(), tc, metav1.UpdateOptions{}) require.NoError(t, err, "failed to update TektonConfig with Spoke role") @@ -192,8 +192,8 @@ func (s *HubClusterResultConfigTestSuite) Test03_MultiClusterDisabled() { tc, err = s.clients.TektonConfig().Get(context.TODO(), s.resourceNames.TektonConfig, metav1.GetOptions{}) require.NoError(t, err, "failed to get TektonConfig") - tc.Spec.Scheduler.MultiClusterDisabled = true - tc.Spec.Scheduler.MultiClusterRole = v1alpha1.MultiClusterRoleHub // Even with Hub role, should not apply when disabled + tc.Spec.Kueue.MultiClusterDisabled = true + tc.Spec.Kueue.MultiClusterRole = v1alpha1.MultiClusterRoleHub // Even with Hub role, should not apply when disabled _, err = s.clients.TektonConfig().Update(context.TODO(), tc, metav1.UpdateOptions{}) require.NoError(t, err, "failed to update TektonConfig with multicluster disabled") @@ -218,8 +218,8 @@ func (s *HubClusterResultConfigTestSuite) resetMultiClusterConfig() { } // Reset to default disabled state - tc.Spec.Scheduler.MultiClusterDisabled = true - tc.Spec.Scheduler.MultiClusterRole = "" + tc.Spec.Kueue.MultiClusterDisabled = true + tc.Spec.Kueue.MultiClusterRole = "" _, err = s.clients.TektonConfig().Update(context.TODO(), tc, metav1.UpdateOptions{}) if err != nil { diff --git a/test/e2e/common/12_syncerservice_networkpolicy_test.go b/test/e2e/common/12_syncerservice_networkpolicy_test.go index b904859cda..131ed1e2ba 100644 --- a/test/e2e/common/12_syncerservice_networkpolicy_test.go +++ b/test/e2e/common/12_syncerservice_networkpolicy_test.go @@ -43,9 +43,9 @@ func TestSyncerServiceNetworkPolicy(t *testing.T) { } utils.CleanupOnInterrupt(func() { utils.TearDownSyncerService(clients, crNames.SyncerService) }) - utils.CleanupOnInterrupt(func() { utils.TearDownScheduler(clients, crNames.TektonScheduler) }) + utils.CleanupOnInterrupt(func() { utils.TearDownKueue(clients, crNames.TektonKueue) }) defer utils.TearDownSyncerService(clients, crNames.SyncerService) - defer utils.TearDownScheduler(clients, crNames.TektonScheduler) + defer utils.TearDownKueue(clients, crNames.TektonKueue) utils.CleanupOnInterrupt(func() { resources.DeleteDummyWorkerCluster(clients) }) defer resources.DeleteDummyWorkerCluster(clients) @@ -57,7 +57,7 @@ func TestSyncerServiceNetworkPolicy(t *testing.T) { Spec: v1alpha1.TektonConfigSpec{ Profile: v1alpha1.ProfileAll, CommonSpec: v1alpha1.CommonSpec{TargetNamespace: crNames.TargetNamespace}, - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.To(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, @@ -72,7 +72,7 @@ func TestSyncerServiceNetworkPolicy(t *testing.T) { resources.EnsureDummyWorkerCluster(t, clients) resources.AssertTektonConfigCRReadyStatus(t, clients, crNames) - resources.AssertTektonSchedulerCRReadyStatus(t, clients, crNames) + resources.AssertTektonKueueCRReadyStatus(t, clients, crNames) resources.AssertSyncerServiceCRReadyStatus(t, clients, crNames) expectedPolicies := []string{ diff --git a/test/e2e/common/12_tektonscheduler_networkpolicy_test.go b/test/e2e/common/12_tektonkueue_networkpolicy_test.go similarity index 70% rename from test/e2e/common/12_tektonscheduler_networkpolicy_test.go rename to test/e2e/common/12_tektonkueue_networkpolicy_test.go index f62e940390..059b94f242 100644 --- a/test/e2e/common/12_tektonscheduler_networkpolicy_test.go +++ b/test/e2e/common/12_tektonkueue_networkpolicy_test.go @@ -31,7 +31,7 @@ import ( "k8s.io/utils/ptr" ) -func TestTektonSchedulerNetworkPolicy(t *testing.T) { +func TestTektonKueueNetworkPolicy(t *testing.T) { crNames := utils.GetResourceNames() clients := client.Setup(t, crNames.TargetNamespace) @@ -42,8 +42,8 @@ func TestTektonSchedulerNetworkPolicy(t *testing.T) { t.Skipf("Kueue API (kueue.x-k8s.io/v1beta1) not available, skipping: %v", err) } - utils.CleanupOnInterrupt(func() { utils.TearDownScheduler(clients, crNames.TektonScheduler) }) - defer utils.TearDownScheduler(clients, crNames.TektonScheduler) + utils.CleanupOnInterrupt(func() { utils.TearDownKueue(clients, crNames.TektonKueue) }) + defer utils.TearDownKueue(clients, crNames.TektonKueue) utils.CleanupOnInterrupt(func() { resources.DeleteDummyWorkerCluster(clients) }) defer resources.DeleteDummyWorkerCluster(clients) @@ -55,7 +55,7 @@ func TestTektonSchedulerNetworkPolicy(t *testing.T) { Spec: v1alpha1.TektonConfigSpec{ Profile: v1alpha1.ProfileAll, CommonSpec: v1alpha1.CommonSpec{TargetNamespace: crNames.TargetNamespace}, - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.To(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, @@ -70,7 +70,7 @@ func TestTektonSchedulerNetworkPolicy(t *testing.T) { resources.EnsureDummyWorkerCluster(t, clients) resources.AssertTektonConfigCRReadyStatus(t, clients, crNames) - resources.AssertTektonSchedulerCRReadyStatus(t, clients, crNames) + resources.AssertTektonKueueCRReadyStatus(t, clients, crNames) expectedPolicies := []string{ "scheduler-controller-default-deny", @@ -84,28 +84,28 @@ func TestTektonSchedulerNetworkPolicy(t *testing.T) { }) t.Run("disable-removes-policies", func(t *testing.T) { - ts, err := clients.TektonSchedulers().Get(context.TODO(), crNames.TektonScheduler, metav1.GetOptions{}) + tk, err := clients.TektonKueues().Get(context.TODO(), crNames.TektonKueue, metav1.GetOptions{}) if err != nil { - t.Fatalf("failed to get TektonScheduler: %v", err) + t.Fatalf("failed to get TektonKueue: %v", err) } - ts.Spec.NetworkPolicy.Disabled = true - if _, err := clients.TektonSchedulers().Update(context.TODO(), ts, metav1.UpdateOptions{}); err != nil { - t.Fatalf("failed to disable NetworkPolicy on TektonScheduler: %v", err) + tk.Spec.NetworkPolicy.Disabled = true + if _, err := clients.TektonKueues().Update(context.TODO(), tk, metav1.UpdateOptions{}); err != nil { + t.Fatalf("failed to disable NetworkPolicy on TektonKueue: %v", err) } - resources.AssertTektonSchedulerCRReadyStatus(t, clients, crNames) + resources.AssertTektonKueueCRReadyStatus(t, clients, crNames) resources.AssertNetworkPoliciesAbsent(t, clients, crNames.TargetNamespace, expectedPolicies) }) t.Run("reenable-restores-policies", func(t *testing.T) { - ts, err := clients.TektonSchedulers().Get(context.TODO(), crNames.TektonScheduler, metav1.GetOptions{}) + tk, err := clients.TektonKueues().Get(context.TODO(), crNames.TektonKueue, metav1.GetOptions{}) if err != nil { - t.Fatalf("failed to get TektonScheduler: %v", err) + t.Fatalf("failed to get TektonKueue: %v", err) } - ts.Spec.NetworkPolicy.Disabled = false - if _, err := clients.TektonSchedulers().Update(context.TODO(), ts, metav1.UpdateOptions{}); err != nil { - t.Fatalf("failed to re-enable NetworkPolicy on TektonScheduler: %v", err) + tk.Spec.NetworkPolicy.Disabled = false + if _, err := clients.TektonKueues().Update(context.TODO(), tk, metav1.UpdateOptions{}); err != nil { + t.Fatalf("failed to re-enable NetworkPolicy on TektonKueue: %v", err) } - resources.AssertTektonSchedulerCRReadyStatus(t, clients, crNames) + resources.AssertTektonKueueCRReadyStatus(t, clients, crNames) resources.AssertNetworkPoliciesExist(t, clients, crNames.TargetNamespace, expectedPolicies) }) } diff --git a/test/e2e/common/12_tektonmulticlusterproxyaae_networkpolicy_test.go b/test/e2e/common/12_tektonmulticlusterproxyaae_networkpolicy_test.go index f6445956fa..d0626778ac 100644 --- a/test/e2e/common/12_tektonmulticlusterproxyaae_networkpolicy_test.go +++ b/test/e2e/common/12_tektonmulticlusterproxyaae_networkpolicy_test.go @@ -43,9 +43,9 @@ func TestTektonMulticlusterProxyAAENetworkPolicy(t *testing.T) { } utils.CleanupOnInterrupt(func() { utils.TearDownMulticlusterProxyAAE(clients, crNames.TektonMulticlusterProxyAAE) }) - utils.CleanupOnInterrupt(func() { utils.TearDownScheduler(clients, crNames.TektonScheduler) }) + utils.CleanupOnInterrupt(func() { utils.TearDownKueue(clients, crNames.TektonKueue) }) defer utils.TearDownMulticlusterProxyAAE(clients, crNames.TektonMulticlusterProxyAAE) - defer utils.TearDownScheduler(clients, crNames.TektonScheduler) + defer utils.TearDownKueue(clients, crNames.TektonKueue) utils.CleanupOnInterrupt(func() { resources.DeleteDummyWorkerCluster(clients) }) defer resources.DeleteDummyWorkerCluster(clients) @@ -57,7 +57,7 @@ func TestTektonMulticlusterProxyAAENetworkPolicy(t *testing.T) { Spec: v1alpha1.TektonConfigSpec{ Profile: v1alpha1.ProfileAll, CommonSpec: v1alpha1.CommonSpec{TargetNamespace: crNames.TargetNamespace}, - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.To(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: false, @@ -72,7 +72,7 @@ func TestTektonMulticlusterProxyAAENetworkPolicy(t *testing.T) { resources.EnsureDummyWorkerCluster(t, clients) resources.AssertTektonConfigCRReadyStatus(t, clients, crNames) - resources.AssertTektonSchedulerCRReadyStatus(t, clients, crNames) + resources.AssertTektonKueueCRReadyStatus(t, clients, crNames) resources.AssertTektonMulticlusterProxyAAECRReadyStatus(t, clients, crNames) expectedPolicies := []string{ diff --git a/test/resources/tektonschedulers.go b/test/resources/tektonkueues.go similarity index 56% rename from test/resources/tektonschedulers.go rename to test/resources/tektonkueues.go index 14fbf4f829..81f206b403 100644 --- a/test/resources/tektonschedulers.go +++ b/test/resources/tektonkueues.go @@ -31,18 +31,18 @@ import ( "knative.dev/pkg/test/logging" ) -func EnsureTektonSchedulerExists(clients typedv1alpha1.TektonSchedulerInterface, names utils.ResourceNames) (*v1alpha1.TektonScheduler, error) { - ks, err := clients.Get(context.TODO(), names.TektonScheduler, metav1.GetOptions{}) +func EnsureTektonKueueExists(clients typedv1alpha1.TektonKueueInterface, names utils.ResourceNames) (*v1alpha1.TektonKueue, error) { + tk, err := clients.Get(context.TODO(), names.TektonKueue, metav1.GetOptions{}) if apierrs.IsNotFound(err) { - ks := &v1alpha1.TektonScheduler{ + tk := &v1alpha1.TektonKueue{ ObjectMeta: metav1.ObjectMeta{ - Name: names.TektonScheduler, + Name: names.TektonKueue, }, - Spec: v1alpha1.TektonSchedulerSpec{ + Spec: v1alpha1.TektonKueueSpec{ CommonSpec: v1alpha1.CommonSpec{ TargetNamespace: names.TargetNamespace, }, - Scheduler: v1alpha1.Scheduler{ + Kueue: v1alpha1.Kueue{ Disabled: ptr.To(false), MultiClusterConfig: v1alpha1.MultiClusterConfig{ MultiClusterDisabled: true, @@ -50,35 +50,35 @@ func EnsureTektonSchedulerExists(clients typedv1alpha1.TektonSchedulerInterface, }, }, } - return clients.Create(context.TODO(), ks, metav1.CreateOptions{}) + return clients.Create(context.TODO(), tk, metav1.CreateOptions{}) } - return ks, err + return tk, err } -func WaitForTektonSchedulerState(clients typedv1alpha1.TektonSchedulerInterface, name string, - inState func(s *v1alpha1.TektonScheduler, err error) (bool, error), -) (*v1alpha1.TektonScheduler, error) { - span := logging.GetEmitableSpan(context.Background(), fmt.Sprintf("WaitForTektonSchedulerState/%s/%s", name, "TektonSchedulerIsReady")) +func WaitForTektonKueueState(clients typedv1alpha1.TektonKueueInterface, name string, + inState func(k *v1alpha1.TektonKueue, err error) (bool, error), +) (*v1alpha1.TektonKueue, error) { + span := logging.GetEmitableSpan(context.Background(), fmt.Sprintf("WaitForTektonKueueState/%s/%s", name, "TektonKueueIsReady")) defer span.End() - var lastState *v1alpha1.TektonScheduler + var lastState *v1alpha1.TektonKueue waitErr := wait.PollUntilContextTimeout(context.TODO(), utils.Interval, utils.Timeout, true, func(ctx context.Context) (bool, error) { lastState, err := clients.Get(context.TODO(), name, metav1.GetOptions{}) return inState(lastState, err) }) if waitErr != nil { - return lastState, fmt.Errorf("tektonscheduler %s is not in desired state, got: %+v: %w", name, lastState, waitErr) + return lastState, fmt.Errorf("tektonkueue %s is not in desired state, got: %+v: %w", name, lastState, waitErr) } return lastState, nil } -func IsTektonSchedulerReady(s *v1alpha1.TektonScheduler, err error) (bool, error) { - return s.Status.IsReady(), err +func IsTektonKueueReady(k *v1alpha1.TektonKueue, err error) (bool, error) { + return k.Status.IsReady(), err } -func AssertTektonSchedulerCRReadyStatus(t *testing.T, clients *utils.Clients, names utils.ResourceNames) { - if _, err := WaitForTektonSchedulerState(clients.TektonSchedulers(), names.TektonScheduler, IsTektonSchedulerReady); err != nil { - t.Fatalf("TektonSchedulerCR %q failed to get to the READY status: %v", names.TektonScheduler, err) +func AssertTektonKueueCRReadyStatus(t *testing.T, clients *utils.Clients, names utils.ResourceNames) { + if _, err := WaitForTektonKueueState(clients.TektonKueues(), names.TektonKueue, IsTektonKueueReady); err != nil { + t.Fatalf("TektonKueue CR %q failed to get to the READY status: %v", names.TektonKueue, err) } } diff --git a/test/utils/cleanup.go b/test/utils/cleanup.go index 90b93406ce..7bb0e99928 100644 --- a/test/utils/cleanup.go +++ b/test/utils/cleanup.go @@ -368,34 +368,34 @@ func TearDownTektonPruner(clients *Clients, name string) { } } -func TearDownScheduler(clients *Clients, name string) { +func TearDownKueue(clients *Clients, name string) { ctx := context.Background() if clients == nil || clients.Operator == nil { return } - ts, err := clients.TektonSchedulers().Get(ctx, name, metav1.GetOptions{}) + tk, err := clients.TektonKueues().Get(ctx, name, metav1.GetOptions{}) if err != nil { if !errors.IsNotFound(err) { - fmt.Printf("error trying to get TektonScheduler instance during teardown, name: %s, error: %v", name, err) + fmt.Printf("error trying to get TektonKueue instance during teardown, name: %s, error: %v", name, err) } return } - targetNamespace := ts.Spec.TargetNamespace + targetNamespace := tk.Spec.TargetNamespace - err = clients.TektonSchedulers().Delete(ctx, name, metav1.DeleteOptions{}) + err = clients.TektonKueues().Delete(ctx, name, metav1.DeleteOptions{}) if err != nil { - fmt.Printf("error trying to delete TektonScheduler during teardown, name: %s, error: %v", name, err) + fmt.Printf("error trying to delete TektonKueue during teardown, name: %s, error: %v", name, err) return } crdf := newCRDeleteVerifier(ctx, func(ctx context.Context) error { - _, err := clients.TektonSchedulers().Get(ctx, name, metav1.GetOptions{}) + _, err := clients.TektonKueues().Get(ctx, name, metav1.GetOptions{}) return err }) - ddf := newDeploymentDeleteVerifier(ctx, clients, targetNamespace, TektonSchedulerDeploymentLabel) + ddf := newDeploymentDeleteVerifier(ctx, clients, targetNamespace, TektonKueueDeploymentLabel) err = waitUntilFullDeletion(crdf, ddf) if err != nil { - fmt.Printf("error waiting from tearDown of TektonScheduler resource, name: %s, error: %v", name, err) + fmt.Printf("error waiting from tearDown of TektonKueue resource, name: %s, error: %v", name, err) } } diff --git a/test/utils/clients.go b/test/utils/clients.go index 1144b9115c..f7321b692c 100644 --- a/test/utils/clients.go +++ b/test/utils/clients.go @@ -193,12 +193,12 @@ func (c *Clients) OpenShiftPipelinesAsCode() operatorv1alpha1.OpenShiftPipelines return c.Operator.OpenShiftPipelinesAsCodes() } -func (c *Clients) TektonSchedulers() operatorv1alpha1.TektonSchedulerInterface { - return c.Operator.TektonSchedulers() +func (c *Clients) TektonKueues() operatorv1alpha1.TektonKueueInterface { + return c.Operator.TektonKueues() } -func (c *Clients) TektonSchedulersAll() operatorv1alpha1.TektonSchedulerInterface { - return c.Operator.TektonSchedulers() +func (c *Clients) TektonKueuesAll() operatorv1alpha1.TektonKueueInterface { + return c.Operator.TektonKueues() } func (c *Clients) TektonMulticlusterProxyAAEs() operatorv1alpha1.TektonMulticlusterProxyAAEInterface { diff --git a/test/utils/e2e_flags.go b/test/utils/e2e_flags.go index 78448abdac..dba0cec4e8 100644 --- a/test/utils/e2e_flags.go +++ b/test/utils/e2e_flags.go @@ -32,7 +32,7 @@ var ( ManualApprovalGateDeploymentLabel = labelString(v1alpha1.ManualApprovalGates) TektonPrunerDeploymentLabel = labelString(v1alpha1.TektonPrunerResourceName) TektonAddonDeploymentLabel = labelString(openshift.OperandOpenShiftPipelinesAddons) - TektonSchedulerDeploymentLabel = labelString(v1alpha1.TektonSchedulerResourceName) + TektonKueueDeploymentLabel = labelString(v1alpha1.TektonKueueResourceName) TektonMulticlusterProxyAAEDeploymentLabel = labelString(v1alpha1.MultiClusterProxyAAEResourceName) SyncerServiceDeploymentLabel = labelString(v1alpha1.OperandSyncerService) ) diff --git a/test/utils/names.go b/test/utils/names.go index 0f6b384780..fcd0933d39 100644 --- a/test/utils/names.go +++ b/test/utils/names.go @@ -28,7 +28,7 @@ type ResourceNames struct { TektonPruner string TektonResult string TektonChain string - TektonScheduler string + TektonKueue string TektonMulticlusterProxyAAE string SyncerService string Namespace string @@ -48,7 +48,7 @@ func GetResourceNames() ResourceNames { TektonPruner: v1alpha1.TektonPrunerResourceName, TektonResult: v1alpha1.ResultResourceName, TektonChain: v1alpha1.ChainResourceName, - TektonScheduler: v1alpha1.TektonSchedulerResourceName, + TektonKueue: v1alpha1.TektonKueueResourceName, TektonMulticlusterProxyAAE: v1alpha1.MultiClusterProxyAAEResourceName, SyncerService: v1alpha1.SyncerServiceResourceName, ManualApprovalGate: v1alpha1.ManualApprovalGates, diff --git a/vendor/github.com/konflux-ci/tekton-kueue/LICENSE b/vendor/github.com/tektoncd/tekton-kueue/LICENSE similarity index 100% rename from vendor/github.com/konflux-ci/tekton-kueue/LICENSE rename to vendor/github.com/tektoncd/tekton-kueue/LICENSE diff --git a/vendor/github.com/konflux-ci/tekton-kueue/pkg/common/common_utils.go b/vendor/github.com/tektoncd/tekton-kueue/pkg/common/common_utils.go similarity index 100% rename from vendor/github.com/konflux-ci/tekton-kueue/pkg/common/common_utils.go rename to vendor/github.com/tektoncd/tekton-kueue/pkg/common/common_utils.go diff --git a/vendor/github.com/konflux-ci/tekton-kueue/pkg/common/constants.go b/vendor/github.com/tektoncd/tekton-kueue/pkg/common/constants.go similarity index 100% rename from vendor/github.com/konflux-ci/tekton-kueue/pkg/common/constants.go rename to vendor/github.com/tektoncd/tekton-kueue/pkg/common/constants.go diff --git a/vendor/github.com/konflux-ci/tekton-kueue/pkg/config/config_type.go b/vendor/github.com/tektoncd/tekton-kueue/pkg/config/config_type.go similarity index 100% rename from vendor/github.com/konflux-ci/tekton-kueue/pkg/config/config_type.go rename to vendor/github.com/tektoncd/tekton-kueue/pkg/config/config_type.go diff --git a/vendor/github.com/konflux-ci/tekton-kueue/pkg/config/zz_generated.deepcopy.go b/vendor/github.com/tektoncd/tekton-kueue/pkg/config/zz_generated.deepcopy.go similarity index 100% rename from vendor/github.com/konflux-ci/tekton-kueue/pkg/config/zz_generated.deepcopy.go rename to vendor/github.com/tektoncd/tekton-kueue/pkg/config/zz_generated.deepcopy.go diff --git a/vendor/modules.txt b/vendor/modules.txt index 9b5ec7522d..0b6d66e0d4 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -853,10 +853,6 @@ github.com/klauspost/compress/internal/le github.com/klauspost/compress/internal/snapref github.com/klauspost/compress/zstd github.com/klauspost/compress/zstd/internal/xxhash -# github.com/konflux-ci/tekton-kueue v0.4.0 -## explicit; go 1.26.4 -github.com/konflux-ci/tekton-kueue/pkg/common -github.com/konflux-ci/tekton-kueue/pkg/config # github.com/lestrrat-go/blackmagic v1.0.4 ## explicit; go 1.23 github.com/lestrrat-go/blackmagic @@ -1560,6 +1556,10 @@ github.com/tektoncd/plumbing/scripts ## explicit; go 1.25.7 github.com/tektoncd/pruner/pkg/config github.com/tektoncd/pruner/pkg/metrics +# github.com/tektoncd/tekton-kueue v0.4.0 => github.com/konflux-ci/tekton-kueue v0.4.0 +## explicit; go 1.26.4 +github.com/tektoncd/tekton-kueue/pkg/common +github.com/tektoncd/tekton-kueue/pkg/config # github.com/tektoncd/triggers v0.37.0 ## explicit; go 1.26.4 github.com/tektoncd/triggers/pkg/apis/config @@ -2787,4 +2787,5 @@ sigs.k8s.io/structured-merge-diff/v6/value # sigs.k8s.io/yaml v1.6.0 ## explicit; go 1.22 sigs.k8s.io/yaml +# github.com/tektoncd/tekton-kueue => github.com/konflux-ci/tekton-kueue v0.4.0 # k8s.io/client-go => k8s.io/client-go v0.35.2