更改 ArgoCD 登录和导航栏图标

问题描述 投票:0回答:1

我使用的是 v2.4.3+471685f 版本,并且我对“argocd-cm”配置映射进行了更改,通过修改 my-styles.css 来更新 ArgoCD 图标,如下所示:

.my-styles.css: | 
   .nav-bar__logo img { 
      content: url(https://My-logo.png);
   }

但是,尽管尝试了以下链接中提到的所有方法,图标仍然没有改变:text 文字 文字

kubernetes continuous-deployment cicd continuous-delivery argocd
1个回答
0
投票

在 Argo CD v2.8.2+dbdfc71 中,我通过更改以下我的 argocd-styles-cm 配置图来使其工作:

img.sidebar__logo__character {
    width: 60px !important;
    content: url("https://user-images.githubusercontent.com/2389292/264784405-1e7e5902-d48f-440d-98f4-44028f4bd90e.png") !important;
}

我通过使用 Firefox 中的右键单击 + 检查工具并在那里进行测试,得到了确切的

img.sidebar__logo__character
字段。

更新此配置映射后,您可能需要重新加载 argocd 服务器 pod,因为配置映射和机密仅在启动时加载到 k8s pod 中。您可能还需要清除缓存和/或打开新选项卡。

我正在使用的完整配置图示例:

apiVersion: v1
kind: ConfigMap
metadata:
  name: argocd-styles-cm
  namespace: argocd
data:
  custom.styles.css: |
    .sidebar {
      background: linear-gradient(to bottom, #414868, #232336);
      color: #c0caf5;
      box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    }
    img.sidebar__logo__character {
       width: 60px !important;
       content: url("https://user-images.githubusercontent.com/2389292/264784405-1e7e5902-d48f-440d-98f4-44028f4bd90e.png") !important;
    }

这假设您还在

argocd-cm
中设置了 ui.cssurl:

---
apiVersion: v1
kind: ConfigMap
metadata:
  ...
  name: argocd-cm
data:
  ui.cssurl: "./custom/my-styles.css"

您还需要确保已在部署中安装该卷:

---
apiVersion: apps/v1
kind: Deployment
metadata:
  name: argocd-server
  ...
spec:
  template:
    ...
    spec:
      containers:
      - command:
        ...
        volumeMounts:
        ...
        - mountPath: /shared/app/custom
          name: styles
      ...
      volumes:
      ...
      - configMap:
          name: argocd-styles-cm
        name: styles

如果您使用 argocd helm 图表,则可以使用

configs.styles
参数,然后您无需进行部署卷挂载。

© www.soinside.com 2019 - 2024. All rights reserved.