Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Elaborate on how to enable autologin for ECR #193

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/spec/v1alpha2/imagerepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ type ImageRepositoryStatus struct {
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// CannonicalName is the name of the image repository with all the
// CanonicalImageName is the name of the image repository with all the
// implied bits made explicit; e.g., `docker.io/library/alpine`
// rather than `alpine`.
// +optional
Expand Down
46 changes: 41 additions & 5 deletions docs/spec/v1beta1/imagerepositories.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ type ImageRepositorySpec struct {
```

The `Suspend` field can be set to `true` to stop the controller scanning the image repository
specified; remove the field value or set to `false` to resume scanning.
specified; remove the field value or set it to `false` to resume scanning.

### Authentication

Expand All @@ -77,9 +77,40 @@ For a publicly accessible image repository, you will not need to provide a `secr

When running in [<abbr title="Elastic Kubernetes Service">EKS</abbr>][EKS] and using [<abbr
title="Elastic Container Registry">ECR</abbr>][ECR] to store images, you should be able to rely on
the controller retrieving credentials automatically. The controller must be run with the flag
`--aws-autologin-for-ecr` set for this to work. The advice under "Other platforms" below will also
work for ECR.
the controller retrieving credentials automatically.

The `image-reflector-controller` must be run with the flag `--aws-autologin-for-ecr` set for this to work.

This flag can be added by including a patch in the `kustomization.yaml` overlay file in your `flux-system`,
similar to the process described in [customize Flux manifests][]:

```
patches:
- target:
version: v1
group: apps
kind: Deployment
name: image-reflector-controller
namespace: flux-system
patch: |-
- op: add
path: /spec/template/spec/containers/0/args/-
value: --aws-autologin-for-ecr
```

Alternatively, the advice under [Other platforms][other platforms] below will also work for ECR.

> You need to upgrade to Flux version 2 release [v0.19][Flux v0.19.0] that contains the image-reflector-controller release [v0.13.0][image-reflector-controller v0.13.0].
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

API specs usually don't contain changelogs, what's the reason we add these here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As an experimental feature, I wanted to call out the release version that these docs applied to so that it is clear enough what needs to be updated when changes inevitably happen. (Also, it was a suggestion from @lloydchang)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I suppose the right place for this documentation might actually be here. This section should be updated anyway since it's likely a lot of folks will prefer this method of authentication over the CronJob approach.


> [**Release date**: 2021-10-19][image-reflector-controller v0.13.0]
>
> This prerelease adds experimental support for automatically getting
credentials from AWS when scanning an image in [Elastic Container Registry
(ECR)][ECR].
>
> Improvements:
> * Get credentials from AWS ECR when needed
> [#174][image-reflector-controller#174]

#### Other platforms

Expand Down Expand Up @@ -190,7 +221,7 @@ type ImageRepositoryStatus struct {
// +optional
ObservedGeneration int64 `json:"observedGeneration,omitempty"`

// CannonicalName is the name of the image repository with all the
// CanonicalImageName is the name of the image repository with all the
Copy link
Contributor

@darkowlzz darkowlzz Nov 3, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This section is taken from https://github.com/fluxcd/image-reflector-controller/blob/main/api/v1beta1/imagerepository_types.go#L99 which also has this incorrect name. Can you update that as well and run make manifests to update the same in the CRD spec in config/crd/bases/image.toolkit.fluxcd.io_imagerepositories.yaml?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks like this has been taken care of. I found another CannonicalName in the docs and updated it there 👍

// implied bits made explicit; e.g., `docker.io/library/alpine`
// rather than `alpine`.
// +optional
Expand Down Expand Up @@ -261,3 +292,8 @@ and reference it under `secretRef`.
[sops-guide]: https://toolkit.fluxcd.io/guides/mozilla-sops/
[EKS]: https://docs.aws.amazon.com/eks/latest/userguide/what-is-eks.html
[ECR]: https://docs.aws.amazon.com/AmazonECR/latest/userguide/what-is-ecr.html
[customize Flux manifests]: https://fluxcd.io/docs/installation/#customize-flux-manifests
[other platforms]: https://fluxcd.io/docs/components/image/imagerepositories/#other-platforms
[Flux v0.19.0]: https://github.com/fluxcd/flux2/releases/tag/v0.19.0
[image-reflector-controller v0.13.0]: https://github.com/fluxcd/image-reflector-controller/blob/main/CHANGELOG.md#0130
[image-reflector-controller#174]: https://github.com/fluxcd/image-reflector-controller/pull/174