Skip to content

Commit

Permalink
Add aliyun cloud support
Browse files Browse the repository at this point in the history
Enable ucd to work in aliyun cloud by add a config templete
for aliyun

Signed-off-by: jwang <jing.j.wang@intel.com>
  • Loading branch information
jwang11 authored and ahkok committed Oct 15, 2019
1 parent 2c8d9c0 commit 4706d35
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 3 deletions.
3 changes: 2 additions & 1 deletion Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,8 @@ systemdsystemunitdir = @SYSTEMD_SYSTEMUNITDIR@
systemdsystemunit_DATA = data/ucd.service \
data/ucd-aws.service \
data/ucd-oci.service \
data/ucd-tencent.service
data/ucd-tencent.service \
data/ucd-aliyun.service

systemdsystemunit-install-local:
mkdir -p $(DESTDIR)$(systemdsystemunitdir)/multi-user.target.wants/
Expand Down
3 changes: 2 additions & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@ AC_CONFIG_FILES([Makefile
data/ucd.service
data/ucd-aws.service
data/ucd-oci.service
data/ucd-tencent.service])
data/ucd-tencent.service
data/ucd-aliyun.service])
AC_CONFIG_HEADERS([config.h])

LT_INIT
Expand Down
17 changes: 17 additions & 0 deletions data/ucd-aliyun.service.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[Unit]
Description=micro-config-drive job for Aliyun
After=network.target systemd-networkd.service
Wants=local-fs.target sshd.service sshd-keygen.service
ConditionPathExists=!/var/lib/cloud/aliyun-user-data

[Service]
Type=oneshot
ExecStart=@prefix@/bin/ucd-data-fetch aliyun
RemainAfterExit=yes
TimeoutSec=0

# Output needs to appear in instance console output
StandardOutput=journal+console

[Install]
WantedBy=multi-user.target
14 changes: 13 additions & 1 deletion src/ucd-data-fetch.c
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ struct cloud_struct {
char *cloud_config_header;
};

#define MAX_CONFIGS 3
#define MAX_CONFIGS 4
static struct cloud_struct config[MAX_CONFIGS] = {
{
"aws",
Expand Down Expand Up @@ -103,6 +103,18 @@ static struct cloud_struct config[MAX_CONFIGS] = {
" groups: wheelnopw\n" \
"ssh_authorized_keys:\n" \
" - "
},
{
"aliyun",
"100.100.100.200",
"/latest/meta-data/public-keys/0/openssh-key",
NULL,
"#cloud-config\n" \
"users:\n" \
" - name: aliyun\n" \
" groups: wheelnopw\n" \
"ssh_authorized_keys:\n" \
" - "
}
};

Expand Down

0 comments on commit 4706d35

Please sign in to comment.