Skip to content

Commit 72ee68c

Browse files
committed
*. delete audit_log in arm64, and build mysql's arm64 dockerfile
1 parent 9d503a3 commit 72ee68c

File tree

5 files changed

+48
-8
lines changed

5 files changed

+48
-8
lines changed

Dockerfile.mysql80arm64

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# docker buildx build --platform linux/arm64 -f Dockerfile.mysql80arm64 -t acekingke/percona-server:8.0.25 -o type=docker .
2+
# docker run --rm -ti -u root --entrypoint "/bin/bash" --platform linux/arm64 radondb/percona-server:8.0.25
3+
# docker run --rm -ti -u root --entrypoint "/bin/bash" radondb/percona-server:8.0.25-amd64
4+
# docker run --rm -ti -u root --entrypoint "/bin/bash" perconalab/percona-server:8.0.30-22.1-arm64
5+
from mysql:8.0.28-oracle
6+
# COPY --from=base /lib64/libc.so.6 usr/lib64/mysql/plugin/libc.so.6
7+
# COPY --from=base /usr/lib64/mysql/plugin/debug/audit_log.so /usr/lib64/mysql/plugin/debug/audit_log.so
8+
# COPY --from=base /usr/lib64/mysql/plugin/audit_log.so /usr/lib64/mysql/plugin/audit_log.so
9+
COPY ps-entry.sh /usr/local/bin/docker-entrypoint.sh
10+
RUN set -ex; \
11+
usermod -u 1001 mysql ;\
12+
groupmod -g 1001 mysql; \
13+
chown -R mysql.mysql /var/run/mysqld /var/lib/mysql-keyring /var/lib/mysql /var/lib/mysql-files; \
14+
cp /usr/local/bin/docker-entrypoint.sh /
15+
ENTRYPOINT ["docker-entrypoint.sh"]
16+
EXPOSE 3306 33060
17+
CMD ["mysqld"]

Dockerfile57.sidecar

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -a -o bin/my
6161

6262
FROM radondb/mysql57-sidecar:v2.4.0
6363
WORKDIR /
64+
RUN set -ex; \
65+
apt-get update; \
66+
apt-get install -y --no-install-recommends mysql-client jq; \
67+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6468
COPY --from=builder /workspace/bin/sidecar /usr/local/bin/sidecar
6569
COPY --from=builder /workspace/bin/mysqlchecker /mnt/mysqlchecker
6670
COPY --from=builder /workspace/bin/s3upload /mnt/s3upload

Dockerfile80.sidecar

+4
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,10 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -a -o bin/my
6161

6262
FROM radondb/mysql80-sidecar:v2.4.0
6363
WORKDIR /
64+
RUN set -ex; \
65+
apt-get update; \
66+
apt-get install -y --no-install-recommends mysql-client jq; \
67+
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
6468
COPY --from=builder /workspace/bin/sidecar /usr/local/bin/sidecar
6569
COPY --from=builder /workspace/bin/mysqlchecker /mnt/mysqlchecker
6670
COPY --from=builder /workspace/bin/s3upload /mnt/s3upload

