Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions OWNERS_ALIASES
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,16 @@ aliases:
- jeffnowicki
- srcarrier
- staebler
alibaba-approvers
- kwoodson
- jcpowermac
- fabianofranz
- rvanderp3
- mtulio
alibaba-reviewers
- kwoodson
- jcpowermac
- fabianofranz
- rvanderp3
- mtulio

Original file line number Diff line number Diff line change
Expand Up @@ -206,6 +206,10 @@ tests:
steps:
cluster_profile: gcp
workflow: openshift-e2e-gcp
- as: e2e-alibaba
steps:
cluster_profile: alibabacloud
workflow: openshift-e2e-alibabacloud
- as: e2e-gcp-shared-vpc
optional: true
steps:
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,77 @@
presubmits:
openshift/installer:
- agent: kubernetes
always_run: true
branches:
- ^master$
- ^master-
cluster: build02
context: ci/prow/e2e-alibaba
decorate: true
labels:
ci-operator.openshift.io/cloud: alibabacloud
ci-operator.openshift.io/cloud-cluster-profile: alibabacloud
ci.openshift.io/generator: prowgen
pj-rehearse.openshift.io/can-be-rehearsed: "true"
name: pull-ci-openshift-installer-master-e2e-alibaba
rerun_command: /test e2e-alibaba
spec:
containers:
- args:
- --gcs-upload-secret=/secrets/gcs/service-account.json
- --image-import-pull-secret=/etc/pull-secret/.dockerconfigjson
- --lease-server-credentials-file=/etc/boskos/credentials
- --report-credentials-file=/etc/report/credentials
- --secret-dir=/secrets/ci-pull-credentials
- --secret-dir=/usr/local/e2e-alibaba-cluster-profile
- --target=e2e-alibaba
command:
- ci-operator
image: ci-operator:latest
imagePullPolicy: Always
name: ""
resources:
requests:
cpu: 10m
volumeMounts:
- mountPath: /etc/boskos
name: boskos
readOnly: true
- mountPath: /secrets/ci-pull-credentials
name: ci-pull-credentials
readOnly: true
- mountPath: /usr/local/e2e-alibaba-cluster-profile
name: cluster-profile
- mountPath: /secrets/gcs
name: gcs-credentials
readOnly: true
- mountPath: /etc/pull-secret
name: pull-secret
readOnly: true
- mountPath: /etc/report
name: result-aggregator
readOnly: true
serviceAccountName: ci-operator
volumes:
- name: boskos
secret:
items:
- key: credentials
path: credentials
secretName: boskos-credentials
- name: ci-pull-credentials
secret:
secretName: ci-pull-credentials
- name: cluster-profile
secret:
secretName: cluster-secrets-alibabacloud
- name: pull-secret
secret:
secretName: registry-pull-credentials
- name: result-aggregator
secret:
secretName: result-aggregator
trigger: (?m)^/test( | .* )e2e-alibaba,?($|\s.*)
- agent: kubernetes
always_run: false
branches:
Expand Down
4 changes: 4 additions & 0 deletions ci-operator/step-registry/gather/alibabacloud-console/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- alibaba-approvers
reviewers:
- alibaba-reviewers
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

trap 'CHILDREN=$(jobs -p); if test -n "${CHILDREN}"; then kill ${CHILDREN} && wait; fi' TERM



if test -f "${KUBECONFIG}"
then
oc --request-timeout=5s get nodes -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' > "${TMPDIR}/node-provider-IDs.txt" &
wait "$!"

oc --request-timeout=5s -n openshift-machine-api get machines -o jsonpath --template '{range .items[*]}{.spec.providerID}{"\n"}{end}' | sed 's|.*/||' >> "${TMPDIR}/node-provider-IDs.txt" &
wait "$!"
else
echo "No kubeconfig; skipping providerID extraction."
fi

if test -s "${SHARED_DIR}/alibaba-instance-ids.txt"
then
cat "${SHARED_DIR}/alibaba-instance-ids.txt" >> "${TMPDIR}/node-provider-IDs.txt"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you want to decouple the aliyun setup from the ID collection. Something like:

