-
Notifications
You must be signed in to change notification settings - Fork 496
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat (jkube-kit/helm) : HelmService exposes helm install functionality
Signed-off-by: Rohan Kumar <rohaan@redhat.com>
- Loading branch information
1 parent
2b5d271
commit e9887d1
Showing
8 changed files
with
487 additions
and
2 deletions.
There are no files selected for viewing
96 changes: 96 additions & 0 deletions
96
...-kit/common/src/test/java/org/eclipse/jkube/kit/common/util/KubernetesMockServerUtil.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,96 @@ | ||
/* | ||
* 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.common.util; | ||
|
||
import io.fabric8.kubernetes.api.model.APIGroupBuilder; | ||
import io.fabric8.kubernetes.api.model.APIGroupList; | ||
import io.fabric8.kubernetes.api.model.APIGroupListBuilder; | ||
import io.fabric8.kubernetes.api.model.APIResourceBuilder; | ||
import io.fabric8.kubernetes.api.model.APIResourceList; | ||
import io.fabric8.kubernetes.api.model.APIResourceListBuilder; | ||
import io.fabric8.kubernetes.client.VersionInfo; | ||
import io.fabric8.kubernetes.client.server.mock.KubernetesMockServer; | ||
|
||
public class KubernetesMockServerUtil { | ||
|
||
private KubernetesMockServerUtil() { } | ||
|
||
// TODO: Remove after https://github.com/fabric8io/kubernetes-client/issues/6062 is fixed | ||
public static void prepareMockWebServerExpectationsForAggregatedDiscoveryEndpoints(KubernetesMockServer server) { | ||
server.expect().get() | ||
.withPath("/version?timeout=32s") | ||
.andReturn(200, new VersionInfo.Builder() | ||
.withMajor("1") | ||
.withMinor("30") | ||
.build()) | ||
.always(); | ||
server.expect().get().withPath("/api?timeout=32s") | ||
.andReturn(200, String.format("{\"kind\":\"APIVersions\",\"versions\":[\"v1\"],\"serverAddressByClientCIDRs\":[{\"clientCIDR\":\"0.0.0.0/0\",\"serverAddress\":\"%s:%d\"}]}", server.getHostName(), server.getPort())) | ||
.always(); | ||
server.expect().get().withPath("/apis?timeout=32s") | ||
.andReturn(200, createNewAPIGroupList()) | ||
.always(); | ||
server.expect().get().withPath("/api/v1?timeout=32s") | ||
.andReturn(200, createNewAPIResourceList()) | ||
.always(); | ||
server.expect().get().withPath("/apis/apps/v1?timeout=32s") | ||
.andReturn(200, createNewAPIResourceList()) | ||
.always(); | ||
} | ||
|
||
private static APIResourceList createNewAPIResourceList() { | ||
APIResourceListBuilder apiResourceListBuilder = new APIResourceListBuilder(); | ||
apiResourceListBuilder.addToResources(new APIResourceBuilder() | ||
.withNamespaced() | ||
.withKind("Service") | ||
.withName("services") | ||
.withSingularName("service") | ||
.build()); | ||
apiResourceListBuilder.addToResources(new APIResourceBuilder() | ||
.withName("deployments") | ||
.withKind("Deployment") | ||
.withSingularName("deployment") | ||
.withNamespaced() | ||
.build()); | ||
apiResourceListBuilder.addToResources(new APIResourceBuilder() | ||
.withName("serviceaccounts") | ||
.withKind("ServiceAccount") | ||
.withSingularName("serviceaccount") | ||
.withNamespaced() | ||
.build()); | ||
apiResourceListBuilder.addToResources(new APIResourceBuilder() | ||
.withName("secrets") | ||
.withKind("Secret") | ||
.withSingularName("secret") | ||
.withNamespaced() | ||
.build()); | ||
return apiResourceListBuilder.build(); | ||
} | ||
|
||
private static APIGroupList createNewAPIGroupList() { | ||
return new APIGroupListBuilder() | ||
.addToGroups(new APIGroupBuilder() | ||
.withName("apps") | ||
.addNewVersion() | ||
.withGroupVersion("apps/v1") | ||
.withVersion("v1") | ||
.endVersion() | ||
.withNewPreferredVersion() | ||
.withGroupVersion("apps/v1") | ||
.withVersion("v1") | ||
.endPreferredVersion() | ||
.build()) | ||
.build(); | ||
} | ||
} |
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
Oops, something went wrong.