Skip to content

Commit

Permalink
Create separate manifests for both FlowSchema and PriorityLevelConfig…
Browse files Browse the repository at this point in the history
…uration in versions v1 and v1beta3.
  • Loading branch information
mbobrovskyi committed Sep 18, 2024
1 parent a7030a7 commit 1355dcc
Show file tree
Hide file tree
Showing 18 changed files with 81 additions and 15 deletions.
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -266,6 +266,8 @@ artifacts: kustomize yq helm ## Generate release artifacts.
$(KUSTOMIZE) build config/alpha-enabled -o artifacts/manifests-alpha-enabled.yaml
$(KUSTOMIZE) build config/prometheus -o artifacts/prometheus.yaml
$(KUSTOMIZE) build config/visibility -o artifacts/visibility-api.yaml
$(KUSTOMIZE) build config/apf/default -o artifacts/apf.yaml
$(KUSTOMIZE) build config/apf/1_28 -o artifacts/apf-1-28.yaml
@$(call clean-manifests)
# Update the image tag and policy
$(YQ) e '.controllerManager.manager.image.repository = "$(IMAGE_REPO)" | .controllerManager.manager.image.tag = "$(GIT_TAG)" | .controllerManager.manager.image.pullPolicy = "IfNotPresent"' -i charts/kueue/values.yaml
Expand Down
4 changes: 2 additions & 2 deletions Makefile-test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ FORCE:
run-test-e2e-%: K8S_VERSION = $(@:run-test-e2e-%=%)
run-test-e2e-%: FORCE
@echo Running e2e for k8s ${K8S_VERSION}
E2E_KIND_VERSION="kindest/node:v$(K8S_VERSION)" KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) CREATE_KIND_CLUSTER=$(CREATE_KIND_CLUSTER) ARTIFACTS="$(ARTIFACTS)/$@" IMAGE_TAG=$(IMAGE_TAG) GINKGO_ARGS="$(GINKGO_ARGS)" JOBSET_VERSION=$(JOBSET_VERSION) KUBEFLOW_VERSION=$(KUBEFLOW_VERSION) KUBEFLOW_MPI_VERSION=$(KUBEFLOW_MPI_VERSION) ./hack/e2e-test.sh
K8S_VERSION="$(K8S_VERSION)" E2E_KIND_VERSION="kindest/node:v$(K8S_VERSION)" KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) CREATE_KIND_CLUSTER=$(CREATE_KIND_CLUSTER) ARTIFACTS="$(ARTIFACTS)/$@" IMAGE_TAG=$(IMAGE_TAG) GINKGO_ARGS="$(GINKGO_ARGS)" JOBSET_VERSION=$(JOBSET_VERSION) KUBEFLOW_VERSION=$(KUBEFLOW_VERSION) KUBEFLOW_MPI_VERSION=$(KUBEFLOW_MPI_VERSION) ./hack/e2e-test.sh
$(PROJECT_DIR)/bin/ginkgo-top -i $(ARTIFACTS)/$@/e2e.json > $(ARTIFACTS)/$@/e2e-top.yaml

run-test-multikueue-e2e-%: K8S_VERSION = $(@:run-test-multikueue-e2e-%=%)
run-test-multikueue-e2e-%: FORCE
@echo Running multikueue e2e for k8s ${K8S_VERSION}
E2E_KIND_VERSION="kindest/node:v$(K8S_VERSION)" KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) CREATE_KIND_CLUSTER=$(CREATE_KIND_CLUSTER) ARTIFACTS="$(ARTIFACTS)/$@" IMAGE_TAG=$(IMAGE_TAG) GINKGO_ARGS="$(GINKGO_ARGS)" JOBSET_VERSION=$(JOBSET_VERSION) KUBEFLOW_VERSION=$(KUBEFLOW_VERSION) KUBEFLOW_MPI_VERSION=$(KUBEFLOW_MPI_VERSION) ./hack/multikueue-e2e-test.sh
K8S_VERSION=$(K8S_VERSION) E2E_KIND_VERSION="kindest/node:v$(K8S_VERSION)" KIND_CLUSTER_NAME=$(KIND_CLUSTER_NAME) CREATE_KIND_CLUSTER=$(CREATE_KIND_CLUSTER) ARTIFACTS="$(ARTIFACTS)/$@" IMAGE_TAG=$(IMAGE_TAG) GINKGO_ARGS="$(GINKGO_ARGS)" JOBSET_VERSION=$(JOBSET_VERSION) KUBEFLOW_VERSION=$(KUBEFLOW_VERSION) KUBEFLOW_MPI_VERSION=$(KUBEFLOW_MPI_VERSION) ./hack/multikueue-e2e-test.sh
$(PROJECT_DIR)/bin/ginkgo-top -i $(ARTIFACTS)/$@/e2e.json > $(ARTIFACTS)/$@/e2e-top.yaml

