Skip to content

Commit

Permalink
Changes in docs for release: v0.6.1
Browse files Browse the repository at this point in the history
  • Loading branch information
codeflare-machine-account authored and github-actions[bot] committed Aug 7, 2023
1 parent f34697a commit f292f26
Show file tree
Hide file tree
Showing 11 changed files with 1,278 additions and 868 deletions.
481 changes: 338 additions & 143 deletions docs/cluster/auth.html

Large diffs are not rendered by default.

183 changes: 78 additions & 105 deletions docs/cluster/awload.html
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,12 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.awload</code></h1>
from os.path import isfile
import errno
import os
import openshift as oc
import yaml

from kubernetes import client, config
from ..utils.kube_api_helpers import _kube_api_error_handling
from .auth import config_check, api_config_handler


class AWManager:
&#34;&#34;&#34;
Expand All @@ -71,10 +74,10 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.awload</code></h1>
self.filename = filename
try:
with open(self.filename) as f:
awyaml = yaml.load(f, Loader=yaml.FullLoader)
assert awyaml[&#34;kind&#34;] == &#34;AppWrapper&#34;
self.name = awyaml[&#34;metadata&#34;][&#34;name&#34;]
self.namespace = awyaml[&#34;metadata&#34;][&#34;namespace&#34;]
self.awyaml = yaml.load(f, Loader=yaml.FullLoader)
assert self.awyaml[&#34;kind&#34;] == &#34;AppWrapper&#34;
self.name = self.awyaml[&#34;metadata&#34;][&#34;name&#34;]
self.namespace = self.awyaml[&#34;metadata&#34;][&#34;namespace&#34;]
except:
raise ValueError(
f&#34;{filename } is not a correctly formatted AppWrapper yaml&#34;
Expand All @@ -86,19 +89,17 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.awload</code></h1>
Attempts to create the AppWrapper custom resource using the yaml file
&#34;&#34;&#34;
try:
with oc.project(self.namespace):
oc.invoke(&#34;create&#34;, [&#34;-f&#34;, self.filename])
except oc.OpenShiftPythonException as osp: # pragma: no cover
error_msg = osp.result.err()
if &#34;Unauthorized&#34; in error_msg or &#34;Forbidden&#34; in error_msg:
raise PermissionError(
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
)
elif &#34;AlreadyExists&#34; in error_msg:
raise FileExistsError(
f&#34;An AppWrapper of the name {self.name} already exists in namespace {self.namespace}&#34;
)
raise osp
config_check()
api_instance = client.CustomObjectsApi(api_config_handler())
api_instance.create_namespaced_custom_object(
group=&#34;mcad.ibm.com&#34;,
version=&#34;v1beta1&#34;,
namespace=self.namespace,
plural=&#34;appwrappers&#34;,
body=self.awyaml,
)
except Exception as e:
return _kube_api_error_handling(e)

self.submitted = True
print(f&#34;AppWrapper {self.filename} submitted!&#34;)
Expand All @@ -113,25 +114,17 @@ <h1 class="title">Module <code>codeflare_sdk.cluster.awload</code></h1>
return

try:
with oc.project(self.namespace):
oc.invoke(&#34;delete&#34;, [&#34;AppWrapper&#34;, self.name])
except oc.OpenShiftPythonException as osp: # pragma: no cover
error_msg = osp.result.err()
if (
&#39;the server doesn\&#39;t have a resource type &#34;AppWrapper&#34;&#39; in error_msg
or &#34;forbidden&#34; in error_msg
or &#34;Unauthorized&#34; in error_msg
or &#34;Missing or incomplete configuration&#34; in error_msg
):
raise PermissionError(
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
)
elif &#34;not found&#34; in error_msg:
self.submitted = False
print(&#34;AppWrapper not found, was deleted in another manner&#34;)
return
else:
raise osp
config_check()
api_instance = client.CustomObjectsApi(api_config_handler())
api_instance.delete_namespaced_custom_object(
group=&#34;mcad.ibm.com&#34;,
version=&#34;v1beta1&#34;,
namespace=self.namespace,
plural=&#34;appwrappers&#34;,
name=self.name,
)
except Exception as e:
return _kube_api_error_handling(e)

self.submitted = False
print(f&#34;AppWrapper {self.name} removed!&#34;)</code></pre>
Expand Down Expand Up @@ -175,10 +168,10 @@ <h2 class="section-title" id="header-classes">Classes</h2>
self.filename = filename
try:
with open(self.filename) as f:
awyaml = yaml.load(f, Loader=yaml.FullLoader)
assert awyaml[&#34;kind&#34;] == &#34;AppWrapper&#34;
self.name = awyaml[&#34;metadata&#34;][&#34;name&#34;]
self.namespace = awyaml[&#34;metadata&#34;][&#34;namespace&#34;]
self.awyaml = yaml.load(f, Loader=yaml.FullLoader)
assert self.awyaml[&#34;kind&#34;] == &#34;AppWrapper&#34;
self.name = self.awyaml[&#34;metadata&#34;][&#34;name&#34;]
self.namespace = self.awyaml[&#34;metadata&#34;][&#34;namespace&#34;]
except:
raise ValueError(
f&#34;{filename } is not a correctly formatted AppWrapper yaml&#34;
Expand All @@ -190,19 +183,17 @@ <h2 class="section-title" id="header-classes">Classes</h2>
Attempts to create the AppWrapper custom resource using the yaml file
&#34;&#34;&#34;
try:
with oc.project(self.namespace):
oc.invoke(&#34;create&#34;, [&#34;-f&#34;, self.filename])
except oc.OpenShiftPythonException as osp: # pragma: no cover
error_msg = osp.result.err()
if &#34;Unauthorized&#34; in error_msg or &#34;Forbidden&#34; in error_msg:
raise PermissionError(
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
)
elif &#34;AlreadyExists&#34; in error_msg:
raise FileExistsError(
f&#34;An AppWrapper of the name {self.name} already exists in namespace {self.namespace}&#34;
)
raise osp
config_check()
api_instance = client.CustomObjectsApi(api_config_handler())
api_instance.create_namespaced_custom_object(
group=&#34;mcad.ibm.com&#34;,
version=&#34;v1beta1&#34;,
namespace=self.namespace,
plural=&#34;appwrappers&#34;,
body=self.awyaml,
)
except Exception as e:
return _kube_api_error_handling(e)

self.submitted = True
print(f&#34;AppWrapper {self.filename} submitted!&#34;)
Expand All @@ -217,25 +208,17 @@ <h2 class="section-title" id="header-classes">Classes</h2>
return

try:
with oc.project(self.namespace):
oc.invoke(&#34;delete&#34;, [&#34;AppWrapper&#34;, self.name])
except oc.OpenShiftPythonException as osp: # pragma: no cover
error_msg = osp.result.err()
if (
&#39;the server doesn\&#39;t have a resource type &#34;AppWrapper&#34;&#39; in error_msg
or &#34;forbidden&#34; in error_msg
or &#34;Unauthorized&#34; in error_msg
or &#34;Missing or incomplete configuration&#34; in error_msg
):
raise PermissionError(
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
)
elif &#34;not found&#34; in error_msg:
self.submitted = False
print(&#34;AppWrapper not found, was deleted in another manner&#34;)
return
else:
raise osp
config_check()
api_instance = client.CustomObjectsApi(api_config_handler())
api_instance.delete_namespaced_custom_object(
group=&#34;mcad.ibm.com&#34;,
version=&#34;v1beta1&#34;,
namespace=self.namespace,
plural=&#34;appwrappers&#34;,
name=self.name,
)
except Exception as e:
return _kube_api_error_handling(e)

self.submitted = False
print(f&#34;AppWrapper {self.name} removed!&#34;)</code></pre>
Expand All @@ -262,25 +245,17 @@ <h3>Methods</h3>
return

try:
with oc.project(self.namespace):
oc.invoke(&#34;delete&#34;, [&#34;AppWrapper&#34;, self.name])
except oc.OpenShiftPythonException as osp: # pragma: no cover
error_msg = osp.result.err()
if (
&#39;the server doesn\&#39;t have a resource type &#34;AppWrapper&#34;&#39; in error_msg
or &#34;forbidden&#34; in error_msg
or &#34;Unauthorized&#34; in error_msg
or &#34;Missing or incomplete configuration&#34; in error_msg
):
raise PermissionError(
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
)
elif &#34;not found&#34; in error_msg:
self.submitted = False
print(&#34;AppWrapper not found, was deleted in another manner&#34;)
return
else:
raise osp
config_check()
api_instance = client.CustomObjectsApi(api_config_handler())
api_instance.delete_namespaced_custom_object(
group=&#34;mcad.ibm.com&#34;,
version=&#34;v1beta1&#34;,
namespace=self.namespace,
plural=&#34;appwrappers&#34;,
name=self.name,
)
except Exception as e:
return _kube_api_error_handling(e)

self.submitted = False
print(f&#34;AppWrapper {self.name} removed!&#34;)</code></pre>
Expand All @@ -300,19 +275,17 @@ <h3>Methods</h3>
Attempts to create the AppWrapper custom resource using the yaml file
&#34;&#34;&#34;
try:
with oc.project(self.namespace):
oc.invoke(&#34;create&#34;, [&#34;-f&#34;, self.filename])
except oc.OpenShiftPythonException as osp: # pragma: no cover
error_msg = osp.result.err()
if &#34;Unauthorized&#34; in error_msg or &#34;Forbidden&#34; in error_msg:
raise PermissionError(
&#34;Action not permitted, have you put in correct/up-to-date auth credentials?&#34;
)
elif &#34;AlreadyExists&#34; in error_msg:
raise FileExistsError(
f&#34;An AppWrapper of the name {self.name} already exists in namespace {self.namespace}&#34;
)
raise osp
config_check()
api_instance = client.CustomObjectsApi(api_config_handler())
api_instance.create_namespaced_custom_object(
group=&#34;mcad.ibm.com&#34;,
version=&#34;v1beta1&#34;,
namespace=self.namespace,
plural=&#34;appwrappers&#34;,
body=self.awyaml,
)
except Exception as e:
return _kube_api_error_handling(e)

self.submitted = True
print(f&#34;AppWrapper {self.filename} submitted!&#34;)</code></pre>
Expand Down
Loading

0 comments on commit f292f26

Please sign in to comment.