Skip to content

Commit 0499f4c

Browse files
authored
Fix DP installation scripts for custom NP controller (#68)
<!-- Thanks for sending a pull request! Here are some tips for you: 1. Ensure you have added the unit tests for your changes. 2. Ensure you have included output of manual testing done in the Testing section. 3. Ensure number of lines of code for new or existing methods are within the reasonable limit. 4. Ensure your change works on existing clusters after upgrade. --> **What type of PR is this?** scripts fix <!-- Add one of the following: bug cleanup documentation feature --> **Which issue does this PR fix**: Fixes an issues with DP installation scripts when passing a custom controller image **What does this PR do / Why do we need it**: Fixes the installation scripts, so that a developer can use either - `make deploy-controller-on-dataplane AMAZON_NP_CONTROLLER=<image-uri>` - Deploy the controller on dataplane `make deploy-and-test AMAZON_NP_CONTROLLER=<image-uri> CLUSTER_NAME=<cluster_name>` - Deploy the controller on dataplane, disable the controller on control-plane and runs cyclonus test **If an issue # is not available please add steps to reproduce and the controller logs**: N/A **Testing done on this change**: Yes, locally tested the script changes <!-- output of manual testing/integration tests results and also attach logs showing the fix being resolved --> **Automation added to e2e**: N/A <!-- List the e2e tests you added as part of this PR. If no, create an issue with enhancement/testing label --> **Will this PR introduce any new dependencies?**: N/A <!-- e.g. new K8s API --> **Will this break upgrades or downgrades. Has updating a running cluster been tested?**: N/A **Does this PR introduce any user-facing change?**: N/A <!-- If yes, a release note update is required: Enter your extended release note in the block below. If the PR requires additional actions from users switching to the new release, include the string "action required". --> By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
2 parents b2055b4 + e0e8a7d commit 0499f4c

File tree

3 files changed

+9
-9
lines changed

3 files changed

+9
-9
lines changed

scripts/lib/network-policy.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -87,11 +87,11 @@ function install_network_policy_helm(){
8787
fi
8888

8989
echo "Updating annotations and labels on existing resources"
90-
for kind in daemonSet clusterRole clusterRoleBinding serviceAccount; do
91-
echo "setting annotations and labels on $kind/aws-node"
92-
kubectl -n kube-system annotate --overwrite $kind aws-node meta.helm.sh/release-name=aws-vpc-cni || echo "Unable to annotate $kind/aws-node"
93-
kubectl -n kube-system annotate --overwrite $kind aws-node meta.helm.sh/release-namespace=kube-system || echo "Unable to annotate $kind/aws-node"
94-
kubectl -n kube-system label --overwrite $kind aws-node app.kubernetes.io/managed-by=Helm || echo "Unable to label $kind/aws-node"
90+
resources=("daemonSet/aws-node" "clusterRole/aws-node" "clusterRoleBinding/aws-node" "serviceAccount/aws-node" "configmap/amazon-vpc-cni")
91+
for kind in ${resources[@]}; do
92+
echo "setting annotations and labels on $kind"
93+
kubectl -n kube-system annotate --overwrite $kind meta.helm.sh/release-name=aws-vpc-cni meta.helm.sh/release-namespace=kube-system || echo "Unable to annotate $kind"
94+
kubectl -n kube-system label --overwrite $kind app.kubernetes.io/managed-by=Helm || echo "Unable to label $kind"
9595
done
9696

9797
echo "Installing/Updating the aws-vpc-cni helm chart with enableNetworkPolicy=true"

scripts/lib/verify_test_results.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ def verify_results(file_name,ip_family):
1515
# expected_results maintains a mapping of the test number and the number of sub-tests that are expected to pass for v4/v6 clusters
1616
# For the test numbers not included in this map, it is expected that all the sub-tests should be passing
1717
if ip_family == "IPv6":
18-
expected_results={ 2:80, 3:80, 8:80, 12:80, 23:80, 25:80, 26:80, 28:80,29:80, 31:77, 98:80, 102:72, 104:72, 106:72, 108:72, 111:80, 112:80 }
18+
expected_results={ 2:80, 3:80, 8:80, 12:64, 23:80, 25:80, 26:80, 28:80, 29:80, 31:50, 98:80, 102:72, 104:72, 106:72, 108:72, 111:80, 112:80 }
1919
else:
20-
expected_results={ 2:80, 3:80, 8:80, 12:80, 23:80, 25:80, 26:80, 28:80, 29:80, 31:80, 98:80, 111:80, 112:80 }
20+
expected_results={ 2:80, 3:80, 8:80, 12:80, 23:80, 25:80, 26:80, 28:80, 29:80, 31:50, 98:80, 111:80, 112:80 }
2121

2222
start="starting test case"
2323
wrong="wrong"

scripts/update-controller-image-dataplane.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
# Parameters:
55
# KUBECONFIG: path to the kubeconfig file, default ~/.kube/config
6-
# AMAZON_NP_CONTROLLER: node agent image
6+
# AMAZON_NP_CONTROLLER: Custom network policy controller image
77

88
set -e
99
DIR=$(cd "$(dirname "$0")"; pwd)
@@ -13,7 +13,7 @@ kubectl apply -k config/default
1313

1414
if [[ ! -z $AMAZON_NP_CONTROLLER ]];then
1515
echo "Setting the Controller Image: $AMAZON_NP_CONTROLLER"
16-
kubectl set image deployment.v1.apps/amazon-network-policy-controller-k8s controller=$AMAZON_NP_CONTROLLER
16+
kubectl set image -n kube-system deployment.v1.apps/amazon-network-policy-controller-k8s controller=$AMAZON_NP_CONTROLLER
1717
fi
1818

1919
echo "Restarting the Controller"

0 commit comments

Comments
 (0)