-
Notifications
You must be signed in to change notification settings - Fork 253
Cluster image set #241
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
Cluster image set #241
Conversation
| applied to the created MachineSet's MachineSpec. This list will | ||
| overwrite any modifications made to Node labels on an ongoing | ||
| basis. | ||
| type: object |
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.
What's causing these to show up in here?
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.
me not running make manifests ... will be fixed in next push
| name: clusterimageset-sample | ||
| spec: | ||
| hive: | ||
| pullSpec: openshift/hive:latest |
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.
Are these real images? Haven't seen them before. If not we should use the CI ones here perhaps.
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.
no, purely made up... will replace with valid ones. This is just the crd sample.
|
|
||
| // ClusterImageSetSpec defines the desired state of ClusterImageSet | ||
| type ClusterImageSetSpec struct { | ||
| // hiveImage is the Hive image to use when installing or destroying a cluster. |
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.
Case in the comments looks wrong here, should it match the go var name case or does it not matter? (status as well if so)
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.
So in recent times, the case of new api type comments has been changed to reflect the names of the external json field names, instead of the Go names, given that those comments are used for external documentation (as in https://github.com/openshift/api/blob/master/operator/v1/types.go#L141-L155). However, that is not very evenly enforced. In our openshift API I see mostly the Go-style casing. I think that whatever we do we should be consistent about it, so I'm okay going to the Go-style case just to keep internal consistency.
| pullPolicy: Always | ||
| install: | ||
| pullSpec: openshift/installer:latest | ||
| pullPolicy: Always |
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 looks like it might be out of sync with the actual type now, perhaps from a previous iteration. It looks like it's just image = string now?
| // Watch for jobs created by a ClusterImageSet | ||
| // The reason that this is not down via ownership is that the ClusterImageSet is a cluster-scoped | ||
| // resource. Before Kubernetes 1.13, cluster-scoped resources should not have ownership of other | ||
| // resources. |
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.
👍 good comment.
| } | ||
| return reconcile.Result{}, err | ||
| } | ||
| logger := log.WithFields(log.Fields{"clusterImageSet": request.NamespacedName.String()}) |
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.
When you've just got one field there's a nice concise log.WithField() function just for ref.
| // image. This is used when fetching the release image to extract the installer | ||
| // image spec. | ||
| // +optional | ||
| ReleaseImagePullSecret *corev1.ObjectReference `json:"releaseImagePullSecret,omitempty"` |
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 interesting, clearly we need one, I wonder what we should do in prod for this.
| if cis.Status.InstallerImage != nil { | ||
| logger.Debug("clusterImageSet has an InstallerImage set.") | ||
| err := r.clearStatusErrorResolvingInstallerImage(cis, logger) | ||
| return reconcile.Result{}, err |
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.
Do we have an issue here if the release image gets updated? I would expect that this could happen, in which case we'd want the installer image re-set.
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.
We can add support for that later potentially.
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.
Wouldn't we want to create a new ClusterImageSet at that point? I was thinking of these more as immutable (which reminds me I need to add validation)
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.
That is probably ok, we'd do 4.0beta2 or whatever during times like this.
|
|
||
| // defaultCLIImage is the image to use for the openshift CLI when an image is not specified | ||
| // via the environment variable | ||
| defaultCLIImage = "registry.svc.ci.openshift.org/openshift/origin-v4.0:cli" |
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.
Good thinking.
0fac0f7 to
34b72c0
Compare
|
Can one of the admins verify this patch? |
34b72c0 to
4ca04a0
Compare
|
@dgoodwin this should be ready for another look |
dgoodwin
left a comment
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.
Looks good just a few questions to possibly round it out.
| } | ||
|
|
||
| if !reflect.DeepEqual(oldObject.Spec, newObject.Spec) { | ||
| message := "ClusterImageSet.Spec is immutable" |
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.
Immutable, but if we really got into a pickle, we could delete and recreate?
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.
yes
| for _, test := range tests { | ||
| t.Run(test.name, func(t *testing.T) { | ||
| client := fake.NewFakeClient(test.existingClusterDeployment) | ||
| workDir, err := ioutil.TempDir("", "test-update") |
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.
Looks like workDir might not be getting cleaned up.
| t.Errorf("did not find expected imageset job") | ||
| } | ||
| }, | ||
| }, |
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.
Could you add a test for deprovision, when the CD references a ClusterImageSet that has since been deleted. I'm not quite sure what we want there but I think it might be ok, we don't need an installer image anymore, if we do start using the installer image to deprovision in future we still have a reference at least to what was used to install the cluster, although that's probably no good anymore. For now though, we'd just use the latest hive image defaulted in the code, which I think is correct as we want it to remain backwards compat.
|
|
||
| // InstallerImageResolutionFailedCondition is a condition that indicates whether the job | ||
| // to determine the installer image based on a release image was successful. | ||
| InstallerImageResolutionFailedCondition ClusterDeploymentConditionType = "InstallerImageResolutionFailed" |
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.
Not in this PR, but between this and incoming preflight checks we should start up a document in the repo outlining the possible conditions and what they mean as a contract for us and UHC.
| name: clusterimageset-sample | ||
| spec: | ||
| hiveImage: registry.svc.ci.openshift.org/openshift/hive-v4.0:hive | ||
| releaseImage: quay.io/openshift-release-dev/ocp-release:4.0.0-0.6 |
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 probably going to be the primary use case to install a cluster going forward, we should probably factor it into the cluster-deployment.yaml template and e2e tests. We could setup make deploy to automatically setup an openshift-latest that points to latest CI images (assuming there is one for release that we can pull)? Or should we drop it into the clusterdeployment template as another object?
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.
We can just add it in as another object in the clusterdeployment template. If ok with you, I'll handle in a follow-up PR.
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.
Sounds good.
| return "", err | ||
| } | ||
| } | ||
| return images.GetHiveImage(cdLog), nil |
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.
Looks like we fall back to this if IsNotFound, which looks correct. 👍
4ca04a0 to
80fbeca
Compare
|
@dgoodwin rebased and added additional deprovision tests to the clusterdeployment controller. I'll handle the move to using ClusterImageSets by default in a follow-up PR. I'm not sure if there is a "latest" release image, but will definitely look into it. |
|
/lgtm |
80fbeca to
d2f4f23
Compare
|
sorry @dgoodwin I missed fixing a comment's case. fixed now |
|
/lgtm |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: csrwng, dgoodwin The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/retest Please review the full test history for this PR and help us cut down flakes. |
No description provided.