rubric/modules/devopsmodules/devops_registry.go

114 lines
3.8 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package devopsmodules
import (
"fmt"
"rubric/utils"
"strings"
)
type Module struct {
Key string
Aliases []string
Title string
Description string
Run func()
}
var All = []Module{
GitModule,
DockerModule,
KubernetesModule,
CicdModule,
AnsibleModule,
TerraformModule,
MonitoringModule,
NginxModule,
}
func Find(key string) (Module, bool) {
key = strings.ToLower(strings.TrimSpace(key))
for _, m := range All {
if m.Key == key {
return m, true
}
for _, a := range m.Aliases {
if a == key {
return m, true
}
}
}
return Module{}, false
}
func ListModules() {
fmt.Printf("\n%s%sРазделы справочника DevOps:%s\n\n",
utils.ColorBold, utils.ColorCyan, utils.ColorReset)
for i, m := range All {
fmt.Printf(" %s%d.%s %-14s — %s\n",
utils.ColorDim, i+1, utils.ColorReset,
utils.ColorYellow+utils.ColorBold+m.Key+utils.ColorReset,
m.Title,
)
}
fmt.Println()
}
// Keywords возвращает ключевые слова для поиска по модулю
func Keywords(key string) []string {
kw := map[string][]string{
"git": {
"git", "ветки", "branch", "merge", "rebase", "commit", "push", "pull",
"clone", "stash", "tag", "cherry-pick", "bisect", "gitflow", "GitHub",
"GitLab", "pull request", "PR", "конфликты", "conflicts", "remote",
"origin", "HEAD", "diff", "log", "blame", "workflow",
},
"docker": {
"docker", "контейнеры", "containers", "образы", "images", "Dockerfile",
"docker compose", "volumes", "тома", "networks", "сети", "registry",
"Hub", "GHCR", "ECR", "podman", "buildx", "multi-stage", "RUN", "CMD",
"ENTRYPOINT", "COPY", "FROM", "healthcheck",
},
"kubernetes": {
"kubernetes", "k8s", "kubectl", "Pod", "Deployment", "Service",
"Ingress", "ConfigMap", "Secret", "Namespace", "PVC", "PV",
"StatefulSet", "DaemonSet", "Job", "CronJob", "Helm", "chart",
"RBAC", "Role", "ClusterRole", "HPA", "autoscaling", "kube",
"node", "cluster", "контейнер", "оркестрация",
},
"cicd": {
"CI", "CD", "пайплайн", "pipeline", "GitHub Actions", "GitLab CI",
"Jenkins", "ArgoCD", "GitOps", "workflow", "job", "runner",
"артефакт", "artifact", "deploy", "деплой", "тесты", "автоматизация",
"continuous integration", "continuous delivery", "YAML",
},
"ansible": {
"ansible", "playbook", "inventory", "инвентарь", "роли", "roles",
"модули", "modules", "задачи", "tasks", "handlers", "шаблоны",
"templates", "Jinja2", "vault", "секреты", "agentless", "SSH",
"конфигурация", "автоматизация", "idempotent",
},
"terraform": {
"terraform", "IaC", "инфраструктура как код", "HCL", "провайдер",
"provider", "ресурс", "resource", "state", "план", "plan", "apply",
"destroy", "модуль", "module", "workspace", "backend", "S3",
"AWS", "GCP", "Azure", "переменные", "output",
},
"monitoring": {
"мониторинг", "Prometheus", "Grafana", "AlertManager", "Loki",
"метрики", "metrics", "алерты", "alerts", "PromQL", "LogQL",
"dashboard", "дашборд", "exporter", "node exporter", "Tempo",
"трассировка", "tracing", "observability", "наблюдаемость",
"SIEM", "логи", "scrape",
},
"nginx": {
"nginx", "веб-сервер", "reverse proxy", "балансировка", "load balancing",
"upstream", "virtual host", "server block", "SSL", "TLS", "HTTPS",
"Let's Encrypt", "certbot", "HAProxy", "rate limiting", "кэширование",
"cache", "gzip", "location", "proxy_pass", "CORS",
},
}
if v, ok := kw[key]; ok {
return v
}
return []string{}
}