package coredns import ( "embed" "fmt" "strings" "edge-infra.dev/pkg/k8s/decoder" "edge-infra.dev/pkg/k8s/unstructured" ) //go:embed base/* // Manifests contains the base chart manifests for coredns var Manifests embed.FS func UnstructuredManifests() ([]*unstructured.Unstructured, error) { file, err := Manifests.ReadFile("base/manifests.yaml") if err != nil { return nil, fmt.Errorf("failed to read manifests.yaml: %w", err) } return decoder.DecodeYAML(editValues(file)) } func editValues(file []byte) []byte { replacer := strings.NewReplacer("$DNS_DOMAIN", "cluster.local", "$DNS_MEMORY_LIMIT", "170Mi", "$DNS_SERVER_IP", "10.96.0.10") editedFile := replacer.Replace(string(file)) return []byte(editedFile) }