Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add k0s+aws template with bootstrapped control planes #13

Closed
wants to merge 19 commits into from
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add OCI registry configuration for template-controller
Signed-off-by: Andrei Pavlov <apavlov@mirantis.com>
  • Loading branch information
Kshatrix authored and eromanova committed Jun 5, 2024
commit c084d92ccebed30876b95b18b9287385788f2597
12 changes: 10 additions & 2 deletions cmd/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ func main() {
var probeAddr string
var secureMetrics bool
var enableHTTP2 bool
var defaultOCIRegistry string
var insecureRegistry bool

flag.StringVar(&metricsAddr, "metrics-bind-address", ":8080", "The address the metric endpoint binds to.")
flag.StringVar(&probeAddr, "health-probe-bind-address", ":8081", "The address the probe endpoint binds to.")
flag.BoolVar(&enableLeaderElection, "leader-elect", false,
Expand All @@ -70,6 +73,9 @@ func main() {
"If set the metrics endpoint is served securely")
flag.BoolVar(&enableHTTP2, "enable-http2", false,
"If set, HTTP/2 will be enabled for the metrics and webhook servers")
flag.StringVar(&defaultOCIRegistry, "default-oci-registry", "oci://ghcr.io/Mirantis/hmc/charts",
"The default OCI registry to download Helm charts from.")
flag.BoolVar(&insecureRegistry, "insecure-registry", false, "Allow connecting to an HTTP registry.")
opts := zap.Options{
Development: true,
}
Expand Down Expand Up @@ -127,8 +133,10 @@ func main() {
}

if err = (&controller.TemplateReconciler{
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
Client: mgr.GetClient(),
Scheme: mgr.GetScheme(),
DefaultOCIRegistry: defaultOCIRegistry,
InsecureRegistry: insecureRegistry,
}).SetupWithManager(mgr); err != nil {
setupLog.Error(err, "unable to create controller", "controller", "Template")
os.Exit(1)
Expand Down
7 changes: 5 additions & 2 deletions internal/controller/template_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ import (
const (
defaultRepoName = "hmc-templates"
defaultRepoType = "oci"
defaultRepoURL = "oci://ghcr.io/Mirantis/hmc/charts"

defaultReconcileInterval = 10 * time.Minute
)
Expand All @@ -46,6 +45,9 @@ const (
type TemplateReconciler struct {
client.Client
Scheme *runtime.Scheme

DefaultOCIRegistry string
InsecureRegistry bool
}

// +kubebuilder:rbac:groups=hmc.mirantis.com,resources=templates,verbs=get;list;watch;create;update;patch;delete
Expand Down Expand Up @@ -152,8 +154,9 @@ func (r *TemplateReconciler) reconcileHelmRepo(ctx context.Context, template *hm
_, err := ctrl.CreateOrUpdate(ctx, r.Client, helmRepo, func() error {
helmRepo.Spec = sourcev1.HelmRepositorySpec{
Type: defaultRepoType,
URL: defaultRepoURL,
URL: r.DefaultOCIRegistry,
Interval: metav1.Duration{Duration: defaultReconcileInterval},
Insecure: r.InsecureRegistry,
}
return nil
})
Expand Down