feat(spegel): BREAKING CHANGE move to custom spegel chart (#28077)

**Description**
Add our own Spegel chart

**⚙️ Type of change**

- [x] ⚙️ Feature/App addition
- [ ] 🪛 Bugfix
- [x] ⚠️ Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] 🔃 Refactor of current code

**🧪 How Has This Been Tested?**
<!--
Please describe the tests that you ran to verify your changes. Provide
instructions so we can reproduce. Please also list any relevant details
for your test configuration
-->

**📃 Notes:**
<!-- Please enter any other relevant information here -->

**✔️ Checklist:**

- [ ] ⚖️ My code follows the style guidelines of this project
- [ ] 👀 I have performed a self-review of my own code
- [ ] #️⃣ I have commented my code, particularly in hard-to-understand
areas
- [ ] 📄 I have made corresponding changes to the documentation
- [ ] ⚠️ My changes generate no new warnings
- [ ] 🧪 I have added tests to this description that prove my fix is
effective or that my feature works
- [ ] ⬆️ I increased versions for any altered app according to semantic
versioning
- [ ] I made sure the title starts with `feat(chart-name):`,
`fix(chart-name):` or `chore(chart-name):`

** App addition**

If this PR is an app addition please make sure you have done the
following.

- [ ] 🖼️ I have added an icon in the Chart's root directory called
`icon.png`

---

