Skip to content

Conversation

@csrwng
Copy link
Contributor

@csrwng csrwng commented Mar 4, 2019

No description provided.

@openshift-ci-robot openshift-ci-robot added do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. size/XXL Denotes a PR that changes 1000+ lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Mar 4, 2019
applied to the created MachineSet's MachineSpec. This list will
overwrite any modifications made to Node labels on an ongoing
basis.
type: object
Copy link
Contributor

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?

Copy link
Contributor Author

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
Copy link
Contributor

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.

Copy link
Contributor Author

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.
Copy link
Contributor

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)

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 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
Copy link
Contributor

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.
Copy link
Contributor

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()})
Copy link
Contributor

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"`
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 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
Copy link
Contributor

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.

Copy link
Contributor

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.

Copy link
Contributor Author

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)

Copy link
Contributor

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"
Copy link
Contributor

Choose a reason for hiding this comment

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

Good thinking.

@csrwng csrwng force-pushed the cluster_image_set branch from 0fac0f7 to 34b72c0 Compare March 4, 2019 22:41
@app-sre-bot
Copy link

Can one of the admins verify this patch?

@openshift-ci-robot openshift-ci-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 4, 2019
@csrwng csrwng force-pushed the cluster_image_set branch from 34b72c0 to 4ca04a0 Compare March 5, 2019 23:26
@openshift-ci-robot openshift-ci-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Mar 5, 2019
@csrwng csrwng changed the title WIP: Cluster image set Cluster image set Mar 5, 2019
@openshift-ci-robot openshift-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 Mar 5, 2019
@csrwng
Copy link
Contributor Author

csrwng commented Mar 5, 2019

@dgoodwin this should be ready for another look

Copy link
Contributor

@dgoodwin dgoodwin left a 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"
Copy link
Contributor

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?

Copy link
Contributor Author

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")
Copy link
Contributor

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")
}
},
},
Copy link
Contributor

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"
Copy link
Contributor

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
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 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?

Copy link
Contributor Author

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.

Copy link
Contributor

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
Copy link
Contributor

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. 👍

@csrwng csrwng force-pushed the cluster_image_set branch from 4ca04a0 to 80fbeca Compare March 6, 2019 15:03
@csrwng
Copy link
Contributor Author

csrwng commented Mar 6, 2019

@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.

@dgoodwin
Copy link
Contributor

dgoodwin commented Mar 6, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 6, 2019
@csrwng csrwng force-pushed the cluster_image_set branch from 80fbeca to d2f4f23 Compare March 6, 2019 15:16
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Mar 6, 2019
@csrwng
Copy link
Contributor Author

csrwng commented Mar 6, 2019

sorry @dgoodwin I missed fixing a comment's case. fixed now

@dgoodwin
Copy link
Contributor

dgoodwin commented Mar 6, 2019

/lgtm

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Mar 6, 2019
@openshift-ci-robot
Copy link

[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

Details 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

@openshift-bot
Copy link

/retest

Please review the full test history for this PR and help us cut down flakes.

@openshift-merge-robot openshift-merge-robot merged commit 9b55455 into openshift:master Mar 6, 2019
@csrwng csrwng deleted the cluster_image_set branch March 8, 2019 19:36
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. lgtm 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.

6 participants