Skip to content
This repository has been archived by the owner on Apr 7, 2020. It is now read-only.

Alicloud: enable customized image sharing #427

Merged
merged 1 commit into from
Nov 28, 2019
Merged

Alicloud: enable customized image sharing #427

merged 1 commit into from
Nov 28, 2019

Conversation

EmoinLanyu
Copy link
Contributor

@EmoinLanyu EmoinLanyu commented Nov 11, 2019

What this PR does / why we need it:
Alicloud currently does not actively support latest operating system images. To reduce & avoid security risks, we are using customized images for Shoot creation. Customized images need to be first shared with Shoot's alicloud account before it can consume it.
This PR provide automatic sharing mechanism in extension-provider-alicloud.

Which issue(s) this PR fixes:
Fixes #

Special notes for your reviewer:

Release note:

provider-alicloud extension now automatically shares customized images to Shoot's alicloud account during infrastructure reconcile.

@EmoinLanyu EmoinLanyu requested a review from a team as a code owner November 11, 2019 22:03
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 11, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 added needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 11, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 12, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 12, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 12, 2019
Copy link
Contributor

@jia-jerry jia-jerry left a comment

Choose a reason for hiding this comment

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

I can't remove the comment...

Copy link
Contributor

@jia-jerry jia-jerry left a comment

Choose a reason for hiding this comment

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

I can't remove the comment...

@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 12, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 12, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 13, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 13, 2019
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 13, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 13, 2019
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 13, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 13, 2019
@EmoinLanyu EmoinLanyu requested a review from rfranzke November 13, 2019 06:16
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 13, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 13, 2019
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 13, 2019
@EmoinLanyu
Copy link
Contributor Author

Hi @rfranzke , I have moved the code to infrastructure controller control loop. Build and tests have passed as well. Could you please help review? Thanks

@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2019
@gardener-robot-ci-3 gardener-robot-ci-3 added reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) and removed reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) labels Nov 14, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2019
@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 14, 2019
@EmoinLanyu EmoinLanyu requested a review from rfranzke November 14, 2019 13:25
Copy link
Contributor

@ialidzhikov ialidzhikov left a comment

Choose a reason for hiding this comment

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

Does it makes sense also to add docs about the image sharing/custom images in controllers/provider-alicloud/docs/usage-as-end-user.md/controllers/provider-alicloud/docs/usage-as-operator.md?

@EmoinLanyu
Copy link
Contributor Author

Does it makes sense also to add docs about the image sharing/custom images in controllers/provider-alicloud/docs/usage-as-end-user.md/controllers/provider-alicloud/docs/usage-as-operator.md?

Yes, good point indeed! Will add it too.

@ialidzhikov
Copy link
Contributor

ialidzhikov commented Nov 15, 2019

One more question - shouldn't we preserve also the existing public image scenario somehow? Currently I try to pass a worker

workers:
- autoScalerMax: 1
  autoScalerMin: 1
  machineImage:
    name: coreos-alicloud
    version: 2023.4.0
  machineType: ecs.c5.large

referencing the public CoreOS image. And the infra fails to reconcile because I didn't specified the machine-image-owner secret.

@EmoinLanyu
Copy link
Contributor Author

One more question - shouldn't we preserve also the existing public image scenario somehow? Currently I try to pass a worker

workers:
- autoScalerMax: 1
  autoScalerMin: 1
  machineImage:
    name: coreos-alicloud
    version: 2023.4.0
  machineType: ecs.c5.large

referencing the public CoreOS image. And the infra fails to reconcile because I didn't specified the machine-image-owner secret.

Sorry for the late reply, I somehow missed your later comments...
Yes, this is because currently Alicloud ECS client is instantiated only once for one extension controller and the initialization is before sharing the image (we are also moving the instantiation to Actuator instantiation as well).
In future setup, which we are working on, this machine-image-owner secret should be created in extension's namespace in seeds by default (since only Alicloud provider is needing it, we don't want to simply adding it the way backup bucket did. So it's kind of tricky so we are looking for a good solution).
As a matter of fact, since we have talked Alicloud into providing a new CoreOS version, we have more time reconsider this sharing process and find a better way to pass this secret credentials.

@gardener-robot-ci-1 gardener-robot-ci-1 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 25, 2019
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 25, 2019
@gardener-robot-ci-2 gardener-robot-ci-2 added the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 25, 2019
@gardener-robot-ci-3 gardener-robot-ci-3 removed the reviewed/ok-to-test Has approval for testing (check PR in detail before setting this label because PR is run on CI/CD) label Nov 25, 2019
@EmoinLanyu
Copy link
Contributor Author

Hi @ialidzhikov @rfranzke , I have made some refactoring and added related documents for customized image sharing. Could you please do another round of review? Thanks a lot!
So Alicloud ECS Client for Seed now is instantiated only once when the controller is added to controller manager (during APIReader injection). Secret reference will be checked, and only when it exists the client will be created, so landscapes that don't use customized images won't be affected.
As specified in the docs file, administrator needs to explicitly provide access credentials of Seed operator in the controller registration configuration (TODO: encrypt ctrlreg). Related PR is also created for landscape-setup.

Copy link
Contributor

@rfranzke rfranzke left a comment

Choose a reason for hiding this comment

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

/lgtm now, very nice PR, thank you!

@rfranzke
Copy link
Contributor

@ialidzhikov could you check again as well?

Copy link
Contributor

@ialidzhikov ialidzhikov left a comment

Choose a reason for hiding this comment

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

/approve

@ialidzhikov ialidzhikov merged commit 6ddae23 into gardener-attic:master Nov 28, 2019
@@ -0,0 +1,9 @@
apiVersion: v1
kind: Secret
Copy link
Contributor

Choose a reason for hiding this comment

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

If .Values.config.machineImageOwnerSecret is not set, let's not create the secret.

Comment on lines +65 to +68
machineImageOwnerSecret:
name: machine-image-owner
accessKeyID: ZHVtbXk=
accessKeySecret: ZHVtbXk=
Copy link
Contributor

Choose a reason for hiding this comment

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

Please mark them off. Otherwise, it will be used as an default value.

// MachineImages is the default list of machine images.
MachineImages []config.MachineImage
// MachineImageOwnerSecretRef is the secret reference which contains credential of AliCloud subaccount for customized images.
MachineImageOwnerSecretRef corev1.SecretReference
Copy link
Contributor

Choose a reason for hiding this comment

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

As MachineImageOwnerSecretRef could be a nil, please define it as *corev1.SecretReference

@ialidzhikov
Copy link
Contributor

@EmoinLanyu , could you please check @jia-jerry's comments? Thanks!

@EmoinLanyu
Copy link
Contributor Author

@EmoinLanyu , could you please check @jia-jerry's comments? Thanks!

I've changed them locally and have been testing it, but was occupied by other stuff so didn't create a PR. Anyway, thanks for the reminder, will do asap! :=)

@EmoinLanyu
Copy link
Contributor Author

@EmoinLanyu , could you please check @jia-jerry's comments? Thanks!

Hi @ialidzhikov , done, please check #483, thanks!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs/ok-to-test Needs approval for testing (check PR in detail before setting this label because PR is run on CI/CD)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants