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

Dynamic ports #125

Draft
wants to merge 3 commits into
base: master
Choose a base branch
from
Draft
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
4 changes: 3 additions & 1 deletion charts/osiris/templates/endpoints-hijacker-deployment.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,11 @@ spec:
value: /osiris/cert/tls.crt
- name: TLS_KEY_FILE
value: /osiris/cert/tls.key
- name: SECURE_PORT
value: "{{ .Values.endpointsHijacker.webhooks.securePort }}"
ports:
- name: https
containerPort: 5000
containerPort: {{ .Values.endpointsHijacker.webhooks.securePort }}
protocol: TCP
livenessProbe:
httpGet:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,6 @@ webhooks:
operations:
- CREATE
- UPDATE
failurePolicy: Ignore
failurePolicy: {{ .Values.endpointsHijacker.webhooks.failurePolicy }}
sideEffects: None
admissionReviewVersions: ["v1", "v1beta1"]
3 changes: 3 additions & 0 deletions charts/osiris/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,9 @@ endpointsHijacker:
nodeSelector: {}
tolerations: []
affinity: {}
webhooks:
failurePolicy: Ignore
securePort: 10250

certmanager:
# -- Enables cert-manager to automatically issue selfSigned certificates
Expand Down
1 change: 1 addition & 0 deletions pkg/endpoints/hijacker/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const envconfigPrefix = "OSIRIS_ENDPOINTS_HIJACKER"
type Config struct {
TLSCertFile string `envconfig:"TLS_CERT_FILE" required:"true"`
TLSKeyFile string `envconfig:"TLS_KEY_FILE" required:"true"`
SecurePort int32 `envconfig:"SECURE_PORT" default:"5000"`
}

// NewConfigWithDefaults returns a Config object with default values already
Expand Down
4 changes: 1 addition & 3 deletions pkg/endpoints/hijacker/hijacker.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"github.com/dailymotion-oss/osiris/pkg/kubernetes"
)

const port = 5000

// Hijacker is an interface for a component that handles webhook requests
// for patching Osiris-enabled services in a manner that will permit the
// Osiris endpoints controller to manage service endpoints
Expand Down Expand Up @@ -51,7 +49,7 @@ func NewHijacker(config Config) Hijacker {
runtime.NewScheme(),
).UniversalDeserializer(),
srv: &http.Server{
Addr: fmt.Sprintf(":%d", port),
Addr: fmt.Sprintf(":%d", config.SecurePort),
Handler: mux,
},
}
Expand Down