if test -f "${SHARED_DIR}/alibaba-instance-ids.txt"
then
  cat "${SHARED_DIR}/alibaba-instance-ids.txt" >> "${TMPDIR}/node-provider-IDs.txt"
fi

# If you really feel motivated, you could exit 0 here if there were no IDs in the assembled node-provider-IDs.txt , but I think that's unlikely enough that we can ignore it.  The existing AWS and GCP console gatherers don't bother.

pushd /tmp
# blah, blah, install aliyun

else
echo "No alibaba-instance-ids.txt; skipping console log retrieval."
fi

if test ! -s "${TMPDIR}/node-provider-IDs.txt"
then
echo "No node-provider-IDs found. Exiting."
exit 0
fi

pushd /tmp

export ALIBABA_CLI_CREDENTIALS_FILE="${SHARED_DIR}/config"

wget https://aliyuncli.alicdn.com/aliyun-cli-linux-latest-amd64.tgz -O aliyun-cli.tgz
tar zxvf aliyun-cli.tgz
popd

/tmp/aliyun version

echo "Settting --config-path=${ALIBABA_CLI_CREDENTIALS_FILE} and --region=${LEASED_RESOURCE}"
/tmp/aliyun --config-path "${ALIBABA_CLI_CREDENTIALS_FILE}" configure set --region "${LEASED_RESOURCE}"

cat "${TMPDIR}/node-provider-IDs.txt" | sort | grep . | uniq | while read -r INSTANCE_ID
do
echo "Gathering console logs for ${INSTANCE_ID}"
/tmp/aliyun --config-path "${ALIBABA_CLI_CREDENTIALS_FILE}" ecs GetInstanceConsoleOutput --RegionId "${LEASED_RESOURCE}" --InstanceId "$INSTANCE_ID" | jq -r '.ConsoleOutput' | base64 -d > "${ARTIFACT_DIR}/${INSTANCE_ID}" &
wait "$!"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure where the ID came from, but the rehearsal failed:

$ curl -s https://storage.googleapis.com/origin-ci-test/pr-logs/pull/openshift_release/20841/rehearse-20841-pull-ci-openshift-installer-master-e2e-alibaba/1485730605567053824/build-log.txt | grep gather-alibabacloud-console
INFO[2022-01-24T22:56:36Z] Running step e2e-alibaba-gather-alibabacloud-console. 
INFO[2022-01-24T22:57:06Z] Logs for container test in pod e2e-alibaba-gather-alibabacloud-console: 
INFO[2022-01-24T22:57:06Z] Step e2e-alibaba-gather-alibabacloud-console failed after 30s. 
Link to job on registry info site: https://steps.ci.openshift.org/job?org=openshift&repo=installer&branch=master&test=e2e-alibaba, "e2e-alibaba" post steps failed: "e2e-alibaba" pod "e2e-alibaba-gather-alibabacloud-console" failed: the pod ci-op-cm47ntwf/e2e-alibaba-gather-alibabacloud-console failed after 20s (failed containers: test): ContainerFailed one or more containers exited
Link to step on registry info site: https://steps.ci.openshift.org/reference/gather-alibabacloud-console

with:

