Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[WIP ]update python dependencies #233

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .python-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.9.12
3.12.0
2 changes: 2 additions & 0 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
python 3.12.0
minikube 1.31.2
11 changes: 4 additions & 7 deletions bin/setup_venv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ pip3 install pipenv
pip3 install wheel

# `pipenv sync` uses only the information in the `Pipfile.lock` ensuring repeatable builds
PIPENV_VERBOSITY=-1 PIPENV_PIPFILE="${script_dir}/../pulumi/python/Pipfile" pipenv sync --dev
PIPENV_VERBOSITY=-1 PIPENV_PIPFILE="${script_dir}/../pulumi/python/Pipfile" pipenv sync

# Install node.js into virtual environment so that it can be used by Python
# modules that make call outs to it.
Expand All @@ -211,10 +211,7 @@ else
echo "Node.js version $("${VIRTUAL_ENV}/bin/node" --version) is already installed"
fi

# Install general package requirements
# `pipenv sync` uses only the information in the `Pipfile.lock` ensuring repeatable builds
PIPENV_VERBOSITY=-1 PIPENV_PIPFILE="${script_dir}/../pulumi/python/Pipfile" pipenv sync

echo "Installing local utilities Python module for MARA"
# Install local common utilities module
pip3 install "${script_dir}/../pulumi/python/utility/kic-pulumi-utils"

Expand Down Expand Up @@ -270,15 +267,15 @@ fi
#
if [ ! -x "${VIRTUAL_ENV}/bin/kubectl" ]; then
echo "Downloading kubectl into virtual environment"
KUBECTL_VERSION="v1.24.3"
KUBECTL_VERSION="v1.27.4"
${download_cmd} "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${OS}/${ARCH}/kubectl" >"${VIRTUAL_ENV}/bin/kubectl"
KUBECTL_CHECKSUM="$(${download_cmd} "https://dl.k8s.io/${KUBECTL_VERSION}/bin/${OS}/${ARCH}/kubectl.sha256")"
echo "${KUBECTL_CHECKSUM} ${VIRTUAL_ENV}/bin/kubectl" | ${sha256sum_cmd}
chmod +x "${VIRTUAL_ENV}/bin/kubectl"
else
echo "kubectl is already installed, but will overwrite to ensure correct version"
echo "Downloading kubectl into virtual environment"
KUBECTL_VERSION="v1.24.3"
KUBECTL_VERSION="v1.27.4"
${download_cmd} "https://dl.k8s.io/release/${KUBECTL_VERSION}/bin/${OS}/${ARCH}/kubectl" >"${VIRTUAL_ENV}/bin/kubectl"
KUBECTL_CHECKSUM="$(${download_cmd} "https://dl.k8s.io/${KUBECTL_VERSION}/bin/${OS}/${ARCH}/kubectl.sha256")"
echo "${KUBECTL_CHECKSUM} ${VIRTUAL_ENV}/bin/kubectl" | ${sha256sum_cmd}
Expand Down
41 changes: 17 additions & 24 deletions pulumi/python/Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,22 @@ verify_ssl = true
name = "pypi"

[packages]
awscli = "~=1.25.35"
grpcio = "==1.43.0"
fart = "~=0.1.5"
lolcat = "~=1.4"
passlib = "~=1.7.4"
pulumi-aws = ">=4.39.0"
pulumi-docker = "==3.1.0"
pulumi-eks = ">=0.41.2"
pulumi-kubernetes = "==3.20.1"
pycryptodome = "~=3.14.0"
requests = "~=2.27.1"
setuptools-git-versioning = "==1.9.2"
yamlreader = "==3.0.4"
pulumi-digitalocean = "==4.12.0"
pulumi-linode = "==3.7.1"
linode-cli = "~=5.17.2"
pulumi = "~=3.36.0"
PyYAML = "~=5.4.1"
nodeenv = "~=1.6.0"

