Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update kpt alpha to use porchctl #244

Merged
merged 1 commit into from
Feb 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions e2e/tests/free5gc/001.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ function assert_workload_resource_contains {
assert_contains "$(_curl_workload_cluster_content "$1")" "$2" "$3"
}

regional_pkg_rev=$(kpt alpha rpkg clone -n default "https://github.com/nephio-project/catalog.git/infra/capi/nephio-workload-cluster@$REVISION" --repository mgmt regional | cut -f 1 -d ' ')
regional_pkg_rev=$(porchctl rpkg clone -n default "https://github.com/nephio-project/catalog.git/infra/capi/nephio-workload-cluster@$REVISION" --repository mgmt regional | cut -f 1 -d ' ')
k8s_wait_exists "packagerev" "$regional_pkg_rev"

# Draft creation
Expand All @@ -57,23 +57,23 @@ assert_workload_resource_contains "drafts/regional/v1" "clusterName: regional" "

pushd "$(mktemp -d -t "001-pkg-XXX")" >/dev/null
trap popd EXIT
kpt alpha rpkg pull -n default "$regional_pkg_rev" regional
porchctl rpkg pull -n default "$regional_pkg_rev" regional
kpt fn eval --image "gcr.io/kpt-fn/set-labels:v0.2.0" regional -- "nephio.org/site-type=regional" "nephio.org/region=us-west1"
assert_contains "$(cat regional/workload-cluster.yaml)" "nephio.org/region: us-west1" "Workload cluster doesn't have region label"

kpt alpha rpkg push -n default "$regional_pkg_rev" regional
porchctl rpkg push -n default "$regional_pkg_rev" regional
porch_wait_log_entry "Update.*packagerevisionresources/${regional_pkg_rev},"

# Proposal
kpt alpha rpkg propose -n default "$regional_pkg_rev"
porchctl rpkg propose -n default "$regional_pkg_rev"
porch_wait_log_entry "Update.*packagerevisions/${regional_pkg_rev},"
assert_lifecycle_equals "$regional_pkg_rev" "Proposed"
assert_branch_exists "proposed/regional/v1"
assert_commit_msg_in_branch "Intermediate commit" "proposed/regional/v1"
assert_workload_resource_contains "proposed/regional/v1" "nephio.org/site-type: regional" "Workload cluster has not been transformed properly to proposed"

# Approval
kpt alpha rpkg approve -n default "$regional_pkg_rev"
porchctl rpkg approve -n default "$regional_pkg_rev"
porch_wait_log_entry "Update.*/${regional_pkg_rev}.*/approval"
assert_lifecycle_equals "$regional_pkg_rev" "Published"
assert_workload_resource_contains "main" "nephio.org/site-type: regional" "Workload cluster has not been successfully merged into main branch"
Expand Down
6 changes: 3 additions & 3 deletions e2e/tests/free5gc/003.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,21 +33,21 @@ source "${LIBDIR}/porch.sh"
# shellcheck source=e2e/lib/_assertions.sh
source "${LIBDIR}/_assertions.sh"

pkg_rev=$(kpt alpha rpkg clone -n default "https://github.com/nephio-project/catalog.git/workloads/free5gc/free5gc-cp@$REVISION" --repository regional free5gc-cp | cut -f 1 -d ' ')
pkg_rev=$(porchctl rpkg clone -n default "https://github.com/nephio-project/catalog.git/workloads/free5gc/free5gc-cp@$REVISION" --repository regional free5gc-cp | cut -f 1 -d ' ')
k8s_wait_exists "packagerev" "$pkg_rev"

porch_wait_log_entry "Creating packagerev default/regional-"
assert_lifecycle_equals "$pkg_rev" "Draft"
assert_branch_exists "drafts/free5gc-cp/v1" "nephio/regional"
assert_commit_msg_in_branch "Intermediate commit" "drafts/free5gc-cp/v1" "nephio/regional"

kpt alpha rpkg propose -n default "$pkg_rev"
porchctl rpkg propose -n default "$pkg_rev"
porch_wait_log_entry "Update.*packagerevisions/${pkg_rev},"
assert_lifecycle_equals "$pkg_rev" "Proposed"
assert_branch_exists "proposed/free5gc-cp/v1" "nephio/regional"
assert_commit_msg_in_branch "Intermediate commit" "proposed/free5gc-cp/v1" "nephio/regional"

kpt alpha rpkg approve -n default "$pkg_rev"
porchctl rpkg approve -n default "$pkg_rev"
porch_wait_log_entry "Update.*/${pkg_rev}.*/approval"
assert_lifecycle_equals "$pkg_rev" "Published"

Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/free5gc/008.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,11 @@ debug "current_memory: $current_memory"
upf_deployment_pkg=$(kubectl --kubeconfig "$kubeconfig" get packagevariant edge-free5gc-upf-edge01-free5gc-upf -o jsonpath='{.status.downstreamTargets[0].name}')
info "Copying $upf_deployment_pkg"
ws="edge01-upf-scaling"
upf_pkg_rev=$(kpt alpha rpkg copy -n default "$upf_deployment_pkg" --workspace "$ws" | cut -d ' ' -f 1)
upf_pkg_rev=$(porchctl rpkg copy -n default "$upf_deployment_pkg" --workspace "$ws" | cut -d ' ' -f 1)
info "Copied to $upf_pkg_rev, pulling"

rm -rf $ws
kpt alpha rpkg pull -n default "$upf_pkg_rev" $ws
porchctl rpkg pull -n default "$upf_pkg_rev" $ws

