Skip to content

Commit

Permalink
refactor(kubernetes): Delete unused code (#4133)
Browse files Browse the repository at this point in the history
This code was part of a temporary implementation of authorization
checks that has now been replaced. We can now delete the code.
  • Loading branch information
ezimanyi authored and mergify[bot] committed Oct 29, 2019
1 parent bc5aeb4 commit 36a1efe
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 140 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.KubernetesPodMetric.ContainerMetric;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesKind;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.description.manifest.KubernetesManifest;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.security.KubernetesApiResourceParser;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.security.KubernetesSelectorList;
import com.netflix.spinnaker.clouddriver.kubernetes.v2.security.KubernetesV2Credentials;
import io.kubernetes.client.models.V1DeleteOptions;
Expand Down Expand Up @@ -599,51 +598,6 @@ private String getOAuthToken(KubernetesV2Credentials credentials) {
return status.getOutput();
}

public Set<KubernetesKind> apiResources(KubernetesV2Credentials credentials) {
List<String> command = kubectlAuthPrefix(credentials);
command.add("api-resources");

JobResult<String> status = jobExecutor.runJob(new JobRequest(command));

// api-resources can return a non-zero status code but still return data
// log here as a warning
if (!status.getResult().equals(JobResult.Result.SUCCESS)) {
log.warn("There was an error reading api-resources. All available kinds may not be present.");
}

String output = status.getOutput().trim();
if (StringUtils.isEmpty(output)) {
return new HashSet<>();
}

return KubernetesApiResourceParser.parse(output);
}

public boolean authCanI(KubernetesV2Credentials credentials, String kind, String verb) {
List<String> command = kubectlAuthPrefix(credentials);
command.add("auth");
command.add("can-i");
command.add(verb);
command.add(kind);

JobResult<String> status = jobExecutor.runJob(new JobRequest(command));

return status.getResult() == JobResult.Result.SUCCESS;
}

public boolean authCanINamespaced(
KubernetesV2Credentials credentials, String namespace, String kind, String verb) {
List<String> command = kubectlNamespacedAuthPrefix(credentials, namespace);
command.add("auth");
command.add("can-i");
command.add(verb);
command.add(kind);

JobResult<String> status = jobExecutor.runJob(new JobRequest(command));

return status.getResult() == JobResult.Result.SUCCESS;
}

public Collection<KubernetesPodMetric> topPod(
KubernetesV2Credentials credentials, String namespace, String pod) {
List<String> command = kubectlNamespacedAuthPrefix(credentials, namespace);
Expand Down

This file was deleted.

This file was deleted.

0 comments on commit 36a1efe

Please sign in to comment.