-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
13 changed files
with
254 additions
and
6 deletions.
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
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
Binary file not shown.
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,12 @@ | ||
--- | ||
{{- $ca := genCA "opensearchca" 1825 }} | ||
{{- $cert := genSignedCert "opensearch-master.{{ Release.Namespace }}.local" nil (list "opensearch-master.{{ Release.Namespace }}.local") 1825 $ca }} | ||
apiVersion: v1 | ||
kind: Secret | ||
metadata: | ||
name: opensearch-certificates | ||
type: Opaque | ||
data: | ||
"ca.crt": {{ $ca.Cert | b64enc | toYaml | indent 4}} | ||
"tls.key": {{ $cert.Key | b64enc | toYaml | indent 4}} | ||
"tls.crt": {{ print $cert.Cert $ca.Cert | b64enc | toYaml | indent 4}} |
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
70 changes: 70 additions & 0 deletions
70
tutor-contrib-harmony-plugin/tutor_k8s_harmony_plugin/opensearch.py
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,70 @@ | ||
import json | ||
import typing | ||
|
||
from tutor import utils | ||
|
||
|
||
class OpenSearchAPI: | ||
""" | ||
Helper class to interact with the OpenSearch | ||
API on the deployed cluster. | ||
""" | ||
|
||
def __init__(self, namespace): | ||
self._command_base = [ | ||
"kubectl", | ||
"exec", | ||
"--stdin", | ||
"--tty", | ||
"--namespace", | ||
namespace, | ||
"opensearch-cluster-master-0", | ||
"--", | ||
"bash", | ||
"-c", | ||
] | ||
self._curl_base = ["curl", "--insecure", "-u", "admin:admin"] | ||
|
||
def run_command(self, curl_options) -> typing.Union[dict, bytes]: | ||
""" | ||
Invokes a curl command on the first Opensearch pod. | ||
If possible returns the parsed json from the Opensearch response. | ||
Otherwise, the raw bytes from the curl command are returned. | ||
""" | ||
response = utils.check_output( | ||
*self._command_base, " ".join(self._curl_base + curl_options) | ||
) | ||
try: | ||
return json.loads(response) | ||
except (TypeError, ValueError): | ||
return response | ||
|
||
def get(self, endpoint): | ||
""" | ||
Runs a GET request on the Opensearch cluster with the specified | ||
endpoint. | ||
If possible returns the parsed json from the Opensearch response. | ||
Otherwise, the raw bytes from the curl command are returned. | ||
""" | ||
return self.run_command(["-XGET", f"https://opensearch-cluster-master:9200/{endpoint}"]) | ||
|
||
def put(self, endpoint: str, data: dict) -> typing.Union[dict, bytes]: | ||
""" | ||
Runs a POST request on the Opensearch cluster with the specified | ||
endpoint. | ||
If possible returns the parsed json from the Opensearch response. | ||
Otherwise, the raw bytes from the curl command are returned. | ||
""" | ||
return self.run_command( | ||
[ | ||
"-XPUT", | ||
f"https://opensearch-cluster-master:9200/{endpoint}", | ||
"-d", | ||
f"'{json.dumps(data)}'", | ||
"-H", | ||
'"Content-Type: application/json"', | ||
] | ||
) |
13 changes: 13 additions & 0 deletions
13
tutor-contrib-harmony-plugin/tutor_k8s_harmony_plugin/patches/openedx-common-settings
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
2 changes: 1 addition & 1 deletion
2
...rmony-plugin/tutor_k8s_harmony_plugin/patches/openedx-dockerfile-post-python-requirements
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 |
---|---|---|
|
@@ -13,3 +13,6 @@ metricsserver: | |
enabled: false | ||
vpa: | ||
enabled: false | ||
|
||
opensearch: | ||
enabled: false |
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 |
---|---|---|
@@ -1,3 +1,24 @@ | ||
# Disable HTTPS cert provisioning for testing with minikube | ||
cert-manager: | ||
enabled: false | ||
|
||
elasticsearch: | ||
enabled: false | ||
|
||
# TODO: move this to a separate PR | ||
# Permit co-located instances for solitary minikube virtual machines. | ||
antiAffinity: "soft" | ||
|
||
volumeClaimTemplate: | ||
resources: | ||
requests: | ||
storage: 8Gi | ||
|
||
opensearch: | ||
enabled: false | ||
|
||
# Permit co-located instances for solitary minikube virtual machines. | ||
antiAffinity: "soft" | ||
|
||
persistence: | ||
size: 8Gi |