forked from deis/controller
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(ingress): Feature work for experimental native ingress
Adding ingress support to controller Adding changes to chart to support feature Adding ingress rules for controller API, and SSH on TCP 2222 Adding ingress support in general Requires deis/workflow#732 Requires deis/builder#495 Requires deis/router#316 Technically a non breaking change, as the user must opt-in to the feature
- Loading branch information
Showing
6 changed files
with
119 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
charts/controller/templates/controller-ingress-rule-http-80.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
{{ if .Values.global.experimental_native_ingress }} | ||
apiVersion: extensions/v1beta1 | ||
kind: Ingress | ||
metadata: | ||
namespace: "deis" | ||
name: "controller-api-server-ingress-http" | ||
labels: | ||
app: "controller" | ||
chart: "{{ .Chart.Name }}-{{ .Chart.Version }}" | ||
release: "{{ .Release.Name }}" | ||
heritage: "{{ .Release.Service }}" | ||
spec: | ||
rules: | ||
- host: deis.{{ .Values.platform_domain }} | ||
http: | ||
paths: | ||
- path: / | ||
backend: | ||
serviceName: deis-controller | ||
servicePort: 80 | ||
{{- end }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
from scheduler.exceptions import KubeHTTPException | ||
from scheduler.resources import Resource | ||
|
||
|
||
class Ingress(Resource): | ||
short_name = 'ingress' | ||
|
||
def get(self, name=None, **kwargs): | ||
""" | ||
Fetch a single Ingress or a list of Ingresses | ||
""" | ||
if name is not None: | ||
url = "/apis/extensions/v1beta1/namespaces/%s/ingresses/%s" % (name, name) | ||
message = 'get Ingress ' + name | ||
else: | ||
url = "/apis/extensions/v1beta1/namespaces/%s/ingresses" % name | ||
message = 'get Ingresses' | ||
|
||
response = self.http_get(url, params=self.query_params(**kwargs)) | ||
if self.unhealthy(response.status_code): | ||
raise KubeHTTPException(response, message) | ||
|
||
return response | ||
|
||
def create(self, ingress, namespace, hostname): | ||
url = "/apis/extensions/v1beta1/namespaces/%s/ingresses" % namespace | ||
|
||
if hostname == "": | ||
raise KubeHTTPException("empty hostname value") | ||
|
||
data = { | ||
"kind": "Ingress", | ||
"apiVersion": "extensions/v1beta1", | ||
"metadata": { | ||
"name": ingress | ||
}, | ||
"spec": { | ||
"rules": [ | ||
{"host": ingress + "." + hostname, | ||
"http": { | ||
"paths": [ | ||
{"path": "/", | ||
"backend": { | ||
"serviceName": ingress, | ||
"servicePort": 80 | ||
}} | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
response = self.http_post(url, json=data) | ||
|
||
if not response.status_code == 201: | ||
raise KubeHTTPException(response, "create Ingress {}".format(namespace)) | ||
|
||
return response | ||
|
||
def delete(self, namespace, ingress): | ||
url = self.api("/namespaces/{}/ingresses/{}", namespace, ingress) | ||
response = self.http_delete(url) | ||
if self.unhealthy(response.status_code): | ||
raise KubeHTTPException(response, 'delete Ingress "{}"', namespace) | ||
|
||
return response |