-
Notifications
You must be signed in to change notification settings - Fork 533
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(enrichers): imagePullSecrets supported in resource controller co…
…nfiguration (3133) feature(imagePullSecrets): Add support for specifying imagePullSecrets via resource configuration, issue #2467 Signed-off-by: arman-yekkehkhani <[email protected]> --- feature(imagePullSecrets): add imagePullSecrets to _controller_resource_generation.adoc, issue #2467 Signed-off-by: arman-yekkehkhani <[email protected]> --- Merge branch 'eclipse-jkube:master' into gh_2467-experimental --- feature(imagePullSecrets): add gradle plugin integration test, issue #2467 Signed-off-by: arman-yekkehkhani <[email protected]> --- feature(imagePullSecrets): remove public access modifier from test class, issue #2467 Signed-off-by: arman-yekkehkhani <[email protected]> --- feature(imagePullSecrets): add license, issue #2467 Signed-off-by: arman-yekkehkhani <[email protected]> --- feature(imagePullSecrets): update CHANGELOG.md , issue #2467 Signed-off-by: arman-yekkehkhani <[email protected]>
- Loading branch information
1 parent
638e5cc
commit 64e498e
Showing
11 changed files
with
406 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
/* | ||
* 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 | ||
*/ | ||
plugins { | ||
id 'org.eclipse.jkube.kubernetes' version "${jKubeVersion}" | ||
id 'org.eclipse.jkube.openshift' version "${jKubeVersion}" | ||
id 'java' | ||
} | ||
|
||
group = 'org.eclipse.jkube.integration.tests.gradle' | ||
version = '0.0.1-SNAPSHOT' | ||
sourceCompatibility = '11' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
def extensionConfig = { | ||
offline = true | ||
images { | ||
image { | ||
name = 'repository/image-pull-secrets:latest' | ||
build { | ||
from = 'quay.io/jkube/jkube-java-11' | ||
ports = ['8080'] | ||
} | ||
} | ||
} | ||
|
||
resources { | ||
controller { | ||
imagePullSecrets = ['secret-1', 'secret-2'] | ||
} | ||
} | ||
} | ||
|
||
kubernetes(extensionConfig) | ||
openshift(extensionConfig) |
101 changes: 101 additions & 0 deletions
101
gradle-plugin/it/src/it/image-pull-secrets/expected/kubernetes.yml
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,101 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
version: 0.0.1-SNAPSHOT | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/version: 0.0.1-SNAPSHOT | ||
name: image-pull-secrets | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: image-pull-secrets | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
- apiVersion: apps/v1 | ||
kind: Deployment | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
version: 0.0.1-SNAPSHOT | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/version: 0.0.1-SNAPSHOT | ||
name: image-pull-secrets | ||
spec: | ||
replicas: 1 | ||
revisionHistoryLimit: 2 | ||
selector: | ||
matchLabels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
template: | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
version: 0.0.1-SNAPSHOT | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/version: 0.0.1-SNAPSHOT | ||
name: image-pull-secrets | ||
spec: | ||
containers: | ||
- env: | ||
- name: KUBERNETES_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
- name: HOSTNAME | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.name | ||
image: repository/image-pull-secrets:latest | ||
imagePullPolicy: IfNotPresent | ||
name: repository-image-pull-secrets | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
securityContext: | ||
privileged: false | ||
imagePullSecrets: | ||
- name: secret-1 | ||
- name: secret-2 |
141 changes: 141 additions & 0 deletions
141
gradle-plugin/it/src/it/image-pull-secrets/expected/openshift.yml
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,141 @@ | ||
--- | ||
apiVersion: v1 | ||
kind: List | ||
items: | ||
- apiVersion: v1 | ||
kind: Service | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
version: 0.0.1-SNAPSHOT | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/version: 0.0.1-SNAPSHOT | ||
name: image-pull-secrets | ||
spec: | ||
ports: | ||
- name: http | ||
port: 8080 | ||
protocol: TCP | ||
targetPort: 8080 | ||
selector: | ||
app: image-pull-secrets | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
- apiVersion: apps.openshift.io/v1 | ||
kind: DeploymentConfig | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
version: 0.0.1-SNAPSHOT | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/version: 0.0.1-SNAPSHOT | ||
name: image-pull-secrets | ||
spec: | ||
replicas: 1 | ||
revisionHistoryLimit: 2 | ||
selector: | ||
app: image-pull-secrets | ||
provider: jkube | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
strategy: | ||
rollingParams: | ||
timeoutSeconds: 3600 | ||
type: Rolling | ||
template: | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
version: 0.0.1-SNAPSHOT | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/version: 0.0.1-SNAPSHOT | ||
name: image-pull-secrets | ||
spec: | ||
containers: | ||
- env: | ||
- name: KUBERNETES_NAMESPACE | ||
valueFrom: | ||
fieldRef: | ||
fieldPath: metadata.namespace | ||
image: repository/image-pull-secrets:latest | ||
imagePullPolicy: IfNotPresent | ||
name: repository-image-pull-secrets | ||
ports: | ||
- containerPort: 8080 | ||
name: http | ||
protocol: TCP | ||
securityContext: | ||
privileged: false | ||
imagePullSecrets: | ||
- name: secret-1 | ||
- name: secret-2 | ||
triggers: | ||
- type: ConfigChange | ||
- imageChangeParams: | ||
automatic: true | ||
containerNames: | ||
- repository-image-pull-secrets | ||
from: | ||
kind: ImageStreamTag | ||
name: image-pull-secrets:latest | ||
type: ImageChange | ||
- apiVersion: route.openshift.io/v1 | ||
kind: Route | ||
metadata: | ||
annotations: | ||
jkube.eclipse.org/git-commit: "@ignore@" | ||
jkube.eclipse.org/git-url: "@ignore@" | ||
app.openshift.io/vcs-ref: "@ignore@" | ||
app.openshift.io/vcs-uri: "@ignore@" | ||
jkube.eclipse.org/git-branch: "@ignore@" | ||
labels: | ||
app: image-pull-secrets | ||
provider: jkube | ||
version: 0.0.1-SNAPSHOT | ||
group: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/part-of: org.eclipse.jkube.integration.tests.gradle | ||
app.kubernetes.io/managed-by: jkube | ||
app.kubernetes.io/name: image-pull-secrets | ||
app.kubernetes.io/version: 0.0.1-SNAPSHOT | ||
name: image-pull-secrets | ||
spec: | ||
port: | ||
targetPort: 8080 | ||
to: | ||
kind: Service | ||
name: image-pull-secrets |
59 changes: 59 additions & 0 deletions
59
gradle-plugin/it/src/test/java/org/eclipse/jkube/gradle/plugin/tests/ImagePullSecretsIT.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,59 @@ | ||
/* | ||
* 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.gradle.plugin.tests; | ||
|
||
import net.minidev.json.parser.ParseException; | ||
import org.eclipse.jkube.kit.common.ResourceVerify; | ||
import org.gradle.testkit.runner.BuildResult; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import java.io.IOException; | ||
|
||
import static org.assertj.core.api.AssertionsForClassTypes.assertThat; | ||
|
||
class ImagePullSecretsIT { | ||
@RegisterExtension | ||
final ITGradleRunnerExtension gradleRunner = new ITGradleRunnerExtension(); | ||
|
||
@Test | ||
void k8sResource_whenRun_generatesK8sManifestsWithImagePullSecrets() throws IOException, ParseException { | ||
final BuildResult result = gradleRunner.withITProject("image-pull-secrets") | ||
.withArguments("k8sResource", "--stacktrace") | ||
.build(); | ||
|
||
ResourceVerify.verifyResourceDescriptors(gradleRunner.resolveDefaultKubernetesResourceFile(), | ||
gradleRunner.resolveFile("expected", "kubernetes.yml")); | ||
assertThat(result).extracting(BuildResult::getOutput).asString() | ||
.contains("Using resource templates from") | ||
.contains("Adding a default Deployment") | ||
.contains("Adding revision history limit to 2") | ||
.contains("validating"); | ||
} | ||
|
||
@Test | ||
void ocResource_whenRun_generatesOpenShiftManifestsWithImagePullSecrets() throws IOException, ParseException { | ||
final BuildResult result = gradleRunner.withITProject("image-pull-secrets") | ||
.withArguments("ocResource", "--stacktrace") | ||
.build(); | ||
|
||
ResourceVerify.verifyResourceDescriptors(gradleRunner.resolveDefaultOpenShiftResourceFile(), | ||
gradleRunner.resolveFile("expected", "openshift.yml")); | ||
assertThat(result).extracting(BuildResult::getOutput).asString() | ||
.contains("Using resource templates from") | ||
.contains("Adding a default Deployment") | ||
.contains("Adding revision history limit to 2") | ||
.contains("validating"); | ||
} | ||
} |
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.