Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

*. delete audit_log in arm64, and build mysql's arm64 dockerfile #848

Merged
merged 1 commit into from
Aug 13, 2024
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
17 changes: 17 additions & 0 deletions Dockerfile.mysql80arm64
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# docker buildx build --platform linux/arm64 -f Dockerfile.mysql80arm64 -t acekingke/percona-server:8.0.25 -o type=docker .
# docker run --rm -ti -u root --entrypoint "/bin/bash" --platform linux/arm64 radondb/percona-server:8.0.25
# docker run --rm -ti -u root --entrypoint "/bin/bash" radondb/percona-server:8.0.25-amd64
# docker run --rm -ti -u root --entrypoint "/bin/bash" perconalab/percona-server:8.0.30-22.1-arm64
from mysql:8.0.28-oracle
# COPY --from=base /lib64/libc.so.6 usr/lib64/mysql/plugin/libc.so.6
# COPY --from=base /usr/lib64/mysql/plugin/debug/audit_log.so /usr/lib64/mysql/plugin/debug/audit_log.so
# COPY --from=base /usr/lib64/mysql/plugin/audit_log.so /usr/lib64/mysql/plugin/audit_log.so
COPY ps-entry.sh /usr/local/bin/docker-entrypoint.sh
RUN set -ex; \
usermod -u 1001 mysql ;\
groupmod -g 1001 mysql; \
chown -R mysql.mysql /var/run/mysqld /var/lib/mysql-keyring /var/lib/mysql /var/lib/mysql-files; \
cp /usr/local/bin/docker-entrypoint.sh /
ENTRYPOINT ["docker-entrypoint.sh"]
EXPOSE 3306 33060
CMD ["mysqld"]
4 changes: 4 additions & 0 deletions Dockerfile57.sidecar
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -a -o bin/my

FROM radondb/mysql57-sidecar:v2.4.0
WORKDIR /
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends mysql-client jq; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --from=builder /workspace/bin/sidecar /usr/local/bin/sidecar
COPY --from=builder /workspace/bin/mysqlchecker /mnt/mysqlchecker
COPY --from=builder /workspace/bin/s3upload /mnt/s3upload
Expand Down
4 changes: 4 additions & 0 deletions Dockerfile80.sidecar
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,10 @@ RUN CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -a -o bin/my

FROM radondb/mysql80-sidecar:v2.4.0
WORKDIR /
RUN set -ex; \
apt-get update; \
apt-get install -y --no-install-recommends mysql-client jq; \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
COPY --from=builder /workspace/bin/sidecar /usr/local/bin/sidecar
COPY --from=builder /workspace/bin/mysqlchecker /mnt/mysqlchecker
COPY --from=builder /workspace/bin/s3upload /mnt/s3upload
Expand Down
6 changes: 3 additions & 3 deletions build_mutiplatform.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ DOCKER_BUILDKIT=1 docker build -f build/xenon/Dockerfile --build-arg GO_PROXY=${
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 .
docker push $XENON_IMGAMD
docker push $XENON_IMGARM
docker manifest create ${IMGPREFIX}xenon:${TAG} ${XENON_IMGAMD} ${XENON_IMGARM}
docker manifest create --amend ${IMGPREFIX}xenon:${TAG} ${XENON_IMGAMD} ${XENON_IMGARM}
docker manifest push --purge ${IMGPREFIX}xenon:${TAG}


Expand All @@ -53,9 +53,9 @@ docker push ${SIDECAR57_IMGAMD}
docker push ${SIDECAR80_IMGAMD}
docker push ${SIDECAR57_IMGARM}
docker push ${SIDECAR80_IMGARM}
docker manifest create ${IMGPREFIX}mysql57-sidecar:${TAG} ${SIDECAR57_IMGAMD} ${SIDECAR57_IMGARM}
docker manifest create --amend ${IMGPREFIX}mysql57-sidecar:${TAG} ${SIDECAR57_IMGAMD} ${SIDECAR57_IMGARM}
docker manifest push --purge ${IMGPREFIX}mysql57-sidecar:${TAG}
docker manifest create ${IMGPREFIX}mysql80-sidecar:${TAG} ${SIDECAR80_IMGAMD} ${SIDECAR80_IMGARM}
docker manifest create --amend ${IMGPREFIX}mysql80-sidecar:${TAG} ${SIDECAR80_IMGAMD} ${SIDECAR80_IMGARM}
docker manifest push --purge ${IMGPREFIX}mysql80-sidecar:${TAG}


Expand Down
25 changes: 20 additions & 5 deletions mysqlcluster/syncer/mysql_cm.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,20 +21,20 @@ import (
"context"
"errors"
"fmt"
"sort"
"strings"

"github.com/blang/semver"
"github.com/go-ini/ini"
"github.com/go-logr/logr"
corev1 "k8s.io/api/core/v1"
k8serrors "k8s.io/apimachinery/pkg/api/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
"k8s.io/apimachinery/pkg/runtime"
osrun "runtime"
"sigs.k8s.io/controller-runtime/pkg/client"
"sigs.k8s.io/controller-runtime/pkg/client/apiutil"
"sigs.k8s.io/controller-runtime/pkg/controller/controllerutil"
logf "sigs.k8s.io/controller-runtime/pkg/log"
"sort"
"strings"

"github.com/radondb/radondb-mysql-kubernetes/mysqlcluster"
"github.com/radondb/radondb-mysql-kubernetes/utils"
Expand Down Expand Up @@ -178,7 +178,10 @@ func (s *mysqlCMSyncer) appendConf() error {
return err
}
if s.Spec.MysqlVersion == "8.0" {
str := pluginConfigs["plugin-load"]
var str string = pluginConfigs["plugin-load"]
if osrun.GOARCH == "aarch64" || osrun.GOARCH == "arm64" {
str = "\"semisync_master.so;semisync_slave.so\""
}
str = str[0:len(str)-1] + ";mysql_clone.so\""
if s.Spec.MysqlOpts.PluginConf != nil {
s.Spec.MysqlOpts.PluginConf["plugin-load"] = str
Expand Down Expand Up @@ -333,7 +336,19 @@ func buildMysqlConf(c *mysqlcluster.MysqlCluster) (string, error) {
func buildMysqlPluginConf(c *mysqlcluster.MysqlCluster) (string, error) {
cfg := ini.Empty(ini.LoadOptions{IgnoreInlineComment: true})
sec := cfg.Section("mysqld")
addKVConfigsToSection(sec, pluginConfigs)
pluginConfigsCpy := make(map[string]string)
cpyMap(pluginConfigs, pluginConfigsCpy)

if osrun.GOARCH == "aarch64" || osrun.GOARCH == "arm64" {
delete(pluginConfigsCpy, "audit_log_file")
delete(pluginConfigsCpy, "audit_log_exclude_accounts")
delete(pluginConfigsCpy, "audit_log_buffer_size")
delete(pluginConfigsCpy, "audit_log_policy")
delete(pluginConfigsCpy, "audit_log_rotate_on_size")
delete(pluginConfigsCpy, "audit_log_rotations")
delete(pluginConfigsCpy, "audit_log_format")
}
addKVConfigsToSection(sec, pluginConfigsCpy)
addKVConfigsToSection(sec, c.Spec.MysqlOpts.PluginConf)
data, err := writeConfigs(cfg)
if err != nil {
Expand Down
Loading