Skip to content

Commit

Permalink
Merge fd0623d into 596c04f
Browse files Browse the repository at this point in the history
  • Loading branch information
maxlaverse committed Feb 24, 2019
2 parents 596c04f + fd0623d commit 3cf5972
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 12 deletions.
1 change: 1 addition & 0 deletions .gitignore
Expand Up @@ -7,3 +7,4 @@
/.idea/
*.iml
nbactions.xml
**/.DS_Store
8 changes: 4 additions & 4 deletions .travis.yml
Expand Up @@ -10,10 +10,10 @@ cache:
- $HOME/.m2

env:
- KUBECTL_VERSION=v1.13.1
- KUBECTL_VERSION=v1.12.4
- KUBECTL_VERSION=v1.11.6
- KUBECTL_VERSION=v1.10.12
- KUBECTL_VERSION=v1.13.3
- KUBECTL_VERSION=v1.12.5
- KUBECTL_VERSION=v1.11.7
- KUBECTL_VERSION=v1.10.13
- KUBECTL_VERSION=v1.9.11
- KUBECTL_VERSION=v1.8.15

Expand Down
13 changes: 13 additions & 0 deletions README.md
Expand Up @@ -8,6 +8,16 @@ Any tool built on top of `kubectl` can then be used from your pipelines, e.g. [k

Initially extracted and rewritten from the [Kubernetes Plugin][kubernetes-plugin].

```groovy
node {
stage('Apply Kubernetes files') {
withKubeConfig([credentialsId: 'user1', serverUrl: 'https://api.k8s.my-company.com']) {
sh 'kubectl apply -f my-kubernetes-directory'
}
}
}
```

## Prerequisites
* An executor with `kubectl` installed (tested against [v1.8 to v1.13][travis-config] included)
* A Kubernetes cluster
Expand Down Expand Up @@ -37,6 +47,8 @@ The parameters have a slightly different effect depending if a plain KubeConfig
### Parameters (with KubeConfig file)

The plugin writes the plain KubeConfig file and doesn't change any other field if only `credentialsId` is provided.
The recommended way to use a single KubeConfig file with multiples clusters, users, and default namespaces is to
configure a Context for each of them, and use the `contextName` parameter to switch between them (see [Kubernetes documentation][multi-clusters]).

| Name | Mandatory | Description |
| --------------- | --------- | ------------- |
Expand Down Expand Up @@ -113,3 +125,4 @@ Refer to the [CHANGELOG](CHANGELOG.md) in the plugin repository.
[kubernetes-deploy]:https://github.com/Shopify/kubernetes-deploy
[master-build]: https://ci.jenkins.io/job/Plugins/job/kubernetes-cli-plugin/job/master/
[issue-tracker]: https://issues.jenkins-ci.org/issues/?jql=project%20%3D%20JENKINS%20AND%20status%20in%20(Open%2C%20%22In%20Progress%22%2C%20Reopened%2C%20%22In%20Review%22)%20AND%20component%20%3D%20kubernetes-cli-plugin
[multi-clusters]: https://kubernetes.io/docs/tasks/access-application-cluster/configure-access-multiple-clusters/
Binary file modified img/webui.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Expand Up @@ -22,6 +22,6 @@ public static KubeConfigWriter get(@Nonnull String serverUrl, @Nonnull String cr
Run<?, ?> run = context.get(Run.class);
FilePath workspace = context.get(FilePath.class);
Launcher launcher = context.get(Launcher.class);
return new KubeConfigWriter(serverUrl, credentialsId, caCertificate, clusterName, contextName,namespace, workspace, launcher, run);
return new KubeConfigWriter(serverUrl, credentialsId, caCertificate, clusterName, contextName, namespace, workspace, launcher, run);
}
}
@@ -1,19 +1,19 @@
<?jelly escape-by-default='true'?>
<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form" xmlns:c="/lib/credentials">

<f:entry field="credentialsId" title="${%Credentials or kubeconfig file}">
<f:entry field="credentialsId" title="${%Credentials}">
<c:select/>
</f:entry>

<f:entry field="serverUrl" title="${%Kubernetes API endpoint}">
<f:textbox/>
</f:entry>

<f:entry field="contextName" title="${%Context name}">
<f:entry field="clusterName" title="${%Cluster name}">
<f:textbox/>
</f:entry>

<f:entry field="clusterName" title="${%Cluster name}">
<f:entry field="contextName" title="${%Context name}">
<f:textbox/>
</f:entry>

Expand Down
Expand Up @@ -9,11 +9,11 @@
<f:textbox/>
</f:entry>

<f:entry field="contextName" title="${%Context name}">
<f:entry field="clusterName" title="${%Cluster name}">
<f:textbox/>
</f:entry>

<f:entry field="clusterName" title="${%Cluster name}">
<f:entry field="contextName" title="${%Context name}">
<f:textbox/>
</f:entry>

Expand Down
@@ -1,4 +1,4 @@
<div>
The base64 encoded certificate of the certificate authority (CA). It is used to verify the server certificate.
The certificate of the certificate authority (CA). It's used to validate the API server certificate.
<p>Leaving this field empty will skip the certificate verification.</p>
</div>
@@ -1,3 +1,3 @@
<div>
Credentials to use for authentication or raw kubeconfig file.
Credentials to use for authentication or raw KubeConfig file.
</div>

0 comments on commit 3cf5972

Please sign in to comment.