Skip to content
This repository has been archived by the owner on Feb 27, 2023. It is now read-only.

Adds Envoy DaemonSet Support #44

Merged
merged 1 commit into from
Oct 19, 2020
Merged

Conversation

danehans
Copy link
Contributor

Adds support for managing Envoy through a DaemonSet resource.

Fixes #40

/assign @jpeach @stevesloka @skriss
/cc @Miciah

Copy link
Member

@stevesloka stevesloka left a comment

Choose a reason for hiding this comment

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

Overall looks good to me, just a question on the source for the images.

Also, would be nice to get the license headers in here now for all new code (and use #11 to follow up on previous files).

metricsAddr string
enableLeaderElection bool
)

func main() {
flag.StringVar(&image, "image", "docker.io/projectcontour/contour:latest", "The image used for the managed Contour.")
flag.StringVar(&contourImage, "contour-image", "docker.io/projectcontour/contour:main",
Copy link
Member

Choose a reason for hiding this comment

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

So does this define the default for the operator? Meaning, if I create a new "contour" CRD, then this is what is used if not specified?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@stevesloka that is correct.

flag.StringVar(&image, "image", "docker.io/projectcontour/contour:latest", "The image used for the managed Contour.")
flag.StringVar(&contourImage, "contour-image", "docker.io/projectcontour/contour:main",
"The container image used for the managed Contour.")
flag.StringVar(&envoyImage, "envoy-image", "docker.io/envoyproxy/envoy:v1.15.1",
Copy link
Member

Choose a reason for hiding this comment

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

Same here as previous question with Contour image.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Same answer as #44 (comment).

func checkContainerHasImage(t *testing.T, container *corev1.Container, image string) {
t.Helper()

if container.Image == image {
Copy link
Member

Choose a reason for hiding this comment

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

This checks against the image defined in the flag right? So the version of the image defined in the flag changes, would this then cause an immediate upgrade?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

As mentioned above, the contour/envoy container images are set from the operator CLI. If the operator was restarted with new values for these flags, the images would be differ causing the Envoy DamonSet and the Contour Deployment to trigger a rolling update.

Copy link
Member

Choose a reason for hiding this comment

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

Maybe it's a docs issue then but that behavior needs to be super clear to users. I would have expected that upgrades to the instances would be done via the CRD that manages that instance.

Copy link
Member

Choose a reason for hiding this comment

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

+1 to @stevesloka's comment, I think ideally you'd manage the versions of Contour and Envoy on the CRD so they could be controlled declaratively and independently of one another if multiple Contours are being managed. Let's file an issue to track.

Copy link
Member

Choose a reason for hiding this comment

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

#55

@danehans
Copy link
Contributor Author

Commit 862a8e3 adds a label/labelSelector that identifies pods of the DaemonSet as being owned by the DaemonSet. The DaemonSet continues to be labeled as being owned by the Contour.

owningContourLabel: contour.Name,
}

pointerTo := func(ios intstr.IntOrString) *intstr.IntOrString { return &ios }
Copy link
Contributor

Choose a reason for hiding this comment

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

You might as well do this:

pointerTo := func(i int) *intstr.IntOrString {
  val := intstr.IntOrString{IntVal: int32(i)}
  return &val
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

With your suggested changes:

$ make test
/Users/daneyonhansen/code/go/bin/controller-gen object:headerFile="hack/boilerplate.go.txt" paths="./..."
go fmt ./...
go vet ./...
# github.com/projectcontour/contour-operator/controller/contour
controller/contour/controller.go:35:41: cannot convert i (type intstr.IntOrString) to type int32
# github.com/projectcontour/contour-operator/controller/contour
vet: controller/contour/controller.go:35:42: cannot convert i (variable of type intstr.IntOrString) to int32
make: *** [vet] Error 2

I did move the func up in scope to remove duplication with deployment.go.

Copy link
Contributor

Choose a reason for hiding this comment

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

Well clearly you'd want to update the call sites too 😂

Copy link
Contributor

@jpeach jpeach left a comment

Choose a reason for hiding this comment

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

This looks OK to me. I marked a few nits, and it needs to be rebased. I'll hold off any final merge until @stevesloka completes his review as well.

Signed-off-by: Daneyon Hansen <[email protected]>
flag.StringVar(&image, "image", "docker.io/projectcontour/contour:main", "The image used for the managed Contour.")
flag.StringVar(&contourImage, "contour-image", "docker.io/projectcontour/contour:main",
"The container image used for the managed Contour.")
flag.StringVar(&envoyImage, "envoy-image", "docker.io/envoyproxy/envoy:v1.15.1",
Copy link
Member

Choose a reason for hiding this comment

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

FYI, we've updated Contour's main branch to use Envoy 1.16.0.

func checkContainerHasImage(t *testing.T, container *corev1.Container, image string) {
t.Helper()

if container.Image == image {
Copy link
Member

Choose a reason for hiding this comment

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

+1 to @stevesloka's comment, I think ideally you'd manage the versions of Contour and Envoy on the CRD so they could be controlled declaratively and independently of one another if multiple Contours are being managed. Let's file an issue to track.

@stevesloka stevesloka merged commit 5eedd7e into projectcontour:main Oct 19, 2020
@danehans danehans deleted the ds_impl branch November 2, 2020 18:36
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add Support for Managing Envoy
4 participants