Skip to content

Commit f8c2b96

Browse files
Merge pull request #437 from Green-Software-Foundation/dev
Release 1.2 Merge. Thank you all for your contributions.
2 parents 30be7e1 + cde43cd commit f8c2b96

File tree

30 files changed

+573
-360
lines changed

30 files changed

+573
-360
lines changed
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: 5-Publish Helm chart
2+
3+
on:
4+
workflow_dispatch:
5+
6+
concurrency:
7+
group: publish-helm-chart
8+
cancel-in-progress: true
9+
10+
jobs:
11+
push-helm-charts:
12+
if: github.repository == 'Green-Software-Foundation/carbon-aware-sdk' || vars.ENABLE_HELM_WORKFLOW == 'true'
13+
runs-on: ubuntu-latest
14+
permissions:
15+
contents: read
16+
packages: write
17+
18+
steps:
19+
- name: Checkout Code
20+
uses: actions/checkout@v3
21+
22+
- name: Detect Helm chart version
23+
run: |
24+
CHART_VERSION=`yq .version helm-chart/Chart.yaml`
25+
echo "CHART_VERSION=$CHART_VERSION" >> "$GITHUB_ENV"
26+
27+
- name: Packaging
28+
run: helm package helm-chart
29+
30+
- name: Log in to the Container registry
31+
uses: docker/[email protected]
32+
with:
33+
registry: ghcr.io
34+
username: ${{ github.actor }}
35+
password: ${{ github.token }}
36+
37+
- name: Push charts to GHCR
38+
run: |
39+
OWNER_LOWER=${GITHUB_REPOSITORY_OWNER,,}
40+
helm push carbon-aware-sdk-${{ env.CHART_VERSION }}.tgz "oci://ghcr.io/$OWNER_LOWER/charts"
41+
shell: bash

.github/workflows/verify-azure-function-with-packages.yaml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,11 @@ jobs:
2626
continue-on-error: true
2727
run: docker rm -f ${{ env.CONTAINER_RUNTIME_NAME }}
2828

29+
# Build and tag final image, remove dangling images only if there are any
2930
- name: Docker Target Final
3031
run: |
3132
docker build --no-cache . -f ${{ env.DOCKERFILE_PATH }} -t ${{ env.CONTAINER_IMAGE_NAME }}
32-
docker rmi -f $(docker images -f "dangling=true" -q)
33+
docker images -qf dangling=true | xargs --no-run-if-empty docker rmi
3334
3435
- name: Docker Run Container
3536
run: docker run -d --name ${{ env.CONTAINER_RUNTIME_NAME }} -p 8080:80 ${{ env.CONTAINER_IMAGE_NAME }}

CHANGELOG.md

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,45 @@
22

33
All notable changes to the Carbon Aware SDK will be documented in this file.
44