_Please don't blindly check all the boxes. Read them and only check
those that apply.
Those checkboxes are there for the reviewer to see what is this all
about and
the status of this PR with a quick glance._
This commit is contained in:
Kjeld Schouten
2024-10-20 17:08:32 +02:00
committed by GitHub
parent e19713feba
commit 0c4009680c
17 changed files with 1879 additions and 83 deletions
+12 -12
View File
@@ -93,7 +93,7 @@ jobs:
- name: Fix Pre-Commit issues
shell: bash
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
run: |
echo "Running pre-commit test-and-cleanup..."
pre-commit run --all ||:
@@ -101,7 +101,7 @@ jobs:
find . -name '*.sh' | xargs chmod +x
- name: Install Helm
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
uses: azure/setup-helm@5119fcb9089d432beecbf79bb2c7915207344b78 # tag=v3
with:
version: v3.14.0
@@ -145,7 +145,7 @@ jobs:
run: helm registry logout quay.io
- name: Copy docs to website
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
shell: bash
run: |
#!/bin/bash
@@ -196,7 +196,7 @@ jobs:
- name: Prefetch contributor icons
shell: bash
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
run: |
#!/bin/bash
@@ -221,7 +221,7 @@ jobs:
#done < src/assets/contributors.json
- name: Setup astro Cache
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
with:
# Cache for build and optimized images.
@@ -230,7 +230,7 @@ jobs:
restore-keys: astro-
- name: Setup npm Cache
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
with:
# Cache for npm
@@ -240,7 +240,7 @@ jobs:
- name: Setup node_modules Cache
id: modulescache
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
uses: actions/cache@3624ceb22c1c5a301c8db4169662070a689d9ea8 # v4
with:
# Cache for npm and optimized images.
@@ -254,19 +254,19 @@ jobs:
node-version-file: ./website/.nvmrc
- name: Install Packages
if: steps.modulescache.outputs.cache-hit != 'true' && needs.check_changes.outputs.changes_detected == 'true'
if: steps.modulescache.outputs.cache-hit != 'true' && needs.check_changes.outputs.changes_detected == 'true'
run: cd website && npm ci
- name: Check
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
run: cd website && npm run check
- name: Build
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
run: cd website && npm run build
- name: Publish to Cloudflare Pages
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
id: cloudflare
continue-on-error: true
uses: cloudflare/pages-action@f0a1cd58cd66095dee69bfa18fa5efd1dde93bca # v1
@@ -299,5 +299,5 @@ jobs:
---
- name: Release-and-Website Completed
if: needs.check_changes.outputs.changes_detected == 'true'
if: needs.check_changes.outputs.changes_detected == 'true'
run: echo "DONE"
+79
View File
@@ -151,6 +151,19 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
- name: Update containerd config
if: contains(matrix.chart, 'Spegel')
run: |
sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
disable_snapshot_annotations = true
discard_unpacked_layers = false
EOL
- name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1
with:
@@ -210,6 +223,19 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
- name: Update containerd config
if: contains(matrix.chart, 'Spegel')
run: |
sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
disable_snapshot_annotations = true
discard_unpacked_layers = false
EOL
- name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1
with:
@@ -269,6 +295,19 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
- name: Update containerd config
if: contains(matrix.chart, 'Spegel')
run: |
sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
disable_snapshot_annotations = true
discard_unpacked_layers = false
EOL
- name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1
with:
@@ -328,6 +367,19 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
- name: Update containerd config
if: contains(matrix.chart, 'Spegel')
run: |
sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
disable_snapshot_annotations = true
discard_unpacked_layers = false
EOL
- name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1
with:
@@ -387,6 +439,20 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
- name: Update containerd config
if: contains(matrix.chart, 'Spegel')
run: |
sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/certs.d/
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
disable_snapshot_annotations = true
discard_unpacked_layers = false
EOL
- name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1
with:
@@ -446,6 +512,19 @@ jobs:
- name: Set up chart-testing
uses: helm/chart-testing-action@e6669bcd63d7cb57cb4380c33043eebe5d111992 # v2.6.1
- name: Update containerd config
if: contains(matrix.chart, 'Spegel')
run: |
sudo mkdir -p /var/lib/rancher/k3s/agent/etc/containerd/
sudo tee /var/lib/rancher/k3s/agent/etc/containerd/config.toml.tmpl > /dev/null <<EOL
[plugins."io.containerd.grpc.v1.cri".registry]
config_path = "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
[plugins."io.containerd.grpc.v1.cri".containerd]
snapshotter = "overlayfs"
disable_snapshot_annotations = true
discard_unpacked_layers = false
EOL
- name: Create k3d cluster
uses: nolar/setup-k3d-k3s@v1
with:
+2 -3
View File
@@ -36,9 +36,8 @@ repos:
exclude: ^archive/
- id: check-added-large-files # prevents giant files from being committed.
exclude: \.(png|jpg|jpeg|svg|yaml|yml|tpl)$
# Broken https://github.com/pre-commit/pre-commit-hooks/issues/1101
# - id: check-yaml # checks yaml files for parseable syntax.
# exclude: (^archive|^website\/public|templates\/.*|crds\/.*|questions.yaml|chart_schema.yaml|test-chart\/.*\.yaml|^clustertool)
- id: check-yaml # checks yaml files for parseable syntax.
exclude: (^archive|^website\/public|templates\/.*|crds\/.*|questions.yaml|chart_schema.yaml|common-test\/.*\.yaml|^clustertool)
- id: detect-private-key # detects the presence of private keys.
exclude: ^archive/
+32
View File
@@ -0,0 +1,32 @@
# Patterns to ignore when building packages.
# This supports shell glob matching, relative path matching, and
# negation (prefixed with !). Only one pattern per line.
.DS_Store
# Common VCS dirs
.git/
.gitignore
.bzr/
.bzrignore
.hg/
.hgignore
.svn/
# Common backup files
*.swp
*.bak
*.tmp
*~
# Various IDEs
.project
.idea/
*.tmproj
.vscode/
# OWNERS file for Kubernetes
OWNERS
# helm-docs templates
*.gotmpl
# docs folder
/docs
# icon
icon.png
icon.webp
icon-small.webp
+33
View File
@@ -0,0 +1,33 @@
annotations:
max_scale_version: 24.04.1
min_scale_version: 24.04.0
truecharts.org/category: incubator
truecharts.org/max_helm_version: "3.15"
truecharts.org/min_helm_version: "3.11"
truecharts.org/train: system
apiVersion: v2
appVersion: 0.31.1
dependencies:
- name: common
version: 25.1.0
repository: oci://tccr.io/truecharts
condition: ""
alias: ""
tags: []
import-values: []
deprecated: false
description: Stateless cluster local OCI registry mirror.
home: https://truecharts.org/charts/system/spegel
icon: https://truecharts.org/img/hotlink-ok/chart-icons/spegel.webp
keywords:
- spegel
kubeVersion: '>=1.24.0-0'
maintainers:
- name: TrueCharts
email: info@truecharts.org
url: https://truecharts.org
name: spegel
sources:
- https://github.com/truecharts/charts/tree/master/charts/system/spegel
type: application
version: 2.0.0
+61
View File
@@ -0,0 +1,61 @@
---
title: README
---
## General Info
TrueCharts can be installed as both _normal_ Helm Charts or as TrueNAS SCALE Apps.
Both solutions are fully supported, but we heavily advice the use of normal Helm Charts where possible
For more information about this Chart, please check the docs on the TrueCharts [website](https://truecharts.org/charts/system/spegel)
**This chart is not maintained by the upstream project and any issues with the chart should be raised [here](https://github.com/truecharts/charts/issues/new/choose)**
## Installation
### Helm-Chart installation
To install TrueCharts Helm charts using Helm, you can use our OCI Repository.
`helm install mychart oci://tccr.io/truecharts/spegel`
For more information on how to install TrueCharts Helm charts, checkout the [instructions on the website](/guides)
### TrueNAS SCALE Apps
For more information on how to use TrueCharts as TrueNAS SCALE Apps, please checkout the [quick-start guides for TrueNAS SCALE](/deprecated/scale).
## Chart Specific Guides and information
All our charts have dedicated documentation pages.
The documentation for this chart can be found here:
https://truecharts.org/charts/system/spegel
## Configuration Options
Please note: For TrueNAS SCALE, only options available in the GUI are supported.
Hence most of these docs do not apply to TrueNAS SCALE
To view the chart specific options, please view Values.yaml included in the chart.
The most recent version of which, is available here: https://github.com/truecharts/public/blob/master/charts/system/spegel/values.yaml
All our Charts use a shared "common" library chart that contains most of the templating and options.
For the complete overview of all available options, please checkout the documentation for them on the [common docs on our website](/common)
For information about the common chart and all defaults included with it, please review its values.yaml file available here: https://github.com/truecharts/public/blob/master/charts/library/common/values.yaml
## Support
- See the [Website](https://truecharts.org)
- Check our [Discord](https://discord.gg/tVsPTHWTtr)
- Open a [issue](https://github.com/truecharts/charts/issues/new/choose)
---
## Sponsor TrueCharts
TrueCharts can only exist due to the incredible effort of our staff.
Please consider making a [donation](/general/sponsor) or contributing back to the project any way you can!
_All Rights Reserved - The TrueCharts Project_
@@ -0,0 +1,9 @@
spegel:
# -- Minimum log level to output. Value should be DEBUG, INFO, WARN, or ERROR.
logLevel: "INFO"
# -- Path to Containerd socket.
containerdSock: "/run/k3s/containerd/containerd.sock"
# -- Path to Containerd mirror configuration.
containerdRegistryConfigPath: "/var/lib/rancher/k3s/agent/etc/containerd/certs.d"
# -- Path to Containerd content store..
containerdContentPath: "/var/lib/containerd/io.containerd.content.v1.content"
File diff suppressed because it is too large Load Diff
Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

@@ -0,0 +1 @@
{{- include "tc.v1.common.lib.chart.notes" $ -}}
@@ -0,0 +1,54 @@
{{/* Define the args */}}
{{- define "spegel.args.init" -}}
args:
- configuration
- --log-level={{ .Values.spegel.logLevel }}
- --containerd-registry-config-path={{ .Values.spegel.containerdRegistryConfigPath }}
{{- with .Values.spegel.registries }}
- --registries
{{- range . }}
- {{ . | quote }}
{{- end }}
{{- end }}
- --mirror-registries
- http://$(NODE_IP):{{ .Values.service.main.ports.main.hostPort }}
- http://$(NODE_IP):{{ .Values.service.main.ports.main.nodePort }}
- http://$(NODE_IP):{{ .Values.service.main.ports.main.port }}
{{- with .Values.spegel.additionalMirrorRegistries }}
{{- range . }}
- {{ . | quote }}
{{- end }}
{{- end }}
- --resolve-tags={{ .Values.spegel.resolveTags }}
- --append-mirrors={{ .Values.spegel.appendMirrors }}
{{- end -}}
{{- define "spegel.args.main" -}}
args:
- registry
- --log-level={{ .Values.spegel.logLevel }}
- --mirror-resolve-retries={{ .Values.spegel.mirrorResolveRetries }}
- --mirror-resolve-timeout={{ .Values.spegel.mirrorResolveTimeout }}
- --registry-addr=:{{ .Values.service.main.ports.main.port }}
- --router-addr=:{{ .Values.service.router.ports.router.port }}
- --metrics-addr=:{{ .Values.service.metrics.ports.metrics.port}}
{{- with .Values.spegel.registries }}
- --registries
{{- range . }}
- {{ . | quote }}
{{- end }}
{{- end }}
- --containerd-sock={{ .Values.spegel.containerdSock }}
- --containerd-namespace={{ .Values.spegel.containerdNamespace }}
- --containerd-registry-config-path={{ .Values.spegel.containerdRegistryConfigPath }}
- --bootstrap-kind=kubernetes
{{- with .Values.spegel.kubeconfigPath }}
- --kubeconfig-path={{ . }}
{{- end }}
- '--leader-election-namespace={{ include "tc.v1.common.lib.metadata.namespace" (dict "rootCtx" $ "objectData" $.Values.workload.main.podSpec.containers.main "caller" "Deployment") }}'
- --leader-election-name={{ .Release.Name }}-leader-election
- --resolve-latest-tag={{ .Values.spegel.resolveLatestTag }}
- --local-addr=$(NODE_IP):{{ .Values.service.main.ports.main.hostPort }}
{{- with .Values.spegel.containerdContentPath }}
- --containerd-content-path={{ . }}
{{- end }}
{{- end -}}
@@ -0,0 +1,13 @@
{{/* Make sure all variables are set properly */}}
{{- include "tc.v1.common.loader.init" . }}
{{- $newArgsInit := (include "spegel.args.init" . | fromYaml) }}
{{- $_ := set .Values "newArgsInit" $newArgsInit -}}
{{- $mergedargsInit := concat $.Values.workload.main.podSpec.initContainers.configuration.args .Values.newArgsInit.args }}
{{- $_ := set $.Values.workload.main.podSpec.initContainers.configuration "args" $mergedargsInit -}}
{{- $newArgs := (include "spegel.args.main" . | fromYaml) }}
{{- $_ := set .Values "newArgs" $newArgs -}}
{{- $mergedargs := concat $.Values.workload.main.podSpec.containers.main.args .Values.newArgs.args }}
{{- $_ := set $.Values.workload.main.podSpec.containers.main "args" $mergedargs -}}
{{- include "tc.v1.common.loader.apply" . }}
+175
View File
@@ -0,0 +1,175 @@
image:
repository: ghcr.io/spegel-org/spegel
pullPolicy: IfNotPresent
tag: v0.0.27
securityContext:
container:
runAsUser: 0
runAsGroup: 0
readOnlyRootFilesystem: false
pod:
fsGroup: 0
service:
main:
ports:
main:
port: 5000
targetPort: 5000
hostPort: 30020
nodePort: 30021
router:
enabled: true
ports:
router:
enabled: true
port: 5001
targetPort: 5001
metrics:
enabled: true
ports:
metrics:
enabled: true
port: 9090
targetPort: 9090
workload:
main:
podSpec:
type: DaemonSet
initContainers:
configuration:
enabled: true
type: init
args: []
env:
NODE_IP:
fieldRef:
fieldPath: status.hostIP
containers:
main:
args: []
env:
NODE_IP:
fieldRef:
fieldPath: status.hostIP
probes:
liveness:
path: /healthz
readiness:
path: /healthz
startup:
path: /healthz
configmap:
dashboard:
enabled: true
labels:
grafana_dashboard: "1"
data:
traefik.json: >-
{{ .Files.Get "dashboard.json" | indent 8 }}
podOptions:
automountServiceAccountToken: true
priorityClassName: "system-node-critical"
nodeSelector:
kubernetes.io/arch: ""
tolerations:
- key: CriticalAddonsOnly
operator: Exists
- effect: NoExecute
operator: Exists
- effect: NoSchedule
operator: Exists
metrics:
main:
enabled: true
type: servicemonitor
endpoints:
- port: metrics
targetSelector: metrics
portal:
open:
enabled: false
persistence:
containerd-sock:
enabled: true
type: hostPath
mountPath: "{{ .Values.spegel.containerdSock }}"
hostPath: "{{ .Values.spegel.containerdSock }}"
hostPathType: Socket
containerd-content:
enabled: "{{ if .Values.spegel.containerdContentPath }}true{{else}}false{{end}}}}"
type: hostPath
mountPath: "{{ .Values.spegel.containerdContentPath }}"
hostPath: "{{ .Values.spegel.containerdContentPath }}"
hostPathType: Directory
readOnly: true
containerd-config:
enabled: "{{ if .Values.spegel.containerdMirrorAdd }}true{{else}}false{{end}}}}"
type: hostPath
mountPath: "{{ .Values.spegel.containerdRegistryConfigPath }}"
hostPath: "{{ .Values.spegel.containerdRegistryConfigPath }}"
hostPathType: DirectoryOrCreate
spegel:
# -- Minimum log level to output. Value should be DEBUG, INFO, WARN, or ERROR.
logLevel: "INFO"
# -- Registries for which mirror configuration will be created.
registries:
- https://cgr.dev
- https://docker.io
- https://ghcr.io
- https://quay.io
- https://mcr.microsoft.com
- https://public.ecr.aws
- https://gcr.io
- https://registry.k8s.io
- https://k8s.gcr.io
- https://tccr.io
- https://factory.talos.dev
# -- Additional target mirror registries other than Spegel.
additionalMirrorRegistries: []
# -- Max ammount of mirrors to attempt.
mirrorResolveRetries: 3
# -- Max duration spent finding a mirror.
mirrorResolveTimeout: "20ms"
# -- Path to Containerd socket.
containerdSock: "/run/containerd/containerd.sock"
# -- Containerd namespace where images are stored.
containerdNamespace: "k8s.io"
# -- Path to Containerd mirror configuration.
containerdRegistryConfigPath: "/etc/cri/conf.d/hosts"
# -- Path to Containerd content store..
containerdContentPath: "/var/lib/containerd/io.containerd.content.v1.content"
# -- If true Spegel will add mirror configuration to the node.
containerdMirrorAdd: true
# -- Path to Kubeconfig credentials, should only be set if Spegel is run in an environment without RBAC.
kubeconfigPath: ""
# -- When true Spegel will resolve tags to digests.
resolveTags: true
# -- When true latest tags will be resolved to digests.
resolveLatestTag: true
# -- When true existing mirror configuration will be appended to instead of replaced.
appendMirrors: false
# -- Whether Role Based Access Control objects like roles and rolebindings should be created
rbac:
main:
enabled: true
primary: true
clusterWide: true
rules:
- apiGroups: ["coordination.k8s.io"]
resources: ["leases"]
verbs: ["get", "list", "watch", "create", "update"]
# -- The service account the pods will use to interact with the Kubernetes API
serviceAccount:
main:
enabled: true
primary: true
@@ -7,8 +7,10 @@ MASTER1IP: 192.168.20.210
GATEWAY: 192.168.20.1
# Defines the ip range metallb is allowed to use
METALLB_RANGE: 192.168.20.211-192.168.20.219
# Sets the IP on which Spegel using loadbalancer is made available
SPEGEL_IP: 192.168.20.211
# Sets the Kubernetes Dashboard IP. Has to be within METALLB_RANGE and not in use
DASHBOARD_IP: 192.168.20.211
DASHBOARD_IP: 192.168.20.212
# Used to automatically generate a sshkey-pair for FluxCD
# Has to start with ssh://
GITHUB_REPOSITORY: ""
@@ -10,10 +10,10 @@ spec:
chart:
spec:
chart: spegel
version: v0.0.27
version: 2.0.0
sourceRef:
kind: HelmRepository
name: spegel
name: truecharts
namespace: flux-system
install:
remediation:
@@ -24,26 +24,7 @@ spec:
strategy: rollback
retries: 3
values:
grafanaDashboard:
enabled: true
serviceMonitor:
enabled: false
spegel:
containerdSock: /run/containerd/containerd.sock
containerdRegistryConfigPath: /etc/cri/conf.d/hosts
appendMirrors: true
registries:
- https://tccr.io
- https://cgr.dev
- https://docker.io
- https://ghcr.io
- https://quay.io
- https://mcr.microsoft.com
- https://public.ecr.aws
- https://gcr.io
- https://registry.k8s.io
- https://k8s.gcr.io
- https://lscr.io
service:
registry:
hostPort: 29999
main:
type: LoadBalancer
loadBalancerIP: ${SPEGEL_IP}
+1 -1
View File
@@ -28,7 +28,7 @@ func LoadTalEnv() error {
clusterName()
PostProcessTalEnv()
clusterEnvtoEnv()
log.Info().Msgf("ClusterEnv loaded successfully\n", )
log.Info().Msgf("ClusterEnv loaded successfully\n")
return nil
}
+119 -42
View File
@@ -274,49 +274,9 @@ func GenPatches() error {
log.Fatal().Err(err).Msg("Error: %s")
}
// Assuming this is part of your function
if helper.TalEnv["DOCKERHUB_USER"] != "" && helper.TalEnv["DOCKERHUB_PASSWORD"] != "" {
// Prepare the content to append
configContent := fmt.Sprintf(`# Add Dockerhub Login
- operation: replace
path: /machine/registries/config/registry-1.docker.io
value:
auth:
username: %s
password: %s
- operation: replace
path: /machine/registries/config/docker.io
value:
auth:
username: %s
password: %s
`, helper.TalEnv["DOCKERHUB_USER"], helper.TalEnv["DOCKERHUB_PASSWORD"], helper.TalEnv["DOCKERHUB_USER"], helper.TalEnv["DOCKERHUB_PASSWORD"])
setDocker()
// Open the file in append mode or create it if it doesn't exist
file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Fatal().Err(err).Msg("Error opening file: %s")
}
defer file.Close()
// Write the content to the file
if _, err := file.Write([]byte(configContent)); err != nil {
log.Fatal().Err(err).Msg("Error writing to file: %s")
}
} else {
// Optional: Append a note if the environment variables are not set
emptyContent := `# No DockerHub credentials provided
`
file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Fatal().Err(err).Msg("Error opening file: %s")
}
defer file.Close()
if _, err := file.Write([]byte(emptyContent)); err != nil {
log.Fatal().Err(err).Msg("Error writing to file: %s")
}
}
setSpegel()
// Read the content of the talenv.yaml file
talenvContent, err := os.ReadFile(helper.ClusterPath + "/clusterenv.yaml")
@@ -344,6 +304,123 @@ func GenPatches() error {
return nil
}
func setDocker() {
// Assuming this is part of your function
if helper.TalEnv["DOCKERHUB_USER"] != "" && helper.TalEnv["DOCKERHUB_PASSWORD"] != "" {
// Prepare the content to append
configContent := fmt.Sprintf(`# Add Dockerhub Login
- operation: replace
path: /machine/registries/config/registry-1.docker.io
value:
auth:
username: %s
password: %s
- operation: replace
path: /machine/registries/config/docker.io
value:
auth:
username: %s
password: %s
`, helper.TalEnv["DOCKERHUB_USER"], helper.TalEnv["DOCKERHUB_PASSWORD"], helper.TalEnv["DOCKERHUB_USER"], helper.TalEnv["DOCKERHUB_PASSWORD"])
// Open the file in append mode or create it if it doesn't exist
file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Fatal().Err(err).Msg("Error opening file: %s")
}
defer file.Close()
// Write the content to the file
if _, err := file.Write([]byte(configContent)); err != nil {
log.Fatal().Err(err).Msg("Error writing to file: %s")
}
} else {
// Optional: Append a note if the environment variables are not set
emptyContent := `# No DockerHub credentials provided
`
file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Fatal().Err(err).Msg("Error opening file: %s")
}
defer file.Close()
if _, err := file.Write([]byte(emptyContent)); err != nil {
log.Fatal().Err(err).Msg("Error writing to file: %s")
}
}
}
func setSpegel() {
// Assuming this is part of your function
if helper.TalEnv["SPEGEL_IP"] != "" && helper.TalEnv["SPEGEL_IP"] != "" {
// Prepare the content to append
configContent := fmt.Sprintf(`# Add Dockerhub Login
- operation: replace
path: /machine/registries/mirrors/
value:
cgr.dev:
endpoints:
- http://%s:5000
docker.io:
endpoints:
- http://%s:5000
ghcr.io:
endpoints:
- http://%s:5000
quay.io:
endpoints:
- http://%s:5000
mcr.microsoft.com:
endpoints:
- http://%s:5000
public.ecr.aws:
endpoints:
- http://%s:5000
gcr.io:
endpoints:
- http://%s:5000
registry.k8s.io:
endpoints:
- http://%s:5000
k8s.gcr.io:
endpoints:
- http://%s:5000
tccr.io:
endpoints:
- http://%s:5000
factory.talos.dev:
endpoints:
- http://%s:5000
`, helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"], helper.TalEnv["SPEGEL_IP"])
// Open the file in append mode or create it if it doesn't exist
file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Fatal().Err(err).Msg("Error opening file: %s")
}
defer file.Close()
// Write the content to the file
if _, err := file.Write([]byte(configContent)); err != nil {
log.Fatal().Err(err).Msg("Error writing to file: %s")
}
} else {
// Optional: Append a note if the environment variables are not set
emptyContent := `# No Spegel_IP provided
`
file, err := os.OpenFile(filepath.Join(helper.ClusterPath+"/talos/patches", "all.yaml"), os.O_APPEND|os.O_CREATE|os.O_WRONLY, 0644)
if err != nil {
log.Fatal().Err(err).Msg("Error opening file: %s")
}
defer file.Close()
if _, err := file.Write([]byte(emptyContent)); err != nil {
log.Fatal().Err(err).Msg("Error writing to file: %s")
}
}
}
func ageGen() error {
outFlag := "age.agekey"