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

inventory assets - mapping and uploading kubernetes containers #3025

Conversation

chrislovecnm
Copy link
Contributor

No description provided.

@k8s-ci-robot k8s-ci-robot added the cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. label Jul 21, 2017
@@ -95,7 +99,13 @@ func (a *AssetBuilder) remapImage(image string) (string, error) {
}

registryMirror := os.Getenv("DEV_KOPS_REGISTRY_MIRROR")
Copy link
Member

Choose a reason for hiding this comment

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

We can dump the env var now that we have AssetRemapping in the API.. it was just to decouple the two PRs

@@ -22,4 +22,5 @@ const (
PhaseIAM Phase = "iam"
PhaseNetwork Phase = "network"
PhaseCluster Phase = "cluster"
PhaseAssetsUpdate Phase = "assets-update"
Copy link
Member

Choose a reason for hiding this comment

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

Probably just assets I'd say

return "gcr.io/google_containers/" + component + ":" + "v" + clusterSpec.KubernetesVersion, nil
image := "gcr.io/google_containers/" + component + ":" + "v" + clusterSpec.KubernetesVersion

assetsBuilder := assets.NewAssetBuilder(clusterSpec.Assets)
Copy link
Member

Choose a reason for hiding this comment

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

OK, but I think we'll have to use the same AssetBuilder if we want this to actually work... in the kubelet pause container it gets put into the OptionsContext

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ideas how?

Copy link
Member

Choose a reason for hiding this comment

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

assetBuilder.Assets = append(assetBuilder.Assets, asset)
}

canonicalLocation := "gcr.io/google_containers/pause-amd64:3.0"
Copy link
Member

Choose a reason for hiding this comment

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

We definitely don't need to special-case this one