SCALABILITY_RUNNER := $(PROJECT_DIR)/bin/performance-scheduler-runner
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if include "kueue.isFeatureGateEnabled" (dict "List" .Values.controllerManager.featureGates "Feature" "VisibilityOnDemand") }}
apiVersion: flowcontrol.apiserver.k8s.io/v1beta3
apiVersion: flowcontrol.apiserver.k8s.io/{{ .Values.apf.version }}
kind: FlowSchema
metadata:
labels:
{{- include "kueue.labels" . | nindent 4 }}
name: '{{ include "kueue.fullname" . }}-visibility'
namespace: '{{ .Release.Namespace }}'
spec:
distinguisherMethod:
type: ByUser
Expand All @@ -29,4 +29,3 @@ spec:
- group:
name: system:authenticated
kind: Group
{{- end }}
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{{- if include "kueue.isFeatureGateEnabled" (dict "List" .Values.controllerManager.featureGates "Feature" "VisibilityOnDemand") }}
apiVersion: flowcontrol.apiserver.k8s.io/v1beta3
apiVersion: flowcontrol.apiserver.k8s.io/{{ .Values.apf.version }}
kind: PriorityLevelConfiguration
metadata:
labels:
{{- include "kueue.labels" . | nindent 4 }}
name: '{{ include "kueue.fullname" . }}-visibility'
namespace: '{{ .Release.Namespace }}'
spec:
limited:
lendablePercent: 0
Expand All @@ -16,4 +16,3 @@ spec:
type: Queue
nominalConcurrencyShares: 10
type: Limited
{{- end }}
3 changes: 3 additions & 0 deletions charts/kueue/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ fullnameOverride: ""
enablePrometheus: false
# Enable x509 automated certificate management using cert-manager (cert-manager.io)
enableCertManager: false
# Customize APF
apf:
version: v1
# Customize controllerManager
controllerManager:
#featureGates:
Expand Down
19 changes: 19 additions & 0 deletions config/apf/1_28/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This overlay builds the APF components for Kubernetes version 1.28 to be used in combination
# with other overlays.

resources:
- ../default/

patches:
- target:
kind: FlowSchema
patch: |
- op: replace
path: /apiVersion
value: flowcontrol.apiserver.k8s.io/v1beta3
- target:
kind: PriorityLevelConfiguration
patch: |
- op: replace
path: /apiVersion
value: flowcontrol.apiserver.k8s.io/v1beta3
17 changes: 17 additions & 0 deletions config/apf/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# This overlay builds the APF components to be used in combination
# with other overlays.

namespace: kueue-system
namePrefix: kueue-

commonLabels:
control-plane: controller-manager

labels:
- pairs:
app.kubernetes.io/name: kueue
app.kubernetes.io/component: controller
includeTemplates: true

