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

Add v1alpha2 types 🎉 #1051

Merged
merged 1 commit into from
Jun 26, 2019
Merged

Conversation

vincepri
Copy link
Member

@vincepri vincepri commented Jun 20, 2019

Signed-off-by: Vince Prignano [email protected]

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #1035
Fixes #1073

Special notes for your reviewer:

Ongoing list of TODOs:

  • Decide what to do with Cluster, are we porting it with providerSpec or leave it on v1alpha1?
  • Regenerate clientset targeting v1alpha2
  • Move, copy, and adapt tests from v1alpha1 types

Release note:


@k8s-ci-robot k8s-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. labels Jun 20, 2019
@k8s-ci-robot k8s-ci-robot requested review from detiber and justinsb June 20, 2019 04:05
@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: vincepri

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 20, 2019
@vincepri vincepri force-pushed the v1alpha2-types branch 2 times, most recently from 169bb0f to 181c713 Compare June 20, 2019 19:38
@pablochacin
Copy link
Contributor

pablochacin commented Jun 20, 2019

  • Decide what to do with Cluster, are we porting it with providerSpec or leave it on v1alpha1?

@vincepri Can you please elaborate on this? I'm not sure what "porting it with providerSpec" means. Something related to #833 (comment)

@vincepri
Copy link
Member Author

vincepri commented Jun 20, 2019

@pablochacin Cluster will be ported to v1alpha2 as is from v1alpha1 (in this PR). Whenever the proposal is ready and accepted, we can modify the v1alpha2 type to match.

@vincepri vincepri force-pushed the v1alpha2-types branch 2 times, most recently from 117665f to c9bb768 Compare June 24, 2019 23:26
@vincepri
Copy link
Member Author

/test pull-cluster-api-test

@vincepri vincepri changed the title WIP: Add v1alpha2 types 🎉 Add v1alpha2 types 🎉 Jun 24, 2019
@k8s-ci-robot k8s-ci-robot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jun 24, 2019
@vincepri
Copy link
Member Author

/check-cla

@vincepri
Copy link
Member Author

/assign @ncdc @detiber

@vincepri
Copy link
Member Author

@ncdc Running informer-gen separately with some debug logs shows a weird behavior when multiple folders that aren't in the same APIGroup, are passed as input-dirs.

--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1

...
(map[string]types.GroupVersions) (len=1) {
 (string) (len=7) "cluster": (types.GroupVersions) {
  PackageName: (string) (len=7) "cluster",
  Group: (types.Group) (len=14) cluster.k8s.io,
  Versions: ([]types.PackageVersion) (len=1 cap=1) {
   (types.PackageVersion) v1alpha1
  }
 }
}
...

--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2

(map[string]types.GroupVersions) (len=1) {
 (string) (len=7) "cluster": (types.GroupVersions) {
  PackageName: (string) (len=7) "cluster",
  Group: (types.Group) (len=19) cluster.sigs.k8s.io,
  Versions: ([]types.PackageVersion) (len=1 cap=1) {
   (types.PackageVersion) v1alpha2
  }
 }
}

--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1,sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2

(map[string]types.GroupVersions) (len=1) {
 (string) (len=7) "cluster": (types.GroupVersions) {
  PackageName: (string) (len=7) "cluster",
  Group: (types.Group) (len=14) cluster.k8s.io,
  Versions: ([]types.PackageVersion) (len=2 cap=2) {
   (types.PackageVersion) v1alpha1,
   (types.PackageVersion) v1alpha2
  }
 }
}
panic: runtime error: index out of range

goroutine 1 [running]:
k8s.io/code-generator/cmd/informer-gen/generators.(*genericGenerator).GenerateType.func1(...)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go:120
k8s.io/code-generator/cmd/informer-gen/generators.(*genericGenerator).GenerateType(0xc003d82690, 0xc00a6d5440, 0xc00a391810, 0x142bee0, 0xc00a6ed8e0, 0x0, 0x139e7f8)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go:121 +0x1060
k8s.io/gengo/generator.(*Context).executeBody(0xc00a6d5440, 0x142bae0, 0xc00a708240, 0x14377a0, 0xc003d82690, 0x480, 0x0)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/generator/execute.go:304 +0x11d
k8s.io/gengo/generator.(*Context).ExecutePackage(0xc00a3b4240, 0xc0001ae140, 0x13, 0x1434aa0, 0xc00a425100, 0x0, 0x0)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/generator/execute.go:265 +0xbf7
k8s.io/gengo/generator.(*Context).ExecutePackages(0xc00a3b4240, 0xc0001ae140, 0x13, 0xc00a425200, 0x5, 0x8, 0x0, 0x12e1136)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/generator/execute.go:51 +0xc5
k8s.io/gengo/args.(*GeneratorArgs).Execute(0xc0001b41e0, 0xc0001b23f0, 0x139d3e0, 0x6, 0x13ccb70, 0x0, 0x0)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/args/args.go:194 +0x2d7
main.main()
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/cmd/informer-gen/main.go:55 +0x320
exit status 2

