小编Pet*_*ter的帖子

Kubernetes 未获得 Letsencrypt 证书

我已经安装了 microk8s、traefik 和 cert-manager。当我尝试接收 LetsEncrypt 证书时,会创建一个用于回答挑战的新 Pod,但来自 LetEnCryt 服务器的请求不会到达此 Pod。相反,请求会转发到为网站提供服务的 Pod。

看起来将流量路由到 Web Pod 的入口路由的优先级高于将请求路由/.well-known/acme-challenge/...到正确 Pod 的入口。我缺少什么?

kubectl edit clusterissuer letsencrypt-prod

kind: ClusterIssuer
metadata:
  annotations:
    kubectl.kubernetes.io/last-applied-configuration: |
      {"apiVersion":"cert-manager.io/v1","kind":"ClusterIssuer","metadata":{"annotations":{},"name":"letsencrypt-prod"},"spec":{"acme":{"email":"office@mydomain.com","privateKeySecretRef":{"name":"letsencrypt-prod"},"server":"https://acme-v02.api.letsencrypt.org/directory","solvers":[{"http01":{"ingress":{"class":"traefik"}}}]}}}
  creationTimestamp: "2022-07-11T14:32:15Z"
  generation: 11
  name: letsencrypt-prod
  resourceVersion: "49979842"
  uid: 40c4e26d-9c94-4cda-aa3a-357491bdb25a
spec:
  acme:
    email: office@mydomain.com
    preferredChain: ""
    privateKeySecretRef:
      name: letsencrypt-prod
    server: https://acme-v02.api.letsencrypt.org/directory
    solvers:
    - http01:
        ingress: {}
status:
  acme:
    lastRegisteredEmail: office@mydomain.com
    uri: https://acme-v02.api.letsencrypt.org/acme/acct/627190636
  conditions:
  - lastTransitionTime: "2022-07-11T14:32:17Z"
    message: The ACME account was registered with the ACME server
    observedGeneration: 11
    reason: …
Run Code Online (Sandbox Code Playgroud)

ssl kubernetes traefik cert-manager

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

mysql:撤销权限"如果存在"?

在脚本中,我想确保一个mysql用户在特定数据库上根本没有任何权限.所以我这样做:

revoke all privileges on `testdb`.* from 'testuser'@'%'
Run Code Online (Sandbox Code Playgroud)

但是如果用户对此数据库没有任何权限,我会收到此错误:

There is no such grant defined for user 'testuser' on host '%'
Run Code Online (Sandbox Code Playgroud)

什么是绝对正确的,但我的脚本现在抛出一个错误并停止.我不想让我的脚本忽略此语句中的所有错误.

所以有类似的东西

revoke all privileges if exist ...
Run Code Online (Sandbox Code Playgroud)

我在mysql手册中找不到任何相关内容.

mysql

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

Visual Studio 代码中的 PHP 8

我在 Ubuntu 上使用最新版本的 Visual Studio Code (1.52.1) 和 PHP Intelephense 1.5.4。尽管它是最新版本,但它似乎不知道新的 PHP 8 语法。例如,它在使用 nullsafe 运算符时显示错误:

$myobject?->myfunction();
Run Code Online (Sandbox Code Playgroud)

有没有办法教 VSC PHP 8 还是我们必须等待更新?

php visual-studio-code php-8 intelephense

4
推荐指数
2
解决办法
2643
查看次数

PHP缓存包含文件

我在test.php中有以下测试代码:

<?php
$step = $_GET['step'];
switch($step) {
  case 1:
    include 'foo.php';   # line 5
    file_put_contents('foo.php', '<?php print "bar\\n"; ?>');
    header('Location: test.php?step=2');
  break;
  case 2:
    print "step 2:\n";
    include 'foo.php';
  break;
}
?>
Run Code Online (Sandbox Code Playgroud)

foo.php最初有以下内容:

<?php print "foo\n"; ?>
Run Code Online (Sandbox Code Playgroud)

当我在浏览器中调用test.php?step = 1时,我希望得到以下输出:

step 2:
bar
Run Code Online (Sandbox Code Playgroud)

但我得到这个输出:

step 2:
foo
Run Code Online (Sandbox Code Playgroud)

当我在第5行注释掉include时,我得到了理想的结果.结论是,PHP缓存了foo.php的内容.当我用step = 2重新加载页面时,我也得到了所需的结果.

现在......为什么这样以及如何避免这种情况?

php caching

3
推荐指数
2
解决办法
3474
查看次数

"dim a"和"dim a,b"之间的区别

VBA的奇怪行为:

这会在第3行中出现错误94"非法使用Null":

Function test1()
  Dim a As String
  a = Null
  test1 = a
End Function
Run Code Online (Sandbox Code Playgroud)

但是......这很完美:

Function test1()
  Dim a, b As String
  a = Null
  test1 = a
End Function
Run Code Online (Sandbox Code Playgroud)

唯一的区别是第2行中的变量b,它从未使用过!WTF正在这里?

vba

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