Skip to content

Split MII zips across Config Maps #2095

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

Merged
merged 6 commits into from
Dec 14, 2020
Merged

Split MII zips across Config Maps #2095

merged 6 commits into from
Dec 14, 2020

Conversation

russgold
Copy link
Member

Under some conditions, the zips generated by an MII domain may be too large to fit in a single config map, which has a total limit of 1 MB. To address that, this PR includes code to split the encoded archives across multiple config maps as needed, and reassemble them as part of starting up the server.

As this requires changes to the shell scripts, this PR also includes a new Maven mojo to run bash unit tests, using shunit2.

Note: the mojo is not unique to this project and contains no Oracle-proprietary code. Since other projects may wish to unit tests scripts, we should look into releasing the plugin separately in the future.

@tbarnes-us
Copy link

High level initial questions/comments:

(1) Could we have 3 fixed named config maps instead of a variable number of configmaps? One for each of the two big MII zips, and a third 'main' one for everything else? Putting the contents in a predictable named location would make theend-user-experience, end-user-debugging, documentation, predictability, testability, etc easier. I realize this is a trade-off versus generic handling of the data, but I think it's a a worthy one. For example, one would know that the "MII primordial' is always in the 'primordial' configmap, and the domain key is always in the 'main' configmap, etc. It would also conveniently remove the big MII zips that clutter the 'main' configmap which also contains the shell scripts, security keys, etc, making it easier to examine the contents of that particular configmap. Finally, it'd make the MII path a more intuitive superset of the behavior of the other domain home source types.

(2) Is there are JIRA to track integration testing?

(3) Is the upgrade of a running domain handled?

(4) There are no documentation changes in this pull. I think the naming pattern and existence of the introspector configmap is documented in at least a couple of places.

@russgold
Copy link
Member Author

High level initial questions/comments:

(1) Could we have 3 fixed named config maps instead of a variable number of configmaps? One for each of the two big
MII zips, and a third 'main' one for everything else?

No, because we don't know how large the zips might be. Johnny suggested that in the JIRA, and Ryan gave this explanation.

(2) Is there are JIRA to track integration testing?

Not to my knowledge

(3) Is the upgrade of a running domain handled?

The code path is unchanged. If the old logic to restore the MII zips was called before, it still will be.

(4) There are no documentation changes in this pull. I think the naming pattern and existence of the introspector configmap is documented in at least a couple of places.

If you can point me to them, I can update them.

@tbarnes-us
Copy link

tbarnes-us commented Dec 10, 2020

High level initial questions/comments:
(1) Could we have 3 fixed named config maps instead of a variable number of configmaps? One for each of the two big
MII zips, and a third 'main' one for everything else?

No, because we don't know how large the zips might be. Johnny suggested that in the JIRA, and Ryan gave this explanation.

I don't think that argument precludes the essence of the suggestion. For example, the primordial zip could go to a dedicated set of one or more configmaps. IMO the ease-of-use and 'debuggability' gain would be worth this refinement.

(2) Is there are JIRA to track integration testing?

Not to my knowledge

Please file one. It should be a relatively high priority.

(3) Is the upgrade of a running domain handled?

The code path is unchanged. If the old logic to restore the MII zips was called before, it still will be.

So the original configmap name is unchanged? Can you please provide an example of how the upgrade would work? For example, would the managed servers need to be rolled to load new configmaps that they had'nt mounted before?

(4) There are no documentation changes in this pull. I think the naming pattern and existence of the introspector configmap is documented in at least a couple of places.

If you can point me to them, I can update them.

find docs-source -name "*.md" | xargs grep introspect-cm

(5) Johnny has an external utility that he uses for debugging that pulls the domain home out of the configmaps, decrypts them, and expands them. I don't know if this pull covers that? If not, ping Johnny for its location in github.

@russgold
Copy link
Member Author

russgold commented Dec 10, 2020

High level initial questions/comments:
(1) Could we have 3 fixed named config maps instead of a variable number of configmaps? One for each of the two big
MII zips, and a third 'main' one for everything else?

No, because we don't know how large the zips might be. Johnny suggested that in the JIRA, and Ryan gave this explanation.

I don't think that argument precludes the essence of the suggestion. For example, the primordial zip could go to a dedicated set of one or more configmaps. IMO the ease-of-use and 'debuggability' gain would be worth this refinement.

Can you explain how such a change improves ease-of-use and 'debuggability' ? This should all be internal to the operator.

(3) Is the upgrade of a running domain handled?
The code path is unchanged. If the old logic to restore the MII zips was called before, it still will be.

So the original configmap name is unchanged? Can you please provide an example of how the upgrade would work? For example, would the managed servers need to be rolled to load new configmaps that they had'nt mounted before?

If a change required a different number of config maps, that also requires the pods to have more volumes and mounts, which would cause them to roll. That's already in place. In addition, the checksum of the domain zip is already consulted, and would change, even if the number of maps does not.

(4) There are no documentation changes in this pull. I think the naming pattern and existence of the introspector configmap is documented in at least a couple of places.

If you can point me to them, I can update them.

