diff --git a/python3-k8sapp-kubernetes-power-manager/debian/deb_folder/changelog b/python3-k8sapp-kubernetes-power-manager/debian/deb_folder/changelog index 284c3e9..a586749 100644 --- a/python3-k8sapp-kubernetes-power-manager/debian/deb_folder/changelog +++ b/python3-k8sapp-kubernetes-power-manager/debian/deb_folder/changelog @@ -1,3 +1,9 @@ +python3-k8sapp-kubernetes-power-manager (1.2-1) unstable; urgency=medium + + * File location changes + + -- Eduardo Alberti Tue, 1 Oct 2024 12:00:00 -0300 + python3-k8sapp-kubernetes-power-manager (1.2-0) unstable; urgency=medium * Change reserved cores profile diff --git a/python3-k8sapp-kubernetes-power-manager/debian/meta_data.yaml b/python3-k8sapp-kubernetes-power-manager/debian/meta_data.yaml index dd428a4..97cc78d 100644 --- a/python3-k8sapp-kubernetes-power-manager/debian/meta_data.yaml +++ b/python3-k8sapp-kubernetes-power-manager/debian/meta_data.yaml @@ -1,6 +1,6 @@ --- debname: python3-k8sapp-kubernetes-power-manager -debver: 1.2-0 +debver: 1.2-1 src_path: k8sapp_kubernetes_power_manager revision: dist: $STX_DIST diff --git a/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/common/constants.py b/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/common/constants.py index 599c13a..fe3b058 100644 --- a/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/common/constants.py +++ b/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/common/constants.py @@ -20,6 +20,112 @@ HELM_APP_KUBERNETES_POWER_MANAGER_CRD_TIMEOFDAYCRONJOBS = 'timeofdaycronjobs.pow HELM_APP_KUBERNETES_POWER_MANAGER_CRD_TIMEOFDAYS = 'timeofdays.power.intel.com' HELM_APP_KUBERNETES_POWER_MANAGER_CRD_UNCORES = 'uncores.power.intel.com' +POWERWORKLOADS_PATCH = """ # noqa: E501 +spec: + versions: + - name: v1 + schema: + openAPIV3Schema: + description: PowerWorkload is the Schema for the powerworkloads API + properties: + apiVersion: + description: 'APIVersion defines the versioned schema of this representation + of an object. Servers should convert recognized schemas to the latest + internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' + type: string + kind: + description: 'Kind is a string value representing the REST resource this + object represents. Servers may infer this from the endpoint the client + submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' + type: string + metadata: + type: object + spec: + description: PowerWorkloadSpec defines the desired state of PowerWorkload + properties: + allCores: + description: AllCores determines if the Workload is to be applied + to all cores (i.e. use the Default Workload) + type: boolean + name: + description: The name of the workload + type: string + powerNodeSelector: + additionalProperties: + type: string + description: The labels signifying the nodes the user wants to use + type: object + powerProfile: + description: PowerProfile is the Profile that this PowerWorkload is + based on + type: string + reservedCPUs: + description: Reserved CPUs are the CPUs that have been reserved by + Kubelet for use by the Kubernetes admin process This list must match + the list in the user's Kubelet configuration + items: + properties: + cores: + items: + type: integer + type: array + powerProfile: + type: string + required: + - cores + type: object + type: array + workloadNodes: + properties: + containers: + items: + properties: + exclusiveCpus: + description: The exclusive CPUs given to this Container + items: + type: integer + type: array + id: + description: The ID of the Container + type: string + name: + description: The name of the Container + type: string + pod: + description: The name of the Pod the Container is running + on + type: string + powerProfile: + description: The PowerProfile that the Container is utilizing + type: string + workload: + description: The PowerWorkload that the Container is utilizing + type: string + type: object + type: array + cpuIds: + items: + type: integer + type: array + name: + type: string + type: object + required: + - name + type: object + status: + description: PowerWorkloadStatus defines the observed state of PowerWorkload + properties: + 'node:': + description: The Node that this Shared PowerWorkload is associated + with + type: string + type: object + type: object + served: true + storage: true +""" + HELM_APP_KUBERNETES_POWER_MANAGER_CRDS = [ HELM_APP_KUBERNETES_POWER_MANAGER_CRD_CSTATES, HELM_APP_KUBERNETES_POWER_MANAGER_CRD_POWERCONFIGS, @@ -45,5 +151,3 @@ HELM_CHART_NFD = 'node-feature-discovery' APPLICATION_CSTATE = "C1" CSTATE_C0 = "POLL" PLATFORM_CSTATE = "C6" - -PATCH_FILE = "/tmp/workloadPatch.yaml" diff --git a/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/lifecycle/lifecycle_kubernetes_power_manager.py b/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/lifecycle/lifecycle_kubernetes_power_manager.py index 5788443..d22ba31 100644 --- a/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/lifecycle/lifecycle_kubernetes_power_manager.py +++ b/python3-k8sapp-kubernetes-power-manager/k8sapp_kubernetes_power_manager/k8sapp_kubernetes_power_manager/lifecycle/lifecycle_kubernetes_power_manager.py @@ -252,8 +252,7 @@ class KubernetesPowerManagerAppLifecycleOperator(base.AppLifecycleOperator): LOG.debug(f"Running app update to {app.version} version") try: - file = open(app_constants.PATCH_FILE, "r") - body = yaml.safe_load(file.read()) + body = yaml.safe_load(app_constants.POWERWORKLOADS_PATCH) k8s_client_ext = app_op._kube._get_kubernetesclient_extensions() k8s_client_ext.patch_custom_resource_definition( @@ -261,12 +260,6 @@ class KubernetesPowerManagerAppLifecycleOperator(base.AppLifecycleOperator): HELM_APP_KUBERNETES_POWER_MANAGER_CRD_POWERWORKLOADS), body=body, ) - except yaml.YAMLError: - LOG.error(f"An error occurred during {app_constants.PATCH_FILE} " - "yaml reading.") - except FileNotFoundError: - LOG.error(f"The existence of {app_constants.PATCH_FILE} " - "was expected") except Exception as ex: LOG.error("Failed to path PowerWorkload resource " "during app update." diff --git a/stx-kubernetes-power-manager/debian/deb_folder/changelog b/stx-kubernetes-power-manager/debian/deb_folder/changelog index 30e3dd1..4bacb88 100644 --- a/stx-kubernetes-power-manager/debian/deb_folder/changelog +++ b/stx-kubernetes-power-manager/debian/deb_folder/changelog @@ -1,3 +1,9 @@ +stx-kubernetes-power-manager (1.1-1) unstable; urgency=medium + + * File location changes + + -- Eduardo Alberti Tue, 1 Oct 2024 12:00:00 +0000 + stx-kubernetes-power-manager (1.1-0) unstable; urgency=medium * Renaming package according to the new app structure. diff --git a/stx-kubernetes-power-manager/debian/deb_folder/rules b/stx-kubernetes-power-manager/debian/deb_folder/rules index 88855d3..98fe77f 100644 --- a/stx-kubernetes-power-manager/debian/deb_folder/rules +++ b/stx-kubernetes-power-manager/debian/deb_folder/rules @@ -57,7 +57,6 @@ override_dh_auto_install: # Install the app tar file. install -d -m 755 $(APP_FOLDER) install -p -D -m 755 $(APP_TARBALL) $(APP_FOLDER) - install -p -D -m 755 files/workloadPatch.yaml $(ROOT)/tmp/workloadPatch.yaml override_dh_auto_test: diff --git a/stx-kubernetes-power-manager/debian/deb_folder/stx-kubernetes-power-manager.install b/stx-kubernetes-power-manager/debian/deb_folder/stx-kubernetes-power-manager.install index 09642a1..1b47c6e 100644 --- a/stx-kubernetes-power-manager/debian/deb_folder/stx-kubernetes-power-manager.install +++ b/stx-kubernetes-power-manager/debian/deb_folder/stx-kubernetes-power-manager.install @@ -1,2 +1 @@ usr/local/share/applications/helm/* -tmp/* diff --git a/stx-kubernetes-power-manager/debian/meta_data.yaml b/stx-kubernetes-power-manager/debian/meta_data.yaml index 4bca7be..5d8a616 100644 --- a/stx-kubernetes-power-manager/debian/meta_data.yaml +++ b/stx-kubernetes-power-manager/debian/meta_data.yaml @@ -4,7 +4,7 @@ # --- debname: stx-kubernetes-power-manager -debver: 1.1-0 +debver: 1.1-1 src_path: stx-kubernetes-power-manager revision: dist: $STX_DIST diff --git a/stx-kubernetes-power-manager/stx-kubernetes-power-manager/files/workloadPatch.yaml b/stx-kubernetes-power-manager/stx-kubernetes-power-manager/files/workloadPatch.yaml deleted file mode 100644 index 78b0a97..0000000 --- a/stx-kubernetes-power-manager/stx-kubernetes-power-manager/files/workloadPatch.yaml +++ /dev/null @@ -1,103 +0,0 @@ -spec: - versions: - - name: v1 - schema: - openAPIV3Schema: - description: PowerWorkload is the Schema for the powerworkloads API - properties: - apiVersion: - description: 'APIVersion defines the versioned schema of this representation - of an object. Servers should convert recognized schemas to the latest - internal value, and may reject unrecognized values. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources' - type: string - kind: - description: 'Kind is a string value representing the REST resource this - object represents. Servers may infer this from the endpoint the client - submits requests to. Cannot be updated. In CamelCase. More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds' - type: string - metadata: - type: object - spec: - description: PowerWorkloadSpec defines the desired state of PowerWorkload - properties: - allCores: - description: AllCores determines if the Workload is to be applied - to all cores (i.e. use the Default Workload) - type: boolean - name: - description: The name of the workload - type: string - powerNodeSelector: - additionalProperties: - type: string - description: The labels signifying the nodes the user wants to use - type: object - powerProfile: - description: PowerProfile is the Profile that this PowerWorkload is - based on - type: string - reservedCPUs: - description: Reserved CPUs are the CPUs that have been reserved by - Kubelet for use by the Kubernetes admin process This list must match - the list in the user's Kubelet configuration - items: - properties: - cores: - items: - type: integer - type: array - powerProfile: - type: string - required: - - cores - type: object - type: array - workloadNodes: - properties: - containers: - items: - properties: - exclusiveCpus: - description: The exclusive CPUs given to this Container - items: - type: integer - type: array - id: - description: The ID of the Container - type: string - name: - description: The name of the Container - type: string - pod: - description: The name of the Pod the Container is running - on - type: string - powerProfile: - description: The PowerProfile that the Container is utilizing - type: string - workload: - description: The PowerWorkload that the Container is utilizing - type: string - type: object - type: array - cpuIds: - items: - type: integer - type: array - name: - type: string - type: object - required: - - name - type: object - status: - description: PowerWorkloadStatus defines the observed state of PowerWorkload - properties: - 'node:': - description: The Node that this Shared PowerWorkload is associated - with - type: string - type: object - type: object - served: true - storage: true