Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Support air-gapped scenario for context-scoped plugins to allow registry override #2937

Conversation

anujc25
Copy link
Contributor

@anujc25 anujc25 commented Jul 14, 2022

What this PR does / why we need it

  • This will allow admins to create a configMap on the server to point
    the context-scoped OCI based plugins to point to different image
    registry instead of the registry mentioned as part of CLIPlugin
    resource
  • To do that admin need to create a configmap on the management-cluster
    with a specific label cli.tanzu.vmware.com/cliplugin-image-repository-override in tanzu-cli-system namespace

Which issue(s) this PR fixes

Fixes #2936

Describe testing done for PR

  • Create CLIPlugin resource on the management-cluster which points plugins to be downloaded from projects.registry.vmware.com/tkg registry.
apiVersion: cli.tanzu.vmware.com/v1alpha1
kind: CLIPlugin
metadata:
  name: cluster
spec:
  artifacts:
    v0.0.0-build.1:
    - arch: amd64
      image: projects.registry.vmware.com/tkg/tanzu_core/tanzu-cli-plugins/cluster-darwin-amd64:v0.0.0
      os: darwin
      type: oci
    - arch: amd64
      image: projects.registry.vmware.com/tkg/tanzu_core/tanzu-cli-plugins/cluster-linux-amd64:v0.0.0
      os: linux
      type: oci
    - arch: amd64
      image: projects.registry.vmware.com/tkg/tanzu_core/tanzu-cli-plugins/cluster-windows-amd64:v0.0.0
      os: windows
      type: oci
  description: Kubernetes cluster operations
  optional: false
  recommendedVersion: v0.0.0-build.1
  • To double check, make sure the OCI images mentioned here doesn't exists.
  • Create a configmap on the supervisor cluster to do registry override
apiVersion: v1
kind: ConfigMap
metadata:
  name: context-plugin-repository-override
  namespace: tanzu-cli-system
  labels:
    cli.tanzu.vmware.com/cliplugin-image-repository-override: ""
data: 
  imageRepoMap: |- 
    projects.registry.vmware.com/tkg: projects-stg.registry.vmware.com/tkg/sandbox
  • Login to the above management-cluster
  • Verify the plugins by running below commands
    • tanzu plugin list
    • tanzu plugin sync
    • tanzu plugin install cluster

Release note

Support air-gapped scenario for context-scoped plugins to allow registry override

PR Checklist

  • Squash the commits into one or a small number of logical commits
  • Use good commit messages
  • Ensure PR contains terms all contributors can understand and links all contributors can access

Additional information

Special notes for your reviewer

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/2937/20220714010703/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@anujc25 anujc25 force-pushed the allow-registry-override-for-context-scoped-plugins branch from 440d37e to 357fad7 Compare July 14, 2022 21:03
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/2937/20220714211453/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@anujc25 anujc25 force-pushed the allow-registry-override-for-context-scoped-plugins branch from 357fad7 to ec5d050 Compare July 14, 2022 22:13
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/2937/20220714222306/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

Copy link
Contributor

@tenczar tenczar left a comment

Choose a reason for hiding this comment

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

LGTM

@anujc25 anujc25 force-pushed the allow-registry-override-for-context-scoped-plugins branch from ec5d050 to 0ba06ac Compare July 14, 2022 23:32
Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

lgtm, thanks!

@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/2937/20220714234138/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@codecov
Copy link

codecov bot commented Jul 14, 2022

Codecov Report

Merging #2937 (3409f85) into main (0696ca2) will increase coverage by 1.27%.
The diff coverage is 66.31%.

@@            Coverage Diff             @@
##             main    #2937      +/-   ##
==========================================
+ Coverage   42.73%   44.00%   +1.27%     
==========================================
  Files         404      416      +12     
  Lines       40145    41847    +1702     
==========================================
+ Hits        17154    18414    +1260     
- Misses      21382    21712     +330     
- Partials     1609     1721     +112     
Impacted Files Coverage Δ
addons/controllers/machine_controller.go 68.68% <ø> (ø)
addons/pkg/util/cluster_util.go 4.34% <0.00%> (+4.34%) ⬆️
addons/pkg/util/provider_util.go 51.72% <0.00%> (ø)
addons/webhooks/clusterbootstrap_webhook.go 24.32% <0.00%> (-0.53%) ⬇️
apis/run/v1alpha3/tanzukubernetesrelease_types.go 33.33% <ø> (ø)
cmd/cli/plugin-admin/builder/main.go 0.00% <0.00%> (ø)
cmd/cli/plugin-admin/builder/publish.go 0.00% <0.00%> (ø)
.../cli/plugin/cluster/get_machinehealthcheck_node.go 9.30% <0.00%> (-1.81%) ⬇️
cmd/cli/plugin/cluster/kubeconfig_get.go 8.82% <0.00%> (-0.27%) ⬇️
cmd/cli/plugin/cluster/machinehealthcheck.go 100.00% <ø> (ø)
... and 102 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update fa1867b...3409f85. Read the comment docs.

@anujc25 anujc25 force-pushed the allow-registry-override-for-context-scoped-plugins branch from 0ba06ac to 93572b4 Compare July 15, 2022 07:25
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/2937/20220715073445/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

@anujc25 anujc25 force-pushed the allow-registry-override-for-context-scoped-plugins branch from 93572b4 to 0aa1fb8 Compare July 15, 2022 17:07
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/2937/20220715171639/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

- This will allow admins to create a configMap on the server to point
  the context-scoped OCI based plugins to point to different image
  registry instead of the registry mentioned as part of CLIPlugin
  resource
- To do that admin need to create a configmap on the management-cluster
  with a specific label `cli.tanzu.vmware.com/cliplugin-image-repository-override`

Signed-off-by: Anuj Chaudhari <anujc@vmware.com>
@anujc25 anujc25 force-pushed the allow-registry-override-for-context-scoped-plugins branch from 0aa1fb8 to 3409f85 Compare July 15, 2022 19:14
@github-actions
Copy link

Cluster Generation A/B Results:
https://storage.googleapis.com/tkg-clustergen/2937/20220715192658/clustergen.diff.txt
Author/reviewers:
Please review to verify that the effects on the generated cluster configurations are exactly what the PR intended, and give a thumbs-up if so.

Copy link
Contributor

@vuil vuil left a comment

Choose a reason for hiding this comment

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

lgtm

@vuil vuil added area/plugin ok-to-merge PRs should be labelled with this before merging labels Jul 15, 2022
@anujc25 anujc25 merged commit 5fdc05d into vmware-tanzu:main Jul 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area/plugin cla-not-required ok-to-merge PRs should be labelled with this before merging
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support air-gapped scenario for context-scoped plugins to allow registry override
4 participants