@@ -700,6 +716,39 @@ func (c *ApplyClusterCmd) Run() error {

tf.AddTo(l.TemplateFunctions)

if cluster.Spec.Assets != nil && cluster.Spec.Assets.ContainerRegistry != nil {
kubernetesComponents := []string{"kube-proxy", "kube-apiserver", "kube-controller-manager", "kube-scheduler"}
Copy link
Member

Choose a reason for hiding this comment

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

Anything that calls Image above should do this automatically. That is called by proxy, kcm & scheduler.

kube-apiserver is still using the models/config/kube-apiserver (!)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But because we are not passing around the same assets builder we are loosing the information. I am rebuilding it here. Any recommendations?

Yah we need to cleanup api server, and git rid of the non go model.

@@ -39,6 +39,8 @@ type BootstrapChannelBuilder struct {
var _ fi.ModelBuilder = &BootstrapChannelBuilder{}

func (b *BootstrapChannelBuilder) Build(c *fi.ModelBuilderContext) error {


Copy link
Member

Choose a reason for hiding this comment

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

Can we remove this one?

@@ -43,8 +45,10 @@ type Asset struct {
CanonicalLocation string
}

func NewAssetBuilder() *AssetBuilder {
return &AssetBuilder{}
func NewAssetBuilder(assetRemapping *kops.Assets) *AssetBuilder {
Copy link
Member

Choose a reason for hiding this comment

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

Depending on the sequencing of merges here, we will likely want to take a cluster as input... but we'll cross that bridge when we come to it

@@ -125,8 +126,16 @@ func Image(component string, clusterSpec *kops.ClusterSpec) (string, error) {
return "gcr.io/google_containers/kubedns-amd64:1.3", nil
Copy link
Member

Choose a reason for hiding this comment

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

Might as well send this one through RemapImage as well...

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 may actually need to remove this from the API. This is not being used at all and really need to get out of the API. It is an Addon ...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Anoher PR, but advice?

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 do not want to remap this image, as it is already in addons. Why add another one?

Copy link
Member

Choose a reason for hiding this comment

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

Maybe change it to glog.Fatalf if this is unused

iamLifecycle = lifecyclePointer(fi.LifecycleExistsAndWarnIfChanges)
networkLifecycle = lifecyclePointer(fi.LifecycleExistsAndWarnIfChanges)
} else {
//assetTransferLifecycle = lifecyclePointer(fi.LifecycleIgnore)
Copy link
Member

Choose a reason for hiding this comment

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

LifecycleExistsAndValidates I believe - we want to know if images aren't in place.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In air gapped and other proxied environments you often will not have access to gcr.io, docker.io or other public container registries. I would recommend an API level option to override. We can definitely check if containers exist in the assets registry or the regular registry, but I would recommend failing.

@@ -202,7 +203,10 @@ func (l *Loader) addAssetCopyTasks(assets []*assets.Asset) error {
Name: fi.String(asset.DockerImage),
SourceImage: fi.String(asset.CanonicalLocation),
TargetImage: fi.String(asset.DockerImage),
// TODO
Copy link
Member

Choose a reason for hiding this comment

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

Suggest threading it through BuildTasks, but you can leave a TODO for me if it gets messy

@chrislovecnm chrislovecnm force-pushed the mapping-and-uploading-kubernetes-assets branch from 169c965 to 96500de Compare July 23, 2017 01:32
@k8s-github-robot
Copy link

@chrislovecnm PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2017
@chrislovecnm chrislovecnm force-pushed the mapping-and-uploading-kubernetes-assets branch from 96500de to 2043c64 Compare July 23, 2017 02:25
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Jul 23, 2017
@chrislovecnm chrislovecnm force-pushed the mapping-and-uploading-kubernetes-assets branch from 2144d9a to c51db4c Compare July 23, 2017 06:36
phase = cloudup.PhaseIAM
case "network":
case string(cloudup.PhaseAssets):
phase = cloudup.PhaseAuth
Copy link
Member

Choose a reason for hiding this comment

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

typo: should be PhaseAssets I believe

@k8s-github-robot k8s-github-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Aug 1, 2017
@k8s-github-robot
Copy link

@chrislovecnm PR needs rebase

@k8s-github-robot k8s-github-robot added the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 4, 2017
@chrislovecnm chrislovecnm force-pushed the mapping-and-uploading-kubernetes-assets branch from c51db4c to 4228b52 Compare August 21, 2017 21:02
@k8s-github-robot k8s-github-robot removed the needs-rebase Indicates a PR cannot be merged because it has merge conflicts with HEAD. label Aug 21, 2017
@chrislovecnm chrislovecnm force-pushed the mapping-and-uploading-kubernetes-assets branch from 4228b52 to c280cf3 Compare August 21, 2017 21:17
@chrislovecnm chrislovecnm force-pushed the mapping-and-uploading-kubernetes-assets branch from c280cf3 to 6071ce7 Compare August 21, 2017 23:29
@@ -125,8 +126,16 @@ func Image(component string, clusterSpec *kops.ClusterSpec) (string, error) {
return "gcr.io/google_containers/kubedns-amd64:1.3", nil
Copy link
Member

Choose a reason for hiding this comment

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

Maybe change it to glog.Fatalf if this is unused

if err != nil {
return "", fmt.Errorf("unable to remap container %q: %v", image, err)
}
return image, nil
}

baseURL := clusterSpec.KubernetesVersion
Copy link
Member

Choose a reason for hiding this comment

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

Maybe a comment here about why we're not remapping this case. (It's not self-evident to me why we are not.)

iamLifecycle = lifecyclePointer(fi.LifecycleExistsAndWarnIfChanges)
networkLifecycle = lifecyclePointer(fi.LifecycleExistsAndWarnIfChanges)
} else {
stageAssetsLifecycle = lifecyclePointer(fi.LifecycleIgnore)
Copy link
Member

Choose a reason for hiding this comment

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

LifecycleExistsAndValidates I believe - we want to check it for problems I think.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Once we have the code for containers and files existing I aggree, will file an issue

@@ -150,7 +149,7 @@ func ignoreHandler(i *loader.TreeWalkItem) error {
return nil
}

func (l *Loader) BuildTasks(modelStore vfs.Path, models []string, assetBuilder *assets.AssetBuilder) (map[string]fi.Task, error) {
func (l *Loader) BuildTasks(modelStore vfs.Path, models []string, assetBuilder *assets.AssetBuilder, lifecycle *fi.Lifecycle) (map[string]fi.Task, error) {
Copy link
Member

Choose a reason for hiding this comment

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

Renaming lifecycle to assetsLifecycle would make this clearer

@@ -76,8 +75,6 @@ func (tf *TemplateFunctions) AddTo(dest template.FuncMap) {

dest["HasTag"] = tf.HasTag

dest["Image"] = tf.Image
Copy link
Member

Choose a reason for hiding this comment

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

Hooray - another step towards getting rid of all the templates!

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 filed an issue for getting rid of the API server templates

@justinsb
Copy link
Member

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Aug 22, 2017
@k8s-github-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: chrislovecnm, justinsb

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

Needs approval from an approver in each of these OWNERS Files:
  • OWNERS [chrislovecnm,justinsb]

You can indicate your approval by writing /approve in a comment
You can cancel your approval by writing /approve cancel in a comment

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@justinsb
Copy link
Member

/test pull-kops-e2e-kubernetes-aws

@chrislovecnm
Copy link
Contributor Author

/re-test

@justinsb
Copy link
Member

/retest

1 similar comment
@justinsb
Copy link
Member

/retest

@justinsb
Copy link
Member

Flakiness is being tracked in upstream issue: kubernetes/kubernetes#51128, hopefully fixed by kubernetes/kubernetes#51144

@eparis
Copy link
Contributor

eparis commented Aug 23, 2017

/retest
merged the referenced fix

@k8s-github-robot
Copy link

/test all [submit-queue is verifying that this PR is safe to merge]

@k8s-github-robot
Copy link

Automatic merge from submit-queue

@k8s-github-robot k8s-github-robot merged commit 2d7fb51 into kubernetes:master Aug 23, 2017
@chrislovecnm chrislovecnm deleted the mapping-and-uploading-kubernetes-assets branch December 30, 2017 20:45
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.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants