Skip to content

Commit

Permalink
Merge branch 'master' of github.com:argoproj/argo-rollouts into analy…
Browse files Browse the repository at this point in the history
…sisRef

Signed-off-by: Zach Aller <[email protected]>
  • Loading branch information
zachaller committed Mar 7, 2024
2 parents 4a88d20 + e184957 commit 6bb8f76
Show file tree
Hide file tree
Showing 60 changed files with 1,374 additions and 813 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
path: coverage.out

- name: Upload code coverage information to codecov.io
uses: codecov/codecov-action@v4.0.1
uses: codecov/codecov-action@v4.1.0
with:
file: coverage.out

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/image-reuse.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ jobs:
cosign-release: 'v2.2.0'

- uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0
- uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0

- name: Setup tags for container image as a CSV type
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # v3.0.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
uses: docker/setup-buildx-action@0d103c3126aa41d772a8362f6aa67afac040f80c # v3.1.0

- name: Generate release artifacts
run: |
Expand Down
3 changes: 2 additions & 1 deletion USERS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
## Who uses Argo Rollouts?
Organizations below are **officially** using Argo Rollouts. Please send a PR with your organization name if you are using Argo Rollouts.

1. [Ada](https://www.ada.cx)
1. [ADP](https://www.adp.com)
1. [Akuity](https://akuity.io/)
1. [Alibaba Group](https://www.alibabagroup.com/)
Expand All @@ -19,6 +20,7 @@ Organizations below are **officially** using Argo Rollouts. Please send a PR wit
1. [Flipkart](https://flipkart.com)
1. [GetYourGuide](https://www.getyourguide.com)
1. [Gllue](https://gllue.com)
1. [HashiCorp](https://www.hashicorp.com/)
1. [Ibotta](https://home.ibotta.com/)
1. [Intuit](https://www.intuit.com/)
1. [New Relic](https://newrelic.com/)
Expand Down Expand Up @@ -48,4 +50,3 @@ Organizations below are **officially** using Argo Rollouts. Please send a PR wit
1. [WeLab Bank](https://www.welab.bank/)
1. [Yotpo](https://www.yotpo.com/)
1. [VGS](https://www.vgs.io)
1. [HashiCorp](https://www.hashicorp.com/)
25 changes: 20 additions & 5 deletions analysis/controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"time"

"github.com/argoproj/argo-rollouts/metric"
jobProvider "github.com/argoproj/argo-rollouts/metricproviders/job"

unstructuredutil "github.com/argoproj/argo-rollouts/utils/unstructured"

Expand Down Expand Up @@ -106,13 +107,13 @@ func NewController(cfg ControllerConfig) *Controller {

cfg.JobInformer.Informer().AddEventHandler(cache.ResourceEventHandlerFuncs{
AddFunc: func(obj any) {
controller.enqueueIfCompleted(obj)
controller.enqueueJobIfCompleted(obj)
},
UpdateFunc: func(oldObj, newObj any) {
controller.enqueueIfCompleted(newObj)
controller.enqueueJobIfCompleted(newObj)
},
DeleteFunc: func(obj any) {
controller.enqueueIfCompleted(obj)
controller.enqueueJobIfCompleted(obj)
},
})

Expand Down Expand Up @@ -186,15 +187,29 @@ func (c *Controller) syncHandler(ctx context.Context, key string) error {
return c.persistAnalysisRunStatus(run, newRun.Status)
}

func (c *Controller) enqueueIfCompleted(obj any) {
func (c *Controller) jobParentNamespace(obj any) string {
job, ok := obj.(*batchv1.Job)
if !ok {
return ""
}
ns := job.GetNamespace()
if job.Annotations != nil {
if job.Annotations[jobProvider.AnalysisRunNamespaceAnnotationKey] != "" {
ns = job.Annotations[jobProvider.AnalysisRunNamespaceAnnotationKey]
}
}
return ns
}

func (c *Controller) enqueueJobIfCompleted(obj any) {
job, ok := obj.(*batchv1.Job)
if !ok {
return
}
for _, condition := range job.Status.Conditions {
switch condition.Type {
case batchv1.JobFailed, batchv1.JobComplete:
controllerutil.EnqueueParentObject(job, register.AnalysisRunKind, c.enqueueAnalysis)
controllerutil.EnqueueParentObject(job, register.AnalysisRunKind, c.enqueueAnalysis, c.jobParentNamespace)
return
}
}
Expand Down
13 changes: 11 additions & 2 deletions cmd/rollouts-controller/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"strings"
"time"

"github.com/argoproj/argo-rollouts/metricproviders"
"github.com/argoproj/argo-rollouts/utils/record"
"github.com/argoproj/pkg/kubeclientmetrics"
smiclientset "github.com/servicemeshinterface/smi-sdk-go/pkg/gen/client/split/clientset/versioned"
Expand Down Expand Up @@ -131,6 +132,7 @@ func newCommand() *cobra.Command {
discoveryClient, err := discovery.NewDiscoveryClientForConfig(config)
checkError(err)
smiClient, err := smiclientset.NewForConfig(config)
checkError(err)
resyncDuration := time.Duration(rolloutResyncPeriod) * time.Second
kubeInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(
kubeClient,
Expand All @@ -140,10 +142,17 @@ func newCommand() *cobra.Command {
instanceIDTweakListFunc := func(options *metav1.ListOptions) {
options.LabelSelector = instanceIDSelector.String()
}
jobKubeClient, err := metricproviders.GetAnalysisJobClientset(kubeClient)
checkError(err)
jobNs := metricproviders.GetAnalysisJobNamespace()
if jobNs == "" {
// if not set explicitly use the configured ns
jobNs = namespace
}
jobInformerFactory := kubeinformers.NewSharedInformerFactoryWithOptions(
kubeClient,
jobKubeClient,
resyncDuration,
kubeinformers.WithNamespace(namespace),
kubeinformers.WithNamespace(jobNs),
kubeinformers.WithTweakListOptions(func(options *metav1.ListOptions) {
options.LabelSelector = jobprovider.AnalysisRunUIDLabelKey
}))
Expand Down
17 changes: 17 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,23 @@ pushed into the other kubernetes repositories yet. In order to import the kubern
associated repos have to pinned to the correct version specified by the kubernetes/kubernetes release. The
`./hack/update-k8s-dependencies.sh` updates all the dependencies to the those correct versions.

## Upgrading Notifications Engine
Argo Rollouts has a dependency on the [argoproj/notifications-engines](https://github.com/argoproj/notifications-engine) repo
for the notifications functionality and related documentation.

This is updated by upgrading the Go library in `go.mod` by running the commands:

```shell
go get github.com/argoproj/notifications-engine@LATEST_COMMIT_HASH
go mod tidy
```

Next the latest notifications documentation can be imported by running:

```shell
make docs
```

## Documentation Changes

Modify contents in `docs/` directory.
Expand Down
3 changes: 3 additions & 0 deletions docs/features/specification.md
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,9 @@ spec:
# will achieve traffic split via a weighted replica counts between
# the canary and stable ReplicaSet.
trafficRouting:
# Supports nginx and plugins only: This lets you control the denominator or total weight of traffic.
# The total weight of traffic. If unspecified, it defaults to 100
maxTrafficWeight: 1000
# This is a list of routes that Argo Rollouts has the rights to manage it is currently only required for
# setMirrorRoute and setHeaderRoute. The order of managedRoutes array also sets the precedence of the route
# in the traffic router. Argo Rollouts will place these routes in the order specified above any routes already
Expand Down
3 changes: 3 additions & 0 deletions docs/features/traffic-management/plugins.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,9 @@ responsibility of the Argo Rollouts administrator to define the plugin installat
* This is just a sample plugin that can be used as a starting point for creating your own plugin.
It is not meant to be used in production. It is based on the built-in prometheus provider.

#### [Consul](https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-consul)
* This is a plugin that allows argo-rollouts to work with Consul's service mesh for traffic shaping patterns.

#### [Contour](https://github.com/argoproj-labs/rollouts-plugin-trafficrouter-contour)
* This is a plugin that allows argo-rollouts to work with contour's resource: HTTPProxy. It enables traffic shaping patterns such as canary releases and more.

Expand Down
10 changes: 5 additions & 5 deletions docs/generated/notification-services/alertmanager.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ You should turn off "send_resolved" or you will receive unnecessary recovery not
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.alertmanager: |
targets:
Expand All @@ -58,7 +58,7 @@ If your alertmanager has changed the default api, you can customize "apiPath".
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.alertmanager: |
targets:
Expand All @@ -70,7 +70,7 @@ data:
### Send high availability alertmanager with auth
Store auth token in `argocd-notifications-secret` Secret and use configure in `argocd-notifications-cm` ConfigMap.
Store auth token in `argo-rollouts-notification-secret` Secret and use configure in `argo-rollouts-notification-configmap` ConfigMap.

```yaml
apiVersion: v1
Expand All @@ -89,7 +89,7 @@ stringData:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.alertmanager: |
targets:
Expand All @@ -110,7 +110,7 @@ data:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.alertmanager: |
targets:
Expand Down
23 changes: 18 additions & 5 deletions docs/generated/notification-services/awssqs.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# AWS SQS
# AWS SQS

## Parameters

This notification service is capable of sending simple messages to AWS SQS queue.
This notification service is capable of sending simple messages to AWS SQS queue.

* `queue` - name of the queue you are intending to send messages to. Can be overridden with target destination annotation.
* `region` - region of the sqs queue can be provided via env variable AWS_DEFAULT_REGION
Expand Down Expand Up @@ -30,7 +30,7 @@ metadata:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.awssqs: |
region: "us-east-2"
Expand Down Expand Up @@ -63,7 +63,7 @@ stringData:
### Minimal configuration using AWS Env variables
Ensure following list of environment variables are injected via OIDC, or other method. And assuming SQS is local to the account.
Ensure the following list of environment variables are injected via OIDC, or another method. And assuming SQS is local to the account.
You may skip usage of secret for sensitive data and omit other parameters. (Setting parameters via ConfigMap takes precedent.)
Variables:
Expand All @@ -89,7 +89,7 @@ metadata:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.awssqs: |
queue: "myqueue"
Expand All @@ -104,3 +104,16 @@ data:
- oncePer: obj.metadata.annotations["generation"]
```
## FIFO SQS Queues
FIFO queues require a [MessageGroupId](https://docs.aws.amazon.com/AWSSimpleQueueService/latest/APIReference/API_SendMessage.html#SQS-SendMessage-request-MessageGroupId) to be sent along with every message, every message with a matching MessageGroupId will be processed one by one in order.
To send to a FIFO SQS Queue you must include a `messageGroupId` in the template such as in the example below:

```yaml
template.deployment-ready: |
message: |
Deployment {{.obj.metadata.name}} is ready!
messageGroupId: {{.obj.metadata.name}}-deployment
```
6 changes: 3 additions & 3 deletions docs/generated/notification-services/email.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ The following snippet contains sample Gmail service configuration:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.email.gmail: |
username: $email-username
Expand All @@ -36,7 +36,7 @@ Without authentication:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.email.example: |
host: smtp.example.com
Expand All @@ -52,7 +52,7 @@ data:
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
template.app-sync-succeeded: |
email:
Expand Down
7 changes: 4 additions & 3 deletions docs/generated/notification-services/github.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ The GitHub notification service changes commit status using [GitHub Apps](https:
3. Generate a private key, and download it automatically
![3](https://user-images.githubusercontent.com/18019529/108397926-d4a36300-725b-11eb-83fe-74795c8c3e03.png)
4. Install app to account
5. Store privateKey in `argocd-notifications-secret` Secret and configure GitHub integration
in `argocd-notifications-cm` ConfigMap
5. Store privateKey in `argo-rollouts-notification-secret` Secret and configure GitHub integration
in `argo-rollouts-notification-configmap` ConfigMap

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.github: |
appID: <app-id>
Expand Down Expand Up @@ -76,6 +76,7 @@ template.app-deployed: |
logURL: "{{.context.argocdUrl}}/applications/{{.app.metadata.name}}?operation=true"
requiredContexts: []
autoMerge: true
transientEnvironment: false
pullRequestComment:
content: |
Application {{.app.metadata.name}} is now running new version of deployments manifests.
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/notification-services/googlechat.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ The Google Chat notification service send message notifications to a google chat
3. Under **Incoming Webhooks**, click **Add Webhook**
4. Give a name to the webhook, optionally add an image and click **Save**
5. Copy the URL next to your webhook
6. Store the URL in `argocd-notification-secret` and declare it in `argocd-notifications-cm`
6. Store the URL in `argocd-notification-secret` and declare it in `argo-rollouts-notification-configmap`

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.googlechat: |
webhooks:
Expand Down
4 changes: 2 additions & 2 deletions docs/generated/notification-services/grafana.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Available parameters :
3. Click "Add API Key"
4. Fill the Key with name `ArgoCD Notification`, role `Editor` and Time to Live `10y` (for example)
5. Click on Add button
6. Store apiKey in `argocd-notifications-secret` Secret and Copy your API Key and define it in `argocd-notifications-cm` ConfigMap
6. Store apiKey in `argo-rollouts-notification-secret` Secret and Copy your API Key and define it in `argo-rollouts-notification-configmap` ConfigMap

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.grafana: |
apiUrl: https://grafana.example.com/api
Expand Down
6 changes: 3 additions & 3 deletions docs/generated/notification-services/mattermost.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@
![1](https://user-images.githubusercontent.com/18019529/111499520-62ed0500-8786-11eb-88b0-d0aade61fed4.png)
2. Invite team
![2](https://user-images.githubusercontent.com/18019529/111500197-1229dc00-8787-11eb-98e5-587ee36c94a9.png)
3. Store token in `argocd-notifications-secret` Secret and configure Mattermost integration
in `argocd-notifications-cm` ConfigMap
3. Store token in `argo-rollouts-notification-secret` Secret and configure Mattermost integration
in `argo-rollouts-notification-configmap` ConfigMap

```yaml
apiVersion: v1
kind: ConfigMap
metadata:
name: <config-map-name>
name: argo-rollouts-notification-configmap
data:
service.mattermost: |
apiURL: <api-url>
Expand Down
Loading

0 comments on commit 6bb8f76

Please sign in to comment.