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

generate bundle: Support overwriting of annotations.yaml #6860

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

KeenonLee
Copy link

@KeenonLee KeenonLee commented Nov 13, 2024

Description of the change:

jitli@RedHat:~/work/src/github/sdk/operator-sdk$ ./build/operator-sdk generate bundle -h

Flags:
      --channels string                  A comma-separated list of channels the bundle belongs to (default "alpha")
      --crds-dir string                  Directory to read cluster-ready CustomResoureDefinition manifests from. This option can only be used if --deploy-dir is set
      --default-channel string           The default channel for the bundle
      --deploy-dir string                Directory to read cluster-ready operator manifests from. If --crds-dir is not set, CRDs are ready from this directory. This option is mutually exclusive with --input-dir and piping to stdin
      --extra-service-accounts strings   Names of service accounts, outside of the operator's Deployment account, that have bindings to {Cluster}Roles that should be added to the CSV
  -h, --help                             help for bundle
      --input-dir string                 Directory to read cluster-ready operator manifests from. This option is mutually exclusive with --deploy-dir/--crds-dir and piping to stdin. This option should not be passed an existing bundle directory, as this bundle will not contain the correct set of manifests required to generate a CSV. Use --kustomize-dir to pass a base CSV
      --kustomize-dir string             Directory containing kustomize bases in a "bases" dir and a kustomization.yaml for operator-framework manifests (default "config/manifests")
      --manifests                        Generate bundle manifests
      --metadata                         Generate bundle metadata and Dockerfile
      --output-dir string                Directory to write the bundle to
      --overwrite                        Overwrite the bundle's metadata and Dockerfile if they exist (default true)
+     --overwrite-annotations            Only overwrite annotations.yaml without modifying bundle.Dockerfile
      --package string                   Bundle's package name
  -q, --quiet                            Run in quiet mode
      --stdout                           Write bundle manifest to stdout
      --use-image-digests                Use SHA Digest for images
  -v, --version string                   Semantic version of the operator in the generated bundle. Only set if creating a new bundle or upgrading your operator

Global Flags:
      --plugins strings   plugin keys to be used for this subcommand execution
      --verbose           Enable verbose logging

Motivation for the change:
--overwrite wipes out any additional labels on the bundle.Dockerfile.
Provide a new --overwrite-annotations option to support overwriting annotations only.

Closes #6787

Checklist

If the pull request includes user-facing changes, extra documentation is required:

@KeenonLee
Copy link
Author

jitli@RedHat:~$ operator-sdk generate bundle -q --overwrite-annotations --version 0.0.2 --deploy-dir="./config/"

WARN[0000] ClusterServiceVersion validation: [CSVFileNotValid] (nginxtestgenerate.v0.0.2) csv.Spec.minKubeVersion is not informed. It is recommended you provide this information. Otherwise, it would mean that your operator project can be distributed and installed in any cluster version available, which is not necessarily the case for all projects. 
INFO[0000] Annotations generated successfully at bundle/metadata/annotations.yaml 
jitli@RedHat:~$ cat bundle.Dockerfile 
FROM scratch

# Core bundle labels.
LABEL operators.operatorframework.io.bundle.mediatype.v1=registry+v1
LABEL operators.operatorframework.io.bundle.manifests.v1=manifests/
LABEL operators.operatorframework.io.bundle.metadata.v1=metadata/
LABEL operators.operatorframework.io.bundle.package.v1=nginxtestgenerate
LABEL operators.operatorframework.io.bundle.channels.v1=alpha
LABEL operators.operatorframework.io.metrics.builder=operator-sdk-v1.37.0+git
LABEL operators.operatorframework.io.metrics.mediatype.v1=metrics+v1
LABEL operators.operatorframework.io.metrics.project_layout=ansible.sdk.operatorframework.io/v1
LABEL jitli.redhat=keenon/lee

# Labels for testing.
LABEL operators.operatorframework.io.test.mediatype.v1=scorecard+v1
LABEL operators.operatorframework.io.test.config.v1=tests/scorecard/

# Copy files to locations specified by labels.
COPY bundle/manifests /manifests/
COPY bundle/metadata /metadata/
COPY bundle/tests/scorecard /tests/scorecard/
jitli@RedHat:~$ operator-sdk generate bundle -q --overwrite --version 0.0.2 --deploy-dir="./config/"
WARN[0000] ClusterServiceVersion validation: [CSVFileNotValid] (nginxtestgenerate.v0.0.2) csv.Spec.minKubeVersion is not informed. It is recommended you provide this information. Otherwise, it would mean that your operator project can be distributed and installed in any cluster version available, which is not necessarily the case for all projects. 
INFO[0000] Creating bundle.Dockerfile                   
INFO[0000] Creating bundle/metadata/annotations.yaml    
INFO[0000] Bundle metadata generated successfully   

@KeenonLee KeenonLee force-pushed the overwriteAnnotations branch 2 times, most recently from a5c0daf to 88f5768 Compare November 19, 2024 03:01
@KeenonLee
Copy link
Author

/assign @acornett21
Please help to take a look, thanks

Signed-off-by: Keenon Lee <jitli@redhat.com>
@KeenonLee KeenonLee force-pushed the overwriteAnnotations branch from 88f5768 to 7dda757 Compare November 20, 2024 03:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

generate bundle: Support overwriting of annotations.yaml
2 participants