rm -rf /tmp/$ws
cp -r $ws /tmp
Expand All @@ -66,14 +66,14 @@ kpt fn eval --image gcr.io/kpt-fn/search-replace:v0.2.0 "$ws" -- by-path='spec.m
diff -r /tmp/$ws $ws || echo

info "Pushing $upf_pkg_rev update"
kpt alpha rpkg push -n default "$upf_pkg_rev" $ws
porchctl rpkg push -n default "$upf_pkg_rev" $ws

info "Proposing $upf_pkg_rev update"
kpt alpha rpkg propose -n default "$upf_pkg_rev"
porchctl rpkg propose -n default "$upf_pkg_rev"
k8s_wait_exists "packagerev" "$upf_pkg_rev"

info "Approving $upf_pkg_rev update"
kpt alpha rpkg approve -n default "$upf_pkg_rev"
porchctl rpkg approve -n default "$upf_pkg_rev"

# Get current UPF pod state after scaling
k8s_wait_ready_replicas "deployment" "upf-edge01" "$cluster_kubeconfig" "free5gc-upf"
Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/free5gc/009.sh
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ smf_pkg_rev=$smf_deployment_pkg

if [[ $lifecycle == "Published" ]]; then
info "Copying $smf_deployment_pkg"
smf_pkg_rev=$(kpt alpha rpkg copy -n default "$smf_deployment_pkg" --workspace "$ws" | cut -d ' ' -f 1)
smf_pkg_rev=$(porchctl rpkg copy -n default "$smf_deployment_pkg" --workspace "$ws" | cut -d ' ' -f 1)
info "Copied to $smf_pkg_rev, pulling"
fi

Expand All @@ -70,7 +70,7 @@ fi
retries=5
while [[ $retries -gt 0 ]]; do
rm -rf $ws
kpt alpha rpkg pull -n default "$smf_pkg_rev" $ws
porchctl rpkg pull -n default "$smf_pkg_rev" $ws

rm -rf /tmp/$ws
cp -r $ws /tmp
Expand All @@ -84,14 +84,14 @@ while [[ $retries -gt 0 ]]; do

modified=false
info "Pushing update"
output=$(kpt alpha rpkg push -n default "$smf_pkg_rev" $ws 2>&1)
output=$(porchctl rpkg push -n default "$smf_pkg_rev" $ws 2>&1)
if [[ $output =~ "modified" ]]; then
modified=true
fi

if [[ $modified == false ]]; then
info "Proposing update"
output=$(kpt alpha rpkg propose -n default "$smf_pkg_rev" 2>&1)
output=$(porchctl rpkg propose -n default "$smf_pkg_rev" 2>&1)
if [[ $output =~ "modified" ]]; then
modified=true
else
Expand All @@ -101,7 +101,7 @@ while [[ $retries -gt 0 ]]; do

if [[ $modified == false ]]; then
info "Approving update"
output=$(kpt alpha rpkg approve -n default "$smf_pkg_rev" 2>&1)
output=$(porchctl rpkg approve -n default "$smf_pkg_rev" 2>&1)
if [[ $output =~ "modified" ]]; then
modified=true
fi
Expand Down
10 changes: 5 additions & 5 deletions e2e/tests/oai/001b-infra-metal-lb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -43,25 +43,25 @@ function _define_ip_address_pool {
pushd "$(mktemp -d -t "001-pkg-XXX")" >/dev/null
trap popd RETURN

pkg_rev=$(kpt alpha rpkg clone -n default "https://github.com/nephio-project/catalog.git/distros/sandbox/metallb-sandbox-config@$REVISION" --repository mgmt-staging "$cluster-metallb-sandbox-config" | cut -f 1 -d ' ')
pkg_rev=$(porchctl rpkg clone -n default "https://github.com/nephio-project/catalog.git/distros/sandbox/metallb-sandbox-config@$REVISION" --repository mgmt-staging "$cluster-metallb-sandbox-config" | cut -f 1 -d ' ')
k8s_wait_exists "packagerev" "$pkg_rev"
kpt alpha rpkg pull -n default "$pkg_rev" "$cluster-metallb-sandbox-config"
porchctl rpkg pull -n default "$pkg_rev" "$cluster-metallb-sandbox-config"
kpt fn eval --image "gcr.io/kpt-fn/search-replace:v0.2" "$cluster-metallb-sandbox-config" -- 'by-path=spec.addresses[0]' "put-value=$cidr"
kpt fn eval --image "gcr.io/kpt-fn/set-annotations:v0.1.4" "$cluster-metallb-sandbox-config" -- "nephio.org/cluster-name=$cluster"

# Push changes
kpt alpha rpkg push -n default "$pkg_rev" "$cluster-metallb-sandbox-config"
porchctl rpkg push -n default "$pkg_rev" "$cluster-metallb-sandbox-config"
porch_wait_log_entry "Update.*packagerevisionresources/${pkg_rev},"

# Propose
kpt alpha rpkg propose -n default "$pkg_rev"
porchctl rpkg propose -n default "$pkg_rev"
porch_wait_log_entry "Update.*packagerevisions/${pkg_rev},"
assert_lifecycle_equals "$pkg_rev" "Proposed"
assert_branch_exists "proposed/$cluster-metallb-sandbox-config/v1" "nephio/mgmt-staging"
assert_commit_msg_in_branch "Intermediate commit" "proposed/$cluster-metallb-sandbox-config/v1" "nephio/mgmt-staging"

# Approval
kpt alpha rpkg approve -n default "$pkg_rev"
porchctl rpkg approve -n default "$pkg_rev"
porch_wait_log_entry "Update.*/${pkg_rev}.*/approval"
assert_lifecycle_equals "$pkg_rev" "Published"
}
Expand Down