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

Add script for generating deployment yamls and static deployment files #257

Merged
merged 11 commits into from
Feb 10, 2021

Conversation

amisevsk
Copy link
Collaborator

@amisevsk amisevsk commented Feb 3, 2021

What does this PR do?

This PR is a rework of #254. See that PR for context.

  • Add script config/generate-templates.sh which outputs the yaml formerly used in make install
    • Script supports --use-defaults option to not respect current shell environment and use default values instead, though this does copy values from the Makefile (which we can maybe avoid)
  • Add makefile rules generate_deployment and generate_default_deployment. The former generates yamls as before and is intended for development use; the latter generates static files that can be applied to any cluster (after routing suffix is set)
  • Add PR check that make generate_default_deployment does not change files, as those now need to be kept in-sync with templates.

As in #254, the output of the script is

config/{static,current}
├── kubernetes
│   ├── objects
│   │   ├── <object-name>.<object-kind.yaml
│   │   └── (...)
│   └── combined.yaml
└── openshift
    ├── objects
    │   ├── <object-name>.<object-kind.yaml
    │   └── (...)
    └── combined.yaml

What issues does this PR fix or reference?

Closes #250

Is it tested? How?

Tested deployment manually, it's basically just moving code around.

Copy link
Member

@sleshchenko sleshchenko left a comment

Choose a reason for hiding this comment

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

LGTM

Please consider renaming generate-templates.sh

config/generate-templates.sh Outdated Show resolved Hide resolved
config/generate-templates.sh Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
.github/workflows/pr.yml Outdated Show resolved Hide resolved
Copy link
Contributor

@JPinkney JPinkney left a comment

Choose a reason for hiding this comment

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

LGTM other than Serhii's comments

.gitattributes Outdated Show resolved Hide resolved
@openshift-ci-robot
Copy link
Collaborator

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: amisevsk, JPinkney, sleshchenko

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

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [JPinkney,amisevsk,sleshchenko]

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

@openshift-ci-robot
Copy link
Collaborator

New changes are detected. LGTM label has been removed.

@amisevsk amisevsk force-pushed the static-deploy branch 2 times, most recently from 7a5aae7 to 6f38397 Compare February 5, 2021 21:27
@amisevsk
Copy link
Collaborator Author

amisevsk commented Feb 5, 2021

/test v5-devworkspaces-operator-e2e

@amisevsk
Copy link
Collaborator Author

amisevsk commented Feb 6, 2021

Rebased on master; it was somewhat complicated due to #252

@amisevsk
Copy link
Collaborator Author

amisevsk commented Feb 6, 2021

/test v5-devworkspaces-operator-e2e

@sleshchenko
Copy link
Member

Tests are failed due yq lack: ERROR: Program yq is required for this script
I tried but did not find really minimal yq container. The best I found is jshimko/kube-tools-aws 351MB.
I see the following approaches:

Please go either of proposed or your way to fix e2e tests.

@amisevsk
Copy link
Collaborator Author

amisevsk commented Feb 8, 2021

/test v5-devworkspaces-operator-e2e

1 similar comment
@amisevsk
Copy link
Collaborator Author

amisevsk commented Feb 9, 2021

/test v5-devworkspaces-operator-e2e

Since we moved to multi-version devfile/api CRDs, the webhook server is
a required component of the DevWorkspace Operator. Currently, the server
is set up to not interfere with any default flows (e.g. local debugging)
as it is a separate deployment. It has also been restricted to only
apply when the restricted-access annotation is set.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Supports --use-defaults argument to generate yamls with default values
applied; otherwise current shell environment is used.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Rework file structure from

    config
    ├── <kustomize templates>
    ├── current (untracked; dev environment)
    └── static (static deployment files)
to
    deploy
    ├── current (untracked; dev environment)
    ├── deployment (static deployment files)
    └── templates (templates from which above dirs are generated
        └── <kustomize templates>
and adjust scripts to match.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
The '-d' argument to readarray is only supported in bash >4.4, which is
not present on the CI machines (or MacOS, by default...). Use a simple
glob instead to sort parsed yamls into subdirectories.

Also double quote env vars in generate-deployment.sh, just in case.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Disable splitting combined.yaml into multiple files by default in
generate deployment. This removes the strict dependency on `yq` and
makes the script faster for basic use (make install only uses
combined.yaml).

Add argument --split-yaml to re-enable splitting yaml if necessary. When
--use-defaults is passed, --split-yaml is assumed.

Signed-off-by: Angel Misevski <amisevsk@redhat.com>
Signed-off-by: Angel Misevski <amisevsk@redhat.com>
@amisevsk
Copy link
Collaborator Author

amisevsk commented Feb 9, 2021

/test v5-devworkspaces-operator-e2e

Had to rebase to ensure all license years are up to date.

@amisevsk amisevsk merged commit c7cbda9 into devfile:master Feb 10, 2021
@amisevsk amisevsk deleted the static-deploy branch February 10, 2021 16:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Begin publishing flattened, ready-to-deploy yaml templates of the controller
4 participants