Flask

  • Canonical IS DevOps
Channel Revision Published Runs on
latest/edge 19 04 Jan 2024
Ubuntu 22.04
juju deploy flask-k8s --channel edge
Show information

Platform:

How to Contribute

Overview

This document explains the processes and practices recommended for contributing enhancements to the Flask operator.

  • Before developing enhancements to this charm, consider opening an issue to explain your use case.
  • If you want to discuss your use-cases or proposed implementation, you can reach us at Canonical Mattermost public channel or Discourse.
  • Familiarizing yourself with the Charmed Operator Framework will be beneficial when working on new features or bug fixes.
  • All enhancements require a review before merging. Code reviews typically examine code quality, test coverage, and user experience for Juju operators of this charm.
  • Please help us ensure easy-to-review branches by rebasing your pull request branch onto the main branch. This also avoids merge commits and creates a linear Git commit history.
  • For additional information on contributing, refer to our Contributing Guide.

Developing

Building from Source

To build and deploy the flask-k8s charm from source, follow the steps below.

Docker Image Build

Build your Flask application image, and to allow microk8s to pick up the locally built image, you must export the image and import it within microk8s.

docker save flask:test > flask.tar && microk8s import flask.tar

Build the Charm

Build the charm locally using charmcraft. It should output a .charm file.

charmcraft pack

Deploy Flask

Deploy the locally built Flask charm with the following command.

juju deploy ./flask-k8s_ubuntu-22.04-amd64_ubuntu-20.04-amd64.charm \
  --resource flask-app-image=localhost:32000/flask:test \
  --resource statsd-prometheus-exporter-image=prom/statsd-exporter

Monitor your local flask-k8s charm’s progress through the stages of the deployment with juju status --watch 2s.

Testing

Use the following commands to run the tests:

  • tox: Runs all of the basic checks (lint, unit, static, and coverage-report).
  • tox -e fmt: Formats the code using black and isort.
  • tox -e lint: Runs a range of static code analyses to check the code.
  • tox -e static: Runs other checks such as bandit for security issues.
  • tox -e unit: Runs the unit tests.
  • tox -e integration: Runs the integration tests. Integration tests require additional arguments depending on the test module.

Canonical Contributor Agreement

Canonical welcomes contributions to the Flask Operator. If you’re interested in contributing to the solution, please check out our contributor agreement.


Help improve this document in the forum (guidelines). Last updated 1 year, 6 months ago.