Gathering console logs for i-0xih3nnep3txd8c4asyo
�[1;31mERROR: SDK.ServerError
ErrorCode: InvalidParameter
Recommend: https://error-center.aliyun.com/status/search?Keyword=InvalidParameter&source=PopGw
RequestId: 78DC8847-01E5-3D1C-BB4A-6F9D2E4C247D
Message: The instanceId provided is not valid
�[0m

Maybe a bootstrap node? Maybe we need to accept failures here for the subset that are "I don't recognize that instance ID"?

I also don't understand the empty tmp-censor254417089 file here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe this instance ID is the bootstrap. Since it gets torn down the console log query fails. Will attempt to fix this morning.

done
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "gather/alibabacloud-console/gather-alibabacloud-console-ref.yaml",
"owners": {
"approvers": [
"alibaba-approvers"
],
"reviewers": [
"alibaba-reviewers"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
ref:
as: gather-alibabacloud-console
optional_on_success: true
from: tools
grace_period: 10m
commands: gather-alibabacloud-console-commands.sh
env:
- name: TMPDIR
default: /tmp
documentation: A pathname of a directory made available for programs that need a place to create temporary files.
resources:
requests:
cpu: 300m
memory: 300Mi
credentials:
- namespace: test-credentials
name: alibabaconfig
mount_path: /var/run/vault/alibaba
documentation: |-
The pre-deprovision artifacts step collects console logs from Alibaba instances. It gathers console logs for all nodes and machines with a provider ID, as well as any instance IDs listed in ${SHARED_DIR}/alibaba-instance-ids.txt. alibaba-instance-ids.txt entries should have a single provider ID per line. Duplicate entries are ok; the step deduplicates before gathering.
4 changes: 4 additions & 0 deletions ci-operator/step-registry/ipi/alibabacloud/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- alibaba-approvers
reviewers:
- alibaba-reviewers
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "ipi/alibabacloud/ipi-alibabacloud-workflow.yaml",
"owners": {
"approvers": [
"alibaba-approvers"
],
"reviewers": [
"alibaba-reviewers"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
workflow:
as: ipi-alibabacloud
steps:
pre:
- chain: ipi-alibabacloud-pre
post:
- chain: ipi-alibabacloud-post
documentation: |-
The IPI workflow provides pre- and post- steps that provision and
deprovision an OpenShift cluster with a default configuration on Alibaba,
allowing job authors to inject their own end-to-end test logic.

All modifications to this workflow should be done by modifying the
`ipi-alibabacloud-{pre,post}` chains to allow other workflows to mimic and extend
this base workflow without a need to backport changes.
1 change: 1 addition & 0 deletions ci-operator/step-registry/ipi/alibabacloud/post/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "ipi/alibabacloud/post/ipi-alibabacloud-post-chain.yaml",
"owners": {
"approvers": [
"alibaba-approvers"
],
"reviewers": [
"alibaba-reviewers"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
chain:
as: ipi-alibabacloud-post
steps:
- ref: gather-alibabacloud-console
Copy link
Member

@wking wking Dec 22, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you want our usual chain: gather in here too?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably? I modeled this after the AWS version. What would this look like with the usual?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The chain: gather is already included in chain: ipi-deprovision.

- chain: ipi-deprovision
- ref: ipi-conf-alibabacloud-cloud-creds-deprovision
documentation: |-
The IPI cleanup step contains all steps that gather and deprovision an OpenShift cluster on Alibaba, provisioned by the `ipi-alibabacloud-pre` chain.
1 change: 1 addition & 0 deletions ci-operator/step-registry/ipi/alibabacloud/pre/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "ipi/alibabacloud/pre/ipi-alibabacloud-pre-chain.yaml",
"owners": {
"approvers": [
"alibaba-approvers"
],
"reviewers": [
"alibaba-reviewers"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
chain:
as: ipi-alibabacloud-pre
steps:
- chain: ipi-conf-alibabacloud
- ref: ipi-conf-alibabacloud-cloud-creds-provision
- chain: ipi-install
documentation: |-
The IPI setup step contains all steps that provision an OpenShift cluster
with a default configuration on Alibaba.
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "ipi/alibabacloud/pre/stableinitial/ipi-alibabacloud-pre-stableinitial-chain.yaml",
"owners": {
"approvers": [
"alibaba-approvers"
],
"reviewers": [
"alibaba-reviewers"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
chain:
as: ipi-alibabacloud-pre-stableinitial
steps:
- chain: ipi-conf-alibabacloud
- ref: ipi-conf-alibabacloud-cloud-creds-provision
- chain: ipi-install-stableinitial
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This chain needs to create the RAM users just like the ipi-alibaba-pre-chain does.

Suggested change
- chain: ipi-install-stableinitial
- ref: ipi-conf-alibabacloud-cloud-creds-provision
- chain: ipi-install-stableinitial

documentation: |-
The IPI setup step contains all steps that provision an OpenShift cluster
from stable-initial imagestream with a default configuration on Alibaba.

4 changes: 4 additions & 0 deletions ci-operator/step-registry/ipi/conf/alibabacloud/OWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
approvers:
- alibaba-approvers
reviewers:
- alibaba-reviewers
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

export ALIBABA_CLOUD_CREDENTIALS_FILE=${SHARED_DIR}/alibabacreds.ini
cluster_id="${NAMESPACE}-${JOB_NAME_HASH}"

# extract ccoctl from the release image
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could just use the CCO image directly instead of extracting it from the release image. In other words, modify ipi-conf-alibabacloud-cloud-creds-deprovision-ref.yaml to use CCO instead of cli. But the create step would still need oc, so perhaps extracting it is better for consistency between the steps.

Copy link
Member

@wking wking Jan 25, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What he has here matches existing ccotcl steps, but +1 to pivoting all of these to using the appropriate release image and then injecting oc via cli: latest. I've opened #25575 to pivot the existing consumers.

CCO_IMAGE=$(oc adm release info --image-for='cloud-credential-operator' "${RELEASE_IMAGE_LATEST}")
cd "/tmp"
oc image extract "${CCO_IMAGE}" --file="/usr/bin/ccoctl"
chmod 555 "/tmp/ccoctl"

# delete credentials infrastructure created by cloud-creds-provision configure step
"/tmp/ccoctl" alibabacloud \
delete-ram-users \
--name="${cluster_id}"
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"path": "ipi/conf/alibabacloud/cloud-creds-deprovision/ipi-conf-alibabacloud-cloud-creds-deprovision-ref.yaml",
"owners": {
"approvers": [
"alibaba-approvers"
],
"reviewers": [
"alibaba-reviewers"
]
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ref:
as: ipi-conf-alibabacloud-cloud-creds-deprovision
from: cli
commands: ipi-conf-alibabacloud-cloud-creds-deprovision-commands.sh
resources:
requests:
cpu: 10m
memory: 100Mi
documentation: The IPI cloud-creds-deprovision configure step adds a step that removes cloud access keys
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the provision step should document the CREDENTIALSREQUEST_* convention, and ideally give some background around why ccoctl is unable to reap these creds without that content. I'd have naively expected a common cluster_id to have been enough. Will we be doc'ing customers needing to preserve these somewhere outside the cluster so they can delete their creds when they're done with the cluster?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added documentation.

Either the preservation or the regeneration will be required as the code is written today. We could file an issue against CCO repository and request that an Alibaba engineer see if it is possible to remove by using the cluster_id.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/bash

set -o nounset
set -o errexit
set -o pipefail

CR_PATH="/tmp/credrequests"
MPREFIX="${SHARED_DIR}/manifest"
cluster_id="${NAMESPACE}-${JOB_NAME_HASH}"
export ALIBABA_CLOUD_CREDENTIALS_FILE="${SHARED_DIR}/alibabacreds.ini"

# extract ccoctl from the release image
oc registry login
CCO_IMAGE=$(oc adm release info --image-for='cloud-credential-operator' "${RELEASE_IMAGE_LATEST}")
cd "/tmp"
oc image extract "${CCO_IMAGE}" --file="/usr/bin/ccoctl"
chmod 555 "/tmp/ccoctl"

# extract alibabacloud credentials requests from the release image
oc adm release extract --credentials-requests --cloud=alibabacloud --to="${CR_PATH}" "${RELEASE_IMAGE_LATEST}"

# create required credentials infrastructure and installer manifests for workload identity
"/tmp/ccoctl" alibabacloud create-ram-users \
--region "${LEASED_RESOURCE}" \
--name="${cluster_id}" \
--credentials-requests-dir="${CR_PATH}" \
--output-dir="/tmp"

cd "/tmp/manifests"
# copy generated secret manifests from ccoctl target directory into shared directory
for FILE in *; do cp "${FILE}" "${MPREFIX}_${FILE}"; done
Loading