-
Notifications
You must be signed in to change notification settings - Fork 536
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: k8s:resource replaces template variables in provided fragments, …
…k8s:helm doesn't. - Moved logic from ResourceMojo to separate service - Fixed Resource generation, template placeholders are replaced only in aggregated YAML file (kubernetes.yml) not in individual resource files. - Placeholder/variable replacement can be turned off (jkube.interpolateTemplateParameters) - Fixed Helm chart generation, template placeholders are NOT replaced. Provided support for Parameters with no default value (values.yml) will only contain those which have a default. The rest of parameters can be specified with `--set` option - Added integration test to verify behavior for resource and helm YAML generation. Signed-off-by: Marc Nuri <[email protected]> WIP fix: k8s:resource replaces template variables in provided fragments, k8s:helm doesn't. - Moved logic from ResourceMojo to separate service - Fixed Resource generation, template placeholders are replaced only in aggregated YAML file (kubernetes.yml) not in individual resource files. - Placeholder/variable replacement can be turned off (jkube.interpolateTemplateParameters) - Fixed Helm chart generation, template placeholders are NOT replaced. Provided support for Parameters with no default value (values.yml) will only contain those which have a default. The rest of parameters can be specified with `--set` option - Added integration test to verify behavior for resource and helm YAML generation. Signed-off-by: Marc Nuri <[email protected]>
- Loading branch information
Showing
34 changed files
with
1,452 additions
and
276 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
28 changes: 28 additions & 0 deletions
28
...it/config/service/src/main/java/org/eclipse/jkube/kit/config/service/EnricherManager.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.kit.config.service; | ||
|
||
import io.fabric8.kubernetes.api.model.KubernetesListBuilder; | ||
import org.eclipse.jkube.kit.config.resource.PlatformMode; | ||
import org.eclipse.jkube.kit.config.resource.ProcessorConfig; | ||
|
||
public interface EnricherManager { | ||
|
||
void createDefaultResources(PlatformMode platformMode, final KubernetesListBuilder builder); | ||
void createDefaultResources(PlatformMode platformMode, ProcessorConfig enricherConfig, final KubernetesListBuilder builder); | ||
|
||
void enrich(PlatformMode platformMode, final KubernetesListBuilder builder); | ||
void enrich(PlatformMode platformMode, final ProcessorConfig enricherConfig, final KubernetesListBuilder builder); | ||
|
||
} |
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
37 changes: 37 additions & 0 deletions
37
...it/config/service/src/main/java/org/eclipse/jkube/kit/config/service/ResourceService.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.kit.config.service; | ||
|
||
import java.io.File; | ||
import java.io.IOException; | ||
|
||
import org.eclipse.jkube.kit.common.KitLogger; | ||
import org.eclipse.jkube.kit.common.util.ResourceClassifier; | ||
import org.eclipse.jkube.kit.config.resource.PlatformMode; | ||
|
||
import io.fabric8.kubernetes.api.model.KubernetesList; | ||
|
||
public interface ResourceService { | ||
|
||
KubernetesList generateResources(PlatformMode platformMode, EnricherManager enricherManager, KitLogger log) | ||
throws IOException; | ||
|
||
File writeResources(KubernetesList resources, ResourceClassifier classifier, KitLogger log) throws IOException; | ||
|
||
@FunctionalInterface | ||
interface ResourceFileProcessor { | ||
|
||
File[] processResources(File[] resources) throws IOException; | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...fig/service/src/main/java/org/eclipse/jkube/kit/config/service/ResourceServiceConfig.java
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/** | ||
* Copyright (c) 2019 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at: | ||
* | ||
* https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.jkube.kit.config.service; | ||
|
||
import java.io.File; | ||
|
||
import org.eclipse.jkube.kit.common.JavaProject; | ||
import org.eclipse.jkube.kit.common.ResourceFileType; | ||
import org.eclipse.jkube.kit.config.resource.ResourceConfig; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.EqualsAndHashCode; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
/** | ||
* Class to hold configuration parameters for the Resource service. | ||
*/ | ||
@Builder(toBuilder = true) | ||
@AllArgsConstructor | ||
@NoArgsConstructor | ||
@Getter | ||
@EqualsAndHashCode | ||
public class ResourceServiceConfig { | ||
|
||
private JavaProject project; | ||
private File resourceDir; | ||
private File targetDir; | ||
private ResourceFileType resourceFileType; | ||
private ResourceConfig resourceConfig; | ||
private ResourceService.ResourceFileProcessor resourceFilesProcessor; | ||
private boolean interpolateTemplateParameters; | ||
|
||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!-- | ||
Copyright (c) 2019 Red Hat, Inc. | ||
This program and the accompanying materials are made | ||
available under the terms of the Eclipse Public License 2.0 | ||
which is available at: | ||
https://www.eclipse.org/legal/epl-2.0/ | ||
SPDX-License-Identifier: EPL-2.0 | ||
Contributors: | ||
Red Hat, Inc. - initial API and implementation | ||
--> | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
|
||
<parent> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<artifactId>jkube-kit-parent</artifactId> | ||
<version>1.0.1-SNAPSHOT</version> | ||
<relativePath>../../parent/pom.xml</relativePath> | ||
</parent> | ||
|
||
<artifactId>jkube-kit-resource-service</artifactId> | ||
|
||
<name>JKube Kit :: Resource :: Service</name> | ||
|
||
<dependencies> | ||
|
||
<dependency> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<artifactId>jkube-kit-enricher-api</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.eclipse.jkube</groupId> | ||
<artifactId>jkube-kit-profiles</artifactId> | ||
</dependency> | ||
|
||
<dependency> | ||
<groupId>junit</groupId> | ||
<artifactId>junit</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.jmockit</groupId> | ||
<artifactId>jmockit</artifactId> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.assertj</groupId> | ||
<artifactId>assertj-core</artifactId> | ||
</dependency> | ||
</dependencies> | ||
</project> |
Oops, something went wrong.