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

Prepare and include demo of olmv1 commands in kubectl-operator plugin README #1807

Open
azych opened this issue Feb 25, 2025 · 1 comment
Open
Assignees
Labels
epic/kubectl-operator-plugin v1.x Issues related to OLMv1 features that come after 1.0

Comments

@azych
Copy link
Contributor

azych commented Feb 25, 2025

Once we're done with extending kubectl-operator plugin with all the new olmv1 commands (and possibly deprecate olmv0 from there), we should prepare an asciicinema demo and include it in the kubectl-operator README, similar to how it's currently done for olmv0.

@joelanford
Copy link
Member

We should also update the extension developer e2e to use kubectl operator rather than all of this:

catalog := &ocv1.ClusterCatalog{
ObjectMeta: metav1.ObjectMeta{
GenerateName: "catalog",
},
Spec: ocv1.ClusterCatalogSpec{
Source: ocv1.CatalogSource{
Type: ocv1.SourceTypeImage,
Image: &ocv1.ImageSource{
Ref: os.Getenv("CATALOG_IMG"),
},
},
},
}
require.NoError(t, c.Create(context.Background(), catalog))
installNamespace := "default"
sa := &corev1.ServiceAccount{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("serviceaccount-%s", rand.String(8)),
Namespace: installNamespace,
},
}
require.NoError(t, c.Create(ctx, sa))
clusterExtension := &ocv1.ClusterExtension{
ObjectMeta: metav1.ObjectMeta{
Name: "registryv1",
},
Spec: ocv1.ClusterExtensionSpec{
Source: ocv1.SourceConfig{
SourceType: "Catalog",
Catalog: &ocv1.CatalogFilter{
PackageName: os.Getenv("REG_PKG_NAME"),
},
},
Namespace: installNamespace,
ServiceAccount: ocv1.ServiceAccountReference{
Name: sa.Name,
},
},
}
cr := &rbacv1.ClusterRole{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("clusterrole-%s", rand.String(8)),
},
Rules: []rbacv1.PolicyRule{
{
APIGroups: []string{
"olm.operatorframework.io",
},
Resources: []string{
"clusterextensions/finalizers",
},
Verbs: []string{
"update",
},
ResourceNames: []string{clusterExtension.Name},
},
{
APIGroups: []string{
"",
},
Resources: []string{
"configmaps",
"services",
"serviceaccounts",
},
Verbs: []string{
"create",
"update",
"delete",
"patch",
"get",
"list",
"watch",
},
},
{
APIGroups: []string{
"apiextensions.k8s.io",
},
Resources: []string{
"customresourcedefinitions",
},
Verbs: []string{
"create",
"update",
"delete",
"patch",
"get",
"list",
"watch",
},
},
{
APIGroups: []string{
"apps",
},
Resources: []string{
"deployments",
},
Verbs: []string{
"create",
"update",
"delete",
"patch",
"get",
"list",
"watch",
},
},
{
APIGroups: []string{
"rbac.authorization.k8s.io",
},
Resources: []string{
"clusterroles",
"roles",
"clusterrolebindings",
"rolebindings",
},
Verbs: []string{
"create",
"update",
"delete",
"patch",
"get",
"list",
"watch",
"bind",
"escalate",
},
},
},
}
require.NoError(t, c.Create(ctx, cr))
crb := &rbacv1.ClusterRoleBinding{
ObjectMeta: metav1.ObjectMeta{
Name: fmt.Sprintf("clusterrolebinding-%s", rand.String(8)),
},
Subjects: []rbacv1.Subject{
{
Kind: "ServiceAccount",
Name: sa.Name,
Namespace: sa.Namespace,
},
},
RoleRef: rbacv1.RoleRef{
APIGroup: "rbac.authorization.k8s.io",
Kind: "ClusterRole",
Name: cr.Name,
},
}
require.NoError(t, c.Create(ctx, crb))
t.Logf("When creating an ClusterExtension that references a package with a %q bundle type", clusterExtension.ObjectMeta.Name)
require.NoError(t, c.Create(context.Background(), clusterExtension))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
epic/kubectl-operator-plugin v1.x Issues related to OLMv1 features that come after 1.0
Projects
Status: No status
Development

No branches or pull requests

4 participants