--input-dirs sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha2,sigs.k8s.io/cluster-api/pkg/apis/cluster/v1alpha1

(map[string]types.GroupVersions) (len=1) {
 (string) (len=7) "cluster": (types.GroupVersions) {
  PackageName: (string) (len=7) "cluster",
  Group: (types.Group) (len=19) cluster.sigs.k8s.io,
  Versions: ([]types.PackageVersion) (len=2 cap=2) {
   (types.PackageVersion) v1alpha2,
   (types.PackageVersion) v1alpha1
  }
 }
}
panic: runtime error: index out of range

goroutine 1 [running]:
k8s.io/code-generator/cmd/informer-gen/generators.(*genericGenerator).GenerateType.func1(...)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go:120
k8s.io/code-generator/cmd/informer-gen/generators.(*genericGenerator).GenerateType(0xc0016167e0, 0xc00a58ec00, 0xc00a354d10, 0x142bee0, 0xc00a577580, 0x0, 0x139e7f8)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/cmd/informer-gen/generators/generic.go:121 +0x1060
k8s.io/gengo/generator.(*Context).executeBody(0xc00a58ec00, 0x142bae0, 0xc00a56d4f0, 0x14377a0, 0xc0016167e0, 0x480, 0x0)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/generator/execute.go:304 +0x11d
k8s.io/gengo/generator.(*Context).ExecutePackage(0xc00a30d800, 0xc000016380, 0x13, 0x1434aa0, 0xc00a3e6600, 0x0, 0x0)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/generator/execute.go:265 +0xbf7
k8s.io/gengo/generator.(*Context).ExecutePackages(0xc00a30d800, 0xc000016380, 0x13, 0xc00a3e6700, 0x5, 0x8, 0x0, 0x12e1136)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/generator/execute.go:51 +0xc5
k8s.io/gengo/args.(*GeneratorArgs).Execute(0xc000012280, 0xc0000ce570, 0x139d3e0, 0x6, 0x13ccb70, 0x0, 0x0)
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/gengo/args/args.go:194 +0x2d7
main.main()
        /Users/vince/go/src/sigs.k8s.io/cluster-api/vendor/k8s.io/code-generator/cmd/informer-gen/main.go:55 +0x320
exit status 2

Makefile Outdated Show resolved Hide resolved
Makefile Outdated Show resolved Hide resolved
pkg/apis/cluster/v1alpha2/cluster_types.go Outdated Show resolved Hide resolved
pkg/apis/cluster/v1alpha2/cluster_types_test.go Outdated Show resolved Hide resolved
pkg/apis/cluster/v1alpha2/common_type.go Outdated Show resolved Hide resolved
pkg/apis/cluster/v1alpha2/machine_types.go Show resolved Hide resolved
pkg/apis/cluster/v1alpha2/machine_types.go Show resolved Hide resolved
pkg/controller/cluster/cluster_controller.go Outdated Show resolved Hide resolved
scripts/ci-integration.sh Outdated Show resolved Hide resolved
test/integration/cluster/cluster_test.go Outdated Show resolved Hide resolved
@ncdc
Copy link
Contributor

ncdc commented Jun 26, 2019

@vincepri informer-gen requires that all API versions in pkg/apis/$foo share the same group. Let's move pkg/apis/cluster/v1alpha1 to something like pkg/apis/deprecated/v1alpha1 and keep pkg/apis/cluster/v1alpha2. Then informer-gen will work.

scripts/ci-integration.sh Outdated Show resolved Hide resolved
scripts/ci-integration.sh Outdated Show resolved Hide resolved
@vincepri vincepri force-pushed the v1alpha2-types branch 4 times, most recently from 86fc928 to c851f78 Compare June 26, 2019 15:57
@vincepri
Copy link
Member Author

