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

refactor: replace kaniko with buildkit for compatibility with the docker/dockerfile:1.4.0 frontend #250

Merged
merged 2 commits into from
Jun 1, 2022
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: 8 additions & 9 deletions api-server/services/bento.go
Original file line number Diff line number Diff line change
Expand Up @@ -428,15 +428,14 @@ func (s *bentoService) CreateImageBuilderJob(ctx context.Context, bento *models.
}

err = ImageBuilderService.CreateImageBuilderJob(ctx, CreateImageBuilderJobOption{
KubeName: kubeName,
ImageName: imageName,
S3ObjectName: s3ObjectName,
S3BucketName: s3BucketName,
Cluster: majorCluster,
DockerFileCMKubeName: nil,
DockerFileContent: nil,
DockerFilePath: utils.StringPtr("./env/docker/Dockerfile"),
KubeLabels: kubeLabels,
KubeName: kubeName,
ImageName: imageName,
S3ObjectName: s3ObjectName,
S3BucketName: s3BucketName,
Cluster: majorCluster,
DockerFileContent: nil,
DockerFilePath: utils.StringPtr("./env/docker/Dockerfile"),
KubeLabels: kubeLabels,
})
if err != nil {
return nil, err
Expand Down
22 changes: 10 additions & 12 deletions api-server/services/cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -475,7 +475,7 @@ func (s *clusterService) GetGrafana(ctx context.Context, cluster *models.Cluster
}, err
}

func (s *clusterService) MakeSureDockerConfigCM(ctx context.Context, cluster *models.Cluster, namespace string) (dockerConfigCM *corev1.ConfigMap, err error) {
func (s *clusterService) MakeSureDockerConfigSecret(ctx context.Context, cluster *models.Cluster, namespace string) (dockerConfigSecret *corev1.Secret, err error) {
org, err := OrganizationService.GetAssociatedOrganization(ctx, cluster)
if err != nil {
return nil, err
Expand Down Expand Up @@ -513,25 +513,25 @@ func (s *clusterService) MakeSureDockerConfigCM(ctx context.Context, cluster *mo
return nil, err
}

cmsCli := kubeCli.CoreV1().ConfigMaps(namespace)
secretsCli := kubeCli.CoreV1().Secrets(namespace)

dockerConfigCM, err = cmsCli.Get(ctx, dockerConfigCMKubeName, metav1.GetOptions{})
dockerConfigSecret, err = secretsCli.Get(ctx, dockerConfigCMKubeName, metav1.GetOptions{})
dockerConfigIsNotFound := apierrors.IsNotFound(err)
// nolint: gocritic
if err != nil && !dockerConfigIsNotFound {
return nil, err
}
err = nil
if dockerConfigIsNotFound {
dockerConfigCM = &corev1.ConfigMap{
dockerConfigSecret = &corev1.Secret{
ObjectMeta: metav1.ObjectMeta{Name: dockerConfigCMKubeName},
Data: map[string]string{
StringData: map[string]string{
"config.json": string(dockerConfigContent),
},
}
_, err_ := cmsCli.Create(ctx, dockerConfigCM, metav1.CreateOptions{})
_, err_ := secretsCli.Create(ctx, dockerConfigSecret, metav1.CreateOptions{})
if err_ != nil {
dockerConfigCM, err = cmsCli.Get(ctx, dockerConfigCMKubeName, metav1.GetOptions{})
dockerConfigSecret, err = secretsCli.Get(ctx, dockerConfigCMKubeName, metav1.GetOptions{})
dockerConfigIsNotFound = apierrors.IsNotFound(err)
if err != nil && !dockerConfigIsNotFound {
return nil, err
Expand All @@ -543,11 +543,9 @@ func (s *clusterService) MakeSureDockerConfigCM(ctx context.Context, cluster *mo
err = nil
}
}
}

if !dockerConfigIsNotFound {
dockerConfigCM.Data["config.json"] = string(dockerConfigContent)
_, err = cmsCli.Update(ctx, dockerConfigCM, metav1.UpdateOptions{})
} else {
dockerConfigSecret.Data["config.json"] = dockerConfigContent
_, err = secretsCli.Update(ctx, dockerConfigSecret, metav1.UpdateOptions{})
if err != nil {
return nil, err
}
Expand Down
2 changes: 1 addition & 1 deletion api-server/services/deployment_revision.go
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ func (*deploymentRevisionService) Create(ctx context.Context, opt CreateDeployme
if err != nil {
return nil, err
}
deploymentComponentMinVersion := version2.Must(version2.NewVersion("0.3.0"))
deploymentComponentMinVersion := version2.Must(version2.NewVersion("0.4.0"))
for _, comp := range yataiComponents {
if comp.Type == modelschemas.YataiComponentTypeDeployment {
var ver *version2.Version
Expand Down
Loading