...

Source file src/edge-infra.dev/third_party/k8s/coredns/chart.go

Documentation: edge-infra.dev/third_party/k8s/coredns

     1  package coredns
     2  
     3  import (
     4  	"embed"
     5  	"fmt"
     6  	"strings"
     7  
     8  	"edge-infra.dev/pkg/k8s/decoder"
     9  	"edge-infra.dev/pkg/k8s/unstructured"
    10  )
    11  
    12  //go:embed base/*
    13  
    14  // Manifests contains the base chart manifests for coredns
    15  var Manifests embed.FS
    16  
    17  func UnstructuredManifests() ([]*unstructured.Unstructured, error) {
    18  	file, err := Manifests.ReadFile("base/manifests.yaml")
    19  	if err != nil {
    20  		return nil, fmt.Errorf("failed to read manifests.yaml: %w", err)
    21  	}
    22  	return decoder.DecodeYAML(editValues(file))
    23  }
    24  
    25  func editValues(file []byte) []byte {
    26  	replacer := strings.NewReplacer("$DNS_DOMAIN", "cluster.local", "$DNS_MEMORY_LIMIT", "170Mi", "$DNS_SERVER_IP", "10.96.0.10")
    27  	editedFile := replacer.Replace(string(file))
    28  	return []byte(editedFile)
    29  }
    30  

View as plain text