build_mutiplatform.sh

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ DOCKER_BUILDKIT=1 docker build -f build/xenon/Dockerfile --build-arg GO_PROXY=${
3333
docker buildx build --build-arg GO_PROXY=on --platform linux/arm64 -f build/xenon/Dockerfile.arm64 --build-arg GO_PROXY=${GO_PROXY} -t ${XENON_IMGARM} -o type=docker .
3434
docker push $XENON_IMGAMD
3535
docker push $XENON_IMGARM
36-
docker manifest create ${IMGPREFIX}xenon:${TAG} ${XENON_IMGAMD} ${XENON_IMGARM}
36+
docker manifest create --amend ${IMGPREFIX}xenon:${TAG} ${XENON_IMGAMD} ${XENON_IMGARM}
3737
docker manifest push --purge ${IMGPREFIX}xenon:${TAG}
3838

3939

@@ -53,9 +53,9 @@ docker push ${SIDECAR57_IMGAMD}
5353
docker push ${SIDECAR80_IMGAMD}
5454
docker push ${SIDECAR57_IMGARM}
5555
docker push ${SIDECAR80_IMGARM}
56-
docker manifest create ${IMGPREFIX}mysql57-sidecar:${TAG} ${SIDECAR57_IMGAMD} ${SIDECAR57_IMGARM}
56+
docker manifest create --amend ${IMGPREFIX}mysql57-sidecar:${TAG} ${SIDECAR57_IMGAMD} ${SIDECAR57_IMGARM}
5757
docker manifest push --purge ${IMGPREFIX}mysql57-sidecar:${TAG}
58-
docker manifest create ${IMGPREFIX}mysql80-sidecar:${TAG} ${SIDECAR80_IMGAMD} ${SIDECAR80_IMGARM}
58+
docker manifest create --amend ${IMGPREFIX}mysql80-sidecar:${TAG} ${SIDECAR80_IMGAMD} ${SIDECAR80_IMGARM}
5959
docker manifest push --purge ${IMGPREFIX}mysql80-sidecar:${TAG}
6060

6161

mysqlcluster/syncer/mysql_cm.go

+20-5
Original file line numberDiff line numberDiff line change
@@ -21,20 +21,20 @@ import (
2121
"context"
2222
"errors"
2323
"fmt"
24-
"sort"
25-
"strings"
26-
2724
"github.com/blang/semver"
2825
"github.com/go-ini/ini"
2926
"github.com/go-logr/logr"
3027
corev1 "k8s.io/api/core/v1"
3128
k8serrors "k8s.io/apimachinery/pkg/api/errors"
3229
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
3330
"k8s.io/apimachinery/pkg/runtime"
31+
osrun "runtime"
3432
"sigs.k8s.io/controller-runtime/pkg/client"
3533
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
3634
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
3735
logf "sigs.k8s.io/controller-runtime/pkg/log"
36+
"sort"
37+
"strings"
3838

3939
"github.com/radondb/radondb-mysql-kubernetes/mysqlcluster"
4040
"github.com/radondb/radondb-mysql-kubernetes/utils"
@@ -178,7 +178,10 @@ func (s *mysqlCMSyncer) appendConf() error {
178178
return err
179179
}
180180
if s.Spec.MysqlVersion == "8.0" {
181-
str := pluginConfigs["plugin-load"]
181+
var str string = pluginConfigs["plugin-load"]
182+
if osrun.GOARCH == "aarch64" || osrun.GOARCH == "arm64" {
183+
str = "\"semisync_master.so;semisync_slave.so\""
184+
}
182185
str = str[0:len(str)-1] + ";mysql_clone.so\""
183186
if s.Spec.MysqlOpts.PluginConf != nil {
184187
s.Spec.MysqlOpts.PluginConf["plugin-load"] = str
@@ -333,7 +336,19 @@ func buildMysqlConf(c *mysqlcluster.MysqlCluster) (string, error) {
333336
func buildMysqlPluginConf(c *mysqlcluster.MysqlCluster) (string, error) {
334337
cfg := ini.Empty(ini.LoadOptions{IgnoreInlineComment: true})
335338
sec := cfg.Section("mysqld")
336-
addKVConfigsToSection(sec, pluginConfigs)
339+
pluginConfigsCpy := make(map[string]string)
340+
cpyMap(pluginConfigs, pluginConfigsCpy)
341+
342+
if osrun.GOARCH == "aarch64" || osrun.GOARCH == "arm64" {
343+
delete(pluginConfigsCpy, "audit_log_file")
344+
delete(pluginConfigsCpy, "audit_log_exclude_accounts")
345+
delete(pluginConfigsCpy, "audit_log_buffer_size")
346+
delete(pluginConfigsCpy, "audit_log_policy")
347+
delete(pluginConfigsCpy, "audit_log_rotate_on_size")
348+
delete(pluginConfigsCpy, "audit_log_rotations")
349+
delete(pluginConfigsCpy, "audit_log_format")
350+
}
351+
addKVConfigsToSection(sec, pluginConfigsCpy)
337352
addKVConfigsToSection(sec, c.Spec.MysqlOpts.PluginConf)
338353
data, err := writeConfigs(cfg)
339354
if err != nil {

0 commit comments

Comments
 (0)