小编see*_*cat的帖子

错误:选择器与模板标签不匹配

我的任务是向all deployments,添加一个名为“ app”的标签daemonsetscronjobs以便在监视工具中更轻松地查询整个堆栈中的应用。这样,我们可以构建使用单个选择器(即应用程序)的仪表板。

为了避免停机,我决定通过以下步骤解决此问题:

  1. 在开发,测试和舞台环境中添加标签。
  2. 将标签添加到产品环境中。
  3. 部署(1)
  4. 部署(2)
  5. 删除旧标签并更新开发者的服务以使用新标签。然后测试并部署。(目前正在执行此步骤
  6. 重复步骤(5)。
  7. 对产品重复(5)。

$ kubectl apply用于更新资源时,我已将“ app”标签添加到“ app”标签/将“ service”标签替换为“ app”标签,但遇到以下错误:

来自服务器的错误(无效):将补丁程序{{ longAssPatchWhichIWon'tIncludeButYaGetThePoint } 应用于以下错误:&{0xc421b02f00 0xc420803650默认设置清单/prod/provisioning-deployment.yaml 0xc 42000c6f8 3942200 false} for:“清单/要求。 yaml”:Deployment.apps“配置”无效:s pec.template.metadata.labels:无效值:map [string] string {“ app”:“配置”,“ component”:“ marketplace”}: selector不匹配模板labels

我需要一些为什么会引发此错误的见解。

yaml kubernetes

5
推荐指数
3
解决办法
6494
查看次数

为什么我的GoLang算法会进行无限循环?

我一直试图以多种方式解决下面的问题(递归地,使用Go-version of do while循环,并使用for循环).但是他们每个人都进入了一个无限循环.我尝试在JavaScript中使用相同的解决方案,它完全正常.有人可以帮助我理解为什么下面的解决方案无法正常工作/进行无限循环?

// Write a function that takes in a number and returns the next number that is divisible by 7
package main                   

func solution9(num int) int {  

        var done bool = false  
        var result int = 0     

        for i := 1; done != true; i++ { 
                if (num + i % 7 == 0) {         
                        result = num + i                
                        done = true                     
                }              
        }                      

        return result          
}
Run Code Online (Sandbox Code Playgroud)

algorithm go

1
推荐指数
1
解决办法
66
查看次数

无法在 time.AfterFunc 的参数中使用 func() 类型的(函数)

我不知道如何在不遇到几个嵌套函数问题的情况下解决这个 Go 算法问题。其中之一是,"cannot use func literal (type func()) as type func() string in return argument"

我现在正在使用的解决方案是:

// Write a function that takes in 2 numbers (a, b) and a function.
// It should execute the function after a milliseconds, 
// and then execute the function again after b milliseconds.

        package main

        import "time"                  

        func newFunc(b int, fn func() string) func() string {
                return func() {        
                        time.AfterFunc(time.Duration(b)*time.Second, fn)
                }
        } 

        func solution10(a, b int, fn func() string) string { …
Run Code Online (Sandbox Code Playgroud)

algorithm go

0
推荐指数
1
解决办法
2976
查看次数

标签 统计

algorithm ×2

go ×2

kubernetes ×1

yaml ×1