Skip to content
This repository has been archived by the owner on Jul 5, 2021. It is now read-only.

Latest commit

 

History

History
240 lines (175 loc) · 8.8 KB

CONTRIBUTING.md

File metadata and controls

240 lines (175 loc) · 8.8 KB

Contributing

Thank you! 🎉

First of all, thank you for exploring the possibility of contributing to this project.

When contributing to this repository, we would appreciate if you could first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.

Please note we have a code of conduct, please follow it in all your interactions with the project.

Local development

To add new features to this project @riccardomc suggests to develop locally using minikube or k3s (or k3d) to check your changes live. If you have better ideas, feel free to do so and please reach out with suggestions.

Building the code

The build process is entirely automated and it uses the operator-sdk executable.

make docker-build

There's a comprehensive set of unit tests that can be run with:

make test

Use minikube Docker environment

You can use minikube's Docker daemon to build the externalsecret-operator image. In this way the image will be automatically available in your minikube instance.

This flow allows you to deploy your changes with an acceptably short feedback loop:

minikube start --driver=docker
eval $(minikube -p minikube docker-env)
make docker-build
IMG=<name+tag> make deploy

* make your changes *

make docker-build
kubectl get pods -n externalsecret-operator-system | grep externalsecret-operator | awk '{print $1}' | xargs kubectl delete pods

* make more changes *

make docker-build
kubectl get pods -n externalsecret-operator-system | grep externalsecret-operator | awk '{print $1}' | xargs kubectl delete pods

...

Image cache

A similar result can be obtained by building the images using the local Docker daemon and copying images to minikube cache:

make docker-build
minikube cache add containersol/externalsecret-operator
kubectl get pods | grep externalsecret-operator | awk '{print $1}' | xargs kubectl delete pods

or k3d:

make docker-build
k3d import-images --name mycluster containersol/externalsecret-operator
kubectl get pods | grep externalsecret-operator | awk '{print $1}' | xargs kubectl delete pods

Testing and CI/CD

Unit tests and end to end tests are run for each commit. Coverage is calculated and uploaded to codecov by Github Actions.

To run tests and view coverage locally

make test

Kubebuilder at /usr/local/kubebuilder is required and recommended to run the controller suite tests.

To use a local cluster for testing update by uncommenting lines with useExistingCluster := true in controllers/secrets/suite_test.go

%cat controllers/secrets/suite_test.go
...
useExistingCluster := true

By("bootstrapping test environment")
testEnv = &envtest.Environment{
  UseExistingCluster:       &useExistingCluster,
  CRDDirectoryPaths: []string{filepath.Join("..", "..", "config", "crd", "bases")},
  // AttachControlPlaneOutput: true,
}

Docker images

The CI/CD approach is very simple and could use some improvements, for now:

  • Docker images are built on pull request to master with the ref pr-<PR number>
  • Docker images are also built on master and on tags with the ref

Every image generated by the CI/CD flow is pushed to Docker Hub as containersol/externalsecret-operator:tag.

Adding a new backend

Adding a new backend should be relatively straightforward. Use a separate package that implements the Backend interface. The Backend interface implements only a handful of functions and is deliberately kept simple:

type Backend interface {
	Init(map[string]string) error
	Get(string, string) (string, error)
}

Where Init is intended to be used to initialize the Backend using the parameters map passed as arguments. Get is executed to retrieve a secret string based on the strings passed as arguments.

Additionally, backends must be imported in pkg/controller/register.go in order to be registered as available backend.

Check out the dummy backend for a simple example that should get you started.

Pull Request Process

We don't really have strict or automated policies for pull requests. Just try to be nice :)

  1. Ensure any install or build dependencies are removed before the end of the layer when doing a build.
  2. Add a good title and description of your pull request.
  3. Try to add meaningful commit messages and keep the commit history tidy (no wip commit please :)).
  4. Reference the issue you are addressing in your pull request.

Code of Conduct

Our Pledge

In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.

Our Standards

Examples of behavior that contributes to creating a positive environment include:

  • Using welcoming and inclusive language
  • Being respectful of differing viewpoints and experiences
  • Gracefully accepting constructive criticism
  • Focusing on what is best for the community
  • Showing empathy towards other community members

Examples of unacceptable behavior by participants include:

  • The use of sexualized language or imagery and unwelcome sexual attention or advances
  • Trolling, insulting/derogatory comments, and personal or political attacks
  • Public or private harassment
  • Publishing others' private information, such as a physical or electronic address, without explicit permission
  • Other conduct which could reasonably be considered inappropriate in a professional setting

Our Responsibilities

Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.

Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.

Scope

This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.

Enforcement

Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project maintainer @riccardomc. All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.

Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.

Attribution

This Code of Conduct is adapted from the Contributor Covenant, version 1.4, available at http://contributor-covenant.org/version/1/4