Skip to content

Commit

Permalink
Merge pull request #437 from Green-Software-Foundation/dev
Browse files Browse the repository at this point in the history
Release 1.2 Merge.  Thank you all for your contributions.
  • Loading branch information
vaughanknight authored Jan 16, 2024
2 parents 30be7e1 + cde43cd commit f8c2b96
Show file tree
Hide file tree
Showing 30 changed files with 573 additions and 360 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/5-publish-helm-chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: 5-Publish Helm chart

on:
workflow_dispatch:

concurrency:
group: publish-helm-chart
cancel-in-progress: true

jobs:
push-helm-charts:
if: github.repository == 'Green-Software-Foundation/carbon-aware-sdk' || vars.ENABLE_HELM_WORKFLOW == 'true'
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- name: Checkout Code
uses: actions/checkout@v3

- name: Detect Helm chart version
run: |
CHART_VERSION=`yq .version helm-chart/Chart.yaml`
echo "CHART_VERSION=$CHART_VERSION" >> "$GITHUB_ENV"
- name: Packaging
run: helm package helm-chart

- name: Log in to the Container registry
uses: docker/[email protected]
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Push charts to GHCR
run: |
OWNER_LOWER=${GITHUB_REPOSITORY_OWNER,,}
helm push carbon-aware-sdk-${{ env.CHART_VERSION }}.tgz "oci://ghcr.io/$OWNER_LOWER/charts"
shell: bash
3 changes: 2 additions & 1 deletion .github/workflows/verify-azure-function-with-packages.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,11 @@ jobs:
continue-on-error: true
run: docker rm -f ${{ env.CONTAINER_RUNTIME_NAME }}

# Build and tag final image, remove dangling images only if there are any
- name: Docker Target Final
run: |
docker build --no-cache . -f ${{ env.DOCKERFILE_PATH }} -t ${{ env.CONTAINER_IMAGE_NAME }}
docker rmi -f $(docker images -f "dangling=true" -q)
docker images -qf dangling=true | xargs --no-run-if-empty docker rmi
- name: Docker Run Container
run: docker run -d --name ${{ env.CONTAINER_RUNTIME_NAME }} -p 8080:80 ${{ env.CONTAINER_IMAGE_NAME }}
Expand Down
40 changes: 39 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,45 @@

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

## [1.1.0] - 2023-18-07
## [1.2.0] - 2024-01

### Added

