Skip to content

Commit

Permalink
RKE2 cluster via terraform
Browse files Browse the repository at this point in the history
  • Loading branch information
albinsun committed Jan 20, 2024
1 parent d466b4d commit fc8025c
Show file tree
Hide file tree
Showing 6 changed files with 499 additions and 32 deletions.
4 changes: 2 additions & 2 deletions apiclient/rancher_api/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,8 +86,8 @@ def authenticate(self, user, passwd, **kwargs):
except AssertionError:
pass # TODO: Log authenticate error
else:
token = "Bearer %s" % r.json()['token']
self.session.headers.update(Authorization=token)
self.token = r.json()['token']
self.session.headers.update(Authorization=f"Bearer {self.token}")
self._version = None
return r.json()

Expand Down
7 changes: 6 additions & 1 deletion apiclient/rancher_api/managers.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,12 @@ def create(self, name, kubeconfig, cluster_id="", *, raw=False):
def get(self, name="", *, raw=False):
if name == "":
return self._get(self.PATH_fmt.format(uid=""), raw=raw)
return self._get(self.PATH_fmt.format(uid=f"/{name}"), raw=raw)

code, data = self._get(self.PATH_fmt.format(uid=f"/{name}"), raw=raw)
if 404 == code:
code, data = self._get(self.PATH_fmt.format(uid=f"?name={name}"), raw=raw)

return code, data

def delete(self, name, *, raw=False):
return self._delete(self.PATH_fmt.format(uid=f"/{name}"), raw=raw)
Expand Down
10 changes: 5 additions & 5 deletions config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ image-cache-url: ''

# script location for terraform related test cases
terraform-scripts-location: 'terraform_test_artifacts'
terraform-provider-rancher: '3.1.1'

# Backup Target S3
s3-endpoint: ''
Expand All @@ -38,12 +39,11 @@ nfs-endpoint: ''
nfs-mount-dir: 'nfsshare'

# Rancher Cluster
# rancher-endpoint: 'https://127.0.0.1'
# External Rancher admin user password
# rancher-admin-password: 'rancher_password'
rancher-endpoint: 'https://127.0.0.1'
rancher-admin-password: 'rancher_password'
# Kubernetes version for RKE
RKE1-version: 'v1.24.11-rancher2-1'
RKE2-version: 'v1.24.11+rke2r1'
RKE1-version: 'v1.26.11-rancher2-1'
RKE2-version: 'v1.26.11+rke2r1'
# Wait time for polling Rancher cluster status.
rancher-cluster-wait-timeout: 7200

Expand Down
6 changes: 6 additions & 0 deletions harvester_e2e_tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,12 @@ def pytest_addoption(parser):
default=config_data.get('terraform-provider-harvester'),
help=('Version of Terraform Harvester Provider')
)
parser.addoption(
'--terraform-provider-rancher',
action='store',
default=config_data.get('terraform-provider-rancher'),
help=('Version of Terraform Rancher Provider')
)


def pytest_configure(config):
Expand Down
Loading

0 comments on commit fc8025c

Please sign in to comment.