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

🌱 Include metadata for the CAPI releases #4167

Merged
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
2 changes: 2 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -499,6 +499,8 @@ release-manifests: $(RELEASE_DIR) $(KUSTOMIZE) ## Builds the manifests to publis
cat $(RELEASE_DIR)/bootstrap-components.yaml >> $(RELEASE_DIR)/cluster-api-components.yaml
echo "---" >> $(RELEASE_DIR)/cluster-api-components.yaml
cat $(RELEASE_DIR)/control-plane-components.yaml >> $(RELEASE_DIR)/cluster-api-components.yaml
# Add metadata to the release artifacts
cp metadata.yaml $(RELEASE_DIR)/metadata.yaml
fabriziopandini marked this conversation as resolved.
Show resolved Hide resolved

.PHONY: release-manifests-dev
release-manifests-dev: ## Builds the development manifests and copies them in the release folder
Expand Down
16 changes: 10 additions & 6 deletions cmd/clusterctl/hack/create-local-repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@
import subprocess
import os
from distutils.dir_util import copy_tree
from distutils.file_util import copy_file
import errno
import sys

Expand All @@ -52,24 +53,24 @@
providers = {
'cluster-api': {
'componentsFile': 'core-components.yaml',
'nextVersion': 'v0.3.8',
'nextVersion': 'v0.4.0',
'type': 'CoreProvider',
},
'bootstrap-kubeadm': {
'componentsFile': 'bootstrap-components.yaml',
'nextVersion': 'v0.3.8',
'nextVersion': 'v0.4.0',
'type': 'BootstrapProvider',
'configFolder': 'bootstrap/kubeadm/config/default',
},
'control-plane-kubeadm': {
'componentsFile': 'control-plane-components.yaml',
'nextVersion': 'v0.3.8',
'nextVersion': 'v0.4.0',
'type': 'ControlPlaneProvider',
'configFolder': 'controlplane/kubeadm/config/default',
},
'infrastructure-docker': {
'componentsFile': 'infrastructure-components.yaml',
'nextVersion': 'v0.3.8',
'nextVersion': 'v0.4.0',
'type': 'InfrastructureProvider',
'configFolder': 'test/infrastructure/docker/config/default',
},
Expand Down Expand Up @@ -116,7 +117,7 @@ def get_repository_folder():
home = get_home()
return os.path.join(home, '.cluster-api', 'dev-repository')

def write_local_repository(provider, version, components_file, components_yaml):
def write_local_repository(provider, version, components_file, components_yaml, metadata_file):
try:
repository_folder = get_repository_folder()
provider_folder = os.path.join(repository_folder, provider, version)
Expand All @@ -130,6 +131,8 @@ def write_local_repository(provider, version, components_file, components_yaml):
f.write(components_yaml)
f.close()

copy_file(metadata_file, provider_folder)

if provider == "infrastructure-docker":
copy_tree("test/infrastructure/docker/templates", provider_folder)

Expand All @@ -148,6 +151,7 @@ def create_local_repositories():

repo = p.get('repo', '.')
config_folder = p.get('configFolder', 'config/default')
metadata_file = repo+'/metadata.yaml'
wfernandes marked this conversation as resolved.
Show resolved Hide resolved

next_version = p.get('nextVersion')
assert next_version is not None, 'invalid configuration for provider {}: please provide nextVersion value'.format(provider)
Expand All @@ -159,7 +163,7 @@ def create_local_repositories():
assert components_file is not None, 'invalid configuration for provider {}: please provide componentsFile value'.format(provider)

components_yaml = execCmd(['kustomize', 'build', os.path.join(repo, config_folder)])
components_path = write_local_repository(provider, next_version, components_file, components_yaml)
components_path = write_local_repository(provider, next_version, components_file, components_yaml, metadata_file)

yield name, type, next_version, components_path

Expand Down
13 changes: 13 additions & 0 deletions metadata.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# maps release series of major.minor to cluster-api contract version
# the contract version may change between minor or major versions, but *not*
# between patch versions.
#
# update this file only when a new major or minor version is released
apiVersion: clusterctl.cluster.x-k8s.io/v1alpha3
releaseSeries:
- major: 0
minor: 4
contract: v1alpha4
- major: 0
minor: 3
contract: v1alpha3
Comment on lines +7 to +13
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 specifically excluded v1alpha2 because the bootstrap provider was v0.1.x for v1alpha2 and ControlPlane provider didn't exist.

Question: Do we need to include v1alpha3 series here?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think we should for future reference, even if it's not strictly needed. Are there any downsides to including it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the only downside I can see is that, currently the three providers - CoreProvider/cluster-api, BootstrapProvider/Kubeadm, and ControlPlaneProvider/Kubeadm all share the same repository and therefore the same metadata.yaml.

If we include a series for v1alpha2 such as

  - major: 0
    minor: 2
    contract: v1alpha2

it would be misleading because for BootstrapProvider/Kubeadm it was v0.1 for v1alpha2. See here for old reference.

However, the above would be accurate for ControlPlaneProvider/Kubeadm. So because of BootstrapProvider/Kubeadm, I decided to not include it.