5-
## [1.1.0] - 2023-18-07
5+
## [1.2.0] - 2024-01
6+
7+
### Added
8+
9+
- [#381 Add Helm chart and workflow](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/381)
10+
- New package release for Helm charts available at https://github.com/Green-Software-Foundation/carbon-aware-sdk/pkgs/container/charts%2Fcarbon-aware-sdk
11+
12+
### Fixed
13+
14+
- [#232 Generating SDK client does not work on linux](https://github.com/Green-Software-Foundation/carbon-aware-sdk/issues/232)
15+
- [#393 Fix: verify-azure-function-with-packages](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/393)
16+
- [#391 fixing 3 broken links in overview.md](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/391)
17+
- [#389 EMFree data source should regard specified time range](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/389)
18+
19+
### Changed
20+
21+
- [#425 Updating CONTRIBUTING.md](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/425)
22+
23+
#### API
24+
25+
-
26+
27+
#### API Deployment
28+
29+
-
30+
31+
#### SDK
32+
33+
-
34+
35+
36+
#### Other
37+
38+
- Improved process leveraging the project boards at https://github.com/orgs/Green-Software-Foundation/projects/15/views/2
39+
40+
41+
For more details, checkout [https://github.com/Green-Software-Foundation/carbon-aware-sdk/issues/232](https://github.com/Green-Software-Foundation/carbon-aware-sdk/issues?q=label%3Av1.2+is%3Aclosed+)
42+
43+
## [1.1.0] - 2023-07-18
644

745
### Added
846

CONTRIBUTING.md

Lines changed: 40 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,52 @@
11
# GSF Member Contribution Guide
22

3-
Welcome to the GSF Carbon Aware SDK, and thank you for contributing to this
3+
Welcome to the GSF Carbon Aware SDK, and thank you for your interest in contributing to this
44
project. This guide outlines the steps for working within the Carbon Aware SDK
55
and the approved contribution process that members should follow.
66

7-
**Please contact the project owners for individual contributions. Working Group
8-
meetings and the internal communication channels are only open to GSF Members.**
7+
#### _Before contributing, please read the [GSF Opensource Working Group charter](https://github.com/Green-Software-Foundation/charter/blob/main/charter.md). Any contributions must comply with the charter._ ####
98

109
## Table of Contents
1110

1211
- [GSF Member Contribution Guide](#gsf-member-contribution-guide)
1312
- [Table of Contents](#table-of-contents)
14-
- [Summary Steps](#summary-steps)
13+
- [Current Opportunities](#current-opportunities)
14+
- [How To Get Started](#how-to-get-started)
15+
- [Code Contribution Steps](#code-contribution-steps)
1516
- [Public Issues](#public-issues)
17+
- [Collaborating with the OSWG](#collaborating-with-the-opensource-working-group)
1618

17-
## Summary Steps
19+
## Current Opportunities
20+
We have opportunities for both code and non code contributors.
1821

19-
For the following:
22+
We're currently looking for contributions in the following areas:
23+
1. Sample Creation
24+
2. Documentation Updates, including getting docusaurus up and running
25+
3. Video Content Creation (how to enable, demos etc)
26+
4. Slide Deck Creation, available for presenter use, including real time video demo
27+
28+
## How To Get Started
29+
Introduce yourself on on our [discussions page](https://github.com/orgs/Green-Software-Foundation/discussions/65) and let us know where you think you can help.
30+
Find the Project Key contacts in the [Confluence page](https://greensoftwarefoundation.atlassian.net/wiki/spaces/~612dd45e45cd76006a84071a/pages/17137665/Opensource+Carbon+Aware+SDK).
31+
32+
If you are a GSF member organisation employee, you should:
33+
Fill out the [Onboarding form](https://greensoftware.foundation/onboarding/) if you are new to the GSF; or
34+
Fill out the [Subscribe form](https://greensoftware.foundation/subscribe/) if you are already part of the GSF but want to join this project.
35+
Following this, you'll receive an invite to join the Carbon Aware SDK Weekly Meeting.
36+
Only members of the foundation can join meetings and internal conversations.
37+
38+
If you are NOT a GSF member organisation employee, individual contributions are still welcome on our public Github repo eg. raising PRs, joining discussions.
39+
40+
Only our Project Leads have the right to merge PRs.
41+
42+
Any questions, email [email protected].
43+
44+
## Code Contribution Steps
45+
46+
For the following code contribution:
2047

2148
"Member and "Contributor" refer to the GSF member looking to make a feature
22-
contribution. "Chair" refers to the Chair, Co-Chair or other accountable
49+
code contribution. "Chair" refers to the Chair, Co-Chair or other accountable
2350
authority within GSF.
2451

2552
1. Submit a Public Issue using the Issue Template
@@ -34,6 +61,11 @@ authority within GSF.
3461
for Review" state
3562
7. If the Chair accepts the PR, it merges into `GSF/carbon-aware-sdk/dev`
3663

64+
### Project Release Schedule:
65+
At most once per month.
66+
As frequent as possible.
67+
We prioritise Security release over Feature release. Documentation release is not restricted.
68+
3769
## Public Issues
3870

3971
All contributions to the GSF are tracked through public issues. Please make a
@@ -43,7 +75,7 @@ issue serves as a commitment by the contributor to developing the feature.
4375
The Issue is **not** a feature request, but tracks expected feature work. Please
4476
do **not** open an issue to request features.
4577

46-
## Collaborating With the WG
78+
## Collaborating With The [Opensource Working Group](https://github.com/Green-Software-Foundation/opensource-wg)
4779

4880
1. Create a
4981
[new Issue](https://github.com/Green-Software-Foundation/standards_wg/issues/new)

docs/architecture/decisions/0010-sdk-packaging.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ Accepted
1111
## Context
1212

1313
Current GSF CarbonAware software can't be consumed as
14-
[Nuget](https://www.nuget.org) Packages in case there is an application that
15-
requires to integrate with it. There are scenerarios where the current runtimes
14+
[Nuget](https://www.nuget.org) packages in case there is an application that
15+
requires to integrate with it. There are scenarios where the current runtimes
1616
(CLI/WebApi) environments are not allowed to be used since all the functionality
1717
requires to be bundled together. The goal of this proposal is to show that the
1818
current GSF repository can provide a mechanism to generate `Nuget` packages that
@@ -21,7 +21,7 @@ can be consumed by any application that wants to integrate with
2121

2222
## Decision
2323

24-
Having nuget packages available to be consumed by 3rd party application would
24+
Having Nuget packages available to be consumed by 3rd party application would
2525
help to integrate easily and it would open the possibilities to extend the SDK
2626
more. Currently there are seven (7) `dotnet` projects that can be set to be
2727
packaged with tools like `dotnet pack` or `msbuild -t:pack`.
@@ -37,7 +37,7 @@ packaged with tools like `dotnet pack` or `msbuild -t:pack`.
3737
| CarbonAware.LocationSources |
3838
| CarbonAware.Tools.WattTimeClient |
3939

40-
**[Must Address]** Creation of a minimum set of packages that can be integrate
40+
**[Must Address]** Creation of a minimum set of packages that can be integrated
4141
with a 3rd party application.
4242

4343
- Continues enhancing the SDK to support integration with different type of

docs/overview.md

Lines changed: 144 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ you different data than the WebAPI for the same query). We provide a number of
66
different endpoints to provide the most flexibility to integrate to your
77
environment:
88

9-
- You can run the application using the [CLI](./src/CarbonAware.CLI) and refer
9+
- You can run the application using the [CLI](../src/CarbonAware.CLI) and refer
1010
to more documentation [here](./carbon-aware-cli.md).
1111

12-
- You can build a container containing the [WebAPI](./src/CarbonAware.WebApi)
12+
- You can build a container containing the [WebAPI](../src/CarbonAware.WebApi)
1313
and connect via REST requests and refer to more documentation
1414
[here](./carbon-aware-webapi.md).
1515

16-
- You can reference the [Carbon Aware C# Library](./src/GSF.CarbonAware) in your
16+
- You can reference the [Carbon Aware C# Library](../src/GSF.CarbonAware) in your
1717
projects and make use of its functionalities and features.
1818

1919
- (Future) You can install the Nuget package and make requests directly.
@@ -219,3 +219,144 @@ $ curl -s http://localhost:8080/emissions/forecasts/current?location=westus2 | j
219219
220220
For more information on containerization, refer to the markdown in
221221
[containerization.md](./containerization.md).
222+
223+
### Deploy Web API on Kubernetes with Helm
224+
225+
You can deploy Web API as a Kubernetes application via Helm. GSF provides a chart as an OCI container, so you have to use Helm v3.8.0 or later.
226+
227+
Following command creates `carbon-aware-sdk` namespace and deploys Web API into it with specified `values.yaml`.
228+
229+
```bash
230+
$ helm install casdk -n carbon-aware-sdk --create-namespace oci://ghcr.io/green-software-foundation/charts/carbon-aware-sdk --values values.yaml
231+
```
232+
233+
`values.yaml` should contain `appsettings.json` which would be used in Web API at least. It should include data source definitions and their credentials. It would be stored as `Secret` resource.
234+
235+
```yaml
236+
appsettings: |-
237+
{
238+
"DataSources": {
239+
"EmissionsDataSource": "WattTime",
240+
"ForecastDataSource": "WattTime",
241+
"Configurations": {
242+
"WattTime": {
243+
"Type": "WattTime",
244+
"Username": "username",
245+
"Password": "password",
246+
"BaseURL": "https://api2.watttime.org/v2/"
247+
}
248+
}
249+
}
250+
}
251+
```
252+
253+
Also you can include following configuration into `values.yaml`.
254+
255+
```yaml
256+
# Number of replicas
257+
replicaCount: 1
258+
259+
image:
260+
repository: ghcr.io/green-software-foundation/carbon-aware-sdk
261+
pullPolicy: IfNotPresent
262+
# You can set specified tag (equivalent with the SDK version in here)
263+
tag: latest
264+
265+
# Set the value if you want to override the name.
266+
nameOverride: ""
267+
fullnameOverride: ""
268+
269+
serviceAccount:
270+
# Specifies whether a service account should be created
271+
create: true
272+
# Annotations to add to the service account
273+
annotations: {}
274+
# The name of the service account to use.
275+
# If not set and create is true, a name is generated using the fullname template
276+
name: ""
277+
278+
podAnnotations: {}
279+
280+
podSecurityContext: {}
281+
# fsGroup: 2000
282+
283+
securityContext: {}
284+
# capabilities:
285+
# drop:
286+
# - ALL
287+
# readOnlyRootFilesystem: true
288+
# runAsNonRoot: true
289+
# runAsUser: 1000
290+
291+
service:
292+
type: ClusterIP
293+
port: 80
294+
295+
ingress:
296+
enabled: false
297+
className: ""
298+
annotations: {}
299+
hosts:
300+
- host: carbon-aware-sdk.local
301+
paths:
302+
- path: /
303+
pathType: ImplementationSpecific
304+
tls: []
305+
# - secretName: carbon-aware-sdk-tls
306+
# hosts:
307+
# - carbon-aware-sdk.local
308+
309+
resources: {}
310+
# limits:
311+
# cpu: 100m
312+
# memory: 128Mi
313+
# requests:
314+
# cpu: 100m
315+
# memory: 128Mi
316+
317+
autoscaling:
318+
enabled: false
319+
minReplicas: 1
320+
maxReplicas: 100
321+
targetCPUUtilizationPercentage: 80
322+
# targetMemoryUtilizationPercentage: 80
323+
324+
nodeSelector: {}
325+
326+
tolerations: []
327+
328+
affinity: {}
329+
330+
# appsettings.json
331+
appsettings: |-
332+
{
333+
"DataSources": {
334+
"EmissionsDataSource": "ElectricityMaps",
335+
"ForecastDataSource": "WattTime",
336+
"Configurations": {
337+
"WattTime": {
338+
"Type": "WattTime",
339+
"Username": "username",
340+
"Password": "password",
341+
"BaseURL": "https://api2.watttime.org/v2/",
342+
"Proxy": {
343+
"useProxy": true,
344+
"url": "http://10.10.10.1",
345+
"username": "proxyUsername",
346+
"password": "proxyPassword"
347+
}
348+
},
349+
"ElectricityMaps": {
350+
"Type": "ElectricityMaps",
351+
"APITokenHeader": "auth-token",
352+
"APIToken": "myAwesomeToken",
353+
"BaseURL": "https://api.electricitymap.org/v3/"
354+
}
355+
}
356+
}
357+
}
358+
```
359+
360+
The video in below is demonstration to install Carbon Aware SDK via Helm. Note that installing the SDK from local directory ( ~/github-forked/carbon-aware-sdk/helm-chart ), not an OCI container.
361+
362+
[!Demonstration to intall Carbon Aware SDK from local with Helm](https://github.com/Green-Software-Foundation/carbon-aware-sdk/assets/7421132/b09d8ab1-642b-442a-882f-abc802153070)

docs/quickstart.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ Expected output:
9696

9797
For example, to get emissions in the `eastus` and `uksouth` region between
9898
`2022-08-23 at 11:15am` and `2022-08-23 at 11:20am`, run:
99-
`dotnet run -l eastus,uksouth -t 2022-08-23T11:15 --toTime 2022-08-23T11:20`
99+
`dotnet run emissions -l eastus,uksouth -s 2022-08-23T11:15 -e 2022-08-23T11:20`
100100

101101
Expected output:
102102

@@ -147,7 +147,7 @@ hour window on the 23rd of August in the regions: `eastus`, `westus`,
147147
`westus3`,`uksouth`, run the command:
148148

149149
```bash
150-
dotnet run -l eastus,westus,westus3,uksouth -t 2022-08-23T00:00 --toTime 2022-08-23T23:59 --best
150+
dotnet run -l eastus,westus,westus3,uksouth -s 2022-08-23T00:00 -e 2022-08-23T23:59 --best
151151
```
152152

153153
Expected output:
File renamed without changes.

0 commit comments

Comments
 (0)