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

k8s: allow limiting k8s instance to a particular namespace #29

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
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
3 changes: 2 additions & 1 deletion kubernetes.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func init() {
// +kubebuilder:scaffold:scheme
}

func cmdKubernetes(metricsAddr string) {
func cmdKubernetes(metricsAddr string, namespace string) {
setupLog := ctrl.Log.WithName("setup")
ctrl.SetLogger(zap.New(zap.UseDevMode(true)))

Expand All @@ -58,6 +58,7 @@ func cmdKubernetes(metricsAddr string) {
Port: 9443,
LeaderElection: false,
LeaderElectionID: "9d76195a.metalmatze.de",
Namespace: namespace,
})
if err != nil {
setupLog.Error(err, "unable to start manager")
Expand Down
3 changes: 2 additions & 1 deletion main.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ var CLI struct {
} `cmd:"" help:"Runs Pyrra's filesystem operator and backend for the API."`
Kubernetes struct {
MetricsAddr string `default:":8080" help:"The address the metric endpoint binds to."`
Namespace string `default:"" help:"Read ServiceLevelObjective from specific namespace only"`
} `cmd:"" help:"Runs Pyrra's Kubernetes operator and backend for the API."`
}

Expand All @@ -57,7 +58,7 @@ func main() {
case "filesystem":
cmdFilesystem(CLI.Filesystem.ConfigFiles, CLI.Filesystem.PrometheusFolder)
case "kubernetes":
cmdKubernetes(CLI.Kubernetes.MetricsAddr)
cmdKubernetes(CLI.Kubernetes.MetricsAddr, CLI.Kubernetes.Namespace)
}

return
Expand Down