resources:
- ../../components/apf/
3 changes: 3 additions & 0 deletions config/components/apf/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- visibility_flowschema.yaml
- visibility_prioritylevelconfigurations.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apiVersion: flowcontrol.apiserver.k8s.io/v1beta3
apiVersion: flowcontrol.apiserver.k8s.io/v1
kind: FlowSchema
metadata:
name: visibility
namespace: system
spec:
distinguisherMethod:
type: ByUser
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
apiVersion: flowcontrol.apiserver.k8s.io/v1beta3
apiVersion: flowcontrol.apiserver.k8s.io/v1
kind: PriorityLevelConfiguration
metadata:
name: visibility
namespace: system
spec:
limited:
lendablePercent: 0
Expand Down
2 changes: 0 additions & 2 deletions config/components/visibility/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,3 @@ resources:
- apiservice.yaml
- role_binding.yaml
- service.yaml
- flowschema.yaml
- prioritylevelconfigurations.yaml
8 changes: 7 additions & 1 deletion hack/e2e-common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,13 @@ function cluster_kind_load_image {
# $1 cluster
function cluster_kueue_deploy {
kubectl config use-context "kind-${1}"
kubectl apply --server-side -k test/e2e/config
if [ "${K8S_VERSION%.*}" = "1.28" ]; then
echo "Applying 1.28"
kubectl apply --server-side -k test/e2e/config/1_28
else
echo "Applying Default"
kubectl apply --server-side -k test/e2e/config/default
fi
}

#$1 - cluster name
Expand Down
12 changes: 12 additions & 0 deletions hack/update-helm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,13 @@ SRC_CRD_DIR=config/components/crd/bases
SRC_RBAC_DIR=config/components/rbac
SRC_WEBHOOK_DIR=config/components/webhook
SRC_VISIBILITY_DIR=config/components/visibility
SRC_APF_DIR=config/components/apf

DEST_CRD_DIR=charts/kueue/templates/crd
DEST_RBAC_DIR=charts/kueue/templates/rbac
DEST_WEBHOOK_DIR=charts/kueue/templates/webhook
DEST_VISIBILITY_DIR=charts/kueue/templates/visibility
DEST_APF_DIR=charts/kueue/templates/apf

YQ=./bin/yq
SED=${SED:-/usr/bin/sed}
Expand All @@ -48,6 +50,8 @@ find $SRC_RBAC_DIR -name "*.yaml" $EXCLUDE_FILES_ARGS -exec cp "{}" $DEST_RBAC_D
find $SRC_WEBHOOK_DIR -name "*.yaml" $EXCLUDE_FILES_ARGS -exec cp "{}" $DEST_WEBHOOK_DIR \;
# shellcheck disable=SC2086
find $SRC_VISIBILITY_DIR -name "*.yaml" $EXCLUDE_FILES_ARGS -exec cp "{}" $DEST_VISIBILITY_DIR \;
# shellcheck disable=SC2086
find $SRC_APF_DIR -name "*.yaml" $EXCLUDE_FILES_ARGS -exec cp "{}" $DEST_APF_DIR \;
$YQ -N -s '.kind' ${DEST_WEBHOOK_DIR}/manifests.yaml
rm ${DEST_WEBHOOK_DIR}/manifests.yaml
files=("MutatingWebhookConfiguration.yml" "ValidatingWebhookConfiguration.yml")
Expand Down Expand Up @@ -305,3 +309,11 @@ EOT
} > "${output_file}.tmp"
mv "${output_file}.tmp" "${output_file}"
done

# Replace flowcontrol version on APF directory
for output_file in "${DEST_APF_DIR}"/*.yaml; do
$YQ -N -i '.apiVersion = "flowcontrol.apiserver.k8s.io/{{ .Values.apf.version }}"' "$output_file"
$YQ -N -i '.metadata.name |= "{{ include \"kueue.fullname\" . }}-" + .' "$output_file"
$YQ -N -i '.metadata.namespace = "{{ .Release.Namespace }}"' "$output_file"
$SED -i '/^metadata:.*/a\ labels:\n {{- include "kueue.labels" . | nindent 4 }}' "$output_file"
done
3 changes: 3 additions & 0 deletions test/e2e/config/1_28/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- ../common
- ../../../../config/apf/1_28
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization

resources:
- ../../../config/dev
- ../../../config/visibility
- ../../../../config/dev
- ../../../../config/visibility

replicas:
- name: kueue-controller-manager
Expand Down
File renamed without changes.
3 changes: 3 additions & 0 deletions test/e2e/config/default/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
resources:
- ../common
- ../../../../config/apf/default

0 comments on commit 1355dcc

Please sign in to comment.