Skip to content

Commit

Permalink
Merge pull request #84 from francescotimperi/aks-test
Browse files Browse the repository at this point in the history
Fix for AKS missing events
  • Loading branch information
francescotimperi authored Jul 23, 2023
2 parents 77e5c38 + ca09824 commit ff70c80
Show file tree
Hide file tree
Showing 7 changed files with 556 additions and 507 deletions.
2 changes: 1 addition & 1 deletion deploy/nuvolaris-permissions/whisk-crd.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ spec:
- http
- https
kube:
description: label representing the kubernetes runtime used to implement specific logic (kind, eks, aks, lks, microk8s, k3s, openshift). Defaulted to detect which is causing the operator to autodetect the k8s runtime.
description: label representing the kubernetes runtime used to implement specific logic (kind, eks, aks, lks, microk8s, k3s, openshift). Defaulted to auto which is causing the operator to autodetect the k8s runtime.
type: string
storageclass:
description: allow to set a defined storage class. Default to auto which will force the operator to autodetect the storage class.
Expand Down
18 changes: 10 additions & 8 deletions nuvolaris/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ def configure(spec: dict):

#forces autodetect of kube if not provided
if not exists('nuvolaris.kube'):
put('nuvolaris.kube','detect')
put('nuvolaris.kube','auto')

return True

Expand Down Expand Up @@ -78,15 +78,15 @@ def keys(prefix=""):
return res

def detect_labels(labels=None):
# read labels if not available
if not labels:
import nuvolaris.kube as kube
labels = kube.kubectl("get", "nodes", jsonpath='{.items[].metadata.labels}')

# skip autodetection of nuvolaris.kube if already available in _config
if exists('nuvolaris.kube') and get('nuvolaris.kube') != 'detect':
if exists('nuvolaris.kube') and get('nuvolaris.kube') != 'auto':
logging.info(f"*** configuration provided already a nuvolaris.kube={get('nuvolaris.kube')}")
return {}

# read labels if not available
if not labels:
import nuvolaris.kube as kube
labels = kube.kubectl("get", "nodes", jsonpath='{.items[].metadata.labels}')

res = {}
kube = None
Expand Down Expand Up @@ -123,8 +123,10 @@ def detect_labels(labels=None):
if kube:
res["nuvolaris.kube"] = kube
_config["nuvolaris.kube"] = kube
return res

if not "nuvolaris.kube" in _config:
# defaults to generic if it is not yet detected
if exists('nuvolaris.kube') and get('nuvolaris.kube') == 'auto':
_config["nuvolaris.kube"] = "generic"
res["nuvolaris.kube"] = "generic"

Expand Down
2 changes: 1 addition & 1 deletion nuvolaris/endpoint.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ def patch(status, action, owner=None):
status['whisk_create']['endpoint']='updated'

logging.info(msg)
logging.info(f"*** hanlded request to {action} endpoint")
logging.info(f"*** handled request to {action} endpoint")
except Exception as e:
logging.error('*** failed to update endpoint: %s' % e)
status['whisk_create']['endpoint']='error'
2 changes: 1 addition & 1 deletion nuvolaris/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -294,7 +294,7 @@ def runtimes_filter(name, type, **kwargs):

@kopf.on.event("configmap", when=runtimes_filter)
def runtimes_cm_event_watcher(event, **kwargs):
logging.info("*** deteched a change in cm/openwhisk-runtimes config map, restarting openwhisk related PODs")
logging.info("*** detected a change in cm/openwhisk-runtimes config map, restarting openwhisk related PODs")
owner = kube.get(f"wsk/controller")

if cfg.get('components.openwhisk'):
Expand Down
1,016 changes: 532 additions & 484 deletions poetry.lock

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ authors = ["Michele Sciabarra <[email protected]>"]

[tool.poetry.dependencies]
python = "^3.9"
kopf = {extras = ["full-auth"], version = "^1.35.3"}
kopf = {extras = ["full-auth"], version = "^1.36.1"}
PyYAML = "^6.0"
pykube = "^0.15.0"
Jinja2 = "^3.0.3"
Expand Down
21 changes: 10 additions & 11 deletions tests/generic/whisk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,9 @@ metadata:
name: controller
namespace: nuvolaris
spec:
#nuvolaris:
#apihost: apidev.nuvolaris.io
#apiport: 80
#protocol: http
nuvolaris:
apihost: auto
kube: auto
components:
# start openwhisk controller
openwhisk: true
Expand All @@ -35,19 +34,19 @@ spec:
# start kafka
kafka: false
# start mongodb
mongodb: true
mongodb: false
# start redis
redis: true
redis: false
# start cron based action parser
cron: true
cron: false
# tls enabled or not
tls: false
# minio enabled or not
minio: true
minio: false
# minio static enabled or not
static: true
static: false
# postgres enabled or not
postgres: true
postgres: false
openwhisk:
namespaces:
whisk-system: 789c46b1-71f6-4ed5-8c54-816aa4f8c502:abcfO3xZCLrMN6v2BKK1dXYFpXlPkccOFqm12CdAsMgRU4VrNZ9lyGVCGuMDGIwP
Expand All @@ -72,7 +71,7 @@ spec:
schedule: "* * * * *"
tls:
acme-registered-email: [email protected]
acme-server-url: https://acme-staging-v02.api.letsencrypt.org/directory
acme-server-url: https://acme-v02.api.letsencrypt.org/directory
configs:
limits:
actions:
Expand Down

0 comments on commit ff70c80

Please sign in to comment.