Skip to content

Commit

Permalink
Refactor katib-config using kustomize vars
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Iwai <[email protected]>
  • Loading branch information
tenzen-y committed Jul 30, 2023
1 parent 8e97a80 commit 2fb978f
Show file tree
Hide file tree
Showing 14 changed files with 122 additions and 83 deletions.
1 change: 1 addition & 0 deletions manifests/v1beta1/components/controller/controller.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
namespace: kubeflow
labels:
katib.kubeflow.org/component: controller
katib.kubeflow.org/version: latest
spec:
replicas: 1
selector:
Expand Down
59 changes: 0 additions & 59 deletions manifests/v1beta1/components/controller/katib-config.yaml

This file was deleted.

14 changes: 8 additions & 6 deletions manifests/v1beta1/components/controller/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ resources:
- rbac.yaml
- service.yaml
- trial-templates.yaml
configMapGenerator:
- name: katib-config
files:
- katib-config.yaml
options:
disableNameSuffixHash: true
#vars:
# - name: KATIB_VERSION
# fieldref:
# fieldpath: metadata.labels.katib\.kubeflow\.org/version
# objref:
# apiVersion: apps/v1
# kind: Deployment
# name: katib-controller
1 change: 1 addition & 0 deletions manifests/v1beta1/components/db-manager/db-manager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ metadata:
namespace: kubeflow
labels:
katib.kubeflow.org/component: db-manager
katib.kubeflow.org/version: latest
spec:
replicas: 1
selector:
Expand Down
59 changes: 59 additions & 0 deletions manifests/v1beta1/components/katib-config/katib-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
---
apiVersion: config.kubeflow.org/v1beta1
kind: KatibConfig
init:
controller:
webhookPort: 8443
trialResources:
- Job.v1.batch
- TFJob.v1.kubeflow.org
- PyTorchJob.v1.kubeflow.org
- MPIJob.v1.kubeflow.org
- XGBoostJob.v1.kubeflow.org
- MXJob.v1.kubeflow.org
runtime:
metricsCollectors:
- kind: StdOut
image: docker.io/kubeflo`wkatib/file-metrics-collector:$(KATIB_VERSION)
- kind: File
image: docker.io/kubeflowkatib/file-metrics-collector:$(KATIB_VERSION)
- kind: TensorFlowEvent
image: docker.io/kubeflowkatib/tfevent-metrics-collector:$(KATIB_VERSION)
resources:
limits:
memory: 1Gi
suggestions:
- algorithmName: random
image: docker.io/kubeflowkatib/suggestion-hyperopt:$(KATIB_VERSION)
- algorithmName: tpe
image: docker.io/kubeflowkatib/suggestion-hyperopt:$(KATIB_VERSION)
- algorithmName: grid
image: docker.io/kubeflowkatib/suggestion-optuna:$(KATIB_VERSION)
- algorithmName: hyperband
image: docker.io/kubeflowkatib/suggestion-hyperband:$(KATIB_VERSION)
- algorithmName: bayesianoptimization
image: docker.io/kubeflowkatib/suggestion-skopt:$(KATIB_VERSION)
- algorithmName: cmaes
image: docker.io/kubeflowkatib/suggestion-goptuna:$(KATIB_VERSION)
- algorithmName: sobol
image: docker.io/kubeflowkatib/suggestion-goptuna:$(KATIB_VERSION)
- algorithmName: multivariate-tpe
image: docker.io/kubeflowkatib/suggestion-optuna:$(KATIB_VERSION)
- algorithmName: enas
image: docker.io/kubeflowkatib/suggestion-enas:$(KATIB_VERSION)
resources:
limits:
memory: 200Mi
- algorithmName: darts
image: docker.io/kubeflowkatib/suggestion-darts:$(KATIB_VERSION)
- algorithmName: pbt
image: docker.io/kubeflowkatib/suggestion-pbt:$(KATIB_VERSION)
persistentVolumeClaimSpec:
accessModes:
- ReadWriteMany
resources:
requests:
storage: 5Gi
earlyStoppings:
- algorithmName: medianstop
image: docker.io/kubeflowkatib/earlystopping-medianstop:$(KATIB_VERSION)
21 changes: 21 additions & 0 deletions manifests/v1beta1/components/katib-config/kustomization.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
apiVersion: kustomize.config.k8s.io/v1beta1
kind: Kustomization
configMapGenerator:
- name: katib-config
files:
- katib-config.yaml
options:
disableNameSuffixHash: true
labels:
katib.kubeflow.org/version: latest
configurations:
- transformer-configs.yaml
vars:
- name: KATIB_VERSION
fieldref:
fieldpath: metadata.labels.katib\.kubeflow\.org/version
objref:
apiVersion: v1
kind: ConfigMap
name: katib-config
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
---
varReference:
- kind: ConfigMap
path: data
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ resources:
- ../../components/webhook/
# Cert-manager certificate for webhooks
- certificate.yaml
# Katib Config.
- ../../components/katib-config/
images:
- name: docker.io/kubeflowkatib/katib-controller
newName: docker.io/kubeflowkatib/katib-controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ resources:
- ../../components/cert-generator/
# Katib webhooks.
- ../../components/webhook/
# Katib Config.
- ../../components/katib-config/
images:
- name: docker.io/kubeflowkatib/katib-controller
newName: docker.io/kubeflowkatib/katib-controller
Expand Down
30 changes: 15 additions & 15 deletions manifests/v1beta1/installs/katib-leader-election/katib-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,40 @@ init:
runtime:
metricsCollectors:
- kind: StdOut
image: docker.io/kubeflowkatib/file-metrics-collector:latest
image: docker.io/kubeflowkatib/file-metrics-collector:$(KATIB_VERSION)
- kind: File
image: docker.io/kubeflowkatib/file-metrics-collector:latest
image: docker.io/kubeflowkatib/file-metrics-collector:$(KATIB_VERSION)
- kind: TensorFlowEvent
image: docker.io/kubeflowkatib/tfevent-metrics-collector:latest
image: docker.io/kubeflowkatib/tfevent-metrics-collector:$(KATIB_VERSION)
resources:
limits:
memory: 1Gi
suggestions:
- algorithmName: random
image: docker.io/kubeflowkatib/suggestion-hyperopt:latest
image: docker.io/kubeflowkatib/suggestion-hyperopt:$(KATIB_VERSION)
- algorithmName: tpe
image: docker.io/kubeflowkatib/suggestion-hyperopt:latest
image: docker.io/kubeflowkatib/suggestion-hyperopt:$(KATIB_VERSION)
- algorithmName: grid
image: docker.io/kubeflowkatib/suggestion-optuna:latest
image: docker.io/kubeflowkatib/suggestion-optuna:$(KATIB_VERSION)
- algorithmName: hyperband
image: docker.io/kubeflowkatib/suggestion-hyperband:latest
image: docker.io/kubeflowkatib/suggestion-hyperband:$(KATIB_VERSION)
- algorithmName: bayesianoptimization
image: docker.io/kubeflowkatib/suggestion-skopt:latest
image: docker.io/kubeflowkatib/suggestion-skopt:$(KATIB_VERSION)
- algorithmName: cmaes
image: docker.io/kubeflowkatib/suggestion-goptuna:latest
image: docker.io/kubeflowkatib/suggestion-goptuna:$(KATIB_VERSION)
- algorithmName: sobol
image: docker.io/kubeflowkatib/suggestion-goptuna:latest
image: docker.io/kubeflowkatib/suggestion-goptuna:$(KATIB_VERSION)
- algorithmName: multivariate-tpe
image: docker.io/kubeflowkatib/suggestion-optuna:latest
image: docker.io/kubeflowkatib/suggestion-optuna:$(KATIB_VERSION)
- algorithmName: enas
image: docker.io/kubeflowkatib/suggestion-enas:latest
image: docker.io/kubeflowkatib/suggestion-enas:$(KATIB_VERSION)
resources:
limits:
memory: 200Mi
- algorithmName: darts
image: docker.io/kubeflowkatib/suggestion-darts:latest
image: docker.io/kubeflowkatib/suggestion-darts:$(KATIB_VERSION)
- algorithmName: pbt
image: docker.io/kubeflowkatib/suggestion-pbt:latest
image: docker.io/kubeflowkatib/suggestion-pbt:$(KATIB_VERSION)
persistentVolumeClaimSpec:
accessModes:
- ReadWriteMany
Expand All @@ -59,4 +59,4 @@ runtime:
storage: 5Gi
earlyStoppings:
- algorithmName: medianstop
image: docker.io/kubeflowkatib/earlystopping-medianstop:latest
image: docker.io/kubeflowkatib/earlystopping-medianstop:$(KATIB_VERSION)
2 changes: 2 additions & 0 deletions manifests/v1beta1/installs/katib-openshift/kustomization.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ resources:
- ../../components/ui/
# Katib webhooks.
- ../../components/webhook/
# Katib Config.
- ../../components/katib-config/
images:
- name: docker.io/kubeflowkatib/katib-controller
newName: docker.io/kubeflowkatib/katib-controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ resources:
- ../../components/cert-generator/
# Katib webhooks.
- ../../components/webhook/
# Katib Config.
- ../../components/katib-config/
images:
- name: docker.io/kubeflowkatib/katib-controller
newName: docker.io/kubeflowkatib/katib-controller
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ resources:
- ../../components/cert-generator/
# Katib webhooks.
- ../../components/webhook/
# Katib Config.
- ../../components/katib-config/
images:
- name: docker.io/kubeflowkatib/katib-controller
newName: docker.io/kubeflowkatib/katib-controller
Expand Down
6 changes: 3 additions & 3 deletions scripts/v1beta1/update-images.sh
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,11 @@ update_yaml_files "${INSTALLS_PATH}" "newName: ${OLD_PREFIX}" "newName: ${NEW_PR
update_yaml_files "${INSTALLS_PATH}" "newTag: .*" "newTag: ${TAG}"

# Katib Config images.
CONFIG_PATH="manifests/v1beta1/components/controller/katib-config.yaml"
CONFIG_PATH="manifests/v1beta1/components/katib-config/"

echo -e "Update Katib Metrics Collectors, Suggestions and EarlyStopping images\n"
update_yaml_files "${CONFIG_PATH}" "${OLD_PREFIX}" "${NEW_PREFIX}"
update_yaml_files "${CONFIG_PATH}" ":[^[:space:]].*\"" ":${TAG}\""
update_yaml_files "${CONFIG_PATH}" "image: ${OLD_PREFIX}" "image: ${NEW_PREFIX}"
update_yaml_files "${CONFIG_PATH}" "katib.kubeflow.org/version: .*" "katib.kubeflow.org/version: ${TAG}"

# Katib Trial training container images.

Expand Down

0 comments on commit 2fb978f

Please sign in to comment.