Skip to content

Commit

Permalink
fix: uninstall anp failed and failed to upload agent cert to tenant
Browse files Browse the repository at this point in the history
Signed-off-by: wangdepeng <wangdepeng_yewu@cmss.chinamobile.com>
  • Loading branch information
village-way committed May 23, 2024
1 parent c6b3fc4 commit 653c1de
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions pkg/kubenest/tasks/anp.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ func NewAnpTask() workflow.Task {
Run: runAnp,
RunSubTasks: true,
Tasks: []workflow.Task{
{
Name: "deploy-anp-server",
Run: runAnpServer,
},
{
Name: "Upload-ProxyAgentCert",
Run: runUploadProxyAgentCert,
},
{
Name: "deploy-anp-server",
Run: runAnpServer,
},
{
Name: "deploy-anp-agent",
Run: runAnpAgent,
Expand Down Expand Up @@ -220,7 +220,9 @@ func getAnpAgentManifest(client clientset.Interface, name string, namespace stri
// get apiServer hostIp
proxyServerHost, err := getDeploymentPodIPs(client, namespace, fmt.Sprintf("%s-%s", name, "apiserver"))
if err != nil {
return "", nil, fmt.Errorf("error when get apiserver hostIp, err: %w", err)
klog.Warningf("Failed to get apiserver hostIp, err: %v", err)
// ignore if can't get the hostIp when uninstall the deployment
proxyServerHost = []string{"127.0.0.1"}
}

anpAgentManifeattBytes, err := util.ParseTemplate(apiserver.AnpAgentManifest, struct {
Expand Down Expand Up @@ -319,6 +321,7 @@ func runUploadProxyAgentCert(r workflow.RunData) error {
certList := data.CertList()
certsData := make(map[string][]byte, len(certList))
for _, c := range certList {
// only upload apisever cert
if strings.Contains(c.KeyName(), "apiserver") {
certsData[c.KeyName()] = c.KeyData()
certsData[c.CertName()] = c.CertData()
Expand Down

0 comments on commit 653c1de

Please sign in to comment.