mirror of
https://github.com/tailscale/tailscale.git
synced 2025-01-09 09:33:42 +00:00
cmd/containerboot: don't attempt to patch a Secret field without permissions (#14365)
Signed-off-by: Irbe Krumina <irbe@tailscale.com>
This commit is contained in:
parent
f1ccdcc713
commit
6e552f66a0
@ -24,6 +24,7 @@ import (
|
|||||||
type kubeClient struct {
|
type kubeClient struct {
|
||||||
kubeclient.Client
|
kubeclient.Client
|
||||||
stateSecret string
|
stateSecret string
|
||||||
|
canPatch bool // whether the client has permissions to patch Kubernetes Secrets
|
||||||
}
|
}
|
||||||
|
|
||||||
func newKubeClient(root string, stateSecret string) (*kubeClient, error) {
|
func newKubeClient(root string, stateSecret string) (*kubeClient, error) {
|
||||||
|
@ -72,7 +72,7 @@ func watchServeConfigChanges(ctx context.Context, path string, cdChanged <-chan
|
|||||||
if err := updateServeConfig(ctx, sc, certDomain, lc); err != nil {
|
if err := updateServeConfig(ctx, sc, certDomain, lc); err != nil {
|
||||||
log.Fatalf("serve proxy: error updating serve config: %v", err)
|
log.Fatalf("serve proxy: error updating serve config: %v", err)
|
||||||
}
|
}
|
||||||
if kc != nil {
|
if kc != nil && kc.canPatch {
|
||||||
if err := kc.storeHTTPSEndpoint(ctx, certDomain); err != nil {
|
if err := kc.storeHTTPSEndpoint(ctx, certDomain); err != nil {
|
||||||
log.Fatalf("serve proxy: error storing HTTPS endpoint: %v", err)
|
log.Fatalf("serve proxy: error storing HTTPS endpoint: %v", err)
|
||||||
}
|
}
|
||||||
|
@ -217,6 +217,7 @@ func (cfg *settings) setupKube(ctx context.Context, kc *kubeClient) error {
|
|||||||
return fmt.Errorf("some Kubernetes permissions are missing, please check your RBAC configuration: %v", err)
|
return fmt.Errorf("some Kubernetes permissions are missing, please check your RBAC configuration: %v", err)
|
||||||
}
|
}
|
||||||
cfg.KubernetesCanPatch = canPatch
|
cfg.KubernetesCanPatch = canPatch
|
||||||
|
kc.canPatch = canPatch
|
||||||
|
|
||||||
s, err := kc.GetSecret(ctx, cfg.KubeSecret)
|
s, err := kc.GetSecret(ctx, cfg.KubeSecret)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user