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 to latest nephio-controllers, nephio-workload-cluster packages #78

Merged
merged 5 commits into from
Jun 12, 2023
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
1 change: 1 addition & 0 deletions e2e/launch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,5 @@ if [[ "$ORGNAME" == "google.com" ]]; then
OPTS="-o ProxyCommand='corp-ssh-helper %h %p'"
fi

trap "echo To ssh to the VM: gcloud compute ssh $VM -- $OPTS" INT
echo gcloud compute ssh $VM -- $OPTS sudo journalctl -u google-startup-scripts.service --follow | /bin/bash
25 changes: 25 additions & 0 deletions e2e/provision/bash_config.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash
# SPDX-license-identifier: Apache-2.0
##############################################################################
# Copyright (c) 2023 The Nephio Authors.
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

# This file contains conveniences for the user on the test machine. It will be
# copied to the .bash_aliases file for that user.

alias k=kubectl

function get_capi_kubeconfig {
local cluster=$1

if [[ -z "$cluster" ]]; then
echo "Usage: $0 cluster-name"
return 1
fi

kubectl get secret "${cluster}-kubeconfig" -o jsonpath='{.data.value}' | base64 -d > "${cluster}-kubeconfig"
}
8 changes: 3 additions & 5 deletions e2e/provision/gce_init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,15 @@ apt-get install -y git

cd /home/$NEPHIO_USER

cat > .bash_aliases <<EOF
alias k=kubectl
EOF

chown $NEPHIO_USER:$NEPHIO_USER .bash_aliases

runuser -u $NEPHIO_USER git clone "$REPO" test-infra
if [[ "$BRANCH" != "main" ]]; then
cd test-infra && runuser -u $NEPHIO_USER -- git checkout -b "$BRANCH" --track "origin/$BRANCH" && cd ..
fi

cp /home/$NEPHIO_USER/test-infra/e2e/provision/bash_config.sh /home/$NEPHIO_USER/.bash_aliases
chown $NEPHIO_USER:$NEPHIO_USER /home/$NEPHIO_USER/.bash_aliases

sed -e "s/vagrant/$NEPHIO_USER/" < /home/$NEPHIO_USER/test-infra/e2e/provision/nephio.yaml > /home/$NEPHIO_USER/nephio.yaml
cd ./test-infra/e2e/provision
export DEBUG DEPLOYMENT_TYPE
Expand Down
2 changes: 1 addition & 1 deletion e2e/provision/playbooks/roles/install/tasks/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
name: kpt
loop:
- {pkg: porch-dev, version: porch-dev/v2, namespaces: [porch-fn-system, porch-system]}
- {pkg: nephio-controllers, version: nephio-controllers/v4, namespaces: [nephio-system]}
- {pkg: nephio-controllers, version: nephio-controllers/v5, namespaces: [nephio-system]}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to pull this version info instead of hardcoding it here? It can be done in a later PR hopefully

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Well, if we do that then we don't have a repeatable deployment. But agreed, this needs rework in R2 or R1++ to be simpler.

What I can do for now is force-push tags to move v5 to a new commit if I need another change. That doesn't go through our review process...

- {pkg: configsync, version: configsync/v1, namespaces: [config-management-monitoring, config-management-system, resource-group-system]}
- {pkg: nephio-stock-repos, version: nephio-stock-repos/v1, namespaces: []}
vars:
Expand Down
5 changes: 3 additions & 2 deletions e2e/tests/001.sh
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ source "${LIBDIR}/k8s.sh"

kubeconfig="$HOME/.kube/config"

workload_cluster_pkg_rev=$(kpt alpha rpkg get --name nephio-workload-cluster --revision v7 -o jsonpath='{.metadata.name}')
workload_cluster_pkg_rev=$(kpt alpha rpkg get --name nephio-workload-cluster --revision v8 -o jsonpath='{.metadata.name}')
Copy link
Collaborator

@vjayaramrh vjayaramrh Jun 12, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You may already be thinking about pulling this value for version automatically instead of this being hard coded, right?
Maybe a good idea for others to look into this who are wanting to contribute?

regional_pkg_rev=$(kpt alpha rpkg clone -n default "$workload_cluster_pkg_rev" --repository mgmt regional | cut -f 1 -d ' ')

kpt alpha rpkg pull -n default "$regional_pkg_rev" regional
Expand All @@ -37,5 +37,6 @@ kpt alpha rpkg propose -n default "$regional_pkg_rev"
kpt alpha rpkg approve -n default "$regional_pkg_rev"