find docs-source -name "*.md" | xargs grep introspect-cm

I've updated a couple that seem relevant.

(5) Johnny has an external utility that he uses for debugging that pulls the domain home out of the configmaps, decrypts them, and expands them. I don't know if this pull covers that? If not, ping Johnny for its location in github.

If it's external, then no. Having an external tool like that cares about internal representations sounds potentially problematic. It might be worthwhile to include something like that as part of the operator scripts, using the functions I've extracted to the MII script. @jshum2479

@jshum2479
Copy link
Member

How about naming as primoridal-1, primordial-2 ... and then domain-config-1, domain-config-2, main-configmap where everything else go? The primordial is the vanilla domain without any configuration, when we start to support other domain source type or existing domain template grew substantially in size, it is possible to exceed 1m. The domain config today can exceeds 1m , say for example one user create 250 servers, 10000 JMS modules and even gzip the config/**/*.xml
mii also has some small md5s to keep track of the WDT artifacts, theoretically if you have 100k pieces of WDT resources and secrets then it's possible to exceed 1m by themselves, though it's highly unlikely.

It will be nice if we can name it with some recognizable way but the process should be transparent for the users. Is there a way to manually reconstruct the zip from various configmaps in case we have to debug it?

Also, are we just splitting the zips or other non-zip files can be placed in any one of the configmap? We have a utility to get the merged model from the current config map, do we have to change it?

How are you testing the splitting and reconstruction now?

@jshum2479
Copy link
Member

The tool for decryption the merged model is in

.//src/integration-tests/bash/show_merged_model.sh

@russgold
Copy link
Member Author

russgold commented Dec 10, 2020

The code is unit tested; there is not currently an integration test that takes advantage of this feature.

The code works as implemented; what is the tremendous value to be gained by putting different files in different config maps? As long as no zips are large enough to need it, this functionality will not be evident to anyone - everything goes into the same config maps as before.

The script modelInImage.sh has functions 'restoreDomainConfig' and 'restorePrimordialDomain' which will handle all of the reconstruction of the domains from the config maps. I presume that your tool could simply call those.

In theory, any type of file could be split, but there is no script support at present for reassembling them.

@jshum2479
Copy link
Member

That's good, today in practice zips too big only happens if user has lots of config/**/*.xml

@tbarnes-us
Copy link

what is the tremendous value to be gained by putting different files in different config maps? As long as no zips are large enough to need it, this functionality will not be evident to anyone - everything goes into the same config maps as before.

It all depends on how much usability and debuggability is valued. Expanding on earlier:

(1) It's nice to be able to guarantee that the same file is in the same configmap in all use cases. This makes them easy to find.
(2) It's nice to have the large zip files separated out of the 'main' configmap, since they usually aren't of interest when debugging, but overwhelm the other contents of the configmap when viewing it.

cat ${OPERATOR_ROOT}/introspector*/${1} > /tmp/domain.secure
base64 -d "/tmp/domain.secure" > /tmp/domain.tar.gz || return 1

tar -xzf /tmp/domain.tar.gz || return 1

Choose a reason for hiding this comment

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

@jshum2479 This is unrelated to Russ' enhancement, but shouldn't the old /tmp file be removed upon success? I assume it takes up a good amount of space.

tar -xzf /tmp/domain.tar.gz || return 1
rm /tmp/domain.tar.gz 

Copy link
Member

Choose a reason for hiding this comment

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

modelInImage only affects the introspect pod which will go away anyway, but since this method will be called in startServer.sh, we should clean up the specific file.

# $1 the name of the encoded file in the config map
function restoreEncodedTar() {
cd / || return 1
cat ${OPERATOR_ROOT}/introspector*/${1} > /tmp/domain.secure

Choose a reason for hiding this comment

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

Append || return 1 to the cat... (not strictly needed as the next line will fail if the cat fails)

@russgold
Copy link
Member Author

(1) It's nice to be able to guarantee that the same file is in the same configmap in all use cases. This makes them easy to find.

With the exception of the zip files if they are large enough, the other entries are exactly where they have always been

(2) It's nice to have the large zip files separated out of the 'main' configmap, since they usually aren't of interest when debugging, but overwhelm the other contents of the configmap when viewing it.

If the tool that examines the map is not interested in them, it can simply ignore them. Everything else should work just as it always has.

@russgold russgold marked this pull request as ready for review December 11, 2020 18:57
@russgold
Copy link
Member Author

At this point, Jenkins runs seem to be working other than intermittent failures to access K8S, which are happening for multiple branches.

Copy link

@tbarnes-us tbarnes-us left a comment

Choose a reason for hiding this comment

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

Approving - but have left a couple of minor outstanding comments.

Copy link
Member

@jshum2479 jshum2479 left a comment

Choose a reason for hiding this comment

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

LGTM

@rjeberhard rjeberhard merged commit 9208dfb into develop Dec 14, 2020
@russgold russgold deleted the owls-84537 branch December 15, 2020 00:10
@russgold russgold restored the owls-84537 branch December 15, 2020 18:02
@rjeberhard rjeberhard deleted the owls-84537 branch January 5, 2021 22:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants