Merge "Use kubectl create/replace rather than apply for gnp rules"

This commit is contained in:
Zuul 2024-06-06 16:38:54 +00:00 committed by Gerrit Code Review
commit ddd097fb67

View File

@ -1,7 +1,7 @@
#!/bin/bash #!/bin/bash
################################################################################ ################################################################################
# Copyright (c) 2023 Wind River Systems, Inc. # Copyright (c) 2023-2024 Wind River Systems, Inc.
# #
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
# #
@ -35,17 +35,23 @@ if [[ ${resource_exist} == "${resource_name}" ]]; then
log_it "Failed to remove last-applied-configuration annotation from ${gnp_name}" log_it "Failed to remove last-applied-configuration annotation from ${gnp_name}"
exit 1 exit 1
fi fi
fi kubectl --kubeconfig=${kubeconfig} replace -f ${file_name_gnp};
kubectl --kubeconfig=${kubeconfig} apply -f ${file_name_gnp}; if [ "$?" -ne 0 ]; then
if [ "$?" -ne 0 ]; then log_it "Failed to replace ${gnp_name} with ${file_name_gnp}"
log_it "Failed to apply ${gnp_name} with ${file_name_gnp}" exit 1
exit 1
else
log_it "Successfully applied ${gnp_name} with ${file_name_gnp}"
if [ -f /etc/platform/.platform_firewall_config_required ]; then
log_it "remove flag platform_firewall_config_required"
rm -fv /etc/platform/.platform_firewall_config_required
fi fi
else
kubectl --kubeconfig=${kubeconfig} create -f ${file_name_gnp};
if [ "$?" -ne 0 ]; then
log_it "Failed to create ${gnp_name} with ${file_name_gnp}"
exit 1
fi
fi
log_it "Successfully applied ${gnp_name} with ${file_name_gnp}"
if [ -f /etc/platform/.platform_firewall_config_required ]; then
log_it "remove flag platform_firewall_config_required"
rm -fv /etc/platform/.platform_firewall_config_required
fi fi
else else
log_it "Failed to check ${resource_name} exists, mark for sysinv to reapply" log_it "Failed to check ${resource_name} exists, mark for sysinv to reapply"