[dev-packages]
wheel = "~=0.37.1"
nodeenv = "~=1.6.0"
pulumi = "*"
fart = "*"
lolcat = "*"
passlib = "*"
pulumi-docker = "*"
pulumi-kubernetes = "*"
setuptools-git-versioning = "*"
pyyaml = "*"
wheel = "*"
nodeenv = "*"
pulumi-digitalocean = "*"
pulumi-linode = "*"
linode-cli = "*"
pulumi-aws = "*"
pulumi-eks = "*"
awscli = "*"

[requires]
python_version = "3.9"
python_version = "3.12"
599 changes: 338 additions & 261 deletions pulumi/python/Pipfile.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pulumi/python/kubernetes/applications/sirius/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def add_namespace(obj):
#
# Create the namespace for Bank of Sirius
#
ns = k8s.core.v1.Namespace(resource_name='bos',
ns = k8s.core.v1.Namespace('bos',
metadata={'name': 'bos'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
2 changes: 1 addition & 1 deletion pulumi/python/kubernetes/certmgr/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ def add_namespace(obj):
k8s_provider = k8s.Provider(resource_name=f'ingress-controller',
kubeconfig=kubeconfig)

ns = k8s.core.v1.Namespace(resource_name='cert-manager',
ns = k8s.core.v1.Namespace('cert-manager',
metadata={'name': 'cert-manager'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
2 changes: 1 addition & 1 deletion pulumi/python/kubernetes/logagent/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ def pulumi_logstore_project_name():
k8s_provider = k8s.Provider(resource_name=f'ingress-controller',
kubeconfig=kubeconfig)

ns = k8s.core.v1.Namespace(resource_name='logagent',
ns = k8s.core.v1.Namespace('logagent',
metadata={'name': 'logagent'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
2 changes: 1 addition & 1 deletion pulumi/python/kubernetes/logstore/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ def project_name_from_project_dir(dirname: str):
k8s_provider = k8s.Provider(resource_name=f'ingress-controller',
kubeconfig=kubeconfig)

ns = k8s.core.v1.Namespace(resource_name='logstore',
ns = k8s.core.v1.Namespace('logstore',
metadata={'name': 'logstore'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def infrastructure_project_name_from_project_dir(dirname: str):

namespace_name = 'nginx-ingress'

ns = k8s.core.v1.Namespace(resource_name='nginx-ingress',
ns = k8s.core.v1.Namespace('nginx-ingress',
metadata={'name': namespace_name,
'labels': {
'prometheus': 'scrape'}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
nginx_repository = "nginx/nginx-ingress"
nginx_tag = config.get('nginx_tag')
if not nginx_tag:
nginx_tag = "2.4.2"
nginx_tag = "3.2.0"
nginx_plus_flag = config.get_bool('nginx_plus_flag')
if not nginx_plus_flag:
nginx_plus_flag = False
Expand Down Expand Up @@ -59,13 +59,6 @@ def k8_manifest_location():
k8_manifest_path = os.path.join(script_dir, 'manifests', 'regcred.yaml')
return k8_manifest_path


k8_manifest = k8_manifest_location()

registrycred = ConfigFile(
"regcred",
file=k8_manifest)

chart_values = {
'controller': {
'nginxplus': nginx_plus_flag,
Expand All @@ -91,6 +84,7 @@ def k8_manifest_location():
}
},
'service': {
'name': "kic-nginx-ingress",
'annotations': {
'co.elastic.logs/module': 'nginx'
},
Expand Down Expand Up @@ -137,13 +131,19 @@ def k8_manifest_location():
kubeconfig=kubeconfig)

# This is required for the service monitor from the Prometheus namespace
ns = k8s.core.v1.Namespace(resource_name='nginx-ingress',
ns = k8s.core.v1.Namespace('nginx-ingress',
metadata={'name': 'nginx-ingress',
'labels': {
'prometheus': 'scrape'}
},
opts=pulumi.ResourceOptions(provider=k8s_provider))

k8_manifest = k8_manifest_location()

registrycred = ConfigFile(
"regcred",
file=k8_manifest)

kic_release_args = ReleaseArgs(
chart=chart_name,
repository_opts=RepositoryOptsArgs(
Expand Down Expand Up @@ -182,8 +182,11 @@ def k8_manifest_location():
# Some LB's give us a hostname (which is cool) and some just an IP. We need to capture
# both, and then make a determination on what the user needs to do based on what they have
# been given.
#
print("befoe export lb_ingress_hostname")
pulumi.export('lb_ingress_hostname', fqdn)
print("befoe export lb_ingress_ip")
pulumi.export('lb_ingress_ip', pulumi.Output.unsecret(ingress_service.load_balancer.ingress[0].ip))
# Print out our status
print("befoe export kic status")
pulumi.export("kic_status", pstatus)
print("All done")
2 changes: 1 addition & 1 deletion pulumi/python/kubernetes/observability/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def add_namespace(obj):
k8s_provider = k8s.Provider(resource_name=f'ingress-controller', kubeconfig=kubeconfig)

# Create the namespace
ns = k8s.core.v1.Namespace(resource_name='observability',
ns = k8s.core.v1.Namespace('observability',
metadata={'name': 'observability'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
2 changes: 1 addition & 1 deletion pulumi/python/kubernetes/prometheus/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ def extract_adminpass_from_k8s_secrets(secrets: Mapping[str, str]) -> str:
k8s_provider = k8s.Provider(resource_name=f'ingress-controller',
kubeconfig=kubeconfig)

ns = k8s.core.v1.Namespace(resource_name='prometheus',
ns = k8s.core.v1.Namespace('prometheus',
metadata={'name': 'prometheus'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
21 changes: 0 additions & 21 deletions pulumi/python/requirements.txt

This file was deleted.

2 changes: 1 addition & 1 deletion pulumi/python/tools/metallb/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def k8_manifest_location():
k8s_provider = k8s.Provider(resource_name=f'ingress-controller', kubeconfig=kubeconfig)

# Create the namespace for metallb
ns = k8s.core.v1.Namespace(resource_name='metallb-system',
ns = k8s.core.v1.Namespace('metallb-system',
metadata={'name': 'metallb-system'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
2 changes: 1 addition & 1 deletion pulumi/python/tools/nfsvolumes/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def pulumi_kube_project_name():

k8s_provider = k8s.Provider(resource_name=f'ingress-controller', kubeconfig=kubeconfig)

ns = k8s.core.v1.Namespace(resource_name='nfsvols',
ns = k8s.core.v1.Namespace('nfsvols',
metadata={'name': 'nfsvols'},
opts=pulumi.ResourceOptions(provider=k8s_provider))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ def format_registry_url_for_docker_login(self):
# We strip out the path from the URL because it isn't used when logging into a repository
return f'{registry_host_url.scheme}://{registry_host_url.hostname}'

def login_to_registry(self) -> Optional[docker.LoginResult]:
async def login_to_registry(self) -> Optional[docker.LoginResult]:
registry = docker.Registry(registry=self.format_registry_url_for_docker_login(),
username=self.credentials.username,
password=self.credentials.password)

docker.login_to_registry(registry=registry, log_resource=None)
await docker.login_to_registry(registry=registry, log_resource=None)
pulumi.log.info(f'Logged into container registry: {registry.registry}')

if not docker.login_results:
Expand Down
2 changes: 1 addition & 1 deletion pulumi/python/utility/kic-pulumi-utils/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
version_config=True,
packages=['kic_util'],
install_requires=[
'pyyaml>=5.3.1,<6.0', 'passlib>=1.7.4,<2.0.0', 'GitPython>=3.1.18,<3.2.0'
'pyyaml', 'passlib', 'GitPython'
])
Loading