k8s_wait_exists "$kubeconfig" 600 "default" "workloadcluster" "regional"

k8s_wait_exists "$kubeconfig" 600 "default" "cluster" "regional"
k8s_wait_ready "$kubeconfig" 600 "default" "cluster" "regional"

2 changes: 1 addition & 1 deletion e2e/tests/002-edge-clusters.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ spec:
upstream:
repo: nephio-example-packages
package: nephio-workload-cluster
revision: v7
revision: v8
targets:
- repositories:
- name: mgmt
Expand Down
3 changes: 3 additions & 0 deletions e2e/tests/002.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,8 @@ k8s_apply "$kubeconfig" "$TESTDIR/002-edge-clusters.yaml"
k8s_wait_exists "$kubeconfig" 600 "default" "workloadcluster" "edge01"
k8s_wait_exists "$kubeconfig" 600 "default" "workloadcluster" "edge02"

k8s_wait_exists "$kubeconfig" 600 "default" "cluster" "edge01"
k8s_wait_exists "$kubeconfig" 600 "default" "cluster" "edge02"

k8s_wait_ready "$kubeconfig" 600 "default" "cluster" "edge01"
k8s_wait_ready "$kubeconfig" 600 "default" "cluster" "edge02"
2 changes: 1 addition & 1 deletion e2e/tests/004.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ kubeconfig="$HOME/.kube/config"
k8s_apply "$kubeconfig" "$TESTDIR/004-free5gc-operator.yaml"

for cluster in "regional" "edge01" "edge02"; do
cluster_kubeconfig=$(k8s_get_capi_kubeconfig "$kubeconfig" "default" "regional")
cluster_kubeconfig=$(k8s_get_capi_kubeconfig "$kubeconfig" "default" "$cluster")
k8s_wait_exists "$cluster_kubeconfig" 600 "free5gc" "deployment" "free5gc-operator-controller"
k8s_wait_ready_replicas "$cluster_kubeconfig" 600 "free5gc" "deployment" "free5gc-operator-controller"
done
17 changes: 9 additions & 8 deletions e2e/tests/005.sh
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,20 @@ source "${LIBDIR}/k8s.sh"

kubeconfig="$HOME/.kube/config"

# apply both AMF and SMF so they both start processing
k8s_apply "$kubeconfig" "$TESTDIR/005-regional-free5gc-amf.yaml"
k8s_apply "$kubeconfig" "$TESTDIR/005-regional-free5gc-smf.yaml"

k8s_wait_exists "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-amf-regional-free5gc-amf"
k8s_wait_exists "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-smf-regional-free5gc-smf"

k8s_wait_ready "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-amf-regional-free5gc-amf"
k8s_wait_ready "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-smf-regional-free5gc-smf"

cluster_kubeconfig=$(k8s_get_capi_kubeconfig "$kubeconfig" "default" "regional")

# check the AMF
k8s_wait_exists "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-amf-regional-free5gc-amf"
k8s_wait_ready "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-amf-regional-free5gc-amf"
k8s_wait_exists "$cluster_kubeconfig" 600 "free5gc-amf" "deployment" "free5gc-amf"
k8s_wait_exists "$cluster_kubeconfig" 600 "free5gc-amf" "deployment" "free5gc-smf"

k8s_wait_ready_replicas "$cluster_kubeconfig" 600 "free5gc" "deployment" "free5gc-amf"

# check the SMF
k8s_wait_ready "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-smf-regional-free5gc-smf"
k8s_wait_exists "$kubeconfig" 600 "default" "packagevariant" "regional-free5gc-smf-regional-free5gc-smf"
k8s_wait_exists "$cluster_kubeconfig" 600 "free5gc-amf" "deployment" "free5gc-smf"
k8s_wait_ready_replicas "$cluster_kubeconfig" 600 "free5gc" "deployment" "free5gc-smf"
2 changes: 1 addition & 1 deletion e2e/tests/006.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for cluster in "edge01" "edge02"; do
done

for cluster in "edge01" "edge02"; do
cluster_kubeconfig=$(k8s_get_capi_kubeconfig "$kubeconfig" "default" "regional")
cluster_kubeconfig=$(k8s_get_capi_kubeconfig "$kubeconfig" "default" "$cluster")
k8s_wait_exists "$cluster_kubeconfig" 600 "free5gc-upf" "deployment" "free5gc-upf"
k8s_wait_ready_replicas "$cluster_kubeconfig" 600 "free5gc-upf" "deployment" "free5gc-upf"
done