-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
openstack: Create machine resources programmatically #1107
openstack: Create machine resources programmatically #1107
Conversation
c4e63f7
to
c15b833
Compare
If OS_CLOUD is not set in the environment, this part of the code will fail with a NPE because neither OS_CLOUD nor opts.Cloud are set. Set opts.Cloud to the value in Platform.
c15b833
to
67f831d
Compare
/assign @tomassedovic |
/test tf-fmt |
/test e2e-aws |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, this looks pretty good! I'm still unable to test this end to end due to #1092.
So what I did was run openshift-install create manifests
and compared the output with my previous machine definitions I had lying around.
I've noticed a few differences (comments inline), but since I can't test this at the moment, I don't know whether those need to be addressed or not.
},*/ | ||
Image: osImage, | ||
CloudName: platform.Cloud, | ||
CloudsSecret: &corev1.SecretReference{Name: cloudsSecret}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems to generate:
cloudsSecret:
name: openstack-credentials
but the previous machine template had just: cloudsSecret: "openstack-credentials"
:
https://github.com/openshift/installer/pull/1042/files#diff-50d413300f38115e1c37fec85d8d7865R47
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is correct. Format has changed upstream
return &openstackprovider.OpenstackProviderSpec{ | ||
TypeMeta: metav1.TypeMeta{ | ||
APIVersion: "openstackproviderconfig.k8s.io/v1alpha1", | ||
Kind: "OpenstackProviderSpec", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Kind
used to be OpenStackMachineProviderConfig
, though I suspect OpenstackProviderSpec
is the correct value now?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
correct
}, | ||
AvailabilityZone: az, | ||
SecurityGroups: []string{role}, | ||
// TODO(flaper87): Trunk support missing. Need to add it back |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In addition to trunk support, the new templates don't seem to have the region placement set:
https://github.com/openshift/installer/pull/1042/files#diff-50d413300f38115e1c37fec85d8d7865R50
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will check and add it if needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, placement
is not a valid key in the actuator: https://github.com/kubernetes-sigs/cluster-api-provider-openstack/blob/master/pkg/apis/openstackproviderconfig/v1alpha1/types.go#L30
/hold cancel |
I'm seeing the following issue in the
The apiVersion: v1
items:
- apiVersion: cluster.k8s.io/v1alpha1
kind: MachineSet
metadata:
creationTimestamp: null
labels:
sigs.k8s.io/cluster-api-cluster: ostest
sigs.k8s.io/cluster-api-machine-role: worker
sigs.k8s.io/cluster-api-machine-type: worker
name: ostest-worker-
namespace: openshift-cluster-api
spec:
replicas: 3
selector:
matchLabels:
sigs.k8s.io/cluster-api-cluster: ostest
sigs.k8s.io/cluster-api-machineset: ostest-worker-
template:
metadata:
creationTimestamp: null
labels:
sigs.k8s.io/cluster-api-cluster: ostest
sigs.k8s.io/cluster-api-machine-role: worker
sigs.k8s.io/cluster-api-machine-type: worker
sigs.k8s.io/cluster-api-machineset: ostest-worker- I guess the worker names are missing the unique suffix? |
c4682b8
to
548d655
Compare
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: flaper87, tomassedovic 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 |
/retest |
Create the machine yaml files using go types rather than go template. This makes testing easier, it guarantees support for a specific openstack actuator version, and allows for more complex logic during the generation.