Skip to content

Commit 465a7d9

Browse files
committed
Make the options configurable via environment variables.
This allows configuration via env vars in addition to CLI flags, improving flexibility for containerized deployments. Signed-off-by: Tsubasa Watanabe <[email protected]>
1 parent fd902f3 commit 465a7d9

File tree

1 file changed

+6
-5
lines changed

1 file changed

+6
-5
lines changed

pkg/operator/options/options.go

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ import (
2424
"os"
2525

2626
karpoptions "sigs.k8s.io/karpenter/pkg/operator/options"
27+
"sigs.k8s.io/karpenter/pkg/utils/env"
2728
)
2829

2930
func init() {
@@ -41,11 +42,11 @@ type Options struct {
4142
}
4243

4344
func (o *Options) AddFlags(fs *karpoptions.FlagSet) {
44-
fs.StringVar(&o.ClusterAPIKubeConfigFile, "cluster-api-kubeconfig", "", "The path to the cluster api manager cluster kubeconfig file. Defaults to service account credentials if not specified.")
45-
fs.StringVar(&o.ClusterAPIUrl, "cluster-api-url", "", "The url of the cluster api manager cluster")
46-
fs.StringVar(&o.ClusterAPIToken, "cluster-api-token", "", "The Bearer token for authentication of the cluster api manager cluster")
47-
fs.StringVar(&o.ClusterAPICertificateAuthorityData, "cluster-api-certificate-authority-data", "", "The cert certificate authority of the cluster api manager cluster")
48-
fs.BoolVar(&o.ClusterAPISkipTlsVerify, "cluster-api-skip-tls-verify", false, "Skip the check for certificate for validity of the cluster api manager cluster. This will make HTTPS connections insecure")
45+
fs.StringVar(&o.ClusterAPIKubeConfigFile, "cluster-api-kubeconfig", env.WithDefaultString("CLUSTER_API_KUBECONFIG", ""), "The path to the cluster api manager cluster kubeconfig file. Defaults to service account credentials if not specified.")
46+
fs.StringVar(&o.ClusterAPIUrl, "cluster-api-url", env.WithDefaultString("CLUSTER_API_URL", ""), "The url of the cluster api manager cluster")
47+
fs.StringVar(&o.ClusterAPIToken, "cluster-api-token", env.WithDefaultString("CLUSTER_API_TOKEN", ""), "The Bearer token for authentication of the cluster api manager cluster")
48+
fs.StringVar(&o.ClusterAPICertificateAuthorityData, "cluster-api-certificate-authority-data", env.WithDefaultString("CLUSTER_API_CERTIFICATE_AUTHORITY_DATA", ""), "The cert certificate authority of the cluster api manager cluster")
49+
fs.BoolVarWithEnv(&o.ClusterAPISkipTlsVerify, "cluster-api-skip-tls-verify", "CLUSTER_API_SKIP_TLS_VERIFY", false, "Skip the check for certificate for validity of the cluster api manager cluster. This will make HTTPS connections insecure")
4950
}
5051

5152
func (o *Options) Parse(fs *karpoptions.FlagSet, args ...string) error {

0 commit comments

Comments
 (0)