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
70 changes: 37 additions & 33 deletions data/data/bootstrap/files/usr/local/bin/bootkube.sh.template
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,43 @@ then
record_service_stage_success
fi

if [ ! -f config-bootstrap.done ]
then
record_service_stage_start "config-bootstrap"
echo "Rendering cluster config manifests..."

rm --recursive --force config-bootstrap

ADDITIONAL_FLAGS=()
if [ -f "$PWD/manifests/cloud-provider-config.yaml" ]; then
ADDITIONAL_FLAGS+=("--cloud-provider-config-input-file=/assets/manifests/cloud-provider-config.yaml")
fi
{{- if .FeatureSet }}
ADDITIONAL_FLAGS+=("--feature-set={{.FeatureSet}}")
{{- end}}
VERSION="$(oc adm release info -o 'jsonpath={.metadata.version}' "${RELEASE_IMAGE_DIGEST}")"

bootkube_podman_run \
--name config-render \
--volume "$PWD:/assets:z" \
"${CONFIG_OPERATOR_IMAGE}" \
/usr/bin/cluster-config-operator render \
--cluster-infrastructure-input-file=/assets/manifests/cluster-infrastructure-02-config.yml \
--cloud-provider-config-output-file=/assets/config-bootstrap/cloud-provider-config-generated.yaml \
--config-output-file=/assets/config-bootstrap/config \
--asset-input-dir=/assets/tls \
--asset-output-dir=/assets/config-bootstrap \
--featuregate-manifest=/assets/manifests/99_feature-gate.yaml \
Copy link
Contributor

Choose a reason for hiding this comment

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

Does this file actually have to be called this? In other render commands I've seen they search through the manifests folder and look at a partial object meta to identify if the file is a featuregate. Pre the installer supporting feature gates, it could have been called whatever I liked, nothing to say that's not still the case for some who have set up clusters without FG support in the installer before

Copy link
Contributor

Choose a reason for hiding this comment

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

This is a good point, spelling it out a bit more...

This PR will make the installer always lay down a feature set manifest. If there is a conflicting feature set manifest the installer will throw an error pre-install.

It would definitely be possible for a user to delete the installer-generated manifest. But in those cases only the feature set spec would be set and not the status, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would definitely be possible for a user to delete the installer-generated manifest. But in those cases only the feature set spec would be set and not the status, right?

Yes. sometimes that's acceptable and the customer should know. I'm open to future refinement in 4.14, but I'd like to unstick azure ccm.

Copy link
Contributor

Choose a reason for hiding this comment

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

If we are going to merge as is, I think we should probably check how many CI jobs rely on the ability to lay down a feature gate manifest blindly. I suspect it's non-zero and that this would break anyone currently relying on that mechanism

Copy link
Contributor

Choose a reason for hiding this comment

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

A quick scan of the release repo leads me to:

Either we need to rename those to fit the pattern, or fix the logic to run a search in CCO of the manifest dir (the latter being the preferred long term IMO)

--rendered-manifest-files=/assets/manifests \
--payload-version=$VERSION \
"${ADDITIONAL_FLAGS[@]}"

cp config-bootstrap/manifests/* manifests/

touch config-bootstrap.done
record_service_stage_success
fi

if [ ! -f cvo-bootstrap.done ]
then
record_service_stage_start "cvo-bootstrap"
Expand Down Expand Up @@ -135,39 +172,6 @@ then
record_service_stage_success
fi

if [ ! -f config-bootstrap.done ]
then
record_service_stage_start "config-bootstrap"
echo "Rendering cluster config manifests..."

rm --recursive --force config-bootstrap

ADDITIONAL_FLAGS=()
if [ -f "$PWD/manifests/cloud-provider-config.yaml" ]; then
ADDITIONAL_FLAGS+=("--cloud-provider-config-input-file=/assets/manifests/cloud-provider-config.yaml")
fi
{{- if .FeatureSet }}
ADDITIONAL_FLAGS+=("--feature-set={{.FeatureSet}}")
{{- end}}

bootkube_podman_run \
--name config-render \
--volume "$PWD:/assets:z" \
"${CONFIG_OPERATOR_IMAGE}" \
/usr/bin/cluster-config-operator render \
--cluster-infrastructure-input-file=/assets/manifests/cluster-infrastructure-02-config.yml \
--cloud-provider-config-output-file=/assets/config-bootstrap/cloud-provider-config-generated.yaml \
--config-output-file=/assets/config-bootstrap/config \
--asset-input-dir=/assets/tls \
--asset-output-dir=/assets/config-bootstrap \
"${ADDITIONAL_FLAGS[@]}"

cp config-bootstrap/manifests/* manifests/

touch config-bootstrap.done
record_service_stage_success
fi

if [ ! -f kube-apiserver-bootstrap.done ]
then
record_service_stage_start "kube-apiserver-bootstrap"
Expand Down
51 changes: 23 additions & 28 deletions pkg/asset/manifests/featuregate.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,38 +40,33 @@ func (f *FeatureGate) Generate(dependencies asset.Parents) error {
installConfig := &installconfig.InstallConfig{}
dependencies.Get(installConfig)

// A FeatureGate could be populated on every install,
// even for those using the default feature set, but for
// continuity let's only create a cluster feature gate
// when non-default feature gates are enabled.
if installConfig.Config.FeatureSet != configv1.Default {
f.Config = configv1.FeatureGate{
TypeMeta: metav1.TypeMeta{
APIVersion: configv1.SchemeGroupVersion.String(),
Kind: "FeatureGate",
f.Config = configv1.FeatureGate{
TypeMeta: metav1.TypeMeta{
APIVersion: configv1.SchemeGroupVersion.String(),
Kind: "FeatureGate",
},
ObjectMeta: metav1.ObjectMeta{
Name: "cluster",
},
Spec: configv1.FeatureGateSpec{
FeatureGateSelection: configv1.FeatureGateSelection{
FeatureSet: installConfig.Config.FeatureSet,
},
ObjectMeta: metav1.ObjectMeta{
Name: "cluster",
},
Spec: configv1.FeatureGateSpec{
FeatureGateSelection: configv1.FeatureGateSelection{
FeatureSet: installConfig.Config.FeatureSet,
},
},
}
},
}

configData, err := yaml.Marshal(f.Config)
if err != nil {
return errors.Wrapf(err, "failed to create %s manifests from InstallConfig", f.Name())
}
configData, err := yaml.Marshal(f.Config)
if err != nil {
return errors.Wrapf(err, "failed to create %s manifests from InstallConfig", f.Name())
}

f.FileList = []*asset.File{
{
Filename: fgFileName,
Data: configData,
},
}
f.FileList = []*asset.File{
{
Filename: fgFileName,
Data: configData,
},
}

return nil
}

Expand Down