- [#381 Add Helm chart and workflow](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/381)
- New package release for Helm charts available at https://github.com/Green-Software-Foundation/carbon-aware-sdk/pkgs/container/charts%2Fcarbon-aware-sdk

### Fixed

- [#232 Generating SDK client does not work on linux](https://github.com/Green-Software-Foundation/carbon-aware-sdk/issues/232)
- [#393 Fix: verify-azure-function-with-packages](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/393)
- [#391 fixing 3 broken links in overview.md](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/391)
- [#389 EMFree data source should regard specified time range](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/389)

### Changed

- [#425 Updating CONTRIBUTING.md](https://github.com/Green-Software-Foundation/carbon-aware-sdk/pull/425)

#### API

-

#### API Deployment

-

#### SDK

-


#### Other

- Improved process leveraging the project boards at https://github.com/orgs/Green-Software-Foundation/projects/15/views/2


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+)

## [1.1.0] - 2023-07-18

### Added

Expand Down
48 changes: 40 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,25 +1,52 @@
# GSF Member Contribution Guide

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

**Please contact the project owners for individual contributions. Working Group
meetings and the internal communication channels are only open to GSF Members.**
#### _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._ ####

## Table of Contents

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

## Summary Steps
## Current Opportunities
We have opportunities for both code and non code contributors.

For the following:
We're currently looking for contributions in the following areas:
1. Sample Creation
2. Documentation Updates, including getting docusaurus up and running
3. Video Content Creation (how to enable, demos etc)
4. Slide Deck Creation, available for presenter use, including real time video demo

## How To Get Started
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.
Find the Project Key contacts in the [Confluence page](https://greensoftwarefoundation.atlassian.net/wiki/spaces/~612dd45e45cd76006a84071a/pages/17137665/Opensource+Carbon+Aware+SDK).

If you are a GSF member organisation employee, you should:
Fill out the [Onboarding form](https://greensoftware.foundation/onboarding/) if you are new to the GSF; or
Fill out the [Subscribe form](https://greensoftware.foundation/subscribe/) if you are already part of the GSF but want to join this project.
Following this, you'll receive an invite to join the Carbon Aware SDK Weekly Meeting.
Only members of the foundation can join meetings and internal conversations.

If you are NOT a GSF member organisation employee, individual contributions are still welcome on our public Github repo eg. raising PRs, joining discussions.

Only our Project Leads have the right to merge PRs.

Any questions, email [email protected].

## Code Contribution Steps

For the following code contribution:

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

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

### Project Release Schedule:
At most once per month.
As frequent as possible.
We prioritise Security release over Feature release. Documentation release is not restricted.

## Public Issues

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

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

1. Create a
[new Issue](https://github.com/Green-Software-Foundation/standards_wg/issues/new)
Expand Down
8 changes: 4 additions & 4 deletions docs/architecture/decisions/0010-sdk-packaging.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Accepted
## Context

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

## Decision

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

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

- Continues enhancing the SDK to support integration with different type of
Expand Down
147 changes: 144 additions & 3 deletions docs/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ you different data than the WebAPI for the same query). We provide a number of
different endpoints to provide the most flexibility to integrate to your
environment:

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

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

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

- (Future) You can install the Nuget package and make requests directly.
Expand Down Expand Up @@ -219,3 +219,144 @@ $ curl -s http://localhost:8080/emissions/forecasts/current?location=westus2 | j
For more information on containerization, refer to the markdown in
[containerization.md](./containerization.md).
### Deploy Web API on Kubernetes with Helm
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.
Following command creates `carbon-aware-sdk` namespace and deploys Web API into it with specified `values.yaml`.
```bash
$ helm install casdk -n carbon-aware-sdk --create-namespace oci://ghcr.io/green-software-foundation/charts/carbon-aware-sdk --values values.yaml
```
`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.
```yaml
appsettings: |-
{
"DataSources": {
"EmissionsDataSource": "WattTime",
"ForecastDataSource": "WattTime",
"Configurations": {
"WattTime": {
"Type": "WattTime",
"Username": "username",
"Password": "password",
"BaseURL": "https://api2.watttime.org/v2/"
}
}
}
}
```
Also you can include following configuration into `values.yaml`.
```yaml
# Number of replicas
replicaCount: 1

image:
repository: ghcr.io/green-software-foundation/carbon-aware-sdk
pullPolicy: IfNotPresent
# You can set specified tag (equivalent with the SDK version in here)
tag: latest

# Set the value if you want to override the name.
nameOverride: ""
fullnameOverride: ""

serviceAccount:
# Specifies whether a service account should be created
create: true
# Annotations to add to the service account
annotations: {}
# The name of the service account to use.
# If not set and create is true, a name is generated using the fullname template
name: ""

podAnnotations: {}

podSecurityContext: {}
# fsGroup: 2000

securityContext: {}
# capabilities:
# drop:
# - ALL
# readOnlyRootFilesystem: true
# runAsNonRoot: true
# runAsUser: 1000

service:
type: ClusterIP
port: 80

ingress:
enabled: false
className: ""
annotations: {}
hosts:
- host: carbon-aware-sdk.local
paths:
- path: /
pathType: ImplementationSpecific
tls: []
# - secretName: carbon-aware-sdk-tls
# hosts:
# - carbon-aware-sdk.local

resources: {}
# limits:
# cpu: 100m
# memory: 128Mi
# requests:
# cpu: 100m
# memory: 128Mi

autoscaling:
enabled: false
minReplicas: 1
maxReplicas: 100
targetCPUUtilizationPercentage: 80
# targetMemoryUtilizationPercentage: 80

nodeSelector: {}

tolerations: []

affinity: {}

# appsettings.json
appsettings: |-
{
"DataSources": {
"EmissionsDataSource": "ElectricityMaps",
"ForecastDataSource": "WattTime",
"Configurations": {
"WattTime": {
"Type": "WattTime",
"Username": "username",
"Password": "password",
"BaseURL": "https://api2.watttime.org/v2/",
"Proxy": {
"useProxy": true,
"url": "http://10.10.10.1",
"username": "proxyUsername",
"password": "proxyPassword"
}
},
"ElectricityMaps": {
"Type": "ElectricityMaps",
"APITokenHeader": "auth-token",
"APIToken": "myAwesomeToken",
"BaseURL": "https://api.electricitymap.org/v3/"
}
}
}
}
```
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.
[!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)
4 changes: 2 additions & 2 deletions docs/quickstart.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ Expected output:

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

Expected output:

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

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

Expected output:
Expand Down
File renamed without changes.
Loading

0 comments on commit f8c2b96

Please sign in to comment.