forked from migtools/crane-runner
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: update clustertasks to integrate with UI
The purpose of this change is to align with what is described in konveyor/enhancements#59 only to the extent that a demonstration of "Stateless App Migration" is possible. This will likely break our examples so it should not be merged into 'main' until stabilized.
- Loading branch information
1 parent
c93a812
commit 1592b89
Showing
13 changed files
with
163 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,15 @@ | ||
FROM registry.ci.openshift.org/openshift/release:golang-1.16 as crane-bin | ||
|
||
FROM registry.ci.openshift.org/openshift/release:golang-1.17 as crane-bin | ||
ENV GOFLAGS "-mod=mod" | ||
WORKDIR /go/src/github.com/konveyor/crane | ||
|
||
RUN git clone https://github.com/konveyor/crane.git . | ||
RUN go build -a -o /build/crane main.go | ||
|
||
FROM registry.access.redhat.com/ubi8/ubi:latest | ||
|
||
COPY --from=crane-bin /build/crane /crane | ||
RUN /crane plugin-manager add OpenshiftPlugin | ||
|
||
# Helpful tools | ||
# TODO(djzager): Determine want can stay and what must go | ||
COPY --from=crane-bin /build/crane /usr/bin/crane | ||
RUN crane plugin-manager add OpenshiftPlugin | ||
RUN curl -sL "https://mirror.openshift.com/pub/openshift-v4/clients/ocp/stable/openshift-client-linux.tar.gz" | \ | ||
tar xvzf - -C /usr/bin/ oc kubectl | ||
RUN curl -sL "https://github.com/mikefarah/yq/releases/download/v4.16.1/yq_linux_amd64.tar.gz" | \ | ||
tar xvzf - -C /usr/bin/ ./yq_linux_amd64 && \ | ||
mv /usr/bin/yq_linux_amd64 /usr/bin/yq | ||
RUN curl -sL "https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v4.4.1/kustomize_v4.4.1_linux_amd64.tar.gz" | \ | ||
tar xvzf - -C /usr/bin/ kustomize | ||
RUN dnf -y install git | ||
|
||
ENTRYPOINT ["/crane"] | ||
ENTRYPOINT ["/usr/bin/crane"] |
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,50 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: ClusterTask | ||
metadata: | ||
name: crane-kubeconfig-generator | ||
annotations: | ||
description: | | ||
This Task is responsible for taking a secret with keys `url` and `token`, | ||
logging into the cluster using `oc login`, renaming the context, and | ||
saving the result in the kubeconfig workspace. | ||
The idea is that subsequent Tasks in a Pipeline or PipelineRun could | ||
reference this task first to populate a kubeconfig based on cluster | ||
auth stored in a secret. | ||
spec: | ||
params: | ||
- name: cluster-secret | ||
type: string | ||
description: | | ||
The name of the secret holding cluster API Server URL and Token. | ||
- name: context-name | ||
type: string | ||
description: | | ||
The name to give the context. | ||
steps: | ||
- name: crane-export | ||
image: quay.io/djzager/crane-runner:alpha | ||
script: | | ||
export KUBECONFIG=$(workspaces.kubeconfig.path)/kubeconfig | ||
set +x | ||
oc login --server=$CLUSTER_URL --token=$CLUSTER_TOKEN | ||
set -x | ||
kubectl config rename-context "$(kubectl config current-context)" "$(params.context-name)" | ||
env: | ||
- name: CLUSTER_URL | ||
valueFrom: | ||
secretKeyRef: | ||
name: $(params.cluster-secret) | ||
key: url | ||
- name: CLUSTER_TOKEN | ||
valueFrom: | ||
secretKeyRef: | ||
name: $(params.cluster-secret) | ||
key: token | ||
workspaces: | ||
- name: kubeconfig | ||
readOnly: false | ||
description: | | ||
Where the generated kubeconfig will be saved. |
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,51 @@ | ||
apiVersion: tekton.dev/v1beta1 | ||
kind: ClusterTask | ||
metadata: | ||
name: crane-kustomize-init | ||
annotations: | ||
description: "Initialize a kustomization.yaml for the manifests generated in crane-apply. \n" | ||
spec: | ||
params: | ||
- name: source-namespace | ||
type: string | ||
description: Source namespace from export. | ||
- name: labels | ||
type: string | ||
description: Add one or more labels | ||
default: "" | ||
- name: name-prefix | ||
type: string | ||
description: Set the namePrefix field in the kustomization file. | ||
default: "" | ||
- name: namespace | ||
type: string | ||
description: Sets the value of the namespace field in the kustomization file. | ||
default: "" | ||
- name: name-suffix | ||
type: string | ||
description: Set the nameSuffix field in the kustomization file. | ||
default: "" | ||
steps: | ||
- name: kustomize-namespace | ||
image: quay.io/djzager/crane-runner:alpha | ||
script: | | ||
# Copy apply resources into kustomize workspace | ||
cp -r "$(workspaces.apply.path)/resources/$(params.source-namespace)/." "$(workspaces.kustomize.path)" | ||
pushd "$(workspaces.kustomize.path)" | ||
kustomize init --autodetect \ | ||
--labels "$(params.labels)" \ | ||
--nameprefix "$(params.name-prefix)" \ | ||
--namespace "$(params.namespace)" \ | ||
--nameSuffix "$(params.name-suffix)" | ||
kustomize build | ||
popd | ||
tree "$(workspaces.kustomize.path)" | ||
workspaces: | ||
- name: apply | ||
description: | | ||
This is the folder where the results from crane-apply are stored. | ||
mountPath: /var/crane/apply | ||
- name: kustomize | ||
description: | | ||
This is where the kustomize related manifests will be saved. |
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
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