forked from opendatahub-io/opendatahub-operator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(cfgmap): simplifies create/update (again!) (opendatahub-io#972)
This is a follow-up PR to opendatahub-io#948. One thing which I missed was updating labels if config map already existed. This is now ensured for both Create and Update paths and captured in tests. In addition `CreateOrUpdateConfigMap` takes a pointer to a ConfigMap "prototype" instance, where you can define `ObjectMeta` and `Data`. This simplifies function signature and allows you to simply pass anonymous struct when you do not want use return value later. Previously this had to be ignored by using `_` as variable name. Additional changes: - `ConfigMap.ObjectMeta.[Name|Namespace]` is required as it will be used for initial Get call. It returns error otherwise. Previously both `name` and `namespace` string params were not validated before invokig k8s client. - `.Data` keys will be merged if configmap already exists. This is similar to previous behaviour, except it handles `nil` maps too.
- Loading branch information
1 parent
1608b0a
commit 6711ab3
Showing
4 changed files
with
100 additions
and
65 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters