Skip to content

Commit

Permalink
Merge pull request #5169 from whitewindmills/karmadactl-metrics-port
Browse files Browse the repository at this point in the history
Expose metrics port for karmadactl installation
  • Loading branch information
karmada-bot authored Jul 11, 2024
2 parents 71de3dc + 6158fd8 commit a2e7828
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pkg/karmadactl/addons/descheduler/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ spec:
- /bin/karmada-descheduler
- --kubeconfig=/etc/kubeconfig
- --bind-address=0.0.0.0
- --secure-port=10358
- --leader-elect-resource-namespace={{ .Namespace }}
- --scheduler-estimator-ca-file=/etc/karmada/pki/ca.crt
- --scheduler-estimator-cert-file=/etc/karmada/pki/karmada.crt
Expand All @@ -60,6 +61,10 @@ spec:
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
ports:
- containerPort: 10358
name: metrics
protocol: TCP
volumeMounts:
- name: k8s-certs
mountPath: /etc/karmada/pki
Expand Down
6 changes: 6 additions & 0 deletions pkg/karmadactl/addons/estimator/manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ spec:
- /bin/karmada-scheduler-estimator
- --kubeconfig=/etc/{{ .MemberClusterName}}-kubeconfig
- --cluster-name={{ .MemberClusterName}}
- --bind-address=0.0.0.0
- --secure-port=10351
- --grpc-auth-cert-file=/etc/karmada/pki/karmada.crt
- --grpc-auth-key-file=/etc/karmada/pki/karmada.key
- --client-cert-auth=true
Expand All @@ -61,6 +63,10 @@ spec:
initialDelaySeconds: 15
periodSeconds: 15
timeoutSeconds: 5
ports:
- containerPort: 10351
name: metrics
protocol: TCP
volumeMounts:
- name: k8s-certs
mountPath: /etc/karmada/pki
Expand Down
21 changes: 21 additions & 0 deletions pkg/karmadactl/cmdinit/kubernetes/deployments.go
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ const (
deploymentAPIVersion = "apps/v1"
deploymentKind = "Deployment"
portName = "server"
metricsPortName = "metrics"
defaultMetricsPort = 8080

// KubeConfigSecretAndMountName is the secret and volume mount name of karmada kubeconfig
KubeConfigSecretAndMountName = "kubeconfig"
Expand Down Expand Up @@ -461,6 +463,13 @@ func (i *CommandInitOption) makeKarmadaSchedulerDeployment() *appsv1.Deployment
"--v=4",
},
LivenessProbe: livenessProbe,
Ports: []corev1.ContainerPort{
{
Name: metricsPortName,
ContainerPort: 10351,
Protocol: corev1.ProtocolTCP,
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: KubeConfigSecretAndMountName,
Expand Down Expand Up @@ -583,6 +592,7 @@ func (i *CommandInitOption) makeKarmadaControllerManagerDeployment() *appsv1.Dep
"/bin/karmada-controller-manager",
"--kubeconfig=/etc/kubeconfig",
"--bind-address=0.0.0.0",
"--metrics-bind-address=:8080",
"--cluster-status-update-frequency=10s",
"--secure-port=10357",
fmt.Sprintf("--leader-elect-resource-namespace=%s", i.Namespace),
Expand All @@ -595,6 +605,11 @@ func (i *CommandInitOption) makeKarmadaControllerManagerDeployment() *appsv1.Dep
ContainerPort: controllerManagerSecurePort,
Protocol: corev1.ProtocolTCP,
},
{
Name: metricsPortName,
ContainerPort: defaultMetricsPort,
Protocol: corev1.ProtocolTCP,
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down Expand Up @@ -702,6 +717,7 @@ func (i *CommandInitOption) makeKarmadaWebhookDeployment() *appsv1.Deployment {
"/bin/karmada-webhook",
"--kubeconfig=/etc/kubeconfig",
"--bind-address=0.0.0.0",
"--metrics-bind-address=:8080",
fmt.Sprintf("--secure-port=%v", webhookTargetPort),
fmt.Sprintf("--cert-dir=%s", webhookCertVolumeMountPath),
"--v=4",
Expand All @@ -712,6 +728,11 @@ func (i *CommandInitOption) makeKarmadaWebhookDeployment() *appsv1.Deployment {
ContainerPort: webhookTargetPort,
Protocol: corev1.ProtocolTCP,
},
{
Name: metricsPortName,
ContainerPort: defaultMetricsPort,
Protocol: corev1.ProtocolTCP,
},
},
VolumeMounts: []corev1.VolumeMount{
{
Expand Down
8 changes: 8 additions & 0 deletions pkg/karmadactl/register/register.go
Original file line number Diff line number Diff line change
Expand Up @@ -711,9 +711,17 @@ func (o *CommandRegisterOption) makeKarmadaAgentDeployment() *appsv1.Deployment
fmt.Sprintf("--cluster-namespace=%s", o.ClusterNamespace),
"--cluster-status-update-frequency=10s",
"--bind-address=0.0.0.0",
"--metrics-bind-address=:8080",
"--secure-port=10357",
"--v=4",
},
Ports: []corev1.ContainerPort{
{
Name: "metrics",
ContainerPort: 8080,
Protocol: corev1.ProtocolTCP,
},
},
VolumeMounts: []corev1.VolumeMount{
{
Name: "kubeconfig",
Expand Down

0 comments on commit a2e7828

Please sign in to comment.