- Notifications
You must be signed in to change notification settings - Fork2
feature: add ske service + examples#3
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Merged
Changes fromall commits
Commits
Show all changes
3 commits Select commitHold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Jump to
Jump to file
Failed to load files.
Loading
Uh oh!
There was an error while loading.Please reload this page.
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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,50 @@ | ||
| import os | ||
| from stackit.ske.api.default_api import DefaultApi | ||
| from stackit.ske.models.create_or_update_cluster_payload import ( | ||
| CreateOrUpdateClusterPayload, | ||
| ) | ||
| from stackit.ske.models.kubernetes import Kubernetes | ||
| from stackit.ske.models.nodepool import Nodepool | ||
| from stackit.ske.models.machine import Machine | ||
| from stackit.ske.models.volume import Volume | ||
| from stackit.ske.models.image import Image | ||
| from stackit.core.configuration import Configuration | ||
| project_id = os.getenv("PROJECT_ID") | ||
| volume_type = "storage_premium_perf0" | ||
| # Create a new API client, that uses default authentication and configuration | ||
| config = Configuration() | ||
| client = DefaultApi(config) | ||
| # Get available options | ||
| options_resonse = client.list_provider_options() | ||
| # Create a new instance using the first option for everything | ||
| cluser_name = "cl-name" | ||
| create_instance_payload = CreateOrUpdateClusterPayload( | ||
| kubernetes=Kubernetes(version=options_resonse.kubernetes_versions[0].version), | ||
| nodepools=[ | ||
| Nodepool( | ||
| availability_zones=[options_resonse.availability_zones[0].name], | ||
| machine=Machine( | ||
| image=Image( | ||
| name=options_resonse.machine_images[0].name, | ||
| version=options_resonse.machine_images[0].versions[0].version, | ||
| ), | ||
| type=options_resonse.machine_types[0].name, | ||
| ), | ||
| maximum=3, | ||
| minimum=2, | ||
| name="my-nodepool", | ||
| volume=Volume( | ||
| size=20, | ||
| type=volume_type, | ||
| ), | ||
| ) | ||
| ], | ||
| ) | ||
| client.create_or_update_cluster(project_id, cluser_name, create_instance_payload) |
This file contains hidden or 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,17 @@ | ||
| import os | ||
| from stackit.ske.api.default_api import DefaultApi | ||
| from stackit.core.configuration import Configuration | ||
| project_id = os.getenv("PROJECT_ID") | ||
| # Create a new API client, that uses default authentication and configuration | ||
| config = Configuration() | ||
| client = DefaultApi(config) | ||
| # Get all ske instances | ||
| response = client.list_clusters(project_id) | ||
| # Rotate credentials on all instances | ||
| for cluster in response.items: | ||
| client.start_credentials_rotation(project_id, cluster.name) |
This file contains hidden or 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,17 @@ | ||
| import os | ||
| from stackit.ske.api.default_api import DefaultApi | ||
| from stackit.core.configuration import Configuration | ||
| project_id = os.getenv("PROJECT_ID") | ||
| # Create a new API client, that uses default authentication and configuration | ||
| config = Configuration() | ||
| client = DefaultApi(config) | ||
| # List all ske clusters | ||
| response = client.list_clusters(project_id) | ||
| # Delete all cluster | ||
| for cluster in response.items: | ||
| client.delete_cluster(project_id, cluster.name) |
This file contains hidden or 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,13 @@ | ||
| import os | ||
| from stackit.ske.api.default_api import DefaultApi | ||
| from stackit.core.configuration import Configuration | ||
| project_id = os.getenv("PROJECT_ID") | ||
| # Create a new API client, that uses default authentication and configuration | ||
| config = Configuration() | ||
| client = DefaultApi(config) | ||
| # List all ske instances | ||
| print(client.list_clusters(project_id)) |
This file contains hidden or 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,93 @@ | ||
| [project] | ||
| name = "stackit-ske" | ||
| version = "1.0.0" | ||
| authors = [ | ||
| { name="STACKIT Kubernetes Engine (SKE) Team", email="team@openapitools.org" }, | ||
| ] | ||
| description = "SKE-API" | ||
| #readme = "README.md" | ||
| #license = "NoLicense" | ||
| requires-python = ">=3.8" | ||
| classifiers = [ | ||
| "Programming Language :: Python :: 3", | ||
| "License :: OSI Approved :: Apache Software License", | ||
| "Operating System :: OS Independent", | ||
| ] | ||
| dependencies = [ | ||
| "requests ~= 2.32.3", | ||
| "python_dateutil ~= 2.5.3", | ||
| "pydantic ~= 2.9.2", | ||
| "stackit-core ~= 0.0.1", | ||
| ] | ||
| [project.optional-dependencies] | ||
| dev = [ | ||
| "black >= 24.8.0", | ||
| "pytest ~= 8.3.2", | ||
| "flake8 ~= 7.1.0", | ||
| "flake8-black ~= 0.3.6", | ||
| "flake8-pyproject ~= 1.2.3", | ||
| "flake8-quotes ~= 3.4.0", | ||
| "flake8-bandit ~= 4.1.1", | ||
| "flake8-bugbear ~= 24.8.19", | ||
| "flake8-eradicate ~= 1.5.0", | ||
| "flake8-eol ~= 0.0.8", | ||
| "autoimport ~= 1.6.1", | ||
| "isort ~= 5.13.2", | ||
| ] | ||
| [project.urls] | ||
| Homepage = "https://github.com/stackitcloud/stackit-sdk-python-beta" | ||
| Issues = "https://github.com/stackitcloud/stackit-sdk-python-beta/issues" | ||
| [build-system] | ||
| requires = ["setuptools"] | ||
| build-backend = "setuptools.build_meta" | ||
| [tool.black] | ||
| line-length = 120 | ||
| exclude = """ | ||
| /( | ||
| .eggs | ||
| | .git | ||
| | .hg | ||
| | .mypy_cache | ||
| | .nox | ||
| | .pants.d | ||
| | .tox | ||
| | .venv | ||
| | _build | ||
| | buck-out | ||
| | build | ||
| | dist | ||
| | node_modules | ||
| | venv | ||
| )/ | ||
| """ | ||
| [tool.isort] | ||
| profile = 'black' | ||
| [tool.flake8] | ||
| exclude= [".eggs", ".git", ".hg", ".mypy_cache", ".tox", ".venv", ".devcontainer", "venv", "_build", "buck-out", "build", "dist"] | ||
| statistics = true | ||
| show-source = false | ||
| max-line-length = 120 | ||
| # E203,W503 and E704 are incompatible with the formatter black | ||
| # W291 needs to be disabled because some doc-strings get generated with trailing whitespace but black won't re-format comments | ||
| ignore = ["E203", "W503", "E704", "W291"] | ||
| inline-quotes = '"' | ||
| docstring-quotes = '"""' | ||
| multiline-quotes = '"""' | ||
| ban-relative-imports = true | ||
| per-file-ignores = """ | ||
| # asserts are fine in tests, tests shouldn't be build optimized | ||
| ./tests/*: S101, | ||
| # F841: some variables get generated but may not be used, depending on the api-spec | ||
| # E501: long descriptions/string values might lead to lines that are too long | ||
| ./stackit/*/models/*: F841,E501 | ||
| # F841: some variables get generated but may not be used, depending on the api-spec | ||
| # E501: long descriptions/string values might lead to lines that are too long | ||
| # B028: stacklevel for deprecation warning is irrelevant | ||
| ./stackit/*/api/default_api.py: F841,B028,E501 | ||
| """ |
This file contains hidden or 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,74 @@ | ||
| # coding: utf-8 | ||
| # flake8: noqa | ||
| """ | ||
| SKE-API | ||
| The SKE API provides endpoints to create, update, delete clusters within STACKIT portal projects and to trigger further cluster management tasks. | ||
| The version of the OpenAPI document: 1.1 | ||
| Generated by OpenAPI Generator (https://openapi-generator.tech) | ||
| Do not edit the class manually. | ||
| """ # noqa: E501 docstring might be too long | ||
| __version__ = "1.0.0" | ||
| # import apis into sdk package | ||
| from stackit.ske.api.default_api import DefaultApi | ||
| from stackit.ske.api_client import ApiClient | ||
| # import ApiClient | ||
| from stackit.ske.api_response import ApiResponse | ||
| from stackit.ske.configuration import HostConfiguration | ||
| from stackit.ske.exceptions import ( | ||
| ApiAttributeError, | ||
| ApiException, | ||
| ApiKeyError, | ||
| ApiTypeError, | ||
| ApiValueError, | ||
| OpenApiException, | ||
| ) | ||
| # import models into sdk package | ||
| from stackit.ske.models.acl import ACL | ||
| from stackit.ske.models.argus import Argus | ||
| from stackit.ske.models.availability_zone import AvailabilityZone | ||
| from stackit.ske.models.cluster import Cluster | ||
| from stackit.ske.models.cluster_status import ClusterStatus | ||
| from stackit.ske.models.cluster_status_state import ClusterStatusState | ||
| from stackit.ske.models.create_kubeconfig_payload import CreateKubeconfigPayload | ||
| from stackit.ske.models.create_or_update_cluster_payload import ( | ||
| CreateOrUpdateClusterPayload, | ||
| ) | ||
| from stackit.ske.models.credentials import Credentials | ||
| from stackit.ske.models.credentials_rotation_state import CredentialsRotationState | ||
| from stackit.ske.models.cri import CRI | ||
| from stackit.ske.models.dns import DNS | ||
| from stackit.ske.models.extension import Extension | ||
| from stackit.ske.models.hibernation import Hibernation | ||
| from stackit.ske.models.hibernation_schedule import HibernationSchedule | ||
| from stackit.ske.models.image import Image | ||
| from stackit.ske.models.kubeconfig import Kubeconfig | ||
| from stackit.ske.models.kubernetes import Kubernetes | ||
| from stackit.ske.models.kubernetes_version import KubernetesVersion | ||
| from stackit.ske.models.list_clusters_response import ListClustersResponse | ||
| from stackit.ske.models.login_kubeconfig import LoginKubeconfig | ||
| from stackit.ske.models.machine import Machine | ||
| from stackit.ske.models.machine_image import MachineImage | ||
| from stackit.ske.models.machine_image_version import MachineImageVersion | ||
| from stackit.ske.models.machine_type import MachineType | ||
| from stackit.ske.models.maintenance import Maintenance | ||
| from stackit.ske.models.maintenance_auto_update import MaintenanceAutoUpdate | ||
| from stackit.ske.models.network import Network | ||
| from stackit.ske.models.nodepool import Nodepool | ||
| from stackit.ske.models.project_response import ProjectResponse | ||
| from stackit.ske.models.project_state import ProjectState | ||
| from stackit.ske.models.provider_options import ProviderOptions | ||
| from stackit.ske.models.runtime_error import RuntimeError | ||
| from stackit.ske.models.taint import Taint | ||
| from stackit.ske.models.time_window import TimeWindow | ||
| from stackit.ske.models.volume import Volume | ||
| from stackit.ske.models.volume_type import VolumeType |
This file contains hidden or 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,4 @@ | ||
| # flake8: noqa | ||
| # import apis into api package | ||
| from stackit.ske.api.default_api import DefaultApi |
Oops, something went wrong.
Uh oh!
There was an error while loading.Please reload this page.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.