Skip to content

Commit ee4a29e

Browse files
committed
rebased jenkinsci#801
1 parent ae9cb0c commit ee4a29e

File tree

6 files changed

+19
-1
lines changed

6 files changed

+19
-1
lines changed

api/v1alpha2/jenkins_types.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -463,6 +463,10 @@ type Service struct {
463463
// This field will be ignored if the cloud-provider does not support the feature.
464464
// +optional
465465
LoadBalancerIP string `json:"loadBalancerIP,omitempty"`
466+
467+
// The port name which is provided to the service.
468+
// More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service
469+
Portname string `json:"Portname,omitempty"`
466470
}
467471

468472
// JenkinsStatus defines the observed state of Jenkins

chart/jenkins-operator/crds/jenkins-crd.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3253,6 +3253,9 @@ spec:
32533253
info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies'
32543254
format: int32
32553255
type: integer
3256+
portName:
3257+
description: 'The port name which is provided to the service. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service'
3258+
type: string
32563259
type:
32573260
description: 'Type determines how the Service is exposed. Defaults
32583261
to ClusterIP. Valid options are ExternalName, ClusterIP, NodePort,

chart/jenkins-operator/templates/operator.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ spec:
2626
image: {{ .Values.operator.image }}
2727
imagePullPolicy: {{ .Values.operator.imagePullPolicy }}
2828
ports:
29-
- name: http
29+
- name: {{ .Values.jenkins.service.portName }}
3030
containerPort: 80
3131
protocol: TCP
3232
command:

chart/jenkins-operator/values.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -181,6 +181,9 @@ jenkins:
181181
runAsUser: 1000
182182
fsGroup: 1000
183183

184+
service:
185+
portName: 'http'
186+
184187
# http Jenkins service
185188
# See https://jenkinsci.github.io/kubernetes-operator/docs/getting-started/latest/schema/#github.com/jenkinsci/kubernetes-operator/pkg/apis/jenkins/v1alpha2.Service for details
186189
#service:

config/crd/bases/jenkins.io_jenkins.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3918,6 +3918,9 @@ spec:
39183918
More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
39193919
format: int32
39203920
type: integer
3921+
portName:
3922+
description: 'The port name which is provided to the service. More info: https://kubernetes.io/docs/concepts/services-networking/service/#defining-a-service'
3923+
type: string
39213924
type:
39223925
description: |-
39233926
Type determines how the Service is exposed. Defaults to ClusterIP. Valid

pkg/configuration/base/resources/service.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ func UpdateService(actual corev1.Service, config v1alpha2.Service, targetPort in
3131
}
3232
actual.Spec.Ports[0].Port = config.Port
3333
actual.Spec.Ports[0].TargetPort = intstr.IntOrString{IntVal: targetPort, Type: intstr.Int}
34+
if config.Portname == "" {
35+
actual.Spec.Ports[0].Name = "http"
36+
} else {
37+
actual.Spec.Ports[0].Name = config.Portname
38+
}
3439
if config.NodePort != 0 {
3540
actual.Spec.Ports[0].NodePort = config.NodePort
3641
}

0 commit comments

Comments
 (0)