Skip to content
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
6 changes: 6 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# the following files will be injected into the bootstrap node (CoreOS) as-is,
# which must be in Unix line endings (LF)
data/data/bootstrap/systemd/**/*.service text eol=lf
Copy link
Contributor

Choose a reason for hiding this comment

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

similar to the other comment, it would be helpful to add context, in a commit message and/or commit on why we need this file and how it relates to windows support (I assume it's specifically to handle windows new lines?)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added comments in .gitattribute. This is to ensure the file checked out always have Unix line ending, since these files are used in CoreOS.

data/data/bootstrap/systemd/**/*.socket text eol=lf
data/data/bootstrap/systemd/**/*.conf text eol=lf
data/data/bootstrap/files/** text eol=lf
10 changes: 5 additions & 5 deletions pkg/asset/agent/image/ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -316,14 +316,14 @@ func (a *Ignition) Generate(ctx context.Context, dependencies asset.Parents) err

// add ZTP manifests to manifestPath
for _, file := range agentManifests.FileList {
manifestFile := ignition.FileFromBytes(filepath.Join(manifestPath, filepath.Base(file.Filename)),
manifestFile := ignition.FileFromBytes(path.Join(manifestPath, filepath.Base(file.Filename)),
Copy link
Contributor

Choose a reason for hiding this comment

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

it would be helpful to add context, for instance in the commit message, about why this change is needed. it's not obvious to me how this relates to windows support

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I added in the commit messages and PR decription

"root", 0600, file.Data)
config.Storage.Files = append(config.Storage.Files, manifestFile)
}

// add AgentConfig if provided
if agentConfigAsset.Config != nil {
agentConfigFile := ignition.FileFromBytes(filepath.Join(manifestPath, filepath.Base(agentConfigAsset.File.Filename)),
agentConfigFile := ignition.FileFromBytes(path.Join(manifestPath, filepath.Base(agentConfigAsset.File.Filename)),
"root", 0600, agentConfigAsset.File.Data)
config.Storage.Files = append(config.Storage.Files, agentConfigFile)
}
Expand Down Expand Up @@ -588,7 +588,7 @@ func addMacAddressToHostnameMappings(
}
for _, host := range agentHostsAsset.Hosts {
if host.Hostname != "" {
file := ignition.FileFromBytes(filepath.Join(hostnamesPath,
file := ignition.FileFromBytes(path.Join(hostnamesPath,
strings.ToLower(filepath.Base(host.Interfaces[0].MacAddress))),
"root", 0600, []byte(host.Hostname))
config.Storage.Files = append(config.Storage.Files, file)
Expand All @@ -602,8 +602,8 @@ func addHostConfig(config *igntypes.Config, agentHosts *agentconfig.AgentHosts)
return err
}

for path, content := range confs {
hostConfigFile := ignition.FileFromBytes(filepath.Join("/etc/assisted/hostconfig", path), "root", 0644, content)
for pathName, content := range confs {
hostConfigFile := ignition.FileFromBytes(path.Join("/etc/assisted/hostconfig", pathName), "root", 0644, content)
config.Storage.Files = append(config.Storage.Files, hostConfigFile)
}
return nil
Expand Down
3 changes: 2 additions & 1 deletion pkg/asset/agent/image/unconfigured_ignition.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"net/url"
"os"
"path"
"path/filepath"
"strings"

Expand Down Expand Up @@ -236,7 +237,7 @@ func (a *UnconfiguredIgnition) Generate(_ context.Context, dependencies asset.Pa
}

for _, file := range ztpManifestsToInclude {
manifestFile := ignition.FileFromBytes(filepath.Join(manifestPath, filepath.Base(file.Filename)),
manifestFile := ignition.FileFromBytes(path.Join(manifestPath, filepath.Base(file.Filename)),
"root", 0600, file.Data)
config.Storage.Files = append(config.Storage.Files, manifestFile)
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/asset/ignition/bootstrap/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,7 +684,7 @@ func (a *Common) addParentFiles(dependencies asset.Parents) {

rootCA := &tls.RootCA{}
dependencies.Get(rootCA)
a.Config.Storage.Files = replaceOrAppend(a.Config.Storage.Files, ignition.FileFromBytes(filepath.Join(rootDir, rootCA.CertFile().Filename), "root", 0644, rootCA.Cert()))
a.Config.Storage.Files = replaceOrAppend(a.Config.Storage.Files, ignition.FileFromBytes(path.Join(rootDir, rootCA.CertFile().Filename), "root", 0644, rootCA.Cert()))
}

func replaceOrAppend(files []igntypes.File, file igntypes.File) []igntypes.File {
Expand Down
5 changes: 2 additions & 3 deletions pkg/asset/ignition/bootstrap/cvoignore.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"encoding/json"
"fmt"
"os"
"path"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand All @@ -18,10 +19,8 @@ import (

var (
_ asset.WritableAsset = (*CVOIgnore)(nil)
)

const (
cvoOverridesFilename = "manifests/cvo-overrides.yaml"
cvoOverridesFilename = path.Join("manifests", "cvo-overrides.yaml")
Copy link
Contributor

Choose a reason for hiding this comment

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

Is this change is on purpose, changing const to var ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

path.Join("manifests", "cvo-overrides.yaml") (value of type string) is not constantcompiler[InvalidConstInit](https://pkg.go.dev/golang.org/x/tools/internal/typesinternal#InvalidConstInit)

originalOverridesFilename = "original_cvo_overrides.patch"
)

Expand Down
6 changes: 5 additions & 1 deletion pkg/asset/ignition/node.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package ignition

import (
"fmt"
"path"
"path/filepath"

"github.com/clarketm/json"
Expand Down Expand Up @@ -30,7 +31,10 @@ func Marshal(input interface{}) ([]byte, error) {
func FilesFromAsset(pathPrefix string, username string, mode int, asset asset.WritableAsset) []igntypes.File {
var files []igntypes.File
for _, f := range asset.Files() {
files = append(files, FileFromBytes(filepath.Join(pathPrefix, f.Filename), username, mode, f.Data))
// f.Filename is using platform-specific path separators
// while its used in CoreOS, thus we need to convert it to Unix path separators
normalizedFilename := path.Join(pathPrefix, filepath.ToSlash(f.Filename))
files = append(files, FileFromBytes(normalizedFilename, username, mode, f.Data))
}
return files
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/additionaltrustbundleconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"crypto/x509"
"encoding/pem"
"fmt"
"path/filepath"
"path"
"strings"

"github.com/pkg/errors"
Expand All @@ -20,7 +20,7 @@ import (
)

var (
additionalTrustBundleConfigFileName = filepath.Join(manifestDir, "user-ca-bundle-config.yaml")
additionalTrustBundleConfigFileName = path.Join(manifestDir, "user-ca-bundle-config.yaml")
)

const (
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/cloudproviderconfig.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"encoding/json"
"fmt"
"path/filepath"
"path"

"github.com/IBM/vpc-go-sdk/vpcv1"
"github.com/pkg/errors"
Expand Down Expand Up @@ -43,7 +43,7 @@ import (
)

var (
cloudProviderConfigFileName = filepath.Join(manifestDir, "cloud-provider-config.yaml")
cloudProviderConfigFileName = path.Join(manifestDir, "cloud-provider-config.yaml")
)

const (
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/clustercsidriver.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package manifests

import (
"context"
"path/filepath"
"path"

"github.com/pkg/errors"

Expand All @@ -19,7 +19,7 @@ import (
)

var (
clusterCSIDriverConfigFileName = filepath.Join(manifestDir, "cluster-csi-driver-config.yaml")
clusterCSIDriverConfigFileName = path.Join(manifestDir, "cluster-csi-driver-config.yaml")
)

// ClusterCSIDriverConfig generates the cluster-csi-driver-config.yaml file.
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/dns.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package manifests
import (
"context"
"fmt"
"path/filepath"
"path"
"strings"

"github.com/pkg/errors"
Expand Down Expand Up @@ -35,7 +35,7 @@ import (
)

var (
dnsCfgFilename = filepath.Join(manifestDir, "cluster-dns-02-config.yml")
dnsCfgFilename = path.Join(manifestDir, "cluster-dns-02-config.yml")

combineGCPZoneInfo = func(project, zoneName string) string {
return fmt.Sprintf("project/%s/managedZones/%s", project, zoneName)
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/featuregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package manifests

import (
"context"
"path/filepath"
"path"

"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -14,7 +14,7 @@ import (
"github.com/openshift/installer/pkg/types/featuregates"
)

var fgFileName = filepath.Join(openshiftManifestDir, "99_feature-gate.yaml")
var fgFileName = path.Join(openshiftManifestDir, "99_feature-gate.yaml")

// FeatureGate generates the feature gate manifest.
type FeatureGate struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/imagedigestmirrorset.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package manifests

import (
"context"
"path/filepath"
"path"

"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -49,7 +49,7 @@ func (p *ImageDigestMirrorSet) Generate(_ context.Context, dependencies asset.Pa
return errors.Wrapf(err, "failed to marshal ImageDigestMirrorSet")
}
p.File = &asset.File{
Filename: filepath.Join(manifestDir, imageDigestMirrorSetFilename),
Filename: path.Join(manifestDir, imageDigestMirrorSetFilename),
Data: policyData,
}
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/imagesourcepolicy.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package manifests

import (
"context"
"path/filepath"
"path"

"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand Down Expand Up @@ -62,7 +62,7 @@ func (p *ImageContentSourcePolicy) Generate(_ context.Context, dependencies asse
return errors.Wrapf(err, "failed to marshal ImageContentSourcePolicy")
}
p.File = &asset.File{
Filename: filepath.Join(manifestDir, imageContentSourcePolicyFilename),
Filename: path.Join(manifestDir, imageContentSourcePolicyFilename),
Data: policyData,
}
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/manifests/infrastructure.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package manifests
import (
"context"
"fmt"
"path/filepath"
"path"
"sort"

"github.com/pkg/errors"
Expand Down Expand Up @@ -35,8 +35,8 @@ import (
)

var (
infraCfgFilename = filepath.Join(manifestDir, "cluster-infrastructure-02-config.yml")
cloudControllerUIDFilename = filepath.Join(manifestDir, "cloud-controller-uid-config.yml")
infraCfgFilename = path.Join(manifestDir, "cluster-infrastructure-02-config.yml")
cloudControllerUIDFilename = path.Join(manifestDir, "cloud-controller-uid-config.yml")
)

// Infrastructure generates the cluster-infrastructure-*.yml files.
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/manifests/ingress.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package manifests
import (
"context"
"fmt"
"path/filepath"
"path"

"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -18,8 +18,8 @@ import (
)

var (
clusterIngressConfigFile = filepath.Join(manifestDir, "cluster-ingress-02-config.yml")
defaultIngressControllerFile = filepath.Join(manifestDir, "cluster-ingress-default-ingresscontroller.yaml")
clusterIngressConfigFile = path.Join(manifestDir, "cluster-ingress-02-config.yml")
defaultIngressControllerFile = path.Join(manifestDir, "cluster-ingress-default-ingresscontroller.yaml")
)

// Ingress generates the cluster-ingress-*.yml files.
Expand Down
3 changes: 2 additions & 1 deletion pkg/asset/manifests/mco.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package manifests

import (
"path"
"path/filepath"
"strings"

Expand All @@ -24,7 +25,7 @@ func generateMCOManifest(installConfig *types.InstallConfig, template []*asset.F
mcoCfg := applyTemplateData(template[0].Data, tmplData)
return []*asset.File{
{
Filename: filepath.Join(manifestDir, strings.TrimSuffix(filepath.Base(template[0].Filename), ".template")),
Filename: path.Join(manifestDir, strings.TrimSuffix(filepath.Base(template[0].Filename), ".template")),
Data: mcoCfg,
},
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/asset/manifests/network.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package manifests
import (
"context"
"fmt"
"path/filepath"
"path"

"github.com/pkg/errors"
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
Expand All @@ -19,8 +19,8 @@ import (
)

var (
noCfgFilename = filepath.Join(manifestDir, "cluster-network-02-config.yml")
cnoCfgFilename = filepath.Join(manifestDir, "cluster-network-03-config.yml")
noCfgFilename = path.Join(manifestDir, "cluster-network-02-config.yml")
cnoCfgFilename = path.Join(manifestDir, "cluster-network-03-config.yml")
// Cluster Network MTU for AWS Local Zone deployments on edge machine pools.
ovnKubernetesNetworkMtuEdge uint32 = 1200
)
Expand Down
3 changes: 2 additions & 1 deletion pkg/asset/manifests/openshift.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"context"
"encoding/base64"
"os"
"path"
"path/filepath"
"strconv"
"strings"
Expand Down Expand Up @@ -286,7 +287,7 @@ func (o *Openshift) Generate(ctx context.Context, dependencies asset.Parents) er
continue
}
o.FileList = append(o.FileList, &asset.File{
Filename: filepath.Join(openshiftManifestDir, name),
Filename: path.Join(openshiftManifestDir, name),
Data: data,
})
}
Expand Down
5 changes: 3 additions & 2 deletions pkg/asset/manifests/operators.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"bytes"
"context"
"encoding/base64"
"path"
"path/filepath"
"strings"
"text/template"
Expand Down Expand Up @@ -32,7 +33,7 @@ const (
)

var (
kubeSysConfigPath = filepath.Join(manifestDir, "cluster-config.yaml")
kubeSysConfigPath = path.Join(manifestDir, "cluster-config.yaml")

_ asset.WritableAsset = (*Manifests)(nil)

Expand Down Expand Up @@ -216,7 +217,7 @@ func (m *Manifests) generateBootKubeManifests(dependencies asset.Parents) []*ass
dependencies.Get(a)
for _, f := range a.Files() {
files = append(files, &asset.File{
Filename: filepath.Join(manifestDir, strings.TrimSuffix(filepath.Base(f.Filename), ".template")),
Filename: path.Join(manifestDir, strings.TrimSuffix(filepath.Base(f.Filename), ".template")),
Data: applyTemplateData(f.Data, templateData),
})
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/proxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"context"
"fmt"
"net/url"
"path/filepath"
"path"
"strings"

"github.com/pkg/errors"
Expand All @@ -22,7 +22,7 @@ import (
"github.com/openshift/installer/pkg/types/openstack"
)

var proxyCfgFilename = filepath.Join(manifestDir, "cluster-proxy-01-config.yaml")
var proxyCfgFilename = path.Join(manifestDir, "cluster-proxy-01-config.yaml")

// Proxy generates the cluster-proxy-*.yml files.
type Proxy struct {
Expand Down
4 changes: 2 additions & 2 deletions pkg/asset/manifests/scheduler.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package manifests

import (
"context"
"path/filepath"
"path"

"github.com/pkg/errors"
"github.com/sirupsen/logrus"
Expand All @@ -16,7 +16,7 @@ import (

var (
// SchedulerCfgFilename is the path of the Scheduler Config file
SchedulerCfgFilename = filepath.Join(manifestDir, "cluster-scheduler-02-config.yml")
SchedulerCfgFilename = path.Join(manifestDir, "cluster-scheduler-02-config.yml")
)

// Scheduler generates the cluster-scheduler-*.yml files.
Expand Down
Loading