
Security News
npm Adopts OIDC for Trusted Publishing in CI/CD Workflows
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
github.com/wangchen615/api
The canonical location of the OpenShift API definition. This repo holds the API type definitions and serialization code used by openshift/client-go
Pull requests that change API types in this repo that have corresponding "internal" API objects in the openshift/origin repo must be paired with a pull request to openshift/origin.
To ensure the corresponding origin pull request is ready to merge as soon as the pull request to this repo is merged:
Add a TMP commit that points glide.yaml at your fork of openshift/api, and the branch of your pull request:
- package: github.com/openshift/api
repo: https://github.com/<your-username>/api.git
version: "<your-openshift-api-branch>"
Update your bump(*)
commit to include the result of running hack/update-deps.sh
, which will pull in the changes from your openshift/api pull request
Make sure CI is green on your openshift/origin pull request
Get LGTM on your openshift/api pull request (for API changes) and your openshift/origin pull request (for code changes)
Once both pull requests are ready, the openshift/api pull request can be merged.
Then do the following with your openshift/origin pull request:
hack/update-deps.sh
and update your bump(*)
commitSince Kubernetes 1.16, every CRD created in apiextensions.k8s.io/v1
is required to have a structural OpenAPIV3 schema. The schemas provide server-side validation for fields, as well as providing the descriptions for oc explain
. Moreover, schemas ensure structural consistency of data in etcd. Without it anything can be stored in a resource which can have security implications. As we host many of our CRDs in this repo along with their corresponding Go types we also require them to have schemas. However, the following instructions apply for CRDs that are not hosted here as well.
These schemas are often very long and complex, and should not be written by hand. For OpenShift, we provide Makefile targets in build-machinery-go which generate the schema, built on upstream's controller-gen tool.
If you make a change to a CRD type in this repo, simply calling make update-codegen-crds
should regenerate all CRDs and update the manifests. If yours is not updated, ensure that the path to its API is included in our calls to the Makefile targets.
To add this generator to another repo:
Vendor github.com/openshift/build-machinery-go
Update your Makefile
to include the following:
include $(addprefix ./vendor/github.com/openshift/build-machinery-go/make/, \
targets/openshift/crd-schema-gen.mk \
)
$(call add-crd-gen,<TARGET_NAME>,<API_DIRECTORY>,<CRD_MANIFESTS>,<MANIFEST_OUTPUT>)
The parameters for the call are:
TARGET_NAME
: The name of your generated Make target. This can be anything, as long as it does not conflict with another make target. Recommended to be your api name.API_DIRECTORY
: The location of your API. For example if your Go types are located under pkg/apis/myoperator/v1/types.go
, this should be ./pkg/apis/myoperator/v1
.CRD_MANIFESTS
: The directory your CRDs are located in. For example, if that is manifests/my_operator.crd.yaml
then it should be ./manifests
MANIFEST_OUTPUT
: This should most likely be the same as CRD_MANIFESTS
, and is only provided for flexibility to output generated code to a different directory.You can include as many calls to different APIs as necessary, or if you have multiple APIs under the same directory (eg, v1
and v2beta1
) you can use 1 call to the parent directory pointing to your API.
After this, calling make update-codegen-crds
should generate a new structural OpenAPIV3 schema for your CRDs.
Notes
doc.go
, include the following:
// +groupName=<API_GROUP_NAME>
, this should match the group
in your CRD spec
// +kubebuilder:validation:Optional
, this tells the operator that fields should be optional unless explicitly marked with // +kubebuilder:validation:Required
For more information on the API markers to add to your Go types, see the Kubebuilder book
Schema generation features might be limited or fall behind what CRD schemas supports in the latest Kubernetes version.
To work around this, there are two patch mechanisms implemented by the add-crd-gen
target. Basic idea is that you
place a patch file next to the CRD yaml manifest with either yaml-merge-patch
or yaml-patch
as extension,
but with the same base name. The update-codegen-crds
Makefile target will apply these after calling
kubebuilder's controller-gen:
yaml-merge-patch
: these are applied via yq m -x <yaml-file> <patch-file>
compare https://mikefarah.gitbook.io/yq/commands/merge#overwrite-values.yaml-patch
: these are applied via yaml-patch -o <patch-file> < <yaml-file>
using https://github.com/krishicks/yaml-patch.FAQs
Unknown package
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
npm now supports Trusted Publishing with OIDC, enabling secure package publishing directly from CI/CD workflows without relying on long-lived tokens.
Research
/Security News
A RubyGems malware campaign used 60 malicious packages posing as automation tools to steal credentials from social media and marketing tool users.
Security News
The CNA Scorecard ranks CVE issuers by data completeness, revealing major gaps in patch info and software identifiers across thousands of vulnerabilities.