Skip to content
This repository has been archived by the owner on Aug 17, 2023. It is now read-only.

Commit

Permalink
Automated cherry pick of #295: Update config file names Cherry pick of
Browse files Browse the repository at this point in the history
…#295 on v1.0-branch. #295: Update config file names (#316)

* Support patch upgrades for kfctl upgrades

* fix upgrade test spec

* Update kfctl_upgrade_e2e_workflow.py

* Update kfctl_upgrade_e2e_workflow.py
  • Loading branch information
richardsliu authored Apr 17, 2020
1 parent 59adb61 commit a476281
Show file tree
Hide file tree
Showing 3 changed files with 28 additions and 9 deletions.
10 changes: 4 additions & 6 deletions pkg/kfupgrade/kfupgrade.go
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ func (upgrader *KfUpgrader) Apply() error {
func (upgrader *KfUpgrader) DeleteObsoleteResources(ns string) error {
applicationsv1beta1.AddToScheme(scheme.Scheme)

ver := upgrader.OldKfCfg.Spec.Version
log.Infof("Deleting resources in in namespace %v version %v", ns, ver)
log.Infof("Deleting resources in in namespace %v", ns)

objs := []runtime.Object{
&applicationsv1beta1.Application{},
Expand All @@ -309,7 +308,7 @@ func (upgrader *KfUpgrader) DeleteObsoleteResources(ns string) error {
}

for _, obj := range objs {
err := upgrader.DeleteResources(ns, ver, obj)
err := upgrader.DeleteResources(ns, obj)
if err != nil {
return err
}
Expand All @@ -318,18 +317,17 @@ func (upgrader *KfUpgrader) DeleteObsoleteResources(ns string) error {
return nil
}

func (upgrader *KfUpgrader) DeleteResources(ns string, ver string, obj runtime.Object) error {
func (upgrader *KfUpgrader) DeleteResources(ns string, obj runtime.Object) error {
config := kftypesv3.GetConfig()
kubeClient, err := client.New(config, client.Options{})
objKind := reflect.TypeOf(obj)

log.Infof("Deleting resources type %v in in namespace %v version %v", objKind, ns, ver)
log.Infof("Deleting resources type %v in in namespace %v", objKind, ns)
err = kubeClient.DeleteAllOf(context.Background(),
obj,
client.InNamespace(ns),
client.MatchingLabels{
"app.kubernetes.io/part-of": "kubeflow",
kftypesv3.DefaultAppVersion: ver,
},
client.PropagationPolicy(metav1.DeletePropagationBackground))

Expand Down
4 changes: 2 additions & 2 deletions prow_config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ workflows:
# test_endpoint flag is actually deprecated; we use pytest annotations to skip on
# presubmit.
test_endpoint: true
config_path: https://raw.githubusercontent.com/kubeflow/manifests/v0.7-branch/kfdef/kfctl_gcp_iap.0.7.1.yaml
upgrade_spec_path: https://raw.githubusercontent.com/kubeflow/manifests/master/kfdef/kfctl_upgrade_gcp_iap_1.0.0.yaml
config_path: https://raw.githubusercontent.com/kubeflow/manifests/v1.0-branch/kfdef/kfctl_gcp_iap.v1.0.0.yaml
upgrade_spec_path: https://raw.githubusercontent.com/kubeflow/manifests/master/kfdef/kfctl_upgrade_gcp_iap_1.0.2.yaml
# E2E tests for kfctl_istio_dex
# - app_dir: kubeflow/kubeflow/testing/workflows
# component: kfctl_go_test
Expand Down
23 changes: 22 additions & 1 deletion py/kubeflow/kfctl/testing/ci/kfctl_upgrade_e2e_workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@

UPGRADE_DAG_NAME = "upgrade-dag"

READY_AFTER_UPGRADE = "ready-after-upgrade"

TEMPLATE_LABEL = "kfctl_upgrade_e2e"

class Builder(kfctl_e2e_workflow.Builder):
Expand Down Expand Up @@ -107,14 +109,33 @@ def build(self):
argo_build_util.add_task_only_to_dag(self.workflow, kfctl_e2e_workflow.E2E_DAG_NAME, step_name,
template_name, dependencies)

# Wait for Kubeflow to be ready after upgrading
step_name = READY_AFTER_UPGRADE
template_name = "kubeflow-is-ready"
command = [
"pytest",
"kf_is_ready_test.py",
"-s",
"--log-cli-level=info",
"--junitxml=" + os.path.join(self.artifacts_dir,
"junit_ready-after-upgrade-test-" +
self.config_name + ".xml"),
"-o", "junit_suite_name=test_ready_after_upgrade_" + self.config_name,
"--app_path=" + self.app_dir,
]

dependencies = [UPGRADE_DAG_NAME]
argo_build_util.add_task_only_to_dag(self.workflow, kfctl_e2e_workflow.E2E_DAG_NAME, step_name,
template_name, dependencies)

#****************************************************************************
# Add tests DAG
#****************************************************************************
# After running upgrade we want to rerun the DAG(s) that validate the deployment is healthy

step_name = "test-after-upgrade"
template_name = kfctl_e2e_workflow.TESTS_DAG_NAME
dependencies = [UPGRADE_DAG_NAME]
dependencies = [READY_AFTER_UPGRADE]
argo_build_util.add_task_only_to_dag(self.workflow, kfctl_e2e_workflow.E2E_DAG_NAME, step_name,
template_name, dependencies)

Expand Down

0 comments on commit a476281

Please sign in to comment.