@ncdc I actually removed the kind file and the feature gates now that we're using trivialVersions for all the CRDs

@vincepri vincepri force-pushed the v1alpha2-types branch 2 times, most recently from d092ed0 to 43ad90c Compare June 26, 2019 16:47
@vincepri
Copy link
Member Author

/test pull-cluster-api-test

1 similar comment
@vincepri
Copy link
Member Author

/test pull-cluster-api-test

@vincepri
Copy link
Member Author

/test pull-cluster-api-test

Signed-off-by: Vince Prignano <[email protected]>
@ncdc
Copy link
Contributor

ncdc commented Jun 26, 2019

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 26, 2019
@k8s-ci-robot k8s-ci-robot merged commit 377ad4e into kubernetes-sigs:master Jun 26, 2019
klog.V(10).Info("retrying: machine.Status.ProviderStatus is not set")
return false, nil
}
// if m.Status.ProviderStatus == nil {
Copy link
Member

Choose a reason for hiding this comment

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

Why commented out here, should this have been replaced with a TODO instead?

@@ -13,8 +13,6 @@ spec:
shortNames:
- cl
scope: Namespaced
subresources:
status: {}
Copy link
Member

Choose a reason for hiding this comment

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

What happened to the status subresource?

@@ -18,7 +18,6 @@ spec:
labelSelectorPath: .status.labelSelector
specReplicasPath: .spec.replicas
statusReplicasPath: .status.replicas
status: {}
Copy link
Member

Choose a reason for hiding this comment

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

What happened to the status subresource?

Copy link
Member Author

Choose a reason for hiding this comment

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

Good point, this needs to be added back. It was conflicting when both v1alpha2 and v1alpha2 were in the same CRD

group: cluster.k8s.io
names:
kind: Machine
plural: machines
shortNames:
- ma
scope: Namespaced
subresources:
status: {}
Copy link
Member

Choose a reason for hiding this comment

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

What happened to the status subresource?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above

@@ -18,7 +18,6 @@ spec:
labelSelectorPath: .status.labelSelector
specReplicasPath: .spec.replicas
statusReplicasPath: .status.replicas
status: {}
Copy link
Member

Choose a reason for hiding this comment

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

What happened to the status subresource?

Copy link
Member Author

Choose a reason for hiding this comment

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

Same as above

@@ -0,0 +1,9 @@
apiVersion: cluster.k8s.io/v1alpha2
Copy link
Member

Choose a reason for hiding this comment

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

Same thing with the v1alpha2 samples, they are invalid and can likely just be removed.

/// [MachineSpec]
// MachineSpec defines the desired state of Machine
type MachineSpec struct {
// ObjectMeta will autopopulate the Node created. Use this to
Copy link
Member

Choose a reason for hiding this comment

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

Do we actually expect this to affect the created Node? That seems more like a concern for the bootstrap controller than something explicitly on the MachineSpec.

I'm not sure I'm completely convinced here that we need an embedded ObjectMeta on the MachineSpec type.

Copy link
Member

Choose a reason for hiding this comment

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

Ah, I see why this was confusing now... ObjectMeta should not be needed on the MachineSpec, only on the MachineTemplateSpec embedded type:

See PodTemplateSpec and PodSpec for comparison

@@ -38,10 +38,6 @@ const (
// Machine is the Schema for the machines API
// +k8s:openapi-gen=true
// +kubebuilder:resource:path=machines,shortName=ma
// +kubebuilder:subresource:status
Copy link
Member

Choose a reason for hiding this comment

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

The subresource status should probably remain.

@@ -168,7 +168,6 @@ type MachineDeploymentStatus struct {
// MachineDeployment is the Schema for the machinedeployments API
// +k8s:openapi-gen=true
// +kubebuilder:resource:path=machinedeployments,shortName=md
// +kubebuilder:subresource:status
Copy link
Member

Choose a reason for hiding this comment

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

The subresource status should probably remain.

@@ -33,7 +33,6 @@ import (
// MachineSet ensures that a specified number of machines replicas are running at any given time.
// +k8s:openapi-gen=true
// +kubebuilder:resource:path=machinesets,shortName=ms
// +kubebuilder:subresource:status
Copy link
Member

Choose a reason for hiding this comment

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

The subresource status should probably remain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. lgtm "Looks good to me", indicates that a PR is ready to be merged. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Come up with globally valid API groups Create v1alpha2 API types
5 participants