Skip to content

Conversation

@ironcladlou
Copy link
Contributor

Introduce a render command which emits the most essential manifests required
to customize ingress during installation. For now, the command emits the
operator namespace and CRD, which should be enough to allow the creation of
ingresscontroller.operator.openshift.io resources before the operator
manifests are created by the CVO.

This enables the installer to create a new ingresscontroller before the
ingress operator starts, effectively allowing users to bring their own complete
default ingresscontroller resource.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Oct 10, 2019
COPY --from=builder /ingress-operator/ingress-operator /usr/bin/
COPY manifests /manifests
RUN useradd ingress-operator
USER ingress-operator
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This new user should be unnecessary, and by using, the installer (as an image consumer) must override the user when doing things like running render with a volume mounted output directory (because ingress-operator user doesn't have permissions to write to the volume mount point).

Although I can work around it in the installer, if we have no reason to run as a new user, removing the useradd makes things more consistent with the other images used for the same purpose.

@ironcladlou ironcladlou changed the title WIP: Add a render command to facilitate install-time customizations Add a render command to facilitate install-time customizations Oct 17, 2019
@openshift-ci-robot openshift-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Oct 17, 2019
func render(dir string, prefix string) error {
files := []string{
manifests.CustomResourceDefinitionManifest,
manifests.NamespaceManifest,
Copy link
Contributor

Choose a reason for hiding this comment

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

Could we also write out a default ingresscontroller resource so the user does not need to write that from scratch?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can we have a separate followup discussion about the default handling in that regard? It's not required for this part of the implementation and could have negative consequences to consider.

# Using "-modtime 1" to make generate target deterministic. It sets all file
# time stamps to unix timestamp 1
GO111MODULE=on GOFLAGS=-mod=vendor go run github.com/kevinburke/go-bindata/go-bindata -mode 420 -modtime 1 -pkg manifests -o ${OUTDIR}/pkg/manifests/bindata.go assets/...
GO111MODULE=on GOFLAGS=-mod=vendor go run github.com/kevinburke/go-bindata/go-bindata -mode 420 -modtime 1 -pkg manifests -o ${OUTDIR}/pkg/manifests/bindata.go assets/... manifests/...
Copy link
Contributor

Choose a reason for hiding this comment

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

Instead of manifests/..., can we build in only the manifests we need?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

go-bindata takes a directory list, not sure there's any real harm here other than binary size inflation?

Copy link
Contributor

Choose a reason for hiding this comment

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

If specifying files individually is not an option, then another option would be to copy the desired files to a temporary directory and specify that directory instead. But you're right, this isn't a major problem, just something that jumped out at me when I glanced at the bindata.

@ironcladlou
Copy link
Contributor Author

@Miciah latest feedback addressed, PTAL.

Introduce a `render` command which emits the most essential manifests required
to customize ingress during installation. For now, the command emits the
operator namespace and CRD, which should be enough to allow the creation of
`ingresscontroller.operator.openshift.io` resources before the operator
manifests are created by the CVO.

This enables the installer to create a new `ingresscontroller` before the
ingress operator starts, effectively allowing users to bring their own complete
default `ingresscontroller` resource.
@ironcladlou
Copy link
Contributor Author

/retest

@ironcladlou
Copy link
Contributor Author

@Miciah tested with openshift/installer#2523, I think this works.

fmt.Println("---")
fmt.Printf("# file: %s\n", filepath.Base(file))
fmt.Println(manifests.MustAssetString(file))
fmt.Println("...")
Copy link
Contributor

Choose a reason for hiding this comment

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

I tried the render command and got the following output (showing the first few lines):

---
# file: 00-custom-resource-definition.yaml

---
apiVersion: apiextensions.k8s.io/v1beta1
kind: CustomResourceDefinition
metadata:
  creationTimestamp: null
  name: ingresscontrollers.operator.openshift.io

On investigation, I realized manifests/00-custom-resource-definition.yaml already has a --- marker. We need to delete either the print statements for the markers or the --- marker in the file.

Copy link
Contributor

Choose a reason for hiding this comment

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

Of course if this loop does not emit markers, that means we also need to add a --- marker to manifests/00-namespace.yaml so that they will be separated when the render command prints them. I think best would be to remove the marker from manifests/00-custom-resource-definition.yaml and keep the print statements as they are.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We've spent way more time on this particular code branch than is reasonable — it's not actually used for anything but debugging. I went ahead and deleted the entire functionality. Can this now merge?

@knobunc
Copy link

knobunc commented Oct 18, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Oct 18, 2019
@openshift-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: ironcladlou, knobunc

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:
  • OWNERS [ironcladlou,knobunc]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-merge-robot openshift-merge-robot merged commit 84bfac2 into openshift:master Oct 18, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/XL Denotes a PR that changes 500-999 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants